You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by sk...@apache.org on 2020/01/17 13:14:59 UTC
[netbeans] branch master updated: Branding for upgrader and
autoupdate
This is an automated email from the ASF dual-hosted git repository.
skygo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new 2a7b624 Branding for upgrader and autoupdate
new 9859bf1 Merge pull request #1530 from ebarboni/upgraderbranding
2a7b624 is described below
commit 2a7b624e9cba8e1d6d689be47d7fff0bbc944043
Author: Eric Barboni <sk...@apache.org>
AuthorDate: Tue Sep 24 18:43:13 2019 +0200
Branding for upgrader and autoupdate
---
nb/autoupdate.pluginimporter/build.xml | 6 +++
.../nbproject/project.properties | 2 +-
nb/autoupdate.pluginimporter/nbproject/project.xml | 9 +++++
.../autoupdate/pluginimporter/Bundle.properties | 1 +
.../autoupdate/pluginimporter/Installer.java | 11 +++++-
.../autoupdate/pluginimporter/InstallerTest.java | 45 ++++++++++++++++++++++
nb/o.n.upgrader/build.xml | 8 +++-
nb/o.n.upgrader/nbproject/project.properties | 2 +-
.../src/org/netbeans/upgrade/AutoUpgrade.java | 15 ++++++--
.../src/org/netbeans/upgrade/Bundle.properties | 2 +
10 files changed, 92 insertions(+), 9 deletions(-)
diff --git a/nb/autoupdate.pluginimporter/build.xml b/nb/autoupdate.pluginimporter/build.xml
index 8c7dae8..17bcd0d 100644
--- a/nb/autoupdate.pluginimporter/build.xml
+++ b/nb/autoupdate.pluginimporter/build.xml
@@ -22,4 +22,10 @@
<project basedir="." default="build" name="nb/autoupdate.pluginimporter">
<description>Builds, tests, and runs the project org.netbeans.modules.autoupdate.pluginsimporter</description>
<import file="../../nbbuild/templates/projectized.xml"/>
+ <target name="compile" depends="projectized-common.compile,-branding"/>
+ <target name="-branding">
+ <replace file="${build.dir}/classes/org/netbeans/modules/autoupdate/pluginimporter/Bundle.properties" value="defaultvalue" propertyFile="${nb_all}/nbbuild/build/netbeansrelease.properties">
+ <replacefilter token="@@metabuild.apachepreviousversion@@" property="metabuild.apachepreviousversion"/>
+ </replace>
+ </target>
</project>
diff --git a/nb/autoupdate.pluginimporter/nbproject/project.properties b/nb/autoupdate.pluginimporter/nbproject/project.properties
index 6cfd90c..5c92e2f 100644
--- a/nb/autoupdate.pluginimporter/nbproject/project.properties
+++ b/nb/autoupdate.pluginimporter/nbproject/project.properties
@@ -17,6 +17,6 @@
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=8
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=80
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=default
-javac.source=1.6
+javac.source=1.8
javac.compilerargs=-Xlint -Xlint:-serial
nbm.module.author=Jiri Rechtacek
diff --git a/nb/autoupdate.pluginimporter/nbproject/project.xml b/nb/autoupdate.pluginimporter/nbproject/project.xml
index 0ec6570..445cf73 100644
--- a/nb/autoupdate.pluginimporter/nbproject/project.xml
+++ b/nb/autoupdate.pluginimporter/nbproject/project.xml
@@ -123,6 +123,15 @@
</run-dependency>
</dependency>
</module-dependencies>
+ <test-dependencies>
+ <test-type>
+ <name>unit</name>
+ <test-dependency>
+ <code-name-base>org.netbeans.libs.junit4</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ </test-type>
+ </test-dependencies>
<public-packages/>
</data>
</configuration>
diff --git a/nb/autoupdate.pluginimporter/src/org/netbeans/modules/autoupdate/pluginimporter/Bundle.properties b/nb/autoupdate.pluginimporter/src/org/netbeans/modules/autoupdate/pluginimporter/Bundle.properties
index 2f52668..ca02a85 100644
--- a/nb/autoupdate.pluginimporter/src/org/netbeans/modules/autoupdate/pluginimporter/Bundle.properties
+++ b/nb/autoupdate.pluginimporter/src/org/netbeans/modules/autoupdate/pluginimporter/Bundle.properties
@@ -40,3 +40,4 @@ PluginImporter.Importing.Plugin=Importing {0}...
PluginImporter.Importing.RestartNeeded=Restart needed to import plugins. Do you want to restart NetBeans IDE now?
#Blacklist codeNameBase of dangerous plugins which cannot be imported like: org.dangerous.plugin,com.nextdangerous.module,... etc.
plugin.import.blacklist=org.netbeans.shortcuts,org.jmarsault.shortcuts
+apachenetbeanspreviousversion=@@metabuild.apachepreviousversion@@
diff --git a/nb/autoupdate.pluginimporter/src/org/netbeans/modules/autoupdate/pluginimporter/Installer.java b/nb/autoupdate.pluginimporter/src/org/netbeans/modules/autoupdate/pluginimporter/Installer.java
index 21dd6d5..1bb9660 100644
--- a/nb/autoupdate.pluginimporter/src/org/netbeans/modules/autoupdate/pluginimporter/Installer.java
+++ b/nb/autoupdate.pluginimporter/src/org/netbeans/modules/autoupdate/pluginimporter/Installer.java
@@ -21,17 +21,21 @@ package org.netbeans.modules.autoupdate.pluginimporter;
import java.io.File;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Comparator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.prefs.BackingStoreException;
import java.util.prefs.Preferences;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
import org.netbeans.api.autoupdate.UpdateManager;
import org.netbeans.api.autoupdate.UpdateUnit;
import org.netbeans.api.autoupdate.UpdateUnitProvider;
import org.netbeans.api.autoupdate.UpdateUnitProviderFactory;
import org.openide.filesystems.FileUtil;
import org.openide.modules.ModuleInstall;
+import org.openide.util.NbBundle;
import org.openide.util.NbPreferences;
import org.openide.util.RequestProcessor;
import org.openide.windows.WindowManager;
@@ -48,10 +52,13 @@ public class Installer extends ModuleInstall {
private static final Logger LOG = Logger.getLogger (Installer.class.getName ());
// XXX: copy from o.n.upgrader
+ private static final Comparator<String> APACHE_VERSION_COMPARATOR = (v1, v2) -> Float.compare(Float.parseFloat(v1), Float.parseFloat(v2));
+ private static final List<String> APACHE_VERSION_TO_CHECK = Arrays.asList(NbBundle.getMessage(Installer.class, "apachenetbeanspreviousversion").split(",")).stream().sorted(APACHE_VERSION_COMPARATOR.reversed()).collect(Collectors.toList());
private static final List<String> VERSION_TO_CHECK =
Arrays.asList (".netbeans/7.1.2", ".netbeans/7.1.1", ".netbeans/7.1", ".netbeans/7.0", ".netbeans/6.9"); //NOI18N
- private static final List<String> NEWER_VERSION_TO_CHECK =
- Arrays.asList ("11.1", "11.0", "10.0", "9.0", "8.2", "8.1", "8.0.2", "8.0.1", "8.0", "7.4", "7.3.1", "7.3", "7.2.1", "7.2"); //NOI18N
+ private static final List<String> PRE_APACHE_NEWER_VERSION_TO_CHECK =
+ Arrays.asList ("8.2", "8.1", "8.0.2", "8.0.1", "8.0", "7.4", "7.3.1", "7.3", "7.2.1", "7.2"); //NOI18N
+ private static final List<String> NEWER_VERSION_TO_CHECK = Stream.concat(APACHE_VERSION_TO_CHECK.stream(), PRE_APACHE_NEWER_VERSION_TO_CHECK.stream()).collect(Collectors.toList());
private static final String IMPORTED = "imported"; // NOI18N
@Override
diff --git a/nb/autoupdate.pluginimporter/test/unit/src/org/netbeans/modules/autoupdate/pluginimporter/InstallerTest.java b/nb/autoupdate.pluginimporter/test/unit/src/org/netbeans/modules/autoupdate/pluginimporter/InstallerTest.java
new file mode 100644
index 0000000..de89f04
--- /dev/null
+++ b/nb/autoupdate.pluginimporter/test/unit/src/org/netbeans/modules/autoupdate/pluginimporter/InstallerTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.autoupdate.pluginimporter;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+import java.util.stream.Collectors;
+import org.junit.Assert;
+import org.junit.Test;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ */
+public class InstallerTest {
+
+ @Test
+ public void testBranding() {
+ // test that branding replacement contains 9.0 first Apache NetBeans incubating
+ Comparator<String> versionComparator = (v1, v2) -> Float.compare(Float.parseFloat(v1), Float.parseFloat(v2));
+ List<String> apacheversion = Arrays.asList(NbBundle.getMessage(Installer.class, "apachenetbeanspreviousversion").split(",")).stream().sorted(versionComparator.reversed()).collect(Collectors.toList());
+ //Comparator<String> comp = (aName, bName) -> FloataName.compareTo(bName);
+ Assert.assertTrue("apache version contains at last 9.0", apacheversion.contains("9.0"));
+ Assert.assertTrue("last version reverse ordered should be 9.0", apacheversion.get(apacheversion.size() - 1).equals("9.0"));
+
+ }
+
+}
diff --git a/nb/o.n.upgrader/build.xml b/nb/o.n.upgrader/build.xml
index cfaea98..0c67ef2 100644
--- a/nb/o.n.upgrader/build.xml
+++ b/nb/o.n.upgrader/build.xml
@@ -23,5 +23,11 @@
<project name="nb/o.n.upgrader" default="build" basedir=".">
<import file="../../nbbuild/templates/projectized.xml"/>
-
+
+ <target name="compile" depends="projectized-common.compile,-branding"/>
+ <target name="-branding">
+ <replace file="${build.dir}/classes/org/netbeans/upgrade/Bundle.properties" value="defaultvalue" propertyFile="${nb_all}/nbbuild/build/netbeansrelease.properties">
+ <replacefilter token="@@metabuild.apachepreviousversion@@" property="metabuild.apachepreviousversion"/>
+ </replace>
+ </target>
</project>
diff --git a/nb/o.n.upgrader/nbproject/project.properties b/nb/o.n.upgrader/nbproject/project.properties
index 184f68d..732e6be 100644
--- a/nb/o.n.upgrader/nbproject/project.properties
+++ b/nb/o.n.upgrader/nbproject/project.properties
@@ -16,7 +16,7 @@
# under the License.
javac.compilerargs=-Xlint:unchecked
-javac.source=1.6
+javac.source=1.8
module.jar.dir=core
javadoc.arch=${basedir}/arch.xml
diff --git a/nb/o.n.upgrader/src/org/netbeans/upgrade/AutoUpgrade.java b/nb/o.n.upgrader/src/org/netbeans/upgrade/AutoUpgrade.java
index 5c75ab6..bf6e9e3 100644
--- a/nb/o.n.upgrader/src/org/netbeans/upgrade/AutoUpgrade.java
+++ b/nb/o.n.upgrader/src/org/netbeans/upgrade/AutoUpgrade.java
@@ -24,9 +24,12 @@ import java.beans.PropertyVetoException;
import java.io.*;
import java.net.URL;
import java.util.Arrays;
+import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Logger;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
@@ -92,10 +95,14 @@ public final class AutoUpgrade {
Arrays.asList (new String[] { ".netbeans/7.1.2", ".netbeans/7.1.1", ".netbeans/7.1", ".netbeans/7.0", ".netbeans/6.9" });//NOI18N
// userdir on OS specific root of userdir (see issue 196075)
- static final List<String> NEWER_VERSION_TO_CHECK =
- Arrays.asList ("11.1", "11.0", "10.0", "9.0", "8.2", "8.1", "8.0.2", "8.0.1", "8.0", "7.4", "7.3.1", "7.3", "7.2.1", "7.2"); //NOI18N
-
-
+ static final List<String> PRE_APACHE_NEWER_VERSION_TO_CHECK =
+ Arrays.asList ("8.2", "8.1", "8.0.2", "8.0.1", "8.0", "7.4", "7.3.1", "7.3", "7.2.1", "7.2"); //NOI18N
+ private static final Comparator<String> APACHE_VERSION_COMPARATOR = (v1, v2) -> Float.compare(Float.parseFloat(v1), Float.parseFloat(v2));
+
+ static final List<String> APACHE_VERSION_TO_CHECK = Arrays.asList(NbBundle.getMessage(AutoUpgrade.class, "apachenetbeanspreviousversion").split(",")).stream().sorted(APACHE_VERSION_COMPARATOR.reversed()).collect(Collectors.toList());
+
+ static final List<String> NEWER_VERSION_TO_CHECK = Stream.concat(APACHE_VERSION_TO_CHECK.stream(), PRE_APACHE_NEWER_VERSION_TO_CHECK.stream()).collect(Collectors.toList());
+
private static File checkPreviousOnOsSpecificPlace (final List<String> versionsToCheck) {
String defaultUserdirRoot = System.getProperty ("netbeans.default_userdir_root"); // NOI18N
File sourceFolder;
diff --git a/nb/o.n.upgrader/src/org/netbeans/upgrade/Bundle.properties b/nb/o.n.upgrader/src/org/netbeans/upgrade/Bundle.properties
index 6ba59f4..bfe58bb 100644
--- a/nb/o.n.upgrader/src/org/netbeans/upgrade/Bundle.properties
+++ b/nb/o.n.upgrader/src/org/netbeans/upgrade/Bundle.properties
@@ -29,3 +29,5 @@ MSG_MigratingSystemOptions = Migrating System Options...
MSG_Note_Title=Note
MSG_ChangedDefaults=Note: The default location of NetBeans userdir was changed to {0}\n\
See http://wiki.netbeans.org/UserdirAndCachedirFoldersInSystemSpecificPaths\n\n
+
+apachenetbeanspreviousversion=@@metabuild.apachepreviousversion@@
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists