diff --git a/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/Bundle.properties b/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/Bundle.properties index 267ae495e139..afb008dbf032 100644 --- a/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/Bundle.properties +++ b/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/Bundle.properties @@ -72,7 +72,6 @@ MSG_RemovingModuleMessage=\ will be removed as well. MSG_SuiteAlreadyContainsCNB=The suite already contains a project with code name base "{0}". HINT_suite_project_root_node=Module suite project in {0} -LBL_jnlp_master=JNLP Descriptor Templates/Licenses/license-cddl-netbeans-sun.txt=NetBeans CDDL/GPL diff --git a/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/ImportantFilesNodeFactory.java b/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/ImportantFilesNodeFactory.java index 867465d3d921..7915278740f5 100644 --- a/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/ImportantFilesNodeFactory.java +++ b/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/ImportantFilesNodeFactory.java @@ -302,7 +302,6 @@ private static final class SuiteImportantFilesChildren extends Children.Keys FILES = new LinkedHashMap(); static { - FILES.put("master.jnlp", NbBundle.getMessage(SuiteLogicalView.class,"LBL_jnlp_master")); FILES.put("build.xml", NbBundle.getMessage(SuiteLogicalView.class,"LBL_build.xml")); FILES.put("nbproject/project.properties", NbBundle.getMessage(SuiteLogicalView.class,"LBL_project.properties")); FILES.put("nbproject/private/private.properties", NbBundle.getMessage(SuiteLogicalView.class,"LBL_private.properties")); diff --git a/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/SuiteActions.java b/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/SuiteActions.java index 8b2c180ef042..d90cd540891e 100644 --- a/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/SuiteActions.java +++ b/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/SuiteActions.java @@ -79,23 +79,18 @@ public final class SuiteActions implements ActionProvider, ExecProject { private static final String COMMAND_BRANDING = "branding"; - private static final String COMMAND_BUILD_JNLP = "build-jnlp"; private static final String COMMAND_BUILD_MAC = "build-mac"; private static final String COMMAND_BUILD_OSGI = "build-osgi"; private static final String COMMAND_BUILD_OSGI_OBR = "build-osgi-obr"; private static final String COMMAND_BUILD_ZIP = "build-zip"; - private static final String COMMAND_DEBUG_JNLP = "debug-jnlp"; private static final String COMMAND_DEBUG_OSGI = "debug-osgi"; private static final String COMMAND_NBMS = "nbms"; private static final String COMMAND_PROFILE_OSGI = "profile-osgi"; - private static final String COMMAND_RUN_JNLP = "run-jnlp"; private static final String COMMAND_RUN_OSGI = "run-osgi"; private static final String SUITE_ACTIONS_TYPE = "org-netbeans-modules-apisupport-project-suite"; private static final String SUITE_ACTIONS_PATH = "Projects/" + SUITE_ACTIONS_TYPE + "/Actions"; private static final String SUITE_PACKAGE_ACTIONS_TYPE = SUITE_ACTIONS_TYPE + "-package"; private static final String SUITE_PACKAGE_ACTIONS_PATH = "Projects/" + SUITE_PACKAGE_ACTIONS_TYPE + "/Actions"; - private static final String SUITE_JNLP_ACTIONS_TYPE = SUITE_ACTIONS_TYPE + "-jnlp"; - private static final String SUITE_JNLP_ACTIONS_PATH = "Projects/" + SUITE_JNLP_ACTIONS_TYPE + "/Actions"; private static final String SUITE_OSGI_ACTIONS_TYPE = SUITE_ACTIONS_TYPE + "-osgi"; private static final String SUITE_OSGI_ACTIONS_PATH = "Projects/" + SUITE_OSGI_ACTIONS_TYPE + "/Actions"; private static final RequestProcessor RP = new RequestProcessor(SuiteActions.class); @@ -148,38 +143,6 @@ public static Action buildMac() { return ProjectSensitiveActions.projectCommandAction(COMMAND_BUILD_MAC, SUITE_ACTION_mac(), null); } - @ActionID(category="Project", id="org.netbeans.modules.apisupport.project.suite.jnlpMenu") - @ActionRegistration(displayName="#SUITE_ACTION_jnlp_menu", lazy=false) - @ActionReference(path=SUITE_ACTIONS_PATH, position=1300) - @Messages("SUITE_ACTION_jnlp_menu=JNLP") - public static Action jnlpMenu() { - return new SubMenuAction(SUITE_ACTION_jnlp_menu(), Arrays.asList(CommonProjectActions.forType(SUITE_JNLP_ACTIONS_TYPE))); - } - - @ActionID(category="Project", id="org.netbeans.modules.apisupport.project.suite.buildJnlp") - @ActionRegistration(displayName="#SUITE_ACTION_build_jnlp", lazy=false) - @ActionReference(path=SUITE_JNLP_ACTIONS_PATH, position=100) - @Messages("SUITE_ACTION_build_jnlp=Build") - public static Action buildJnlp() { - return ProjectSensitiveActions.projectCommandAction(COMMAND_BUILD_JNLP, SUITE_ACTION_build_jnlp(), null); - } - - @ActionID(category="Project", id="org.netbeans.modules.apisupport.project.suite.runJnlp") - @ActionRegistration(displayName="#SUITE_ACTION_run_jnlp", lazy=false) - @ActionReference(path=SUITE_JNLP_ACTIONS_PATH, position=200) - @Messages("SUITE_ACTION_run_jnlp=Run") - public static Action runJnlp() { - return ProjectSensitiveActions.projectCommandAction(COMMAND_RUN_JNLP, SUITE_ACTION_run_jnlp(), null); - } - - @ActionID(category="Project", id="org.netbeans.modules.apisupport.project.suite.debugJnlp") - @ActionRegistration(displayName="#SUITE_ACTION_debug_jnlp", lazy=false) - @ActionReference(path=SUITE_JNLP_ACTIONS_PATH, position=300) - @Messages("SUITE_ACTION_debug_jnlp=Debug") - public static Action debugJnlp() { - return ProjectSensitiveActions.projectCommandAction(COMMAND_DEBUG_JNLP, SUITE_ACTION_debug_jnlp(), null); - } - @ActionID(category="Project", id="org.netbeans.modules.apisupport.project.suite.osgiMenu") @ActionRegistration(displayName="#SUITE_ACTION_osgi_menu", lazy=false) @ActionReference(path=SUITE_ACTIONS_PATH, position=1400) @@ -296,9 +259,6 @@ public String[] getSupportedActions() { ActionProvider.COMMAND_DEBUG, ActionProvider.COMMAND_TEST, COMMAND_BUILD_ZIP, - COMMAND_BUILD_JNLP, - COMMAND_RUN_JNLP, - COMMAND_DEBUG_JNLP, COMMAND_BUILD_OSGI, COMMAND_BUILD_OSGI_OBR, COMMAND_RUN_OSGI, @@ -416,21 +376,6 @@ public void run () { return null; } targetNames = new String[] {COMMAND_BUILD_ZIP}; - } else if (command.equals(COMMAND_BUILD_JNLP)) { - if (promptForAppName(PROMPT_FOR_APP_NAME_MODE_JNLP)) { - return null; - } - targetNames = new String[] {COMMAND_BUILD_JNLP}; - } else if (command.equals(COMMAND_RUN_JNLP)) { - if (promptForAppName(PROMPT_FOR_APP_NAME_MODE_JNLP)) { - return null; - } - targetNames = new String[] {COMMAND_RUN_JNLP}; - } else if (command.equals(COMMAND_DEBUG_JNLP)) { - if (promptForAppName(PROMPT_FOR_APP_NAME_MODE_JNLP)) { - return null; - } - targetNames = new String[] {COMMAND_DEBUG_JNLP}; } else { targetNames = new String[] {command}; } @@ -444,11 +389,9 @@ private static FileObject findBuildXml(SuiteProject project) { return project.getProjectDirectory().getFileObject(GeneratedFilesHelper.BUILD_XML_PATH); } - private static final int PROMPT_FOR_APP_NAME_MODE_JNLP = 0; - private static final int PROMPT_FOR_APP_NAME_MODE_ZIP = 1; + private static final int PROMPT_FOR_APP_NAME_MODE_ZIP = 1; /** @return true if the dialog is shown */ @Messages({ - "ERR_app_name_jnlp=The JNLP application cannot be built because this suite is not yet set up as a standalone application.
At least a branding name must be configured before building or running in JNLP mode.", "ERR_app_name_zip=The ZIP file cannot be built because this suite is not yet set up as a standalone application.
At least a branding name must be configured before building an application ZIP.", "TITLE_app_name=Not Standalone Application", "LBL_configure_app_name=Configure Application...", @@ -462,10 +405,7 @@ private boolean promptForAppName(int mode) { // #61372: warn the user, rather than disabling the action. String msg; - switch (mode) { - case PROMPT_FOR_APP_NAME_MODE_JNLP: - msg = ERR_app_name_jnlp(); - break; + switch (mode) { case PROMPT_FOR_APP_NAME_MODE_ZIP: msg = ERR_app_name_zip(); break; diff --git a/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/SuiteOperations.java b/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/SuiteOperations.java index 443c2e72d011..791e13fed56f 100644 --- a/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/SuiteOperations.java +++ b/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/SuiteOperations.java @@ -192,8 +192,6 @@ public List getMetadataFiles() { List files = new ArrayList(); addFile(GeneratedFilesHelper.BUILD_XML_PATH, files); addFile("nbproject", files); // NOI18N - addFile("master.jnlp", files); // NOI18N - addFile("branding.jnlp", files); // NOI18N return files; } diff --git a/apisupport/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/jnlp/GenerateJNLPApplicationTest.java b/apisupport/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/jnlp/GenerateJNLPApplicationTest.java deleted file mode 100644 index 15a061cd5515..000000000000 --- a/apisupport/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/jnlp/GenerateJNLPApplicationTest.java +++ /dev/null @@ -1,588 +0,0 @@ -/* - * 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.apisupport.project.jnlp; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Arrays; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; -import org.netbeans.modules.apisupport.project.DialogDisplayerImpl; -import org.netbeans.modules.apisupport.project.InstalledFileLocatorImpl; -import org.netbeans.modules.apisupport.project.NbModuleProject; -import org.netbeans.modules.apisupport.project.TestBase; -import org.netbeans.modules.apisupport.project.layers.LayerTestBase; -import org.netbeans.modules.apisupport.project.suite.SuiteProject; -import org.netbeans.modules.apisupport.project.ui.SuiteActions; -import org.netbeans.spi.project.ActionProvider; -import org.openide.DialogDescriptor; -import org.openide.execution.ExecutorTask; -import org.openide.filesystems.FileObject; - -/** - * Checks JNLP support behaviour. - * @author Jaroslav Tulach - */ -public class GenerateJNLPApplicationTest extends TestBase { - - static { - // #65461: do not try to load ModuleInfo instances from ant module - System.setProperty("org.netbeans.core.startup.ModuleSystem.CULPRIT", "true"); - LayerTestBase.Lkp.setLookup(new Object[0]); - } - - private SuiteProject suite; - private Logger LOG; - - public GenerateJNLPApplicationTest(String name) { - super(name); - } - - @Override - protected Level logLevel() { - return Level.FINE; - } - - protected @Override void setUp() throws Exception { - LOG = Logger.getLogger("test." + getName()); - - super.setUp(); - - InstalledFileLocatorImpl.registerDestDir(destDirF); - - suite = TestBase.generateSuite(new File(getWorkDir(), "projects"), "suite"); - NbModuleProject proj = TestBase.generateSuiteComponent(suite, "mod1"); - - suite.open(); - proj.open(); - } - - public void testBuildTheJNLPAppWhenAppNamePropIsNotSet() throws Exception { - SuiteActions p = (SuiteActions) suite.getLookup().lookup(ActionProvider.class); - assertNotNull("Provider is here"); - - List l = Arrays.asList(p.getSupportedActions()); - assertTrue("We support build-jnlp: " + l, l.contains("build-jnlp")); - - DialogDisplayerImpl.returnFromNotify(DialogDescriptor.NO_OPTION); - ExecutorTask task = p.invokeActionImpl("build-jnlp", suite.getLookup()); - assertNull("did not even run task", task); - } - - // XXX: failing test, fix or delete -// public void testBuildTheJNLPAppWhenAppNamePropIsSet() throws Exception { -// EditableProperties ep = suite.getHelper().getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH); -// ep.setProperty("app.name", "fakeapp"); -// -// File someJar = createNewJarFile("fake-jnlp-servlet"); -// -// ep.setProperty("enabled.clusters", TestBase.CLUSTER_PLATFORM); -// ep.setProperty("disabled.modules", "org.netbeans.modules.autoupdate," + -// "org.openide.compat," + -// "org.netbeans.api.progress," + -// "org.netbeans.core.multiview," + -// "org.openide.filesystems," + -// "org.openide.modules," + -// "org.openide.util," + -// "org.netbeans.core.execution," + -// "org.netbeans.core.output2," + -// "org.netbeans.core.ui," + -// "org.netbeans.core.windows," + -// "org.netbeans.core," + -// "org.netbeans.modules.favorites," + -// "org.netbeans.modules.javahelp," + -// "org.netbeans.modules.masterfs," + -// "org.netbeans.modules.queries," + -// "org.netbeans.modules.settings," + -// "org.netbeans.swing.plaf," + -// "org.netbeans.swing.tabcontrol," + -// "org.openide.actions," + -// "org.openide.awt," + -// "org.openide.dialogs," + -// "org.openide.execution," + -// "org.openide.explorer," + -// "org.openide.io," + -// "org.openide.loaders," + -// "org.openide.nodes," + -// "org.openide.options," + -// "org.openide.text," + -// "org.openide.windows," + -// ""); -// ep.setProperty("jnlp.servlet.jar", someJar.toString()); -// suite.getHelper().putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, ep); -// ProjectManager.getDefault().saveProject(suite); -// LOG.info("Properties stored"); -// -// SuiteActions p = (SuiteActions)suite.getLookup().lookup(ActionProvider.class); -// assertNotNull("Provider is here"); -// -// List l = Arrays.asList(p.getSupportedActions()); -// assertTrue("We support build-jnlp: " + l, l.contains("build-jnlp")); -// -// DialogDisplayerImpl.returnFromNotify(null); -// LOG.info("invoking build-jnlp"); -// ExecutorTask task = p.invokeActionImpl("build-jnlp", suite.getLookup()); -// LOG.info("Invocation started"); -// -// assertNotNull("Task was started", task); -// LOG.info("Waiting for task to finish"); -// task.waitFinished(); -// LOG.info("Checking the result"); -// assertEquals("Finished ok", 0, task.result()); -// LOG.info("Testing the content of the directory"); -// -// FileObject[] arr = suite.getProjectDirectory().getChildren(); -// List subobj = new ArrayList(Arrays.asList(arr)); -// subobj.remove(suite.getProjectDirectory().getFileObject("mod1")); -// subobj.remove(suite.getProjectDirectory().getFileObject("nbproject")); -// subobj.remove(suite.getProjectDirectory().getFileObject("build.xml")); -// FileObject master = suite.getProjectDirectory().getFileObject("master.jnlp"); -// assertNotNull("Master must be created", master); -// FileObject branding = suite.getProjectDirectory().getFileObject("branding.jnlp"); -// assertNotNull("Branding must be created", branding); -// subobj.remove(master); -// subobj.remove(branding); -// subobj.remove(suite.getProjectDirectory().getFileObject("build")); -// FileObject dist = suite.getProjectDirectory().getFileObject("dist"); -// assertNotNull("dist created", dist); -// subobj.remove(dist); -// -// if (!subobj.isEmpty()) { -// fail("There should be no created directories in the suite dir: " + subobj); -// } -// -// FileObject war = dist.getFileObject("fakeapp.war"); -// assertNotNull("War file created: " + war, war); -// -// File warF = FileUtil.toFile(war); -// JarFile warJ = new JarFile(warF); -// Enumeration en = warJ.entries(); -// int cntJnlp = 0; -// while (en.hasMoreElements()) { -// JarEntry entry = (JarEntry)en.nextElement(); -// if (!entry.getName().endsWith(".jnlp")) { -// continue; -// } -// cntJnlp++; -// -// byte[] data = new byte[(int)entry.getSize()]; -// int len = 0; -// InputStream is = warJ.getInputStream(entry); -// for(int pos = 0; pos < data.length; ) { -// int r = is.read(data, pos, data.length - pos); -// pos += r; -// len += r; -// } -// is.close(); -// assertEquals("Correct data read: " + entry, data.length, len); -// -// String s = new String(data); -// if (s.indexOf(getWorkDir().getName()) >= 0) { -// fail("Name of work dir in a file, means that there is very likely local reference to a file: " + entry + "\n" + s); -// } -// } -// -// if (cntJnlp == 0) { -// fail("There should be at least one jnlp entry"); -// } -// } - -// XXX: failing test, fix or delete -// public void testItIsPossibleToGenerateStaticRepository() throws Exception { -// EditableProperties ep = suite.getHelper().getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH); -// ep.setProperty("app.name", "fakeapp"); -// -// ep.setProperty("enabled.clusters", TestBase.CLUSTER_PLATFORM); -// ep.setProperty("disabled.modules", "org.netbeans.modules.autoupdate," + -// "org.openide.compat," + -// "org.netbeans.api.progress," + -// "org.netbeans.core.multiview," + -// "org.openide.filesystems," + -// "org.openide.modules," + -// "org.openide.util," + -// "org.netbeans.core.execution," + -// "org.netbeans.core.output2," + -// "org.netbeans.core.ui," + -// "org.netbeans.core.windows," + -// "org.netbeans.core," + -// "org.netbeans.modules.favorites," + -// "org.netbeans.modules.javahelp," + -// "org.netbeans.modules.masterfs," + -// "org.netbeans.modules.queries," + -// "org.netbeans.modules.settings," + -// "org.netbeans.swing.plaf," + -// "org.netbeans.swing.tabcontrol," + -// "org.openide.actions," + -// "org.openide.awt," + -// "org.openide.dialogs," + -// "org.openide.execution," + -// "org.openide.explorer," + -// "org.openide.io," + -// "org.openide.loaders," + -// "org.openide.nodes," + -// "org.openide.options," + -// "org.openide.text," + -// "org.openide.windows," + -// ""); -// suite.getHelper().putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, ep); -// ProjectManager.getDefault().saveProject(suite); -// LOG.info("Properties stored"); -// -// FileObject fo = suite.getProjectDirectory().getFileObject("build.xml"); -// assertNotNull("There should be a build script", fo); -// -// { -// String s = readFile(fo); -// int insert = s.indexOf(""); -// if (insert == -1) { -// fail("there should be insert place: " + s); -// } -// -// s = s.substring(0, insert) + -// " " + -// " " + -// " " + -// " " + -// "" -// + s.substring(insert); -// FileLock lock = fo.lock(); -// OutputStream os = fo.getOutputStream(lock); -// try { -// os.write(s.getBytes()); -// } finally { -// os.close(); -// lock.releaseLock(); -// } -// } -// -// SuiteActions p = (SuiteActions)suite.getLookup().lookup(ActionProvider.class); -// assertNotNull("Provider is here"); -// -// List l = Arrays.asList(p.getSupportedActions()); -// assertTrue("We support build-jnlp: " + l, l.contains("build-jnlp")); -// -// DialogDisplayerImpl.returnFromNotify(null); -// LOG.info("invoking build-jnlp"); -// ExecutorTask task = p.invokeActionImpl("build-jnlp", suite.getLookup()); -// LOG.info("Invocation started"); -// -// assertNotNull("Task was started", task); -// LOG.info("Waiting for task to finish"); -// task.waitFinished(); -// LOG.info("Checking the result"); -// assertEquals("Finished ok", 0, task.result()); -// LOG.info("Testing the content of the directory"); -// -// FileObject[] arr = suite.getProjectDirectory().getChildren(); -// List subobj = new ArrayList(Arrays.asList(arr)); -// subobj.remove(suite.getProjectDirectory().getFileObject("mod1")); -// subobj.remove(suite.getProjectDirectory().getFileObject("nbproject")); -// FileObject buildXML = suite.getProjectDirectory().getFileObject("build.xml"); -// subobj.remove(buildXML); -// FileObject master = suite.getProjectDirectory().getFileObject("master.jnlp"); -// assertNotNull("Master must be created", master); -// subobj.remove(master); -// FileObject build = suite.getProjectDirectory().getFileObject("build"); -// subobj.remove(build); -// -// { -// // check content of build -// FileObject jnlpDir = build.getFileObject("jnlp/app/"); -// assertNotNull("app dir exists", jnlpDir); -// FileObject[] arrX = jnlpDir.getChildren(); -// int cnt = 0; -// for (int i = 0; i < arrX.length; i++) { -// if (arrX[i].hasExt("jnlp")) { -// cnt++; -// String jnlpContent = readFile(arrX[i]); -// if (jnlpContent.indexOf("http://www.netbeans.org/download/samples/jnlp/htmleditor/app/") == -1) { -// fail(" for " + arrX[i] + " URL with /app/ must be present: " + jnlpContent); -// } -// } -// } -// -// if (cnt == 0) fail("At least one jnlp file in app dir"); -// } -// -// { -// // check content of netbeans default dir -// FileObject jnlpDir = build.getFileObject("jnlp/netbeans/"); -// assertNotNull("netbeans dir exists", jnlpDir); -// FileObject[] arrX = jnlpDir.getChildren(); -// int cnt = 0; -// for (int i = 0; i < arrX.length; i++) { -// if (arrX[i].hasExt("jnlp")) { -// cnt++; -// String jnlpContent = readFile(arrX[i]); -// if (jnlpContent.indexOf("http://www.netbeans.org/download/samples/jnlp/htmleditor/netbeans/") == -1) { -// fail(" for " + arrX[i] + " URL with /netbeans/ must be present: " + jnlpContent); -// } -// } -// } -// -// if (cnt == 0) fail("At least one jnlp file in app dir"); -// } -// -// // check master file has it -// String masterContent = readFile(master); -// if (masterContent.indexOf("http://www.netbeans.org/download/samples/jnlp/htmleditor/") == -1) { -// fail("URL must be present in master: " + masterContent); -// } -// -// -// FileObject dist = suite.getProjectDirectory().getFileObject("dist"); -// assertNull("no dist created", dist); -// -// FileObject branding = suite.getProjectDirectory().getFileObject("branding.jnlp"); -// assertNotNull("Branding must be created", branding); -// subobj.remove(branding); -// -// if (!subobj.isEmpty()) { -// fail("There should be no created directories in the suite dir: " + subobj); -// } -// -// } - - // XXX: failing test, fix or delete -// public void testBuildJNLPWhenLocalizedFilesAreMissing() throws Exception { -// File openideUtil = new File( -// Lookup.class.getProtectionDomain().getCodeSource().getLocation().toURI() -// ); -// File platformC = openideUtil.getParentFile().getParentFile(); -// -// File copyP = new File(new File(getWorkDir(), "netbeans"), "platform"); -// copyP.mkdirs(); -// -// copyFiles(platformC, copyP); -// -// EditableProperties ep = suite.getHelper().getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH); -// ep.setProperty("app.name", "fakeapp"); -// -// File someJar = createNewJarFile("fake-jnlp-servlet"); -// -// String platformPropsPath = "nbproject/platform.properties"; -// EditableProperties props = suite.getHelper().getProperties(platformPropsPath); -// props.setProperty("harness.dir", platformC.getParent() + File.separator + "harness"); -// props.setProperty(ModuleList.NETBEANS_DEST_DIR, copyP.getParent()); -// props.setProperty("app.name", "fakeapp"); -// props.setProperty("jnlp.servlet.jar", someJar.getAbsolutePath()); -// suite.getHelper().putProperties(platformPropsPath, props); -// -// File where = new File(copyP, "update_tracking"); -// Source xslt = new StreamSource(getClass().getResourceAsStream("GenerateJNLPApplicationTest.xsl")); -// Transformer t = TransformerFactory.newInstance().newTransformer(xslt); -// File f = new File(where, "org-netbeans-core-startup.xml"); -// assertTrue("core exists: " + f, f.exists()); -// File tmp = new File(f.getParent(), f.getName() + ".copy"); -// // delete & renameTo has problems on Windows, see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4017593 -// boolean renamed = f.renameTo(tmp); -// assertTrue("rename " + f + " --> " + f + ".copy succeeded", renamed); -// -// { -// Source s = new StreamSource(tmp); -// Result r = new StreamResult(f); -// t.clearParameters(); -// t.setParameter("file", "core/locale/core_cs.jar"); -// t.transform(s, r); -// tmp.delete(); -// assertFalse("File.delete() works as expected", tmp.exists()); -// assertTrue("modified core exists: " + f, f.exists()); -// } -// -// ProjectManager.getDefault().saveProject(suite); -// -// ep.setProperty("enabled.clusters", TestBase.CLUSTER_PLATFORM); -// ep.setProperty("disabled.modules", "org.netbeans.modules.autoupdate," + -// "org.openide.compat," + -// "org.netbeans.api.progress," + -// "org.netbeans.core.multiview," + -// "org.openide.filesystems," + -// "org.openide.modules," + -// "org.openide.util," + -// "org.netbeans.api.visual," + -// "org.netbeans.core.execution," + -// "org.netbeans.core.output2," + -// "org.netbeans.core.ui," + -// "org.netbeans.core.windows," + -// "org.netbeans.core," + -// "org.netbeans.modules.favorites," + -// "org.netbeans.modules.javahelp," + -// "org.netbeans.modules.masterfs," + -// "org.netbeans.modules.queries," + -// "org.netbeans.modules.settings," + -// "org.netbeans.swing.plaf," + -// "org.netbeans.swing.tabcontrol," + -// "org.openide.actions," + -// "org.openide.awt," + -// "org.openide.dialogs," + -// "org.openide.execution," + -// "org.openide.explorer," + -// "org.openide.io," + -// "org.openide.loaders," + -// "org.openide.nodes," + -// "org.openide.options," + -// "org.openide.text," + -// "org.openide.windows," + -// ""); -// ep.setProperty("jnlp.servlet.jar", someJar.toString()); -// suite.getHelper().putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, ep); -// ProjectManager.getDefault().saveProject(suite); -// LOG.info("Properties stored"); -// -// SuiteActions p = (SuiteActions)suite.getLookup().lookup(ActionProvider.class); -// assertNotNull("Provider is here"); -// -// List l = Arrays.asList(p.getSupportedActions()); -// assertTrue("We support build-jnlp: " + l, l.contains("build-jnlp")); -// /* -// WeakReference ref = new WeakReference(suite); -// suite = null; -// assertGC("Project can go away", ref); -// -// NbPlatform nbp = suite.getPlatform(false); -// assertNotNull("Platform is associated", nbp); -// assertEquals(copyP.getParentFile(), nbp.getDestDir()); -// */ -// DialogDisplayerImpl.returnFromNotify(null); -// LOG.info("invoking build-jnlp"); -// ExecutorTask task = p.invokeActionImpl("build-jnlp", suite.getLookup()); -// LOG.info("Invocation started"); -// -// assertNotNull("Task was started", task); -// LOG.info("Waiting for task to finish"); -// task.waitFinished(); -// LOG.info("Checking the result"); -// assertEquals("Finished ok", 0, task.result()); -// LOG.info("Testing the content of the directory"); -// -// FileObject[] arr = suite.getProjectDirectory().getChildren(); -// List subobj = new ArrayList(Arrays.asList(arr)); -// subobj.remove(suite.getProjectDirectory().getFileObject("mod1")); -// subobj.remove(suite.getProjectDirectory().getFileObject("nbproject")); -// subobj.remove(suite.getProjectDirectory().getFileObject("build.xml")); -// FileObject master = suite.getProjectDirectory().getFileObject("master.jnlp"); -// assertNotNull("Master must be created", master); -// FileObject branding = suite.getProjectDirectory().getFileObject("branding.jnlp"); -// assertNotNull("Branding must be created", branding); -// subobj.remove(master); -// subobj.remove(branding); -// subobj.remove(suite.getProjectDirectory().getFileObject("build")); -// FileObject dist = suite.getProjectDirectory().getFileObject("dist"); -// assertNotNull("dist created", dist); -// subobj.remove(dist); -// -// if (!subobj.isEmpty()) { -// fail("There should be no created directories in the suite dir: " + subobj); -// } -// -// FileObject war = dist.getFileObject("fakeapp.war"); -// assertNotNull("War file created: " + war, war); -// -// File warF = FileUtil.toFile(war); -// JarFile warJ = new JarFile(warF); -// Enumeration en = warJ.entries(); -// int cntJnlp = 0; -// while (en.hasMoreElements()) { -// JarEntry entry = (JarEntry)en.nextElement(); -// if (!entry.getName().endsWith(".jnlp")) { -// continue; -// } -// cntJnlp++; -// -// byte[] data = new byte[(int)entry.getSize()]; -// int len = 0; -// InputStream is = warJ.getInputStream(entry); -// for(int pos = 0; pos < data.length; ) { -// int r = is.read(data, pos, data.length - pos); -// pos += r; -// len += r; -// } -// is.close(); -// assertEquals("Correct data read: " + entry, data.length, len); -// -// String s = new String(data); -// if (s.indexOf(getWorkDir().getName()) >= 0) { -// fail("Name of work dir in a file, means that there is very likely local reference to a file: " + entry + "\n" + s); -// } -// } -// -// if (cntJnlp == 0) { -// fail("There should be at least one jnlp entry"); -// } -// } - - private static String readFile(final FileObject fo) throws IOException, FileNotFoundException { - // write user modified version of the file - byte[] arr = new byte[(int)fo.getSize()]; - InputStream is = fo.getInputStream(); - int len = is.read(arr); - assertEquals("Read all", arr.length, len); - String s = new String(arr); - is.close(); - return s; - } - - private void copyFiles(File from, File to) throws IOException { - LOG.fine("Copy " + from + " to " + to); - if (from.isDirectory()) { - to.mkdirs(); - for (File f : from.listFiles()) { - copyFiles(f, new File(to, f.getName())); - } - } else { - byte[] arr = new byte[4096]; - FileInputStream is = new FileInputStream(from); - FileOutputStream os = new FileOutputStream(to); - for (;;) { - int r = is.read(arr); - if (r == -1) { - break; - } - os.write(arr, 0, r); - } - is.close(); - os.close(); - } - - } - - private File createNewJarFile (String prefix) throws IOException { - if (prefix == null) { - prefix = "modules"; - } - - File dir = new File(this.getWorkDir(), prefix); - dir.mkdirs(); - - int i = 0; - for (;;) { - File f = new File (dir, i++ + ".jar"); - if (!f.exists ()) { - f.createNewFile(); - return f; - } - } - } -} diff --git a/apisupport/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/jnlp/GenerateJNLPApplicationTest.xsl b/apisupport/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/jnlp/GenerateJNLPApplicationTest.xsl deleted file mode 100644 index 55b12899d8cc..000000000000 --- a/apisupport/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/jnlp/GenerateJNLPApplicationTest.xsl +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/apisupport/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/ui/SuiteLogicalViewTest.java b/apisupport/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/ui/SuiteLogicalViewTest.java index 8e5b691c7ac2..12cc292ea0ca 100644 --- a/apisupport/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/ui/SuiteLogicalViewTest.java +++ b/apisupport/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/ui/SuiteLogicalViewTest.java @@ -95,7 +95,6 @@ public void testImportantFiles() throws Exception { Locale.setDefault(Locale.US); SuiteProject suite = generateSuite("sweet"); - FileObject master = suite.getProjectDirectory().createData("master.jnlp"); LogicalViewProvider viewProv = suite.getLookup().lookup(LogicalViewProvider.class); Node n = viewProv.createLogicalView(); diff --git a/enterprise/websvc.metro.lib/nbproject/project.properties b/enterprise/websvc.metro.lib/nbproject/project.properties index b86cd26860a8..6b732e639a14 100644 --- a/enterprise/websvc.metro.lib/nbproject/project.properties +++ b/enterprise/websvc.metro.lib/nbproject/project.properties @@ -16,12 +16,6 @@ # under the License. javac.compilerargs=-Xlint:all -Xlint:-serial javac.source=1.8 -jnlp.indirect.jars=\ - modules/ext/metro/webservices-api.jar,\ - modules/ext/metro/webservices-extra.jar,\ - modules/ext/metro/webservices-tools.jar,\ - modules/ext/metro/webservices-extra-api.jar,\ - modules/ext/metro/webservices-rt.jar release.external/webservices-api-2.4.8.jar=modules/ext/metro/webservices-api.jar release.external/webservices-extra-2.4.8.jar=modules/ext/metro/webservices-extra.jar diff --git a/enterprise/websvc.restlib/nbproject/project.properties b/enterprise/websvc.restlib/nbproject/project.properties index d3eb78a0228a..2afd385754c1 100644 --- a/enterprise/websvc.restlib/nbproject/project.properties +++ b/enterprise/websvc.restlib/nbproject/project.properties @@ -20,31 +20,6 @@ javac.source=1.8 javac.compilerargs=-Xlint:all -Xlint:-serial javadoc.arch=${basedir}/arch.xml -jnlp.indirect.jars=\ - modules/ext/jersey2/javax.annotation-api-1.3.2.jar,\ - modules/ext/jersey2/jakarta.activation-api-1.2.1.jar,\ - modules/ext/jersey2/jakarta.annotation-api-2.1.1.jar,\ - modules/ext/jersey2/jakarta.persistence-api-2.2.3.jar,\ - modules/ext/jersey2/jakarta.servlet-api-4.0.4.jar,\ - modules/ext/jersey2/jakarta.validation-api-2.0.2.jar,\ - modules/ext/jaxrs-2.1/jakarta.ws.rs-api-2.1.6.jar,\ - modules/ext/jersey2/jakarta.xml.bind-api-2.3.3.jar,\ - modules/ext/jersey2/jersey-apache-connector-2.35.jar,\ - modules/ext/jersey2/jersey-client-2.35.jar,\ - modules/ext/jersey2/jersey-common-2.35.jar,\ - modules/ext/jersey2/jersey-container-servlet-2.35.jar,\ - modules/ext/jersey2/jersey-container-servlet-core-2.35.jar,\ - modules/ext/jersey2/jersey-entity-filtering-2.35.jar,\ - modules/ext/jersey2/jersey-hk2-2.35.jar,\ - modules/ext/jersey2/jersey-media-json-jackson-2.35.jar,\ - modules/ext/jersey2/jersey-media-moxy-2.35.jar,\ - modules/ext/jersey2/jersey-server-2.35.jar,\ - modules/ext/jersey2/aopalliance-repackaged-2.6.1.jar,\ - modules/ext/jersey2/hk2-api-2.6.1.jar,\ - modules/ext/jersey2/hk2-locator-2.6.1.jar,\ - modules/ext/jersey2/hk2-utils-2.6.1.jar,\ - modules/ext/jersey2/osgi.core-8.0.0.jar,\ - modules/ext/jersey2/osgi-resource-locator-1.0.3.jar release.external/javax.annotation-api-1.3.2.jar=modules/ext/javax.annotation-api-1.3.2.jar release.external/jakarta.activation-api-1.2.1.jar=modules/ext/jersey2/jakarta.activation-api-1.2.1.jar diff --git a/extide/o.apache.tools.ant.module/build.xml b/extide/o.apache.tools.ant.module/build.xml index b0b90b1d5daf..8423d8522e8b 100644 --- a/extide/o.apache.tools.ant.module/build.xml +++ b/extide/o.apache.tools.ant.module/build.xml @@ -71,59 +71,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Apache Ant Integration - NetBeans - Bundles Apache Ant. - This module bundles the Apache Ant build tool. - - - - - - - - - - ]]> - - - diff --git a/harness/apisupport.harness/build.xml b/harness/apisupport.harness/build.xml index 170678385224..cbeca0c2d830 100644 --- a/harness/apisupport.harness/build.xml +++ b/harness/apisupport.harness/build.xml @@ -48,26 +48,6 @@ - - - - - - - - - - - - - - - - - - - - - + diff --git a/harness/apisupport.harness/jnlp-manifest.mf b/harness/apisupport.harness/jnlp-manifest.mf deleted file mode 100644 index 9acbceac8153..000000000000 --- a/harness/apisupport.harness/jnlp-manifest.mf +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: org.netbeans.modules.apisupport.jnlplauncher.Main - diff --git a/harness/apisupport.harness/jnlp-src/org/netbeans/modules/apisupport/jnlplauncher/InstalledFileLocatorImpl.java b/harness/apisupport.harness/jnlp-src/org/netbeans/modules/apisupport/jnlplauncher/InstalledFileLocatorImpl.java deleted file mode 100644 index 77ef4de757c5..000000000000 --- a/harness/apisupport.harness/jnlp-src/org/netbeans/modules/apisupport/jnlplauncher/InstalledFileLocatorImpl.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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.apisupport.jnlplauncher; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URI; -import java.net.URL; -import java.util.Iterator; -import org.openide.modules.InstalledFileLocator; -import org.openide.util.Exceptions; -import org.openide.util.NbBundle; -import org.openide.util.Utilities; -import org.openide.util.lookup.ServiceProvider; - -/** - * Special locator for JNLP mode. - * Locates files in userdir; JARs with the special META-INF/clusterpath/$relpath entry; - * and JARs present in extra-files.jar. - * @author Jesse Glick - */ -@ServiceProvider(service=InstalledFileLocator.class, supersedes="org.netbeans.core.startup.InstalledFileLocatorImpl") -public class InstalledFileLocatorImpl extends InstalledFileLocator { - - public InstalledFileLocatorImpl() {} - - public File locate(String relativePath, String codeNameBase, boolean localized) { - if (localized) { - int i = relativePath.lastIndexOf('.'); - String baseName, ext; - if (i == -1 || i < relativePath.lastIndexOf('/')) { - baseName = relativePath; - ext = ""; - } else { - baseName = relativePath.substring(0, i); - ext = relativePath.substring(i); - } - Iterator it = NbBundle.getLocalizingSuffixes(); - while (it.hasNext()) { - String locName = baseName + it.next() + ext; - File f = locate(locName, codeNameBase, false); - if (f != null) { - return f; - } - } - } else { - String userdir = System.getProperty("netbeans.user"); - if (userdir != null) { - File f = new File(userdir, relativePath.replace('/', File.separatorChar)); - if (f.exists()) { - return f; - } - } - String resource = "META-INF/clusterpath/" + relativePath; - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - URL found = loader.getResource(resource); - if (found != null) { - String foundS = found.toExternalForm(); - String prefix = "jar:"; - String suffix = "!/" + resource; - if (foundS.startsWith(prefix) && foundS.endsWith(suffix)) { - String infix = foundS.substring(prefix.length(), foundS.length() - suffix.length()); - if (infix.startsWith("file:")) { - File jar = Utilities.toFile(URI.create(infix)); - assert jar.isFile(); - return jar; - } - } - } - try { - InputStream is = loader.getResourceAsStream("META-INF/files/" + relativePath); - if (is != null) { - try { - // XXX could try to cache previously created files - File temp = File.createTempFile("nbjnlp-", relativePath.replaceFirst("^.+/", "")); - temp.deleteOnExit(); - OutputStream os = new FileOutputStream(temp); - try { - byte[] buf = new byte[4096]; - int read; - while ((read = is.read(buf)) != -1) { - os.write(buf, 0, read); - } - } finally { - os.close(); - } - return temp; - } finally { - is.close(); - } - } - } catch (IOException x) { - Exceptions.printStackTrace(x); - } - } - return null; - } - -} diff --git a/harness/apisupport.harness/jnlp-src/org/netbeans/modules/apisupport/jnlplauncher/Main.java b/harness/apisupport.harness/jnlp-src/org/netbeans/modules/apisupport/jnlplauncher/Main.java deleted file mode 100644 index 187dbcd012ea..000000000000 --- a/harness/apisupport.harness/jnlp-src/org/netbeans/modules/apisupport/jnlplauncher/Main.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -// XXX is this really an appropriate package? Perhaps move to e.g. org.netbeans.jnlplauncher. -package org.netbeans.modules.apisupport.jnlplauncher; - -import java.io.File; -import java.security.Policy; - -/** The JNLP entry point. Does not do much, in future it can do more - * of JNLP related stuff. - * - * @author Jaroslav Tulach - */ -public class Main extends Object { - - /** Starts NetBeans - * @param args the command line arguments - * @throws Exception for lots of reasons - */ - public static void main (String args[]) throws Exception { - fixPolicy(); - fixNetBeansUser(); - org.netbeans.Main.main(args); - } - - /** Fixes value of netbeans.user property. - */ - static final void fixNetBeansUser() { - String userDir = System.getProperty("netbeans.user"); // NOI18N - if (userDir == null) { - userDir = System.getProperty("jnlp.netbeans.user"); // NOI18N - } - if (userDir == null) { - return; - } - final String PREFIX = "${user.home}/"; // NOI18N - int uh = userDir.indexOf(PREFIX); - if (uh == -1) { - return; - } - String newDir = - userDir.substring(0, uh) + - System.getProperty("user.home") + // NOI18N - File.separator + - userDir.substring(uh + PREFIX.length()); - System.setProperty("netbeans.user", newDir); // NOI18N - } - - /** - * Attempt to give the rest of NetBeans all the - * permissions. The jars besides the one containing this class - * don't have to be signed with this. - */ - static final void fixPolicy() { - if (Boolean.getBoolean("netbeans.jnlp.fixPolicy")) { // NOI18N - // Grant all the code all persmission - Policy.setPolicy(new RuntimePolicy()); - // Replace the security manager by a fresh copy - // that does the delegation to the permissions system - // -- just to make sure that there is nothing left - // from the JWS - System.setSecurityManager(new SecurityManager()); - } - } -} diff --git a/harness/apisupport.harness/jnlp-src/org/netbeans/modules/apisupport/jnlplauncher/RuntimePolicy.java b/harness/apisupport.harness/jnlp-src/org/netbeans/modules/apisupport/jnlplauncher/RuntimePolicy.java deleted file mode 100644 index 28aec50dfa7d..000000000000 --- a/harness/apisupport.harness/jnlp-src/org/netbeans/modules/apisupport/jnlplauncher/RuntimePolicy.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.apisupport.jnlplauncher; - -import java.security.*; - -/** - * Policy giving all permissions to all of the code. - * - * @author David Strupl - */ -class RuntimePolicy extends Policy { - /** PermissionCollection with an instance of AllPermission. */ - private static PermissionCollection permissions; - /** @return initialized set of AllPermissions */ - private static synchronized PermissionCollection getAllPermissionCollection() { - if (permissions == null) { - permissions = new Permissions(); - permissions.add(new AllPermission()); - permissions.setReadOnly(); - } - return permissions; - } - - public PermissionCollection getPermissions(CodeSource codesource) { - return getAllPermissionCollection(); - } - - public boolean implies(ProtectionDomain domain, Permission permission) { - return getPermissions(domain.getCodeSource()).implies(permission); - } - - public PermissionCollection getPermissions(ProtectionDomain domain) { - return getPermissions(domain.getCodeSource()); - } - - public void refresh() { - } -} diff --git a/harness/apisupport.harness/nbproject/project.properties b/harness/apisupport.harness/nbproject/project.properties index 066614f085e3..2f3a0641c5c5 100644 --- a/harness/apisupport.harness/nbproject/project.properties +++ b/harness/apisupport.harness/nbproject/project.properties @@ -17,12 +17,6 @@ javac.compilerargs=-Xlint -Xlint:-serial javac.source=1.8 -jnlp.cp=\ - ${o.n.bootstrap.dir}/lib/boot.jar:\ - ${openide.modules.dir}/lib/org-openide-modules.jar:\ - ${openide.util.dir}/lib/org-openide-util-lookup.jar:\ - ${openide.util.dir}/lib/org-openide-util.jar:\ - ${openide.util.dir}/lib/org-openide-util-ui.jar release.../../nbbuild/templates/common.xml=common.xml release.../../nbbuild/templates/no-testcoverage.xml=no-testcoverage.xml @@ -36,7 +30,6 @@ release.external/harness-launchers-8.2.zip!/pre7_app.exe=launchers/pre7_app.exe release.external/harness-launchers-8.2.zip!/pre7_app_w.exe=launchers/pre7_app_w.exe nbm.executable.files=launchers/app.sh extra.module.files=\ - jnlp/jnlp-launcher.jar,\ tasks.jar # Just to keep it from being enabled (it does nothing as a module, and the cluster @@ -63,15 +56,9 @@ bundled.tasks=\ org/netbeans/nbbuild/FixDependencies*.class,\ org/netbeans/nbbuild/FixTestDependencies*.class,\ org/netbeans/nbbuild/JHIndexer*.class,\ - org/netbeans/nbbuild/JNLPUpdateManifestStartup*.class,\ - org/netbeans/nbbuild/JNLPUpdateManifestBranding*.class,\ - org/netbeans/nbbuild/JNLP-1.5.dtd,\ - org/netbeans/nbbuild/JNLP-6.0.dtd,\ org/netbeans/nbbuild/JarWithModuleAttributes*.class,\ org/netbeans/nbbuild/JUnitReportWriter*.class,\ - org/netbeans/nbbuild/MakeJNLP*.class,\ org/netbeans/nbbuild/MakeListOfNBM*.class,\ - org/netbeans/nbbuild/MakeMasterJNLP*.class,\ org/netbeans/nbbuild/MakeNBM*.class,\ org/netbeans/nbbuild/MakeOSGi*.class,\ org/netbeans/nbbuild/MakeUpdateDesc*.class,\ @@ -87,16 +74,9 @@ bundled.tasks=\ org/netbeans/nbbuild/SortSuiteModules*.class,\ org/netbeans/nbbuild/UpdateTracking*.class,\ org/netbeans/nbbuild/VerifyClassLinkage*.class,\ - org/netbeans/nbbuild/VerifyJNLP*.class,\ org/netbeans/nbbuild/XMLUtil*.class,\ org/netbeans/nbbuild/extlibs/DownloadBinaries*.class,\ org/netbeans/nbbuild/extlibs/ConfigureProxy*.class,\ org/netbeans/nbbuild/extlibs/MavenCoordinate.class -test.unit.cp.extra=${netbeans.dest.dir}/harness/jnlp/jnlp-launcher.jar javadoc.arch=${basedir}/arch.xml - -test.config.stableBTD.includes=**/*Test.class - -# TODO needed for tests; remove with jnlp code -test.jms.flags=-Djava.security.manager=allow diff --git a/harness/apisupport.harness/nbproject/project.xml b/harness/apisupport.harness/nbproject/project.xml index 6fb201faf49b..f247ef07faba 100644 --- a/harness/apisupport.harness/nbproject/project.xml +++ b/harness/apisupport.harness/nbproject/project.xml @@ -33,28 +33,8 @@ 1 - - - - unit - - org.netbeans.libs.junit4 - - - - org.netbeans.modules.nbjunit - - - - - - - - jnlp-src - ${jnlp.cp} - ${build.dir}/jnlp-launcher-classes - ${cluster}/jnlp/jnlp-launcher.jar - + + diff --git a/harness/apisupport.harness/release/README b/harness/apisupport.harness/release/README index 6e35c70f15be..33be63a5d07c 100644 --- a/harness/apisupport.harness/release/README +++ b/harness/apisupport.harness/release/README @@ -8,7 +8,7 @@ the NBM project type module, so that you can open any module in the NB IDE and work with it naturally: build and test it using Ant, use Java code completion, and so on. -Questions and comments should go to: dev@openide.netbeans.org +Questions and comments should go to: dev@netbeans.apache.org BASIC FILE LAYOUT ----------------- @@ -101,7 +101,7 @@ projects. They would be ignored anyway so there is a dedicated check that project is not trying to setup something that would not work anyway. For more info on uses of 'cluster.path' property and setting it in IDE, see -http://wiki.netbeans.org/DevFaqHowToReuseModules. +https://netbeans.apache.org/wiki/main/netbeansdevelopperfaq/DevFaqHowToReuseModules MODULE SUITES: CONFIGURATION FILES ---------------------------------- @@ -187,8 +187,8 @@ harness and platform rather than storing them in VCS. As of platform version 6.7, suite-chaining as described here is superseded by using 'cluster.path' property, see previous chapters and developer FAQ -http://wiki.netbeans.org/DevFaqHowToReuseModules. For platform versions 6.5 -and older, read on. +https://netbeans.apache.org/wiki/main/netbeansdevelopperfaq/DevFaqHowToReuseModules +For platform versions 6.5 and older, read on. Suppose you have one platform P1, say the bare NetBeans Platform. Then you have a module suite S1 with modules M1a...M1z which uses P1. Now it may happen that @@ -954,81 +954,6 @@ extra.test.libs.dir - directory with extra libraries needed for test run. tools.jar [since 5.0u1] - set to location of tools.jar in active JDK. Useful in case your module needs to compile against JDK-only classes. Meaningless on Mac OS X. - -To support builds of JNLP-based applications additional properties may be used -or redefined in JNLP-related targets: - -jnlp.servlet.jar - must point to jnlp-servlet.jar as provided by JDK 5 in - the directory sample/jnlp/servlet/jnlp-servlet.jar if one wants to build - a packaged war file of JNLP version of your suite - -jnlp.dest.dir - the location where to generate the JNLP files and signed - jars. By default it is your ${suite.dir}/build/jnlp - -jnlp.master.dir - (category='private') location of a directory in which - to generate pieces of master JNLP file to be included in the resources - section. - -jnlp.signjar.alias - -jnlp.signjar.keystore - -jnlp.signjar.password - allow you to sign your app with your own private key, if - unspecified then a default keystore is generated. Nice for trying things for - the first time, but not for production, then you very likely want to generate - your key and set these properties -jnlp.signjar.vendor - you can override this to be the default dname for the keystore - -jnlp.platform.codebase - can point to a shared repository which can be generated - by ant -f nbbuild/build.xml build-jnlp. Then your WAR file will contain only - modules of your suite and platform modules will be referenced by the value of - this property. Sample values with prebuilt binaries (good for testing): -http://bits.netbeans.org/6.5/jnlp/ -http://bits.netbeans.org/6.7/fcs/jnlp/ -http://deadlock.netbeans.org/job/ide-jnlp/lastStableBuild/artifact/nbbuild/build/jnlp/ - -jnlp.indirect.jars [since 6.0] - optional pattern of JARs in the cluster to load - in JNLP mode even though they are not listed as Class-Path extensions of the - module JAR. The module ought not directly refer to classes in these JARs (it - could not do so in non-JNLP mode) but it may load them reflectively using - InstalledFileLocator using the same path in regular as in JNLP mode. Note that - the physical path on disk to the resulting JAR will not necessarily contain - the directory prefix that the JAR in the cluster uses, so do not expect that - jar.getParentFile() is meaningful. The implementation creates an empty JAR - entry META-INF/clusterpath/$path where $path is the ('/'-separated) path - within the cluster where the JAR would be found in a normal installation. - -jnlp.indirect.files [since 6.7 M1] - optional pattern of files in the cluster to - load in JNLP mode. The module may load these files using InstalledFileLocator - using the same path in regular as in JNLP mode. Note that the physical path on - disk to the resulting file will not necessarily contain the directory prefix - that the file in the cluster uses, so do not expect that file.getParentFile() - is meaningful. The implementation creates a JAR entry META-INF/files/$path - where $path is the ('/'-separated) path within the cluster where the file - would be found in a normal installation. - -jnlp.verify.excludes - the default implementation of "jnlp" task in common.xml - does verification and compares that all files from module NBM are really - referenced from the JNLP file. Sometimes not all of them need to be, for - them you can put their full names (relative to your cluster root) into this - property and separate them by comma. - -jnlp.permissions - allows altering of the fragment in the resulting .jnlp file - that sets the permissions for individual modules. The default value is - <security><all-permissions/></security> when jnlp.sign.jars - is true, <security/> when jnlp.sign.jars is false. - If you want to change the default to something else please define the value - of the property. - -jnlp.sign.jars [since 6.0] - defaults to true. If set to false the jars - will not be signed, only the main (startup) jar. This should allow for - faster startup but might compromise JNLP security. Use with extreme care. - -jnlp.generate.versions [since 6.7] - Defaults to false, which means versioning - info is not generated (see - http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/downloadservletguide.html#resources). - If set true, build-jnlp target creates versioning info in jnlp descriptors and version.xml files. - This allows for incremental updates of Webstart applications, but requires download via - JnlpDownloadServlet (thus run-jnlp and debug-jnlp does not create versioning info even with this - property set to true). PROPERTIES WHICH MAY BE DEFINED IN YOUR SUITE platform.properties ----------------------------------------------------------------- @@ -1101,11 +1026,6 @@ dist.dir - directory (if not 'dist') to place the final application in. Since 6. modules - list of contained modules. Path format; entries resolved against the suite directory as needed. -jnlp.codebase [since 5.0u1] - in case one wants to build a static repository not -packaged in a WAR file, one needs to pass in the full URL for it. By default it -is specified as "$$codebase" and replaced dynamically by the servlet packaged in -the WAR file. - TARGETS AVAILABLE FOR OVERRIDING IN YOUR build.xml -------------------------------------------------- @@ -1187,10 +1107,6 @@ jar-prep - prepare to build the module JAR; define ${buildnumber}. javadoc - build module Javadoc. -jnlp - generetes the JNLP component file for this module and all necessary - resources for it into ${jnlp.dest.dir} directory and also a fragment of - the master JNLP into ${jnlp.master.dir} - javadoc-nb - same, and open it in a web browser (only from the IDE). Available as Build -> Generate Javadoc. @@ -1256,9 +1172,6 @@ will be packed into build - build all suite modules. -build-jnlp - builds a JNLP WAR file from your application suitable for -publishing in a Java EE container. - build-mac [since 5.0u2] - creates a Mac OS X application. build-zip - builds a ZIP file containing your application including launchers. @@ -1268,8 +1181,6 @@ clean - clean everything. debug - like run, but run in the JPDA debugger. (Only available from inside the IDE.) -debug-jnlp - starts debuging of your JNLP application (works only from NetBeans IDE) - nbms [since 5.0u1] - creates NBMs for all modules in the suite, and generates an XML descriptor listing them suitable for use from Auto Update. @@ -1277,8 +1188,6 @@ profile - used from inside the NetBeans IDE to profile the entire suite run - start application for testing. -run-jnlp - executes your JNLP application (currently from local files) - test - run all module unit tests. Since NetBeans 6.8 runs tests of all suite modules by default, even if some of them fails and target succeeds regardless of test status. When property 'continue.after.failing.tests' is set to 'false', this target fails @@ -1355,6 +1264,109 @@ other related files must be stored in 'testcoverage/' subfolder. +JNLP Legacy +----------- + +PROPERTIES WHICH MAY BE DEFINED IN YOUR project.properties + +To support builds of JNLP-based applications additional properties may be used +or redefined in JNLP-related targets: + +jnlp.servlet.jar - must point to jnlp-servlet.jar as provided by JDK 5 in + the directory sample/jnlp/servlet/jnlp-servlet.jar if one wants to build + a packaged war file of JNLP version of your suite + +jnlp.dest.dir - the location where to generate the JNLP files and signed + jars. By default it is your ${suite.dir}/build/jnlp + +jnlp.master.dir - (category='private') location of a directory in which + to generate pieces of master JNLP file to be included in the resources + section. + +jnlp.signjar.alias - +jnlp.signjar.keystore - +jnlp.signjar.password - allow you to sign your app with your own private key, if + unspecified then a default keystore is generated. Nice for trying things for + the first time, but not for production, then you very likely want to generate + your key and set these properties +jnlp.signjar.vendor - you can override this to be the default dname for the keystore + +jnlp.platform.codebase - can point to a shared repository which can be generated + by ant -f nbbuild/build.xml build-jnlp. Then your WAR file will contain only + modules of your suite and platform modules will be referenced by the value of + this property. Sample values with prebuilt binaries (good for testing): +http://bits.netbeans.org/6.5/jnlp/ +http://bits.netbeans.org/6.7/fcs/jnlp/ +http://deadlock.netbeans.org/job/ide-jnlp/lastStableBuild/artifact/nbbuild/build/jnlp/ + +jnlp.indirect.jars [since 6.0] - optional pattern of JARs in the cluster to load + in JNLP mode even though they are not listed as Class-Path extensions of the + module JAR. The module ought not directly refer to classes in these JARs (it + could not do so in non-JNLP mode) but it may load them reflectively using + InstalledFileLocator using the same path in regular as in JNLP mode. Note that + the physical path on disk to the resulting JAR will not necessarily contain + the directory prefix that the JAR in the cluster uses, so do not expect that + jar.getParentFile() is meaningful. The implementation creates an empty JAR + entry META-INF/clusterpath/$path where $path is the ('/'-separated) path + within the cluster where the JAR would be found in a normal installation. + +jnlp.indirect.files [since 6.7 M1] - optional pattern of files in the cluster to + load in JNLP mode. The module may load these files using InstalledFileLocator + using the same path in regular as in JNLP mode. Note that the physical path on + disk to the resulting file will not necessarily contain the directory prefix + that the file in the cluster uses, so do not expect that file.getParentFile() + is meaningful. The implementation creates a JAR entry META-INF/files/$path + where $path is the ('/'-separated) path within the cluster where the file + would be found in a normal installation. + +jnlp.verify.excludes - the default implementation of "jnlp" task in common.xml + does verification and compares that all files from module NBM are really + referenced from the JNLP file. Sometimes not all of them need to be, for + them you can put their full names (relative to your cluster root) into this + property and separate them by comma. + +jnlp.permissions - allows altering of the fragment in the resulting .jnlp file + that sets the permissions for individual modules. The default value is + <security><all-permissions/></security> when jnlp.sign.jars + is true, <security/> when jnlp.sign.jars is false. + If you want to change the default to something else please define the value + of the property. + +jnlp.sign.jars [since 6.0] - defaults to true. If set to false the jars + will not be signed, only the main (startup) jar. This should allow for + faster startup but might compromise JNLP security. Use with extreme care. + +jnlp.generate.versions [since 6.7] - Defaults to false, which means versioning + info is not generated (see + http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/downloadservletguide.html#resources). + If set true, build-jnlp target creates versioning info in jnlp descriptors and version.xml files. + This allows for incremental updates of Webstart applications, but requires download via + JnlpDownloadServlet (thus run-jnlp and debug-jnlp does not create versioning info even with this + property set to true). + +PROPERTIES WHICH MAY BE DEFINED IN YOUR SUITE project.properties + +jnlp.codebase [since 5.0u1] - in case one wants to build a static repository not +packaged in a WAR file, one needs to pass in the full URL for it. By default it +is specified as "$$codebase" and replaced dynamically by the servlet packaged in +the WAR file. + +TARGETS AVAILABLE FOR OVERRIDING IN YOUR build.xml + +jnlp - generetes the JNLP component file for this module and all necessary + resources for it into ${jnlp.dest.dir} directory and also a fragment of + the master JNLP into ${jnlp.master.dir} + + +TARGETS AVAILABLE FOR OVERRIDING IN YOUR SUITE build.xml + +build-jnlp - builds a JNLP WAR file from your application suitable for +publishing in a Java EE container. + +debug-jnlp - starts debuging of your JNLP application (works only from NetBeans IDE) + +run-jnlp - executes your JNLP application (currently from local files) + ---------------- Hey Emacs! Local Variables: diff --git a/harness/apisupport.harness/release/jnlp.xml b/harness/apisupport.harness/release/jnlp.xml deleted file mode 100644 index cd1251a27927..000000000000 --- a/harness/apisupport.harness/release/jnlp.xml +++ /dev/null @@ -1,458 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - $${app.title} - $${app.title} vendor - $${app.name} application - - - - - - - - - - - - - - - --branding - $${branding.token} - - -]]> - - - - - $${app.title} - $${app.title} vendor - $${app.name} application - - - $${jnlp.permissions} - - $${jnlp.branding.jars} - - - -]]> - - - - Must have set at least an application name ('app.name') - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - JnlpDownloadServlet - jnlp.sample.servlet.JnlpDownloadServlet - - - JnlpDownloadServlet - *.jnlp - - -]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Your JNLP file is generated at ${jnlp.dest.dir}/master.jnlp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/harness/apisupport.harness/release/suite.xml b/harness/apisupport.harness/release/suite.xml index b2602a8a4c0b..e96c8761a3ce 100644 --- a/harness/apisupport.harness/release/suite.xml +++ b/harness/apisupport.harness/release/suite.xml @@ -488,7 +488,6 @@ Alternatively use "zip -yr ${app.name}.app" to create a simple zipped distributi Will not delete ${test.user.dir} because ${test.user.dir.lock} still exists; kill any running process and delete lock file if necessary - @@ -526,28 +525,7 @@ Alternatively use "zip -yr ${app.name}.app" to create a simple zipped distributi - - - - - - - - - - - - - - - - - - - - - - + OSGi support is EXPERIMENTAL for now; see: http://wiki.netbeans.org/NetBeansInOSGi diff --git a/harness/apisupport.harness/taskdefs.properties b/harness/apisupport.harness/taskdefs.properties index 19a01429c9f3..91833556ee1d 100644 --- a/harness/apisupport.harness/taskdefs.properties +++ b/harness/apisupport.harness/taskdefs.properties @@ -19,10 +19,6 @@ createmodulexml=org.netbeans.nbbuild.CreateModuleXML jhindexer=org.netbeans.nbbuild.JHIndexer jarwithmoduleattributes=org.netbeans.nbbuild.JarWithModuleAttributes makenbm=org.netbeans.nbbuild.MakeNBM -jnlpupdatemanifeststartup=org.netbeans.nbbuild.JNLPUpdateManifestStartup -jnlpupdatemanifestbranding=org.netbeans.nbbuild.JNLPUpdateManifestBranding -makejnlp=org.netbeans.nbbuild.MakeJNLP -makemasterjnlp=org.netbeans.nbbuild.MakeMasterJNLP makeosgi=org.netbeans.nbbuild.MakeOSGi parseprojectxml=org.netbeans.nbbuild.ParseProjectXml genlist=org.netbeans.nbbuild.MakeListOfNBM diff --git a/harness/apisupport.harness/test/unit/src/org/netbeans/modules/apisupport/jnlplauncher/FixPolicyTest.java b/harness/apisupport.harness/test/unit/src/org/netbeans/modules/apisupport/jnlplauncher/FixPolicyTest.java deleted file mode 100644 index 465dae1f230f..000000000000 --- a/harness/apisupport.harness/test/unit/src/org/netbeans/modules/apisupport/jnlplauncher/FixPolicyTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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.apisupport.jnlplauncher; - -import java.net.URL; -import java.security.cert.CertificateEncodingException; -import java.security.cert.CertificateException; -import junit.framework.*; -import java.security.*; - -/** - * Test whether the system property netbeans.jnlp.fixPolicy - * really grants everything to everybody. - * @author David Strupl - */ -public class FixPolicyTest extends TestCase { - - private URL url = null; - - public FixPolicyTest(String testName) { - super(testName); - } - - public void testFixPolicy() throws Exception { - - url = new URL("http://boo.baa"); - System.setProperty("netbeans.jnlp.fixPolicy", "true"); - - Main.fixPolicy(); - - assertTrue(Policy.getPolicy().implies( - new ProtectionDomain( - new CodeSource( - url, - new java.security.cert.Certificate[0] - ), - new AllPermission().newPermissionCollection()), - new AllPermission() - )); - } - -} diff --git a/harness/apisupport.harness/test/unit/src/org/netbeans/modules/apisupport/jnlplauncher/ReplaceUserDirTest.java b/harness/apisupport.harness/test/unit/src/org/netbeans/modules/apisupport/jnlplauncher/ReplaceUserDirTest.java deleted file mode 100644 index 22b41b1a8d0e..000000000000 --- a/harness/apisupport.harness/test/unit/src/org/netbeans/modules/apisupport/jnlplauncher/ReplaceUserDirTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.apisupport.jnlplauncher; - -import junit.framework.*; -import java.awt.*; -import java.awt.event.*; -import java.beans.*; -import java.io.*; -import java.security.*; -import java.util.Locale; -import javax.swing.*; -import javax.swing.border.*; - -/** Can we specify ${user.home} in name of userdirectory? - * - * @author Jaroslav Tulach - */ -public class ReplaceUserDirTest extends TestCase { - - public ReplaceUserDirTest(String testName) { - super(testName); - } - - public void testGetUserDir() { - System.setProperty("netbeans.user", "${user.home}/mine"); - - String expResult = System.getProperty("user.home") + File.separator + "mine"; - Main.fixNetBeansUser(); - String result = System.getProperty("netbeans.user"); - assertEquals(expResult, result); - } - -} diff --git a/ide/css.editor/nbproject/project.properties b/ide/css.editor/nbproject/project.properties index 4de590d38fc0..2354fd8769a9 100644 --- a/ide/css.editor/nbproject/project.properties +++ b/ide/css.editor/nbproject/project.properties @@ -20,10 +20,6 @@ auxiliary.org-netbeans-modules-css-prep.sass_2e_configured=true release.external/css21-spec.zip=docs/css21-spec.zip release.external/css3-spec.zip=docs/css3-spec.zip -jnlp.indirect.files=\ - docs/css21-spec.zip,\ - docs/css3-spec.zip - javac.compilerargs=-Xlint -Xlint:-serial javac.release=17 diff --git a/ide/db.drivers/nbproject/project.properties b/ide/db.drivers/nbproject/project.properties index c47e3a56ff72..05857980e45e 100644 --- a/ide/db.drivers/nbproject/project.properties +++ b/ide/db.drivers/nbproject/project.properties @@ -18,5 +18,3 @@ javac.compilerargs=-Xlint -Xlint:-serial javac.release=8 release.external/postgresql-42.5.4.jar=modules/ext/postgresql-42.5.4.jar -jnlp.indirect.jars=\ - modules/ext/postgresql-42.5.4.jar diff --git a/ide/derby/nbproject/project.properties b/ide/derby/nbproject/project.properties index f91cca36ace9..ea72a6c0085e 100644 --- a/ide/derby/nbproject/project.properties +++ b/ide/derby/nbproject/project.properties @@ -20,8 +20,6 @@ javac.compilerargs=-Xlint release.build/derbysampledb.zip=modules/ext/derbysampledb.zip extra.module.files=modules/ext/derbysampledb.zip -jnlp.indirect.jars=\ - modules/ext/derbysampledb.zip test.config.stableBTD.includes=**/*Test.class test.config.stableBTD.excludes=\ diff --git a/ide/dlight.nativeexecution/nbproject/project.properties b/ide/dlight.nativeexecution/nbproject/project.properties index 29b0a6cae1cd..44e252284778 100644 --- a/ide/dlight.nativeexecution/nbproject/project.properties +++ b/ide/dlight.nativeexecution/nbproject/project.properties @@ -20,7 +20,6 @@ javac.compilerargs=-Xlint -Xlint:-serial javadoc.arch=${basedir}/arch.xml project.license=apache20-asf nbm.executable.files=bin/nativeexecution/** -jnlp.indirect.files=bin/nativeexecution/** spec.version.base=1.71.0 test.config.default.includes=**/*Test.class diff --git a/ide/html.editor/nbproject/project.properties b/ide/html.editor/nbproject/project.properties index aa4e56a5773c..74671f9351ae 100644 --- a/ide/html.editor/nbproject/project.properties +++ b/ide/html.editor/nbproject/project.properties @@ -19,7 +19,6 @@ release.external/html-4.01.zip=docs/html-4.01.zip javac.compilerargs=-Xlint javac.release=17 -jnlp.verify.excludes=docs/html-4.01.zip test.config.stableBTD.includes=**/*Test.class test.config.stableBTD.excludes=\ diff --git a/ide/html.parser/nbproject/project.properties b/ide/html.parser/nbproject/project.properties index f21cc69ce47b..9ec4f44a5d1f 100644 --- a/ide/html.parser/nbproject/project.properties +++ b/ide/html.parser/nbproject/project.properties @@ -22,8 +22,6 @@ release.external/htmlparser-1.4.20190624.jar=modules/ext/html5-parser.jar release.external/html5doc.zip=docs/html5doc.zip release.external/icu4j-4_4_2.jar=modules/ext/icu4j-4_4_2.jar -jnlp.indirect.jars=docs/html5doc.zip - # Fatal error: class com.lowagie.text.DocumentException not found # Warning: class com.lowagie.text.DocumentException not found. Please, add required jar or directory to the classpath. sigtest.gen.fail.on.error=false diff --git a/ide/libs.c.kohlschutter.junixsocket/nbproject/project.properties b/ide/libs.c.kohlschutter.junixsocket/nbproject/project.properties index f61dba9cd0b3..05e3b4ceff09 100644 --- a/ide/libs.c.kohlschutter.junixsocket/nbproject/project.properties +++ b/ide/libs.c.kohlschutter.junixsocket/nbproject/project.properties @@ -24,12 +24,4 @@ release.external/junixsocket-native-common-2.5.1.jar!/lib/aarch64-Linux-clang/jn release.external/junixsocket-native-common-2.5.1.jar!/lib/riscv64-Linux-clang/jni/libjunixsocket-native-2.5.1.so=modules/lib/riscv64/linux/libjunixsocket-native-2.5.1.so release.external/junixsocket-native-common-2.5.1.jar!/lib/amd64-Windows10-clang/jni/junixsocket-native-2.5.1.dll=modules/lib/amd64/junixsocket-native-2.5.1.dll release.external/junixsocket-native-common-2.5.1.jar!/lib/aarch64-Windows10-clang/jni/junixsocket-native-2.5.1.dll=modules/lib/aarch64/junixsocket-native-2.5.1.dll -jnlp.verify.excludes=\ - modules/lib/x86_64/libjunixsocket-native-2.5.1.dylib,\ - modules/lib/aarch64/libjunixsocket-native-2.5.1.dylib,\ - modules/lib/amd64/linux/libjunixsocket-native-2.5.1.so,\ - modules/lib/aarch64/linux/libjunixsocket-native-2.5.1.so,\ - modules/lib/riscv64/linux/libjunixsocket-native-2.5.1.so,\ - modules/lib/amd64/junixsocket-native-2.5.1.dll,\ - modules/lib/aarch64/junixsocket-native-2.5.1.dll is.autoload=true diff --git a/ide/libs.jaxb/nbproject/project.properties b/ide/libs.jaxb/nbproject/project.properties index c41915be8096..4f4efe8c7d33 100644 --- a/ide/libs.jaxb/nbproject/project.properties +++ b/ide/libs.jaxb/nbproject/project.properties @@ -19,11 +19,6 @@ is.autoload=true javac.release=8 javac.compilerargs=-Xlint -Xlint:-serial -jnlp.indirect.jars=\ - modules/ext/jaxb/jaxb-impl.jar,\ - modules/ext/jaxb/jaxb-xjc.jar,\ - docs/jaxb-api-doc.jar - # pack200 bug in JDK 7 (#7131266) pack200.excludes=modules/ext/jaxb/jaxb-xjc.jar diff --git a/ide/libs.json_simple/nbproject/project.properties b/ide/libs.json_simple/nbproject/project.properties index d319b4efec7d..207326e96590 100644 --- a/ide/libs.json_simple/nbproject/project.properties +++ b/ide/libs.json_simple/nbproject/project.properties @@ -15,8 +15,6 @@ # specific language governing permissions and limitations # under the License. -jnlp.indirect.jars=modules/ext/json-simple-1.1.1.jar - release.external/json-simple-1.1.1.jar=modules/ext/json-simple-1.1.1.jar sigtest.gen.fail.on.error=false diff --git a/ide/spellchecker.dictionary_en/nbproject/project.properties b/ide/spellchecker.dictionary_en/nbproject/project.properties index fcb122feaef4..f2050b1044d6 100644 --- a/ide/spellchecker.dictionary_en/nbproject/project.properties +++ b/ide/spellchecker.dictionary_en/nbproject/project.properties @@ -17,4 +17,3 @@ javac.release=17 release.external/wordlist-en_GB-large-2017.08.24.zip=modules/dict/wordlist-en_GB-large-2017.08.24.zip release.external/wordlist-en_US-large-2017.08.24.zip=modules/dict/wordlist-en_US-large-2017.08.24.zip -jnlp.indirect.files=modules/dict/dictionary_en_US.description,modules/dict/dictionary_en_GB.description,modules/dict/dictionary_en.description,modules/dict/wordlist-en_GB-large-2017.08.24.zip,modules/dict/wordlist-en_US-large-2017.08.24.zip diff --git a/ide/usersguide/nbproject/project.properties b/ide/usersguide/nbproject/project.properties index 8dba2bd14198..6c526a17a58b 100644 --- a/ide/usersguide/nbproject/project.properties +++ b/ide/usersguide/nbproject/project.properties @@ -21,4 +21,3 @@ javahelp.excludes=**/credits.html,ant/credits.html,pending.html javahelp.base=org/netbeans/modules/usersguide javahelp.hs=ide.hs -jnlp.verify.excludes=docs/org/netbeans/modules/usersguide/ide.css diff --git a/ide/xml.jaxb.api/nbproject/project.properties b/ide/xml.jaxb.api/nbproject/project.properties index 52d06ed9ffcc..2feb8acf6f5a 100644 --- a/ide/xml.jaxb.api/nbproject/project.properties +++ b/ide/xml.jaxb.api/nbproject/project.properties @@ -19,10 +19,6 @@ is.autoload=true javac.release=8 javac.compilerargs=-Xlint -Xlint:-serial -jnlp.indirect.jars=\ - modules/ext/jaxb/activation.jar,\ - modules/ext/jaxb/api/jaxb-api.jar - release.external/jakarta.activation-1.2.2.jar=modules/ext/jaxb/activation.jar release.external/jakarta.xml.bind-api-2.3.3.jar=modules/ext/jaxb/api/jaxb-api.jar diff --git a/java/form/nbproject/project.properties b/java/form/nbproject/project.properties index 2c8a9dfd9203..5e7b10b19b63 100644 --- a/java/form/nbproject/project.properties +++ b/java/form/nbproject/project.properties @@ -29,8 +29,6 @@ javac.compilerargs=--add-exports=java.desktop/java.awt.peer=ALL-UNNAMED javadoc.arch=${basedir}/arch.xml spec.version.base=1.89.0 test-unit-sys-prop.org.netbeans.modules.form.layoutdesign.test=0 -jnlp.verify.excludes=sources/org/netbeans/lib/awtextra/AbsoluteLayout.java,sources/org/netbeans/lib/awtextra/AbsoluteConstraints.java,sources/readme.txt - test.config.templates.includes=org/netbeans/qa/form/TemplateTest.class diff --git a/java/j2ee.eclipselink/nbproject/project.properties b/java/j2ee.eclipselink/nbproject/project.properties index 6f244aa60811..84e24e2a0e74 100644 --- a/java/j2ee.eclipselink/nbproject/project.properties +++ b/java/j2ee.eclipselink/nbproject/project.properties @@ -18,15 +18,6 @@ is.autoload=true javac.compilerargs=-Xlint -Xlint:-serial javac.release=17 -jnlp.indirect.jars=\ - modules/ext/eclipselink/org.eclipse.persistence.core-2.7.12.jar,\ - modules/ext/eclipselink/org.eclipse.persistence.asm-9.4.0.jar,\ - modules/ext/eclipselink/org.eclipse.persistence.antlr-2.7.12.jar,\ - modules/ext/eclipselink/org.eclipse.persistence.jpa-2.7.12.jar,\ - modules/ext/eclipselink/org.eclipse.persistence.jpa.jpql-2.7.12.jar,\ - modules/ext/eclipselink/org.eclipse.persistence.moxy-2.7.12.jar,\ - modules/ext/eclipselink/jakarta.persistence-2.2.3.jar,\ - modules/ext/docs/jakarta.persistence-2.2.3-doc.zip release.external/org.eclipse.persistence.core-2.7.12.jar=modules/ext/eclipselink/org.eclipse.persistence.core-2.7.12.jar release.external/org.eclipse.persistence.asm-9.4.0.jar=modules/ext/eclipselink/org.eclipse.persistence.asm-9.4.0.jar diff --git a/java/j2ee.eclipselinkmodelgen/nbproject/project.properties b/java/j2ee.eclipselinkmodelgen/nbproject/project.properties index 2e35b0475f4c..bdf181d23b6a 100644 --- a/java/j2ee.eclipselinkmodelgen/nbproject/project.properties +++ b/java/j2ee.eclipselinkmodelgen/nbproject/project.properties @@ -17,7 +17,5 @@ javac.compilerargs=-Xlint -Xlint:-serial javac.release=17 -jnlp.indirect.jars=\ - modules/ext/eclipselink/org.eclipse.persistence.jpa.modelgen.processor-2.7.12.jar release.external/org.eclipse.persistence.jpa.modelgen.processor-2.7.12.jar=modules/ext/eclipselink/org.eclipse.persistence.jpa.modelgen.processor-2.7.12.jar diff --git a/java/java.j2seembedded/nbproject/project.properties b/java/java.j2seembedded/nbproject/project.properties index 52833f8fdea7..482f1dd0738b 100644 --- a/java/java.j2seembedded/nbproject/project.properties +++ b/java/java.j2seembedded/nbproject/project.properties @@ -17,4 +17,3 @@ javac.source=1.8 javac.compilerargs=-Xlint -Xlint:-serial extra.module.files=modules/ext/org-netbeans-modules-java-j2seembedded-probe.jar -jnlp.indirect.jars=modules/ext/org-netbeans-modules-java-j2seembedded-probe.jar diff --git a/java/java.j2seplatform/nbproject/project.properties b/java/java.j2seplatform/nbproject/project.properties index 58cc3858b25b..2fba4ae2a2a8 100644 --- a/java/java.j2seplatform/nbproject/project.properties +++ b/java/java.j2seplatform/nbproject/project.properties @@ -18,7 +18,6 @@ javac.compilerargs=-Xlint -Xlint:-serial javac.release=17 extra.module.files=modules/ext/org-netbeans-modules-java-j2seplatform-probe.jar -jnlp.indirect.jars=modules/ext/org-netbeans-modules-java-j2seplatform-probe.jar javadoc.arch=${basedir}/arch.xml javadoc.apichanges=${basedir}/apichanges.xml diff --git a/java/java.j2seproject/nbproject/project.properties b/java/java.j2seproject/nbproject/project.properties index 14008a960dc7..29c12fa82240 100644 --- a/java/java.j2seproject/nbproject/project.properties +++ b/java/java.j2seproject/nbproject/project.properties @@ -30,7 +30,6 @@ test-unit-sys-prop.test.junit.jar=${nb_all}/platform/libs.junit4/external/junit- test-unit-sys-prop.test.testng.jar=${nb_all}/platform/libs.testng/external/testng-6.14.3.jar test-unit-sys-prop.test.jcommander.jar=${nb_all}/platform/libs.testng/external/jcommander-1.78.jar extra.module.files=ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar -jnlp.indirect.jars=ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar test.config.stableBTD.includes=**/*Test.class test.config.stableBTD.excludes=\ diff --git a/java/javawebstart/nbproject/project.properties b/java/javawebstart/nbproject/project.properties index 1b767da03530..3de97539d0b8 100644 --- a/java/javawebstart/nbproject/project.properties +++ b/java/javawebstart/nbproject/project.properties @@ -18,5 +18,4 @@ javac.compilerargs=-Xlint:unchecked javac.release=17 extra.module.files=ant/extra/org-netbeans-modules-javawebstart-anttasks.jar -jnlp.indirect.jars=ant/extra/org-netbeans-modules-javawebstart-anttasks.jar requires.nb.javac=true diff --git a/java/lib.jshell.agent/nbproject/project.properties b/java/lib.jshell.agent/nbproject/project.properties index 0ca87b9c6088..6a919da4d16e 100644 --- a/java/lib.jshell.agent/nbproject/project.properties +++ b/java/lib.jshell.agent/nbproject/project.properties @@ -19,6 +19,5 @@ is.autoload=true javac.release=17 javac.compilerargs=-Xlint -Xlint:-serial extra.module.files=modules/ext/nb-custom-jshell-probe.jar -jnlp.indirect.jars=modules/ext/nb-custom-jshell-probe.jar agentsrc.asm.cp=${libs.asm.dir}/core/asm-9.9.jar diff --git a/java/libs.springframework/nbproject/project.properties b/java/libs.springframework/nbproject/project.properties index b6d82a9111f5..a66608a142d8 100644 --- a/java/libs.springframework/nbproject/project.properties +++ b/java/libs.springframework/nbproject/project.properties @@ -46,25 +46,3 @@ release.external/spring-webflux-5.3.31.jar=modules/ext/spring-5/spring-webflux-5 release.external/spring-webmvc-5.3.31.jar=modules/ext/spring-5/spring-webmvc-5.3.31.jar release.external/spring-websocket-5.3.31.jar=modules/ext/spring-5/spring-websocket-5.3.31.jar -jnlp.indirect.jars=\ - modules/ext/spring-5/spring-aop-5.3.31.jar,\ - modules/ext/spring-5/spring-aspects-5.3.31.jar,\ - modules/ext/spring-5/spring-beans-5.3.31.jar,\ - modules/ext/spring-5/spring-context-5.3.31.jar,\ - modules/ext/spring-5/spring-context-indexer-5.3.31.jar,\ - modules/ext/spring-5/spring-context-support-5.3.31.jar,\ - modules/ext/spring-5/spring-core-5.3.31.jar,\ - modules/ext/spring-5/spring-expression-5.3.31.jar,\ - modules/ext/spring-5/spring-instrument-5.3.31.jar,\ - modules/ext/spring-5/spring-jcl-5.3.31.jar,\ - modules/ext/spring-5/spring-jdbc-5.3.31.jar,\ - modules/ext/spring-5/spring-jms-5.3.31.jar,\ - modules/ext/spring-5/spring-messaging-5.3.31.jar,\ - modules/ext/spring-5/spring-orm-5.3.31.jar,\ - modules/ext/spring-5/spring-oxm-5.3.31.jar,\ - modules/ext/spring-5/spring-test-5.3.31.jar,\ - modules/ext/spring-5/spring-tx-5.3.31.jar,\ - modules/ext/spring-5/spring-web-5.3.31.jar,\ - modules/ext/spring-5/spring-webflux-5.3.31.jar,\ - modules/ext/spring-5/spring-webmvc-5.3.31.jar,\ - modules/ext/spring-5/spring-websocket-5.3.31.jar diff --git a/java/maven.embedder/nbproject/project.properties b/java/maven.embedder/nbproject/project.properties index e9ef864fccad..2bc70caccd45 100644 --- a/java/maven.embedder/nbproject/project.properties +++ b/java/maven.embedder/nbproject/project.properties @@ -27,9 +27,7 @@ extra.license.files=${cluster}/maven/LICENSE.txt,${cluster}/maven/NOTICE.txt module.javadoc.packages=org.netbeans.modules.maven.embedder javadoc.apichanges=${basedir}/apichanges.xml javadoc.arch=${basedir}/arch.xml -jnlp.indirect.files=modules/ext/maven/rootpackage/default-report.xml,modules/ext/maven/settings.xml # Will not be able to run bundled Maven, but embedder should work and should be able to specify external Maven: -jnlp.verify.excludes=maven/NOTICE,maven/bin/mvnDebug,maven/bin/m2.conf,maven/LICENSE,maven/README.txt,maven/conf/settings.xml,maven/bin/mvnyjp,maven/bin/mvn,maven/bin/mvn.bat,maven/bin/mvnDebug.bat,maven/lib/ext/README.txt, maven/lib/maven-settings-builder.license, maven/lib/org.eclipse.sisu.inject.license, maven/lib/wagon-http.license, maven/lib/maven-compat.license, maven/lib/org.eclipse.sisu.plexus.license, maven/lib/maven-artifact.license, maven/lib/maven-settings.license, maven/lib/maven-model.license, maven/lib/maven-embedder.license, maven/lib/maven-builder-support.license, maven/lib/aether-util.license, maven/lib/maven-model-builder.license, maven/lib/wagon-provider-api.license, maven/lib/wagon-file.license, maven/lib/slf4j-api.license, maven/lib/aether-impl.license, maven/lib/aether-transport-wagon.license, maven/lib/plexus-cipher.license, maven/bin/mvnDebug.cmd, maven/conf/logging/simplelogger.properties, maven/lib/plexus-sec-dispatcher.license, maven/bin/mvn.cmd, maven/lib/maven-aether-provider.license, maven/lib/aether-api.license, maven/lib/cdi-api.license, maven/lib/aether-spi.license, maven/lib/commons-lang3.license, maven/lib/jsr250-api.license, maven/lib/jsoup.license, maven/lib/maven-repository-metadata.license, maven/lib/wagon-http-shared.license, maven/lib/maven-core.license, maven/lib/maven-plugin-api.license, maven/lib/aether-connector-basic.license, maven/lib/slf4j-simple.license, maven/conf/toolchains.xml # gen-sigtest fails with: # Fatal error: class junit.framework.TestCase not found sigtest.gen.fail.on.error=false diff --git a/java/maven/nbproject/project.properties b/java/maven/nbproject/project.properties index 85412150adb1..c8d890317d72 100644 --- a/java/maven/nbproject/project.properties +++ b/java/maven/nbproject/project.properties @@ -32,8 +32,6 @@ test.config.stableBTD.excludes=\ **/JavaOutputListenerProviderTest.class,\ **/ProjectOpenedHookImplTest.class -jnlp.indirect.files=maven-nblib/netbeans-eventspy.jar,maven-nblib/netbeans-cos.jar - # build needs CompilationUnitTree#getModule (jdk17) and ModuleInfoSupportTest needs functioning nb-javac requires.nb.javac=true diff --git a/java/websvc.jaxws21/nbproject/project.properties b/java/websvc.jaxws21/nbproject/project.properties index 3a62443949d7..e9d8c609f7df 100644 --- a/java/websvc.jaxws21/nbproject/project.properties +++ b/java/websvc.jaxws21/nbproject/project.properties @@ -19,22 +19,6 @@ is.autoload=true javac.compilerargs=-Xlint -Xlint:-serial javac.release=17 -jnlp.indirect.jars=\ - modules/ext/jaxws22/FastInfoset.jar,\ - modules/ext/jaxws22/gmbal-api-only.jar,\ - modules/ext/jaxws22/ha-api.jar,\ - modules/ext/jaxws22/jakarta.mail.jar,\ - modules/ext/jaxws22/jaxws-rt.jar,\ - modules/ext/jaxws22/jaxws-tools.jar,\ - modules/ext/jaxws22/management-api.jar,\ - modules/ext/jaxws22/mimepull.jar,\ - modules/ext/jaxws22/policy.jar,\ - modules/ext/jaxws22/saaj-impl.jar,\ - modules/ext/jaxws22/stax-ex.jar,\ - modules/ext/jaxws22/stax2-api.jar,\ - modules/ext/jaxws22/streambuffer.jar,\ - modules/ext/jaxws22/woodstox-core.jar,\ - docs/jaxws-api-doc.zip release.external/FastInfoset-2.0.0.jar=modules/ext/jaxws22/FastInfoset.jar release.external/gmbal-api-only-4.0.3.jar=modules/ext/jaxws22/gmbal-api-only.jar diff --git a/java/websvc.jaxws21api/nbproject/project.properties b/java/websvc.jaxws21api/nbproject/project.properties index 03c0add9009e..4bb0f5e357de 100644 --- a/java/websvc.jaxws21api/nbproject/project.properties +++ b/java/websvc.jaxws21api/nbproject/project.properties @@ -19,10 +19,6 @@ is.autoload=true javac.compilerargs=-Xlint -Xlint:-serial javac.release=17 -jnlp.indirect.jars=\ - modules/ext/jaxws22/api/jakarta.jws-api.jar,\ - modules/ext/jaxws22/api/jakarta.xml.soap-api.jar,\ - modules/ext/jaxws22/api/jakarta.xml.ws-api.jar release.external/jakarta.jws-api-2.1.0.jar=modules/ext/jaxws22/api/jakarta.jws-api.jar release.external/jakarta.xml.soap-api-1.4.2.jar=modules/ext/jaxws22/api/jakarta.xml.soap-api.jar diff --git a/javafx/javafx2.samples/AdvancedMedia/nbproject/jfx-impl_backup.xml b/javafx/javafx2.samples/AdvancedMedia/nbproject/jfx-impl_backup.xml new file mode 100644 index 000000000000..bc99a7944345 --- /dev/null +++ b/javafx/javafx2.samples/AdvancedMedia/nbproject/jfx-impl_backup.xml @@ -0,0 +1,4013 @@ + + + + + + JavaFX-specific Ant calls + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${cssfileslist} + + + + + + + + + + + + + + + + + + + + + + + + self.addMappedName( + (source.indexOf("jfxrt.jar") >= 0) || + (source.indexOf("deploy.jar") >= 0) || + (source.indexOf("javaws.jar") >= 0) || + (source.indexOf("plugin.jar") >= 0) + ? "" : source + ); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/JNLP-6.0.dtd b/nbbuild/antsrc/org/netbeans/nbbuild/JNLP-6.0.dtd deleted file mode 100644 index 8227681f42a1..000000000000 --- a/nbbuild/antsrc/org/netbeans/nbbuild/JNLP-6.0.dtd +++ /dev/null @@ -1,713 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/JNLPUpdateManifestBranding.java b/nbbuild/antsrc/org/netbeans/nbbuild/JNLPUpdateManifestBranding.java deleted file mode 100644 index ee4d86f3d3a1..000000000000 --- a/nbbuild/antsrc/org/netbeans/nbbuild/JNLPUpdateManifestBranding.java +++ /dev/null @@ -1,300 +0,0 @@ -/* - * 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.nbbuild; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.io.Reader; -import java.nio.charset.Charset; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.Vector; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.Task; -import org.apache.tools.ant.taskdefs.Copy; -import org.apache.tools.ant.taskdefs.Delete; -import org.apache.tools.ant.taskdefs.ManifestException; -import org.apache.tools.ant.taskdefs.SignJar; -import org.apache.tools.ant.types.FileSet; -import org.apache.tools.ant.util.FileUtils; -import org.apache.tools.zip.ZipOutputStream; - -/** - * - * @author mkozeny - */ -public class JNLPUpdateManifestBranding extends Task { - - private static final String MANIFEST = "META-INF/MANIFEST.MF"; //NOI18N - private static final String UTF_8 = "UTF-8"; //NOI18N - private static final String ATTR_CODEBASE = "Codebase"; //NOI18N - private static final String ATTR_PERMISSIONS = "Permissions"; //NOI18N - private static final String ATTR_APPLICATION_NAME = "Application-Name"; //NOI18N - - private final Vector filesets = new Vector<>(); - - public void addFileset(FileSet fileset) { - filesets.add(fileset); - } - - private String appName; - - public void setAppName(String appName) { - this.appName = appName; - } - - private final String permissions = "all-permissions"; - - private final String codebase = "*"; - - private SignJar signTask; - - private SignJar getSignTask() { - if (signTask == null) { - signTask = (SignJar) getProject().createTask("signjar"); - } - return signTask; - } - - public void setAlias(String a) { - getSignTask().setAlias(a); - } - - public void setStorePass(String p) { - getSignTask().setStorepass(p); - } - - public void setKeystore(String k) { - getSignTask().setKeystore(k); - } - - public void setStoreType(String t) { - getSignTask().setStoretype(t); - } - - @Override - public void execute() throws BuildException { - Set filePaths = new HashSet<>(); - File tmpFile = null; - for (FileSet fs : filesets) { - if (fs != null) { - DirectoryScanner scan = fs.getDirectoryScanner(getProject()); - for (String f : scan.getIncludedFiles()) { - filePaths.add(fs.getDir().getAbsolutePath() + File.separatorChar + f.replace(File.separatorChar, '/')); - } - } - } - try { - for (String filePathIter : filePaths) { - File jarFile = new File(filePathIter); - if (isSigned(jarFile) == null) { - tmpFile = extendLibraryManifest(getProject(), jarFile, jarFile, codebase, permissions, appName); - } - if (tmpFile != null) { - sign(tmpFile, jarFile); - deleteTmpFile(tmpFile); - } else { - sign(jarFile, jarFile); - } - - } - } catch (IOException | ManifestException ex) { - getProject().log( - "Failed to extend libraries manifests: " + ex.getMessage(), //NOI18N - Project.MSG_WARN); - } - } - - private File extendLibraryManifest( - final Project prj, - final File sourceJar, - final File signedJar, - final String codebase, - final String permissions, - final String appName) throws IOException, ManifestException { - org.apache.tools.ant.taskdefs.Manifest manifest = null; - Copy cp = new Copy(); - File tmpFile = new File(String.format("%s.tmp", signedJar.getAbsolutePath())); - cp.setFile(sourceJar); - cp.setTofile(tmpFile); - cp.execute(); - boolean success = false; - try { - final Map extendedAttrs = new HashMap<>(); - final org.apache.tools.zip.ZipFile zf = new org.apache.tools.zip.ZipFile(sourceJar); - try { - final org.apache.tools.zip.ZipEntry manifestEntry = zf.getEntry(MANIFEST); - if (manifestEntry != null) { - final Reader in = new InputStreamReader(zf.getInputStream(manifestEntry), Charset.forName(UTF_8)); //NOI18N - try { - manifest = new org.apache.tools.ant.taskdefs.Manifest(in); - } finally { - in.close(); - } - } else { - manifest = new org.apache.tools.ant.taskdefs.Manifest(); - } - final org.apache.tools.ant.taskdefs.Manifest.Section mainSection = manifest.getMainSection(); - String attr = mainSection.getAttributeValue(ATTR_CODEBASE); - if (attr == null) { - mainSection.addAttributeAndCheck(new org.apache.tools.ant.taskdefs.Manifest.Attribute( - ATTR_CODEBASE, - codebase)); - extendedAttrs.put(ATTR_CODEBASE, codebase); - } - attr = mainSection.getAttributeValue(ATTR_PERMISSIONS); - if (attr == null) { - mainSection.addAttributeAndCheck(new org.apache.tools.ant.taskdefs.Manifest.Attribute( - ATTR_PERMISSIONS, - permissions)); - extendedAttrs.put(ATTR_PERMISSIONS, permissions); - } - attr = mainSection.getAttributeValue(ATTR_APPLICATION_NAME); - if (attr == null) { - mainSection.addAttributeAndCheck(new org.apache.tools.ant.taskdefs.Manifest.Attribute( - ATTR_APPLICATION_NAME, - appName)); - extendedAttrs.put(ATTR_APPLICATION_NAME, appName); - } - if (!extendedAttrs.isEmpty()) { - final Enumeration zent = zf.getEntries(); - final ZipOutputStream out = new ZipOutputStream(tmpFile); - try { - while (zent.hasMoreElements()) { - final org.apache.tools.zip.ZipEntry entry = zent.nextElement(); - final InputStream in = zf.getInputStream(entry); - try { - out.putNextEntry(entry); - if (MANIFEST.equals(entry.getName())) { - final PrintWriter manifestOut = new PrintWriter(new OutputStreamWriter(out, Charset.forName(UTF_8))); - manifest.write(manifestOut); - manifestOut.flush(); - } else { - copy(in, out); - } - } finally { - in.close(); - } - } - } finally { - out.close(); - } - success = true; - final StringBuilder message = new StringBuilder("Updating library "). //NOI18N - append(safeRelativePath(prj.getBaseDir(), tmpFile)). - append(" manifest"); //NOI18N - for (Map.Entry e : extendedAttrs.entrySet()) { - message.append(String.format(" %s: %s,", e.getKey(), e.getValue())); - } - message.deleteCharAt(message.length() - 1); - prj.log(message.toString(), Project.MSG_VERBOSE); - } - } finally { - zf.close(); - } - } finally { - if (!success) { - final Delete rm = new Delete(); - rm.setFile(tmpFile); - rm.setQuiet(true); - rm.execute(); - tmpFile = null; - } - } - return tmpFile; - } - - private static void deleteTmpFile(File tmpFile) { - final Delete del = new Delete(); - del.setFile(tmpFile); - del.execute(); - } - - private static void copy(final InputStream in, final OutputStream out) throws IOException { - final byte[] BUFFER = new byte[4096]; - int len; - for (;;) { - len = in.read(BUFFER); - if (len == -1) { - return; - } - out.write(BUFFER, 0, len); - } - } - - private static String safeRelativePath(File from, File to) { - try { - return FileUtils.getRelativePath(from, to); - } catch (Exception ex) { - return to.getAbsolutePath(); - } - } - - /** - * return alias if signed, or null if not - */ - private static String isSigned(File f) throws IOException { - try (JarFile jar = new JarFile(f)) { - Enumeration en = jar.entries(); - while (en.hasMoreElements()) { - Matcher m = SF.matcher(en.nextElement().getName()); - if (m.matches()) { - return m.group(1); - } - } - return null; - } - } - private static final Pattern SF = Pattern.compile("META-INF/(.+)\\.SF"); - - /** - * Signs the given files according to the signJars variable value. - */ - private void sign(File from, File to) { - if (!from.exists() && from.getParentFile().getName().equals("locale")) { - // skip missing locale files, probably the best fix for #103301 - log("Localization file " + from + " is referenced, but cannot be found. Skipping.", Project.MSG_WARN); - return; - } - getSignTask().setJar(from); - if (to != null) { - // #125970: might be .../modules/locale/something_ja.jar - to.getParentFile().mkdirs(); - } - getSignTask().setSignedjar(to); - // use reflection for calling getSignTask().setDigestAlg("SHA1"); - getSignTask().setDigestAlg("SHA1"); - getSignTask().execute(); - - } -} diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/JNLPUpdateManifestStartup.java b/nbbuild/antsrc/org/netbeans/nbbuild/JNLPUpdateManifestStartup.java deleted file mode 100644 index ad92be40b5a1..000000000000 --- a/nbbuild/antsrc/org/netbeans/nbbuild/JNLPUpdateManifestStartup.java +++ /dev/null @@ -1,302 +0,0 @@ -/* - * 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.nbbuild; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.io.Reader; -import java.nio.charset.Charset; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Map; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.Task; -import org.apache.tools.ant.taskdefs.Copy; -import org.apache.tools.ant.taskdefs.Delete; -import org.apache.tools.ant.taskdefs.ManifestException; -import org.apache.tools.ant.taskdefs.SignJar; -import org.apache.tools.ant.util.FileUtils; -import org.apache.tools.zip.ZipOutputStream; - -/** - * - * @author mkozeny - */ -public class JNLPUpdateManifestStartup extends Task { - - private static final String MANIFEST = "META-INF/MANIFEST.MF"; //NOI18N - private static final String UTF_8 = "UTF-8"; //NOI18N - private static final String ATTR_CODEBASE = "Codebase"; //NOI18N - private static final String ATTR_PERMISSIONS = "Permissions"; //NOI18N - private static final String ATTR_APPLICATION_NAME = "Application-Name"; //NOI18N - - private File jar; - - public void setJar(File jar) { - this.jar = jar; - } - - private File destJar; - - public void setDestJar(File destJar) { - this.destJar = destJar; - } - - private String appName; - - public void setAppName(String appName) { - this.appName = appName; - } - - private File masterJnlp; - - public void setMasterJnlp(File masterJnlp) { - this.masterJnlp = masterJnlp; - } - - private final String permissions = "all-permissions"; - - private final String codebase = "*"; - - private SignJar signTask; - - private SignJar getSignTask() { - if (signTask == null) { - signTask = (SignJar) getProject().createTask("signjar"); - } - return signTask; - } - - public void setAlias(String a) { - getSignTask().setAlias(a); - } - - public void setStorePass(String p) { - getSignTask().setStorepass(p); - } - - public void setKeystore(String k) { - getSignTask().setKeystore(k); - } - - public void setStoreType(String t) { - getSignTask().setStoretype(t); - } - - @Override - public void execute() throws BuildException { - File tmpFile = null; - try { - if (isSigned(jar) == null) { - tmpFile = extendLibraryManifest(getProject(), jar, destJar, codebase, permissions, appName); - } - } catch (IOException | ManifestException ex) { - getProject().log( - "Failed to extend libraries manifests: " + ex.getMessage(), //NOI18N - Project.MSG_WARN); - } - if (tmpFile != null) { - sign(tmpFile, destJar); - deleteTmpFile(tmpFile); - } else { - sign(jar, destJar); - } - } - - private File extendLibraryManifest( - final Project prj, - final File sourceJar, - final File signedJar, - final String codebase, - final String permissions, - final String appName) throws IOException, ManifestException { - org.apache.tools.ant.taskdefs.Manifest manifest = null; - Copy cp = new Copy(); - File tmpFile = new File(String.format("%s.tmp", signedJar.getAbsolutePath())); - cp.setFile(sourceJar); - cp.setTofile(tmpFile); - cp.execute(); - boolean success = false; - try { - final Map extendedAttrs = new HashMap<>(); - final org.apache.tools.zip.ZipFile zf = new org.apache.tools.zip.ZipFile(sourceJar); - try { - final org.apache.tools.zip.ZipEntry manifestEntry = zf.getEntry(MANIFEST); - if (manifestEntry != null) { - final Reader in = new InputStreamReader(zf.getInputStream(manifestEntry), Charset.forName(UTF_8)); //NOI18N - try { - manifest = new org.apache.tools.ant.taskdefs.Manifest(in); - } finally { - in.close(); - } - } else { - manifest = new org.apache.tools.ant.taskdefs.Manifest(); - } - final org.apache.tools.ant.taskdefs.Manifest.Section mainSection = manifest.getMainSection(); - String attr = mainSection.getAttributeValue(ATTR_CODEBASE); - if (attr == null) { - mainSection.addAttributeAndCheck(new org.apache.tools.ant.taskdefs.Manifest.Attribute( - ATTR_CODEBASE, - codebase)); - extendedAttrs.put(ATTR_CODEBASE, codebase); - } - attr = mainSection.getAttributeValue(ATTR_PERMISSIONS); - if (attr == null) { - mainSection.addAttributeAndCheck(new org.apache.tools.ant.taskdefs.Manifest.Attribute( - ATTR_PERMISSIONS, - permissions)); - extendedAttrs.put(ATTR_PERMISSIONS, permissions); - } - attr = mainSection.getAttributeValue(ATTR_APPLICATION_NAME); - if (attr == null) { - mainSection.addAttributeAndCheck(new org.apache.tools.ant.taskdefs.Manifest.Attribute( - ATTR_APPLICATION_NAME, - appName)); - extendedAttrs.put(ATTR_APPLICATION_NAME, appName); - } - if (!extendedAttrs.isEmpty()) { - final Enumeration zent = zf.getEntries(); - final ZipOutputStream out = new ZipOutputStream(tmpFile); - try { - org.apache.tools.zip.ZipEntry masterJnlpEntry = new org.apache.tools.zip.ZipEntry("JNLP-INF/APPLICATION.JNLP"); - out.putNextEntry(masterJnlpEntry); - FileInputStream masterFis = new FileInputStream(masterJnlp.getAbsolutePath()); - try { - copy(masterFis, out); - } finally { - masterFis.close(); - } - while (zent.hasMoreElements()) { - final org.apache.tools.zip.ZipEntry entry = zent.nextElement(); - final InputStream in = zf.getInputStream(entry); - try { - out.putNextEntry(entry); - if (MANIFEST.equals(entry.getName())) { - final PrintWriter manifestOut = new PrintWriter(new OutputStreamWriter(out, Charset.forName(UTF_8))); - manifest.write(manifestOut); - manifestOut.flush(); - } else { - copy(in, out); - } - } finally { - in.close(); - } - } - } finally { - out.close(); - } - success = true; - final StringBuilder message = new StringBuilder("Updating library "). //NOI18N - append(safeRelativePath(prj.getBaseDir(), tmpFile)). - append(" manifest"); //NOI18N - for (Map.Entry e : extendedAttrs.entrySet()) { - message.append(String.format(" %s: %s,", e.getKey(), e.getValue())); - } - message.deleteCharAt(message.length() - 1); - prj.log(message.toString(), Project.MSG_VERBOSE); - } - } finally { - zf.close(); - } - } finally { - if (!success) { - final Delete rm = new Delete(); - rm.setFile(tmpFile); - rm.setQuiet(true); - rm.execute(); - tmpFile = null; - } - } - return tmpFile; - } - - private static void deleteTmpFile(File tmpFile) { - final Delete del = new Delete(); - del.setFile(tmpFile); - del.execute(); - } - - private static void copy(final InputStream in, final OutputStream out) throws IOException { - final byte[] BUFFER = new byte[4096]; - int len; - for (;;) { - len = in.read(BUFFER); - if (len == -1) { - return; - } - out.write(BUFFER, 0, len); - } - } - - private static String safeRelativePath(File from, File to) { - try { - return FileUtils.getRelativePath(from, to); - } catch (Exception ex) { - return to.getAbsolutePath(); - } - } - - /** - * return alias if signed, or null if not - */ - private static String isSigned(File f) throws IOException { - try (JarFile jar = new JarFile(f)) { - Enumeration en = jar.entries(); - while (en.hasMoreElements()) { - Matcher m = SF.matcher(en.nextElement().getName()); - if (m.matches()) { - return m.group(1); - } - } - return null; - } - } - private static final Pattern SF = Pattern.compile("META-INF/(.+)\\.SF"); - - /** - * Signs the given files according to the signJars variable value. - */ - private void sign(File from, File to) { - if (!from.exists() && from.getParentFile().getName().equals("locale")) { - // skip missing locale files, probably the best fix for #103301 - log("Localization file " + from + " is referenced, but cannot be found. Skipping.", Project.MSG_WARN); - return; - } - getSignTask().setJar(from); - if (to != null) { - // #125970: might be .../modules/locale/something_ja.jar - to.getParentFile().mkdirs(); - } - getSignTask().setSignedjar(to); - getSignTask().setDigestAlg("SHA1"); - getSignTask().execute(); - - } -} diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/MakeJNLP.java b/nbbuild/antsrc/org/netbeans/nbbuild/MakeJNLP.java deleted file mode 100644 index 7129fe598f8f..000000000000 --- a/nbbuild/antsrc/org/netbeans/nbbuild/MakeJNLP.java +++ /dev/null @@ -1,996 +0,0 @@ -/* - * 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.nbbuild; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.io.Reader; -import java.io.StringWriter; -import java.io.Writer; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URLDecoder; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; -import java.util.StringTokenizer; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; -import java.util.jar.Manifest; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.zip.ZipEntry; -import javax.xml.parsers.ParserConfigurationException; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.Task; -import org.apache.tools.ant.taskdefs.Copy; -import org.apache.tools.ant.taskdefs.Delete; -import org.apache.tools.ant.taskdefs.ManifestException; -import org.apache.tools.ant.taskdefs.SignJar; -import org.apache.tools.ant.taskdefs.Zip; -import org.apache.tools.ant.types.FileSet; -import org.apache.tools.ant.types.Resource; -import org.apache.tools.ant.types.ResourceCollection; -import org.apache.tools.ant.types.ZipFileSet; -import org.apache.tools.ant.types.resources.FileResource; -import org.apache.tools.ant.util.FileUtils; -import org.apache.tools.zip.ZipOutputStream; -import org.xml.sax.SAXException; - -/** Generates JNLP files for signed versions of the module JAR files. - * - * @author Jaroslav Tulach, Jesse Glick - */ -public class MakeJNLP extends Task { - /** the files to work on */ - private ResourceCollection files; - private SignJar signTask; - - private static final String MANIFEST = "META-INF/MANIFEST.MF"; //NOI18N - private static final String UTF_8 = "UTF-8"; //NOI18N - private static final String ATTR_CODEBASE = "Codebase"; //NOI18N - private static final String ATTR_PERMISSIONS = "Permissions"; //NOI18N - private static final String ATTR_APPLICATION_NAME = "Application-Name"; //NOI18N - - public FileSet createModules() - throws BuildException { - FileSet fs = new FileSet(); - fs.setProject(getProject()); - addConfigured(fs); - return fs; - } - - public void addConfigured(ResourceCollection rc) throws BuildException { - if (files != null) throw new BuildException("modules can be specified just once"); - files = rc; - } - - private SignJar getSignTask() { - if (signTask == null) { - signTask = (SignJar)getProject().createTask("signjar"); - } - return signTask; - } - - private File targetFile; - public void setDir(File t) { - targetFile = t; - } - - public void setAlias(String a) { - getSignTask().setAlias(a); - } - - public void setStorePass(String p) { - getSignTask().setStorepass(p); - } - - public void setKeystore(String k) { - getSignTask().setKeystore(k); - } - - public void setStoreType(String t) { - getSignTask().setStoretype(t); - } - - private String appName; - - public void setAppName(String appName) { - this.appName = appName; - } - - private final String manifestPermissions = "all-permissions"; - - private final String manifestCodebase = "*"; - - private String codebase = "$$codebase"; - public void setCodebase(String s) { - this.codebase = s; - } - - private boolean verify; - public void setVerify(boolean v) { - this.verify = v; - } - - private String verifyExcludes; - /** Comma separated list of allowed excluded names of files during verify - * phase. - */ - public void setVerifyExcludes(String s) { - this.verifyExcludes = s; - } - - private String permissions = ""; - /** - * XML fragment pasted into the security part of the .jnlp file. - * Should default to "<all-permissions/>" - */ - public void setPermissions(String s) { - permissions = s; - } - - private FileSet indirectJars; - /** - * Other JARs which should be copied into the destination directory and referred to as resources, - * even though they are not listed as Class-Path extensions of the module and would not normally - * be in its effective classpath. The basedir of the fileset should be a cluster root; for each - * such JAR, a file META-INF/clusterpath/$relpath will be inserted in the JAR, where $relpath is the - * relative path within the cluster. This permits the JAR to be located at runtime in a flat classpath, - * using ClassLoader.getResource. - */ - public void addIndirectJars(FileSet fs) { - indirectJars = fs; - } - - private FileSet indirectFiles; - /** - * Other non-JAR files which should be made available to InstalledFileLocator. - * The basedir of the fileset should be a cluster root; each - * such file will be packed into a ZIP entry META-INF/files/$relpath - * where the JAR will be available at runtime in a flat classpath, - * using ClassLoader.getResource. - */ - public void addIndirectFiles(FileSet fs) { - indirectFiles = fs; - } - - private boolean signJars = true; - /** - * Whether the final jars should be signed or not. Defaults to true - * (if not supplied). - */ - public void setSignJars(boolean s) { - this.signJars = s; - } - - private boolean processJarVersions = false; - /** - * Whether to add versions and sizes of jars into jnlp files. Defaults to false - * (if not supplied). - * @param b - */ - public void setProcessJarVersions(boolean b) { - this.processJarVersions = b; - } - - private Map jarVersions; - /** - * Explicit definition of jar file versions (for jars without versions specified - * in manifest file) - * @param jarVersions - */ - public void setJarVersions(Map jarVersions) { - this.jarVersions = jarVersions; - } - - private Set nativeLibraries; - public void setNativeLibraries(Set libs) { - this.nativeLibraries = libs; - } - - private Set jarDirectories; - - private String includelocales; - public void setIncludelocales(String includelocales) { - this.includelocales = includelocales; - } - - /** - * Signs or copies the given files according to the signJars variable value. - */ - private void signOrCopy(File from, File to) { - if (!from.exists() && from.getParentFile().getName().equals("locale")) { - // skip missing locale files, probably the best fix for #103301 - log("Localization file " + from + " is referenced, but cannot be found. Skipping.", Project.MSG_WARN); - return; - } - if (signJars) { - getSignTask().setJar(from); - if (to != null) { - // #125970: might be .../modules/locale/something_ja.jar - to.getParentFile().mkdirs(); - } - getSignTask().setSignedjar(to); - getSignTask().setDigestAlg("SHA1"); - getSignTask().execute(); - } else if (to != null) { - Copy copy = (Copy)getProject().createTask("copy"); - copy.setFile(from); - copy.setTofile(to); - copy.execute(); - } - if (processJarVersions) { - if (jarDirectories == null) { - jarDirectories = new HashSet<>(); - } - jarDirectories.add(new File(to.getParent())); - } - } - - @Override - public void execute() throws BuildException { - if (targetFile == null) throw new BuildException("Output dir must be provided"); - if (files == null) throw new BuildException("modules must be provided"); - try { - generateFiles(); - if (processJarVersions && jarDirectories!=null && jarDirectories.size() > 0) { - generateVersionXMLFiles(); - } - } catch (IOException ex) { - throw new BuildException(ex); - } - } - - private void generateFiles() throws IOException, BuildException { - Set declaredLocales = new HashSet<>(); - boolean useAllLocales = false; - if(includelocales == null || "*".equals(includelocales)) { - useAllLocales = true; - } else if ("".equals(includelocales)) { - useAllLocales = false; - } else { - StringTokenizer tokenizer = new StringTokenizer(includelocales, ","); - while (tokenizer.hasMoreElements()) { - declaredLocales.add(tokenizer.nextToken()); - } - } - Set indirectFilePaths = new HashSet<>(); - File tmpFile = null; - for (FileSet fs : new FileSet[] {indirectJars, indirectFiles}) { - if (fs != null) { - DirectoryScanner scan = fs.getDirectoryScanner(getProject()); - for (String f : scan.getIncludedFiles()) { - indirectFilePaths.add(f.replace(File.separatorChar, '/')); - } - } - } - - for (Iterator fileIt = files.iterator(); fileIt.hasNext();) { - FileResource fr = (FileResource) fileIt.next(); - File jar = fr.getFile(); - - if (!jar.canRead()) { - throw new BuildException("Cannot read file: " + jar); - } - - try (JarFile theJar = new JarFile(jar)) { - String codenamebase = JarWithModuleAttributes.extractCodeName(theJar.getManifest().getMainAttributes()); - if (codenamebase == null) { - throw new BuildException("Not a NetBeans Module: " + jar); - } - if ( - codenamebase.equals("org.objectweb.asm.all") && - jar.getParentFile().getName().equals("core") && - jar.getParentFile().getParentFile().getName().startsWith("platform") - ) { - continue; - } - { - int slash = codenamebase.indexOf('/'); - if (slash >= 0) { - codenamebase = codenamebase.substring(0, slash); - } - } - - String dashcnb = codenamebase.replace('.', '-'); - String title; - String oneline; - String shrt; - String osDep = null; - - { - String bundle = theJar.getManifest().getMainAttributes().getValue("OpenIDE-Module-Localizing-Bundle"); - Properties prop = new Properties(); - if (bundle != null) { - ZipEntry en = theJar.getEntry(bundle); - if (en == null) { - throw new BuildException("Cannot find entry: " + bundle + " in file: " + jar); - } try (InputStream is = theJar.getInputStream(en)) { - prop.load(is); - } - } - title = prop.getProperty("OpenIDE-Module-Name", codenamebase); - oneline = prop.getProperty("OpenIDE-Module-Short-Description", title); - shrt = prop.getProperty("OpenIDE-Module-Long-Description", oneline); - } - { - String osMan = theJar.getManifest().getMainAttributes().getValue("OpenIDE-Module-Requires"); - if (osMan != null) { - if (osMan.indexOf("org.openide.modules.os.MacOSX") >= 0) { // NOI18N - osDep = "Mac OS X"; // NOI18N - } else if (osMan.indexOf("org.openide.modules.os.Linux") >= 0) { // NOI18N - osDep = "Linux"; // NOI18N - } else if (osMan.indexOf("org.openide.modules.os.Solaris") >= 0) { // NOI18N - osDep = "Solaris"; // NOI18N - } else if (osMan.indexOf("org.openide.modules.os.Windows") >= 0) { // NOI18N - osDep = "Windows"; // NOI18N - } - } - } Map> localizedFiles = verifyExtensions(jar, theJar.getManifest(), dashcnb, codenamebase, verify, indirectFilePaths); - new File(targetFile, dashcnb).mkdir(); - File signed = new File(new File(targetFile, dashcnb), jar.getName()); - File jnlp = new File(targetFile, dashcnb + ".jnlp"); - StringWriter writeJNLP = new StringWriter(); - writeJNLP.write("\n"); - writeJNLP.write("\n"); - writeJNLP.write("\n"); - writeJNLP.write(" \n"); - writeJNLP.write(" " + XMLUtil.toElementContent(title) + "\n"); - writeJNLP.write(" NetBeans\n"); - writeJNLP.write(" " + XMLUtil.toElementContent(oneline) + "\n"); - writeJNLP.write(" " + XMLUtil.toElementContent(shrt) + "\n"); - writeJNLP.write(" \n"); - writeJNLP.write(permissions +"\n"); - if (osDep == null) { - writeJNLP.write(" \n"); - } else { - writeJNLP.write(" \n"); - } writeJNLP.write(constructJarHref(jar, dashcnb)); - processExtensions(jar, theJar.getManifest(), writeJNLP, dashcnb, codebase); - processIndirectJars(writeJNLP, dashcnb); - processIndirectFiles(writeJNLP, dashcnb); - writeJNLP.write(" \n"); - if (useAllLocales || !declaredLocales.isEmpty()){ - // write down locales - for (Map.Entry> e : localizedFiles.entrySet()) { - String locale = e.getKey(); - if (!declaredLocales.isEmpty() && !declaredLocales.contains(locale)) { - continue; - } - List allFiles = e.getValue(); - - writeJNLP.write(" \n"); - - for (File n : allFiles) { - log("generating locale " + locale + " for " + n, Project.MSG_VERBOSE); - String name = n.getName(); - String clusterRootPrefix = jar.getParent() + File.separatorChar; - String absname = n.getAbsolutePath(); - if (absname.startsWith(clusterRootPrefix)) { - name = absname.substring(clusterRootPrefix.length()).replace(File.separatorChar, '-'); - } - File t = new File(new File(targetFile, dashcnb), name); - - File localeTmpFile = null; - if (n.exists() && isSigned(n) == null) { - try { - localeTmpFile = extendLibraryManifest(getProject(), n, t, manifestCodebase, manifestPermissions, appName, jnlp); - } catch (IOException | ManifestException ex) { - getProject().log( - "Failed to extend libraries manifests: " + ex.getMessage(), //NOI18N - Project.MSG_WARN); - } - } else { - getProject().log( - String.format( - "Not adding security attributes into locale library: %s the library is already signed.", - safeRelativePath(getProject().getBaseDir(),t)), - Project.MSG_WARN); - } - if (localeTmpFile != null) { - signOrCopy(localeTmpFile, t); - deleteTmpFile(localeTmpFile); - } - else { - signOrCopy(n, t); - } - writeJNLP.write(constructJarHref(n, dashcnb, name)); - } - - writeJNLP.write(" \n"); - - } - } writeJNLP.write(" \n"); - writeJNLP.write("\n"); - writeJNLP.close(); - FileWriter w = new FileWriter(jnlp); - w.write(writeJNLP.toString()); - w.close(); - if (jar.exists() && isSigned(jar) == null) { - try { - tmpFile = extendLibraryManifest(getProject(), jar, signed, manifestCodebase, manifestPermissions, appName, jnlp); - } catch (IOException | ManifestException ex) { - getProject().log( - "Failed to extend libraries manifests: " + ex.getMessage(), //NOI18N - Project.MSG_WARN); - } - } else { - getProject().log( - String.format( - "Not adding security attributes into library: %s the library is already signed.", - safeRelativePath(getProject().getBaseDir(),signed)), - Project.MSG_WARN); - } if (tmpFile != null) { - signOrCopy(tmpFile, signed); - deleteTmpFile(tmpFile); - } else { - signOrCopy(jar, signed); - } - } - } - - } - - private File extendLibraryManifest( - final Project prj, - final File sourceJar, - final File signedJar, - final String codebase, - final String permissions, - final String appName, - final File jnlp) throws IOException, ManifestException { - org.apache.tools.ant.taskdefs.Manifest manifest = null; - Copy cp = new Copy(); - File tmpFile = new File(String.format("%s.tmp", signedJar.getAbsolutePath())); - cp.setFile(sourceJar); - cp.setTofile(tmpFile); - cp.execute(); - boolean success = false; - try { - final Map extendedAttrs = new HashMap<>(); - final org.apache.tools.zip.ZipFile zf = new org.apache.tools.zip.ZipFile(sourceJar); - try { - final org.apache.tools.zip.ZipEntry manifestEntry = zf.getEntry(MANIFEST); - if (manifestEntry != null) { - final Reader in = new InputStreamReader(zf.getInputStream(manifestEntry), Charset.forName(UTF_8)); //NOI18N - try { - manifest = new org.apache.tools.ant.taskdefs.Manifest(in); - } finally { - in.close(); - } - } else { - manifest = new org.apache.tools.ant.taskdefs.Manifest(); - } - final org.apache.tools.ant.taskdefs.Manifest.Section mainSection = manifest.getMainSection(); - String attr = mainSection.getAttributeValue(ATTR_CODEBASE); - if (attr == null) { - mainSection.addAttributeAndCheck(new org.apache.tools.ant.taskdefs.Manifest.Attribute( - ATTR_CODEBASE, - codebase)); - extendedAttrs.put(ATTR_CODEBASE, codebase); - } - attr = mainSection.getAttributeValue(ATTR_PERMISSIONS); - if (attr == null) { - mainSection.addAttributeAndCheck(new org.apache.tools.ant.taskdefs.Manifest.Attribute( - ATTR_PERMISSIONS, - permissions)); - extendedAttrs.put(ATTR_PERMISSIONS, permissions); - } - attr = mainSection.getAttributeValue(ATTR_APPLICATION_NAME); - if (attr == null) { - mainSection.addAttributeAndCheck(new org.apache.tools.ant.taskdefs.Manifest.Attribute( - ATTR_APPLICATION_NAME, - appName)); - extendedAttrs.put(ATTR_APPLICATION_NAME, appName); - } - if (!extendedAttrs.isEmpty()) { - final Enumeration zent = zf.getEntries(); - final ZipOutputStream out = new ZipOutputStream(tmpFile); - try { - if (jnlp != null) { - org.apache.tools.zip.ZipEntry jnlpEntry = new org.apache.tools.zip.ZipEntry("JNLP-INF/" + jnlp.getName()); - out.putNextEntry(jnlpEntry); - FileInputStream fis = new FileInputStream(jnlp.getAbsolutePath()); - try { - copy(fis, out); - } finally { - fis.close(); - } - } - while (zent.hasMoreElements()) { - final org.apache.tools.zip.ZipEntry entry = zent.nextElement(); - final InputStream in = zf.getInputStream(entry); - try { - out.putNextEntry(entry); - if (MANIFEST.equals(entry.getName())) { - final PrintWriter manifestOut = new PrintWriter(new OutputStreamWriter(out, Charset.forName(UTF_8))); - manifest.write(manifestOut); - manifestOut.flush(); - } else { - copy(in,out); - } - } finally { - in.close(); - } - } - } finally { - out.close(); - } - success = true; - final StringBuilder message = new StringBuilder("Updating library "). //NOI18N - append(safeRelativePath(prj.getBaseDir(), tmpFile)). - append(" manifest"); //NOI18N - for (Map.Entry e : extendedAttrs.entrySet()) { - message.append(String.format(" %s: %s,", e.getKey(), e.getValue())); - } - message.deleteCharAt(message.length()-1); - prj.log(message.toString(), Project.MSG_VERBOSE); - } - } finally { - zf.close(); - } - } finally { - if (!success) { - final Delete rm = new Delete(); - rm.setFile(tmpFile); - rm.setQuiet(true); - rm.execute(); - tmpFile = null; - } - } - return tmpFile; - } - - private static void deleteTmpFile(File tmpFile) { - final Delete del = new Delete(); - del.setFile(tmpFile); - del.execute(); - } - - private static void copy(final InputStream in, final OutputStream out) throws IOException { - final byte[] BUFFER = new byte[4096]; - int len; - for (;;) { - len = in.read(BUFFER); - if (len == -1) { - return; - } - out.write(BUFFER, 0, len); - } - } - - private static String safeRelativePath(File from, File to) { - try { - return FileUtils.getRelativePath(from, to); - } catch (Exception ex) { - return to.getAbsolutePath(); - } - } - - - private Map> verifyExtensions(File f, Manifest mf, String dashcnb, String codebasename, boolean verify, Set indirectFilePaths) throws IOException, BuildException { - Map> localizedFiles = new HashMap<>(); - - - File clusterRoot = f.getParentFile(); - String moduleDirPrefix = ""; - File updateTracking; - log("Verifying extensions for: " + codebasename + ", cluster root: " + clusterRoot + ", verify: " + verify, Project.MSG_DEBUG); - for(;;) { - updateTracking = new File(clusterRoot, "update_tracking"); - if (updateTracking.isDirectory()) { - break; - } - moduleDirPrefix = clusterRoot.getName() + "/" + moduleDirPrefix; - clusterRoot = clusterRoot.getParentFile(); - if (clusterRoot == null || !clusterRoot.exists()) { - if (!verify) { - return localizedFiles; - } - - throw new BuildException("Cannot find update_tracking directory for module " + f); - } - } - - File ut = new File(updateTracking, dashcnb + ".xml"); - if (!ut.exists()) { - throw new BuildException("The file " + ut + " for module " + codebasename + " cannot be found"); - } - - Map fileToOwningModule = new HashMap<>(); - try { - ModuleSelector.readUpdateTracking(getProject(), ut.toString(), fileToOwningModule); - } catch (IOException | ParserConfigurationException | SAXException ex) { - throw new BuildException(ex); - } - - log("project files: " + fileToOwningModule, Project.MSG_DEBUG); - String name = relative(f, clusterRoot); - log(" removing: " + name, Project.MSG_DEBUG); - removeWithLocales(fileToOwningModule, name, clusterRoot, localizedFiles); - name = "config/Modules/" + dashcnb + ".xml"; - log(" removing: " + name, Project.MSG_DEBUG); - removeWithLocales(fileToOwningModule, name, clusterRoot, localizedFiles); - name = "config/ModuleAutoDeps/" + dashcnb + ".xml"; - log(" removing: " + name, Project.MSG_DEBUG); - removeWithLocales(fileToOwningModule, name, clusterRoot, localizedFiles); - name = "update_tracking/" + dashcnb + ".xml"; - log(" removing: " + name, Project.MSG_DEBUG); - removeWithLocales(fileToOwningModule, name, clusterRoot, localizedFiles); - - - - - String path = mf.getMainAttributes().getValue("Class-Path"); - if (path != null) { - StringTokenizer tok = new StringTokenizer(path, ", "); - while(tok.hasMoreElements()) { - String s = tok.nextToken(); - File e = new File(f.getParentFile(), s); - String r = relative(e, clusterRoot); - removeWithLocales(fileToOwningModule, r, clusterRoot, localizedFiles); - } - } - - fileToOwningModule.remove("ant/nblib/" + dashcnb + ".jar"); - - fileToOwningModule.remove("VERSION.txt"); // cluster release information - - log(" removing: " + indirectFilePaths, Project.MSG_DEBUG); - fileToOwningModule.keySet().removeAll(indirectFilePaths); - - if (verifyExcludes != null) { - StringTokenizer tok = new StringTokenizer(verifyExcludes, ", "); - while(tok.hasMoreElements()) { - removeWithLocales(fileToOwningModule, tok.nextToken(), clusterRoot, localizedFiles); - } - } - - - if (verify) { - if (!fileToOwningModule.isEmpty()) { - throw new BuildException( - "Cannot build JNLP for module " + f + " as these files are in " + - "module's NBM, but are not referenced from any path (see harness/README for properties you can define to fix):\n" + fileToOwningModule.keySet() - ); - } - } - - return localizedFiles; - } - - private static void removeWithLocales(Map removeFrom, String removeWhat, File clusterRoot, Map> recordLocales) { - if (removeFrom.remove(removeWhat) != null && removeWhat.endsWith(".jar")) { - int basedir = removeWhat.lastIndexOf('/'); - String base = basedir == -1 ? "" : removeWhat.substring(0, basedir); - String name = removeWhat.substring(basedir + 1, removeWhat.length() - 4); - Pattern p = Pattern.compile(base + "/locale/" + name + "(|_[a-zA-Z0-9_]+)\\.jar"); - - Iterator it = removeFrom.keySet().iterator(); - while (it.hasNext()) { - String s = it.next(); - Matcher m = p.matcher(s); - if (m.matches()) { - String locale = m.group(1).substring(1); - - List l = recordLocales.get(locale); - if (l == null) { - l = new ArrayList<>(); - recordLocales.put(locale, l); - } - l.add(new File(clusterRoot, s.replace('/', File.separatorChar))); - it.remove(); - } - } - } - } - - private void processExtensions(File f, Manifest mf, Writer fileWriter, String dashcnb, String codebase) throws IOException, BuildException { - - File nblibJar = new File(new File(new File(f.getParentFile().getParentFile(), "ant"), "nblib"), dashcnb + ".jar"); - if (nblibJar.isFile()) { - File ext = new File(new File(targetFile, dashcnb), "ant-nblib-" + nblibJar.getName()); - fileWriter.write(constructJarHref(ext, dashcnb)); - signOrCopy(nblibJar, ext); - } - - String path = mf.getMainAttributes().getValue("Class-Path"); - if (path == null) { - return; - } - - StringTokenizer tok = new StringTokenizer(path, ", "); - while(tok.hasMoreElements()) { - String s = URLDecoder.decode(tok.nextToken(), "UTF-8"); - - if (s.contains("${java.home}")) { - continue; - } - - File e = new File(f.getParentFile(), s); - if (!e.canRead()) { - throw new BuildException("Cannot read extension " + e + " referenced from " + f); - } - String n = e.getName(); - if (n.endsWith(".jar")) { - n = n.substring(0, n.length() - 4); - } - File ext = new File(new File(targetFile, dashcnb), s.replace("../", "").replace('/', '-')); - - if (e.exists() && isSigned(e) != null) { - getProject().log( - String.format( - "Not adding security attributes into library: %s the library is already signed.", - safeRelativePath(getProject().getBaseDir(),ext)), - Project.MSG_WARN); - Copy copy = (Copy)getProject().createTask("copy"); - copy.setFile(e); - copy.setTofile(ext); - copy.execute(); - - String extJnlpName = dashcnb + '-' + ext.getName().replaceFirst("\\.jar$", "") + ".jnlp"; - File jnlp = new File(targetFile, extJnlpName); - - try (FileWriter writeJNLP = new FileWriter(jnlp)) { - writeJNLP.write("\n"); - writeJNLP.write("\n"); - writeJNLP.write("\n"); - writeJNLP.write(" \n"); - writeJNLP.write(" " + n + "\n"); - writeJNLP.write(" NetBeans\n"); - writeJNLP.write(" \n"); - writeJNLP.write(permissions +"\n"); - writeJNLP.write(" \n"); - writeJNLP.write(constructJarHref(ext, dashcnb)); - writeJNLP.write(" \n"); - writeJNLP.write(" \n"); - writeJNLP.write("\n"); - } - - fileWriter.write(" \n"); - } else { - File tmpFile = null; - try { - tmpFile = extendLibraryManifest(getProject(), e, ext, manifestCodebase, manifestPermissions, appName, null); - } catch (IOException | ManifestException ex) { - getProject().log( - "Failed to extend libraries manifests: " + ex.getMessage(), //NOI18N - Project.MSG_WARN); - } - if (tmpFile != null) { - signOrCopy(tmpFile, ext); - deleteTmpFile(tmpFile); - } else { - signOrCopy(e, ext); - } - - fileWriter.write(constructJarHref(ext, dashcnb)); - } - } - } - - private void processIndirectJars(Writer fileWriter, String dashcnb) throws IOException, BuildException { - if (indirectJars == null) { - return; - } - DirectoryScanner scan = indirectJars.getDirectoryScanner(getProject()); - for (String f : scan.getIncludedFiles()) { - File jar = new File(scan.getBasedir(), f); - String rel = f.replace(File.separatorChar, '/'); - String sig; - try { - sig = isSigned(jar); - } catch (IOException x) { - throw new BuildException("Cannot check signature on " + jar, x, getLocation()); - } - // javaws will reject .zip files even with signatures. - String rel2 = rel.endsWith(".jar") ? rel : rel.replaceFirst("(\\.zip)?$", ".jar"); - File ext = new File(new File(targetFile, dashcnb), rel2.replace('/', '-').replaceFirst("^modules-", "")); - Zip jartask = (Zip) getProject().createTask("jar"); - jartask.setDestFile(ext); - ZipFileSet zfs = new ZipFileSet(); - zfs.setSrc(jar); - if (sig != null) { - // Need to cancel original signature since we are adding one entry to the JAR. - zfs.setExcludes("META-INF/" + sig + ".*"); - } - jartask.addZipfileset(zfs); - zfs = new ZipFileSet(); - File blank = File.createTempFile("empty", ""); - blank.deleteOnExit(); - zfs.setFile(blank); - zfs.setFullpath("META-INF/clusterpath/" + rel); - jartask.addZipfileset(zfs); - jartask.execute(); - blank.delete(); - - fileWriter.write(constructJarHref(ext, dashcnb)); - signOrCopy(ext, null); - } - } - - private void processIndirectFiles(Writer fileWriter, String dashcnb) throws IOException, BuildException { - if (indirectFiles == null) { - return; - } - DirectoryScanner scan = indirectFiles.getDirectoryScanner(getProject()); - Map entries = new LinkedHashMap<>(); - for (String f : scan.getIncludedFiles()) { - entries.put(f.replace(File.separatorChar, '/'), new File(scan.getBasedir(), f)); - } - if (entries.isEmpty()) { - return; - } - File ext = new File(new File(targetFile, dashcnb), "extra-files.jar"); - Zip jartask = (Zip) getProject().createTask("jar"); - jartask.setDestFile(ext); - for (Map.Entry entry : entries.entrySet()) { - ZipFileSet zfs = new ZipFileSet(); - zfs.setFile(entry.getValue()); - zfs.setFullpath("META-INF/files/" + entry.getKey()); - jartask.addZipfileset(zfs); - } - jartask.execute(); - fileWriter.write(constructJarHref(ext, dashcnb)); - signOrCopy(ext, null); - } - - private String relative(File file, File root) { - String sfile = file.toString().replace(File.separatorChar, '/'); - String sroot = (root.toString() + File.separator).replace(File.separatorChar, '/'); - if (sfile.startsWith(sroot)) { - try { - String result = new URI(null, sfile.substring(sroot.length()), null).normalize().getPath(); - return result; - } catch (URISyntaxException x) { - throw new BuildException(x, getLocation()); // or just ignore? - } - } - return sfile; - } - - /** return alias if signed, or null if not */ - private static String isSigned(File f) throws IOException { - try (JarFile jar = new JarFile(f)) { - Enumeration en = jar.entries(); - while (en.hasMoreElements()) { - Matcher m = SF.matcher(en.nextElement().getName()); - if (m.matches()) { - return m.group(1); - } - } - return null; - } - } - private static final Pattern SF = Pattern.compile("META-INF/(.+)\\.SF"); - - /** - * returns version of jar file depending on manifest.mf or explicitly specified - * @param jar - * @return - * @throws IOException - */ - private String getJarVersion(JarFile jar) throws IOException { - String version = jar.getManifest().getMainAttributes().getValue("OpenIDE-Module-Specification-Version"); - if (version == null) { - version = jar.getManifest().getMainAttributes().getValue("Specification-Version"); - } - if (version == null && jarVersions != null) { - version = jarVersions.get(jar.getName()); - } - return version; - } - - /** - * Constructs jar or nativelib tag for jars - * @param f - * @param dashcnb - * @return - * @throws IOException - */ - private String constructJarHref(File f, String dashcnb) throws IOException { - return constructJarHref(f, dashcnb, f.getName()); - } - - /** - * Constructs jar or nativelib tag for jars using custom name - * @param f - * @param dashcnb - * @return - * @throws IOException - */ - private String constructJarHref(File f, String dashcnb, String name) throws IOException { - String tag = "jar"; - if (nativeLibraries != null && nativeLibraries.contains(name)) { - tag = "nativelib"; - } - if (processJarVersions) { - if (!f.exists()) { - throw new BuildException("JAR file " + f + " does not exist, cannot extract required versioning info."); - } - JarFile extJar = new JarFile(f); - String version = getJarVersion(extJar); - if (version != null) { - return " <" + tag + " href='" + dashcnb + '/' + name + "' version='" + version + "' size='" + f.length() + "'/>\n"; - } - } - return " <" + tag + " href='" + dashcnb + '/' + name + "'/>\n"; - } - - private void generateVersionXMLFiles() throws IOException { - FileSet fs = new FileSet(); - fs.setIncludes("**/*.jar"); - for (File directory : jarDirectories) { - fs.setDir(directory); - DirectoryScanner scan = fs.getDirectoryScanner(getProject()); - StringWriter writeVersionXML = new StringWriter(); - writeVersionXML.append("\n"); - writeVersionXML.append("\n"); - for (String jarName : scan.getIncludedFiles()) { - File jar = new File(scan.getBasedir(), jarName); - JarFile jarFile = new JarFile(jar); - String version = getJarVersion(jarFile); - if (version != null) { - writeVersionXML.append(" \n \n "); - writeVersionXML.append(jar.getName()); - writeVersionXML.append("\n "); - writeVersionXML.append(version); - writeVersionXML.append("\n \n "); - writeVersionXML.append(jar.getName()); - writeVersionXML.append("\n \n"); - } else { - writeVersionXML.append(" \n"); - } - } - writeVersionXML.append("\n"); - writeVersionXML.close(); - - File versionXML = new File(directory, "version.xml"); - FileWriter w = new FileWriter(versionXML); - w.write(writeVersionXML.toString()); - w.close(); - } - } - -} diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/MakeMasterJNLP.java b/nbbuild/antsrc/org/netbeans/nbbuild/MakeMasterJNLP.java deleted file mode 100644 index d53995b3abd1..000000000000 --- a/nbbuild/antsrc/org/netbeans/nbbuild/MakeMasterJNLP.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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.nbbuild; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.util.Iterator; -import java.util.jar.JarFile; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; -import org.apache.tools.ant.types.FileSet; -import org.apache.tools.ant.types.Resource; -import org.apache.tools.ant.types.ResourceCollection; -import org.apache.tools.ant.types.resources.FileResource; - -/** Generates JNLP files for signed versions of the module JAR files. - * - * @author Jaroslav Tulach - */ -public class MakeMasterJNLP extends Task { - /** the files to work on */ - private ResourceCollection files; - - public FileSet createModules() - throws BuildException { - FileSet fs = new FileSet(); - fs.setProject(getProject()); - addConfigured(fs); - return fs; - } - - public void addConfigured(ResourceCollection rc) throws BuildException { - if (files != null) throw new BuildException("modules can be specified just once"); - files = rc; - } - - private File target; - public void setDir(File t) { - target = t; - } - - private String masterPrefix = ""; - public void setCodeBase(String p) { - masterPrefix = p; - } - - public void execute() throws BuildException { - if (target == null) throw new BuildException("Output dir must be provided"); - if (files == null) throw new BuildException("modules must be provided"); - - try { - generateFiles(); - } catch (IOException ex) { - throw new BuildException(ex); - } - } - - private void generateFiles() throws IOException, BuildException { - for (Iterator fileIt = files.iterator(); fileIt.hasNext();) { - FileResource fr = (FileResource) fileIt.next(); - File jar = fr.getFile(); - - if (!jar.canRead()) { - throw new BuildException("Cannot read file: " + jar); - } - - try (JarFile theJar = new JarFile(jar)) { - String codenamebase = JarWithModuleAttributes.extractCodeName(theJar.getManifest().getMainAttributes()); - if (codenamebase == null) { - throw new BuildException("Not a NetBeans Module: " + jar); - } - if (codenamebase.equals("org.objectweb.asm.all") - && jar.getParentFile().getName().equals("core") - && jar.getParentFile().getParentFile().getName().startsWith("platform")) { - continue; - } - { - int slash = codenamebase.indexOf('/'); - if (slash >= 0) { - codenamebase = codenamebase.substring(0, slash); - } - } - String dashcnb = codenamebase.replace('.', '-'); - - File n = new File(target, dashcnb + ".ref"); - try (FileWriter w = new FileWriter(n)) { - w.write(" \n"); - } - } - } - - } -} diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/VerifyJNLP.java b/nbbuild/antsrc/org/netbeans/nbbuild/VerifyJNLP.java deleted file mode 100644 index 77aef90ffed8..000000000000 --- a/nbbuild/antsrc/org/netbeans/nbbuild/VerifyJNLP.java +++ /dev/null @@ -1,236 +0,0 @@ -/* - * 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.nbbuild; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.net.URISyntaxException; -import java.security.cert.Certificate; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Enumeration; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.Task; -import org.apache.tools.ant.types.FileSet; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; -import org.xml.sax.EntityResolver; -import org.xml.sax.ErrorHandler; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -/** - * Validates the syntax and semantics of one or more JNLP files. - * Any other JNLP fragments referred to recursively from these files will be validated as well. - * JNLP files must specify a document type, normally: - * <!DOCTYPE jnlp PUBLIC "-//Sun Microsystems, Inc//DTD JNLP Descriptor 6.0//EN" "http://java.sun.com/dtd/JNLP-6.0.dtd"> - * The codebase specified in the file is used as is if a file: URL; - * if $$codebase, it is taken to be the immediately containing directory, to match the behavior of JnlpDownloadServlet; - * if a remote URL, it is also taken to be the immediately containing directory, - * since otherwise it would be impossible to validate files which were generated with intent to upload to a server. - * See issue #96630. - */ -public class VerifyJNLP extends Task { - - private List filesets = new ArrayList<>(); - /** - * Add one or more JNLP files to validate. - * Use <fileset file="..."/> if you have just one. - * Fragments referred to from higher JNLP files are checked automatically and do not need to be specified. - */ - public void addConfiguredFileset(FileSet fs) { - filesets.add(fs); - } - - private File report; - /** - * JUnit report file to create rather than halting build if errors are encountered. - */ - public void setReport(File report) { - this.report = report; - } - - private boolean failOnError = true; - /** - * Whether to halt the build if there is a verification error. Default true. - */ - public void setFailOnError(boolean failOnError) { - this.failOnError = failOnError; - } - - public @Override void execute() throws BuildException { - Map results = new LinkedHashMap<>(); - for (FileSet fs : filesets) { - DirectoryScanner s = fs.getDirectoryScanner(getProject()); - File basedir = s.getBasedir(); - for (String incl : s.getIncludedFiles()) { - validate(new File(basedir, incl), results); - } - } - JUnitReportWriter.writeReport(this, null, failOnError ? null : report, results); - } - - private static void error(File jnlp, Map results, String key, String message) { - results.put(jnlp + "/test" + key, message); - } - - private void validate(File jnlp, Map results) { - log("Validating: " + jnlp); - Document doc; - try { - doc = XMLUtil.parse(new InputSource(jnlp.toURI().toString()), true, false, new ErrorHandler() { - public void warning(SAXParseException exception) throws SAXException { - fatalError(exception); - } - public void error(SAXParseException exception) throws SAXException { - fatalError(exception); - } - public void fatalError(SAXParseException exception) throws SAXException { - throw new SAXException("parse or validation error:\n" + - exception.getSystemId() + ":" + exception.getLineNumber() + ": " + exception.getMessage()); - } - }, new EntityResolver() { - public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { - if ("-//Sun Microsystems, Inc//DTD JNLP Descriptor 6.0//EN".equals(publicId)) { - return new InputSource(VerifyJNLP.class.getResource("JNLP-6.0.dtd").toString()); - } else { - return null; - } - } - }); - } catch (Exception x) { - error(jnlp, results, "Parse", x.getMessage()); - return; - } - String codebase = doc.getDocumentElement().getAttribute("codebase"); - URI base; - if (codebase.equals("$$codebase")) { - base = jnlp.getParentFile().toURI(); - } else { - try { - base = new URI(codebase); - if (!base.isAbsolute()) { - error(jnlp, results, "Codebase", "non-absolute codebase " + base); - return; - } - if (!"file".equals(base.getScheme())) { - // Needed for local validation of a tree intended for eventual upload to a server. - base = jnlp.getParentFile().toURI(); - } - } catch (URISyntaxException x) { - error(jnlp, results, "Codebase", "invalid codebase " + codebase + "': " + x); - return; - } - } - Certificate[] existingCertificates = null; - File existingSignedJar = null; - NodeList nl = doc.getElementsByTagName("*"); - for (int i = 0; i < nl.getLength(); i++) { - Element el = (Element) nl.item(i); - String href = el.getAttribute("href"); - if (href.length() > 0) { - URI u; - try { - u = base.resolve(new URI(href)); - } catch (URISyntaxException x) { - error(jnlp, results, "Href", "invalid href '" + href + "': " + x); - continue; - } - assert u.isAbsolute() : u + " not absolute as " + href + " resolved against " + base; - if ("file".equals(u.getScheme())) { - File f = new File(u); - if (!f.isFile()) { - if (el.getTagName().equals("icon")) { - // jnlp.xml in harness generates optimistically. - // Does not seem to be a problem if it is missing. - log(jnlp + ": warning: no such file " + f, Project.MSG_WARN); - } else if (! f.exists() && f.getName().startsWith("locale")) { - // skip missing locale files, probably the best fix for #103301 (copied from MakeJNLP.java) - log("Localization file " + f + " is referenced, but cannot be found. Skipping.", Project.MSG_WARN); - } - else { - error(jnlp, results, "Href", "no such file " + f); - continue; - } - } - if (el.getTagName().equals("extension")) { - validate(f, results); - } else if (el.getTagName().equals("jar") && f.exists()) { - try { - // Try to find signers. - try (JarFile jf = new JarFile(f, true)) { - Enumeration entries = jf.entries(); - while (entries.hasMoreElements()) { - JarEntry entry = entries.nextElement(); - if (entry.getName().startsWith("META-INF/")) { - // At least MANIFEST.MF is not signed in the normal way, it seems. - continue; - } - if (entry.getSize() < 1) { - // Dirs are not signed. - continue; - } - InputStream is = jf.getInputStream(entry); - int read = 0; - while (read != -1) { - read = is.read(); - } - Certificate[] certs = entry.getCertificates(); - /* - System.err.println("existingSignedJar=" + existingSignedJar + " existingCertificates=" + Arrays.toString(existingCertificates) + - " f=" + f + " certs=" + Arrays.toString(certs) + " entry.name=" + entry.getName()); - */ - if (existingSignedJar != null && !Arrays.equals(certs, existingCertificates)) { - error(jnlp, results, "Signatures", "different signatures (or signing status) between " + existingSignedJar + " and " + f); - break; - } - existingCertificates = certs; - existingSignedJar = f; - break; // just check one representative file - } - } - } catch (IOException x) { - error(jnlp, results, "Signatures", "error examining signatures in " + f + ": " + x); - } - } - } else { - try { - u.toURL().openStream().close(); - } catch (IOException x) { - log(jnlp + ": could not open network URL " + u, Project.MSG_WARN); - // Do not halt build; might just be a network connectivity issue. - } - } - } - } - } - -} diff --git a/nbbuild/build.properties b/nbbuild/build.properties index 2311f404f16c..2f1759c06709 100644 --- a/nbbuild/build.properties +++ b/nbbuild/build.properties @@ -259,9 +259,3 @@ config.javadoc.deprecated= # ${config.javadoc.friend},\ # ${config.javadoc.deprecated} -# list of modules for jnlp: -config.jnlp.stable=\ - ${nb.cluster.platform},\ - ${nb.cluster.ide},\ - ${nb.cluster.extide},\ - ${nb.cluster.java} diff --git a/nbbuild/build.xml b/nbbuild/build.xml index d9917bbd3317..9c4ae76ee046 100644 --- a/nbbuild/build.xml +++ b/nbbuild/build.xml @@ -355,52 +355,7 @@ metabuild.hash=${metabuild.hash} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/nbbuild/default.xml b/nbbuild/default.xml index f72c31f2b2d3..50496eec1fcf 100644 --- a/nbbuild/default.xml +++ b/nbbuild/default.xml @@ -26,24 +26,12 @@ - - - - + classpath="${nbantext.jar}"/> diff --git a/nbbuild/installer/jnlp/build.xml b/nbbuild/installer/jnlp/build.xml deleted file mode 100644 index 932d14a84ce1..000000000000 --- a/nbbuild/installer/jnlp/build.xml +++ /dev/null @@ -1,255 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -]]> - - - -]]> - - - - - - - - - -]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/nbbuild/installer/jnlp/external/binaries-list b/nbbuild/installer/jnlp/external/binaries-list deleted file mode 100644 index 99fbc80a0d48..000000000000 --- a/nbbuild/installer/jnlp/external/binaries-list +++ /dev/null @@ -1,19 +0,0 @@ -# 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. -# -B428664160FBBB4884F319A52A53911235E8F279 com.massisframework:jnlp-definitions:7.0 -24D9B16E2AB7B6B078C15F8742E73C60CE68B4A9 org.codehaus.mojo:webstart-jnlp-servlet:1.0-beta-7 \ No newline at end of file diff --git a/nbbuild/installer/jnlp/external/jnlp-definitions-7.0-license.txt b/nbbuild/installer/jnlp/external/jnlp-definitions-7.0-license.txt deleted file mode 100644 index 84d846ed8d6c..000000000000 --- a/nbbuild/installer/jnlp/external/jnlp-definitions-7.0-license.txt +++ /dev/null @@ -1,355 +0,0 @@ -Name: JNLP -License: GPL-2-CP -Description: Java Web Start APIs -Origin: https://github.com/rpax/jnlp-definitions -Version: 7.0 -Type: compile-time -Comment: The usage in the compilation is unclear, but it is not packaged, so should be safe - -The GNU General Public License (GPL) - -Version 2, June 1991 - -Copyright (C) 1989, 1991 Free Software Foundation, Inc. -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -Preamble - -The licenses for most software are designed to take away your freedom to share -and change it. By contrast, the GNU General Public License is intended to -guarantee your freedom to share and change free software--to make sure the -software is free for all its users. This General Public License applies to -most of the Free Software Foundation's software and to any other program whose -authors commit to using it. (Some other Free Software Foundation software is -covered by the GNU Library General Public License instead.) You can apply it to -your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for this service if you wish), -that you receive source code or can get it if you want it, that you can change -the software or use pieces of it in new free programs; and that you know you -can do these things. - -To protect your rights, we need to make restrictions that forbid anyone to deny -you these rights or to ask you to surrender the rights. These restrictions -translate to certain responsibilities for you if you distribute copies of the -software, or if you modify it. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must give the recipients all the rights that you have. You must -make sure that they, too, receive or can get the source code. And you must -show them these terms so they know their rights. - -We protect your rights with two steps: (1) copyright the software, and (2) -offer you this license which gives you legal permission to copy, distribute -and/or modify the software. - -Also, for each author's protection and ours, we want to make certain that -everyone understands that there is no warranty for this free software. If the -software is modified by someone else and passed on, we want its recipients to -know that what they have is not the original, so that any problems introduced -by others will not reflect on the original authors' reputations. - -Finally, any free program is threatened constantly by software patents. We -wish to avoid the danger that redistributors of a free program will -individually obtain patent licenses, in effect making the program proprietary. -To prevent this, we have made it clear that any patent must be licensed for -everyone's free use or not licensed at all. - -The precise terms and conditions for copying, distribution and modification -follow. - -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - -0. This License applies to any program or other work which contains a notice -placed by the copyright holder saying it may be distributed under the terms of -this General Public License. The "Program", below, refers to any such program -or work, and a "work based on the Program" means either the Program or any -derivative work under copyright law: that is to say, a work containing the -Program or a portion of it, either verbatim or with modifications and/or -translated into another language. (Hereinafter, translation is included -without limitation in the term "modification".) Each licensee is addressed as -"you". - -Activities other than copying, distribution and modification are not covered by -this License; they are outside its scope. The act of running the Program is -not restricted, and the output from the Program is covered only if its contents -constitute a work based on the Program (independent of having been made by -running the Program). Whether that is true depends on what the Program does. - -1. You may copy and distribute verbatim copies of the Program's source code as -you receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice and -disclaimer of warranty; keep intact all the notices that refer to this License -and to the absence of any warranty; and give any other recipients of the -Program a copy of this License along with the Program. - -You may charge a fee for the physical act of transferring a copy, and you may -at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Program or any portion of it, thus -forming a work based on the Program, and copy and distribute such modifications -or work under the terms of Section 1 above, provided that you also meet all of -these conditions: - - a) You must cause the modified files to carry prominent notices stating - that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in whole or - in part contains or is derived from the Program or any part thereof, to be - licensed as a whole at no charge to all third parties under the terms of - this License. - - c) If the modified program normally reads commands interactively when run, - you must cause it, when started running for such interactive use in the - most ordinary way, to print or display an announcement including an - appropriate copyright notice and a notice that there is no warranty (or - else, saying that you provide a warranty) and that users may redistribute - the program under these conditions, and telling the user how to view a copy - of this License. (Exception: if the Program itself is interactive but does - not normally print such an announcement, your work based on the Program is - not required to print an announcement.) - -These requirements apply to the modified work as a whole. If identifiable -sections of that work are not derived from the Program, and can be reasonably -considered independent and separate works in themselves, then this License, and -its terms, do not apply to those sections when you distribute them as separate -works. But when you distribute the same sections as part of a whole which is a -work based on the Program, the distribution of the whole must be on the terms -of this License, whose permissions for other licensees extend to the entire -whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest your -rights to work written entirely by you; rather, the intent is to exercise the -right to control the distribution of derivative or collective works based on -the Program. - -In addition, mere aggregation of another work not based on the Program with the -Program (or with a work based on the Program) on a volume of a storage or -distribution medium does not bring the other work under the scope of this -License. - -3. You may copy and distribute the Program (or a work based on it, under -Section 2) in object code or executable form under the terms of Sections 1 and -2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable source - code, which must be distributed under the terms of Sections 1 and 2 above - on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three years, to - give any third party, for a charge no more than your cost of physically - performing source distribution, a complete machine-readable copy of the - corresponding source code, to be distributed under the terms of Sections 1 - and 2 above on a medium customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer to - distribute corresponding source code. (This alternative is allowed only - for noncommercial distribution and only if you received the program in - object code or executable form with such an offer, in accord with - Subsection b above.) - -The source code for a work means the preferred form of the work for making -modifications to it. For an executable work, complete source code means all -the source code for all modules it contains, plus any associated interface -definition files, plus the scripts used to control compilation and installation -of the executable. However, as a special exception, the source code -distributed need not include anything that is normally distributed (in either -source or binary form) with the major components (compiler, kernel, and so on) -of the operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the source -code from the same place counts as distribution of the source code, even though -third parties are not compelled to copy the source along with the object code. - -4. You may not copy, modify, sublicense, or distribute the Program except as -expressly provided under this License. Any attempt otherwise to copy, modify, -sublicense or distribute the Program is void, and will automatically terminate -your rights under this License. However, parties who have received copies, or -rights, from you under this License will not have their licenses terminated so -long as such parties remain in full compliance. - -5. You are not required to accept this License, since you have not signed it. -However, nothing else grants you permission to modify or distribute the Program -or its derivative works. These actions are prohibited by law if you do not -accept this License. Therefore, by modifying or distributing the Program (or -any work based on the Program), you indicate your acceptance of this License to -do so, and all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - -6. Each time you redistribute the Program (or any work based on the Program), -the recipient automatically receives a license from the original licensor to -copy, distribute or modify the Program subject to these terms and conditions. -You may not impose any further restrictions on the recipients' exercise of the -rights granted herein. You are not responsible for enforcing compliance by -third parties to this License. - -7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), conditions -are imposed on you (whether by court order, agreement or otherwise) that -contradict the conditions of this License, they do not excuse you from the -conditions of this License. If you cannot distribute so as to satisfy -simultaneously your obligations under this License and any other pertinent -obligations, then as a consequence you may not distribute the Program at all. -For example, if a patent license would not permit royalty-free redistribution -of the Program by all those who receive copies directly or indirectly through -you, then the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply and -the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any patents or -other property right claims or to contest validity of any such claims; this -section has the sole purpose of protecting the integrity of the free software -distribution system, which is implemented by public license practices. Many -people have made generous contributions to the wide range of software -distributed through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing to -distribute software through any other system and a licensee cannot impose that -choice. - -This section is intended to make thoroughly clear what is believed to be a -consequence of the rest of this License. - -8. If the distribution and/or use of the Program is restricted in certain -countries either by patents or by copyrighted interfaces, the original -copyright holder who places the Program under this License may add an explicit -geographical distribution limitation excluding those countries, so that -distribution is permitted only in or among countries not thus excluded. In -such case, this License incorporates the limitation as if written in the body -of this License. - -9. The Free Software Foundation may publish revised and/or new versions of the -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any later -version", you have the option of following the terms and conditions either of -that version or of any later version published by the Free Software Foundation. -If the Program does not specify a version number of this License, you may -choose any version ever published by the Free Software Foundation. - -10. If you wish to incorporate parts of the Program into other free programs -whose distribution conditions are different, write to the author to ask for -permission. For software which is copyrighted by the Free Software Foundation, -write to the Free Software Foundation; we sometimes make exceptions for this. -Our decision will be guided by the two goals of preserving the free status of -all derivatives of our free software and of promoting the sharing and reuse of -software generally. - -NO WARRANTY - -11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR -THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE -STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE -PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND -PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, -YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - -12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL -ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE -PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR -INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA -BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER -OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -END OF TERMS AND CONDITIONS - -How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively convey the exclusion -of warranty; and each file should have at least the "copyright" line and a -pointer to where the full notice is found. - - One line to give the program's name and a brief idea of what it does. - - Copyright (C) - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the Free - Software Foundation; either version 2 of the License, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this when it -starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author Gnomovision comes - with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free - software, and you are welcome to redistribute it under certain conditions; - type 'show c' for details. - -The hypothetical commands 'show w' and 'show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may be -called something other than 'show w' and 'show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your school, -if any, to sign a "copyright disclaimer" for the program, if necessary. Here -is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - 'Gnomovision' (which makes passes at compilers) written by James Hacker. - - signature of Ty Coon, 1 April 1989 - - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General Public -License instead of this License. - - -"CLASSPATH" EXCEPTION TO THE GPL - -Certain source files distributed by Oracle America and/or its affiliates are -subject to the following clarification and special exception to the GPL, but -only where Oracle has expressly included in the particular source file's header -the words "Oracle designates this particular file as subject to the "Classpath" -exception as provided by Oracle in the LICENSE file that accompanied this code." - - Linking this library statically or dynamically with other modules is making - a combined work based on this library. Thus, the terms and conditions of - the GNU General Public License cover the whole combination. - - As a special exception, the copyright holders of this library give you - permission to link this library with independent modules to produce an - executable, regardless of the license terms of these independent modules, - and to copy and distribute the resulting executable under terms of your - choice, provided that you also meet, for each linked independent module, - the terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. If - you modify this library, you may extend this exception to your version of - the library, but you are not obligated to do so. If you do not wish to do - so, delete this exception statement from your version. diff --git a/nbbuild/installer/jnlp/external/webstart-jnlp-servlet-1.0-beta-7-license.txt b/nbbuild/installer/jnlp/external/webstart-jnlp-servlet-1.0-beta-7-license.txt deleted file mode 100644 index 8cb6fd2076a3..000000000000 --- a/nbbuild/installer/jnlp/external/webstart-jnlp-servlet-1.0-beta-7-license.txt +++ /dev/null @@ -1,37 +0,0 @@ -Name: MWEBSTART :: JNLP Servlet -License: BSD-sun -Description: Java Web Start APIs and servlet. -Version: 1.0-beta-7 -Origin: MojoHaus, extracted from JDK 6 samples - -Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - --Redistribution of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - --Redistribution in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -Neither the name of Sun Microsystems, Inc. or the names of contributors may -be used to endorse or promote products derived from this software without -specific prior written permission. - -This software is provided "AS IS," without a warranty of any kind. ALL -EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING -ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE -OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") -AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE -AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS -DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST -REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, -INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY -OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, -EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -You acknowledge that this software is not designed, licensed or intended -for use in the design, construction, operation or maintenance of any -nuclear facility. diff --git a/nbbuild/installer/jnlp/help.jnlp b/nbbuild/installer/jnlp/help.jnlp deleted file mode 100644 index 168333be559c..000000000000 --- a/nbbuild/installer/jnlp/help.jnlp +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - JavaHelp - Sun Microsystems, Inc. - - - - - - diff --git a/nbbuild/installer/jnlp/jnlp_1_0.dtd b/nbbuild/installer/jnlp/jnlp_1_0.dtd deleted file mode 100644 index 346f5a753f2f..000000000000 --- a/nbbuild/installer/jnlp/jnlp_1_0.dtd +++ /dev/null @@ -1,652 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/nbbuild/installer/jnlp/nb-launch.jnlp b/nbbuild/installer/jnlp/nb-launch.jnlp deleted file mode 100644 index abe77c3fe33c..000000000000 --- a/nbbuild/installer/jnlp/nb-launch.jnlp +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - NetBeans Start - NetBeans - - - - - - - - - - - - - - - - - diff --git a/nbbuild/installer/jnlp/src/org/netbeans/jnlp/Main.java b/nbbuild/installer/jnlp/src/org/netbeans/jnlp/Main.java deleted file mode 100644 index e0e0581d869d..000000000000 --- a/nbbuild/installer/jnlp/src/org/netbeans/jnlp/Main.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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.jnlp; - -/** - * Just start core main. Note: there is another main - * in core/bootstrap. I hope that the one from core/src is fine. - */ -public class Main { - - /** - * @param args the command line arguments - */ - public static void main(String[] args) throws Exception { - org.netbeans.core.startup.Main.main(args); - } - -} diff --git a/nbbuild/installer/jnlp/web.xml b/nbbuild/installer/jnlp/web.xml deleted file mode 100644 index 484812036996..000000000000 --- a/nbbuild/installer/jnlp/web.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - JnlpDownloadServlet - jnlp.sample.servlet.JnlpDownloadServlet - - - IndexServlet - org.netbeans.jnlp.IndexServlet - - - JnlpDownloadServlet - *.jnlp - - - IndexServlet - /config.txt - - diff --git a/nbbuild/templates/common.xml b/nbbuild/templates/common.xml index 6de819595775..f91698224493 100644 --- a/nbbuild/templates/common.xml +++ b/nbbuild/templates/common.xml @@ -389,61 +389,6 @@ - - - You have to provide value to jnlp.dest.dir property! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/nbbuild/templates/projectized.xml b/nbbuild/templates/projectized.xml index e001e3bb42e0..989fb6d0628c 100644 --- a/nbbuild/templates/projectized.xml +++ b/nbbuild/templates/projectized.xml @@ -254,7 +254,6 @@ - diff --git a/nbbuild/test/unit/src/org/netbeans/nbbuild/MakeJNLPTest.java b/nbbuild/test/unit/src/org/netbeans/nbbuild/MakeJNLPTest.java deleted file mode 100644 index 28796d015c4c..000000000000 --- a/nbbuild/test/unit/src/org/netbeans/nbbuild/MakeJNLPTest.java +++ /dev/null @@ -1,1212 +0,0 @@ -/* - * 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.nbbuild; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileWriter; -import java.io.IOException; -import java.util.Arrays; -import java.util.Enumeration; -import java.util.Properties; -import java.util.Random; -import java.util.Set; -import java.util.SortedSet; -import java.util.TreeSet; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; -import java.util.jar.JarOutputStream; -import java.util.jar.Manifest; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.BuildFileRule; -import org.junit.Rule; - -/** Is generation of Jnlp files correct? - * - * @author Jaroslav Tulach, Jesse Glick - */ -public class MakeJNLPTest extends TestBase { - @Rule - public final BuildFileRule buildRule = new BuildFileRule(); - - public MakeJNLPTest (String name) { - super (name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - System.clearProperty("test.output"); - System.clearProperty("test.parent"); - System.clearProperty("test.name"); - System.clearProperty("test.ks"); - System.clearProperty("test.ext"); - } - - - private static void assertFilenames(File dir, String... contents) { - assertTrue(dir + " is a directory", dir.isDirectory()); - SortedSet expected = new TreeSet<>(Arrays.asList(contents)); - SortedSet actual = new TreeSet<>(); - findFilenames(dir, "", actual); - assertEquals("correct contents of " + dir, expected/*.toString()*/, actual/*.toString()*/); - } - private static void findFilenames(File dir, String prefix, Set names) { - for (File f : dir.listFiles()) { - if (f.isFile()) { - names.add(prefix + f.getName()); - } else if (f.isDirectory()) { - findFilenames(f, prefix + f.getName() + "/", names); - } - } - } - - public void testGenerateJNLPAndSignedJarForSimpleModule() throws Exception { - Manifest m; - - m = createManifest (); - m.getMainAttributes ().putValue ("OpenIDE-Module", "org.my.module/3"); - File simpleJar = generateJar (new String[0], m); - - File parent = simpleJar.getParentFile (); - File output = new File(parent, "output"); - File ks = generateKeystore("jnlp", "netbeans-test"); - - java.io.File f = extractString ( - "" + - "" + - " " + - "" + - " " + - " " + - " " + - " " + - " " + - " " + - "" + - "" - ); - buildRule.configureProject(f.getAbsolutePath()); - buildRule.executeTarget("all"); - - assertFilenames(output, "org-my-module.jnlp", "org-my-module/s0.jar"); - - File jnlp = new File(output, "org-my-module.jnlp"); - String res = readFile (jnlp); - - assertTrue ("Component JNLP type: " + res, res.indexOf ("") >= 0); - assertTrue ("We support all permissions by default: " + res, res.indexOf ("") >= 0); - - Matcher match = Pattern.compile(".*codebase=['\\\"]([^'\\\"]*)['\\\"]").matcher(res); - assertTrue("codebase is there", match.find()); - assertEquals("one group found", 1, match.groupCount()); - String base = match.group(1); - - assertEquals("By default the dest directory is $$codebase: ", "$$codebase", base); - - CHECK_SIGNED: { - File jar = new File(output, "org-my-module/s0.jar"); - JarFile signed = new JarFile(jar); - Enumeration it = signed.entries(); - while (it.hasMoreElements()) { - JarEntry entry = it.nextElement(); - if (entry.getName().endsWith(".SF")) { - break CHECK_SIGNED; - } - } - fail ("File does not seem to be signed: " + jar); - } - } - - public void testHandlesOSGi() throws Exception { - Manifest m; - - m = createManifest (); - m.getMainAttributes ().putValue ("Bundle-SymbolicName", "org.my.module"); - File simpleJar = generateJar (new String[0], m); - - File parent = simpleJar.getParentFile (); - File output = new File(parent, "output"); - File ks = generateKeystore("jnlp", "netbeans-test"); - - java.io.File f = extractString ( - "" + - "" + - " " + - "" + - " " + - " " + - " " + - " " + - " " + - " " + - "" + - "" - ); - buildRule.configureProject(f.getAbsolutePath()); - buildRule.executeTarget("all"); - assertFilenames(output, "org-my-module.jnlp", "org-my-module/s0.jar"); - - File jnlp = new File(output, "org-my-module.jnlp"); - String res = readFile (jnlp); - - assertTrue ("Component JNLP type: " + res, res.indexOf ("") >= 0); - assertTrue ("We support all permissions by default: " + res, res.indexOf ("") >= 0); - - Matcher match = Pattern.compile(".*codebase=['\\\"]([^'\\\"]*)['\\\"]").matcher(res); - assertTrue("codebase is there", match.find()); - assertEquals("one group found", 1, match.groupCount()); - String base = match.group(1); - - assertEquals("By default the dest directory is $$codebase: ", "$$codebase", base); - } - - public void testGenerateJNLPAndUnSignedJarForSimpleModule() throws Exception { - Manifest m; - - m = createManifest (); - m.getMainAttributes ().putValue ("OpenIDE-Module", "org.my.module/3"); - File simpleJar = generateJar (new String[0], m); - - File parent = simpleJar.getParentFile (); - File output = new File(parent, "output"); - File ks = generateKeystore("jnlp", "netbeans-test"); - - java.io.File f = extractString ( - "" + - "" + - " " + - "" + - " " + - " " + - " " + - " " + - " " + - " " + - "" + - "" - ); - buildRule.configureProject(f.getAbsolutePath()); - buildRule.executeTarget("all"); - - assertFilenames(output, "org-my-module.jnlp", "org-my-module/s0.jar"); - - File jnlp = new File(output, "org-my-module.jnlp"); - String res = readFile (jnlp); - - assertTrue ("Component JNLP type: " + res, res.indexOf ("") >= 0); - assertTrue ("We support all permissions by default: " + res, res.indexOf ("") >= 0); - - Matcher match = Pattern.compile(".*codebase=['\\\"]([^'\\\"]*)['\\\"]").matcher(res); - assertTrue("codebase is there", match.find()); - assertEquals("one group found", 1, match.groupCount()); - String base = match.group(1); - - assertEquals("By default the dest directory is $$codebase: ", "$$codebase", base); - - File jar = new File(output, "org-my-module/s0.jar"); - JarFile signed = new JarFile(jar); - Enumeration it = signed.entries(); - while (it.hasMoreElements()) { - JarEntry entry = it.nextElement(); - if (entry.getName().endsWith(".SF")) { - fail ("File should not be signed: " + jar); - } - } - - } - - public void testGenerateMacOSOnlySimpleModule() throws Exception { - doGenerateOSOnlySimpleModule("org.openide.modules.os.MacOSX", ""); - } - - public void testGenerateLinuxOSOnlySimpleModule() throws Exception { - doGenerateOSOnlySimpleModule("org.openide.modules.os.Linux", ""); - } - - public void testGenerateWindowsOSOnlySimpleModule() throws Exception { - doGenerateOSOnlySimpleModule("org.openide.modules.os.Windows", ""); - } - public void testGenerateSolarisOSOnlySimpleModule() throws Exception { - doGenerateOSOnlySimpleModule("org.openide.modules.os.Solaris", ""); - } - - private void doGenerateOSOnlySimpleModule(String tok, String find) throws Exception { - Manifest m; - - m = createManifest (); - m.getMainAttributes ().putValue ("OpenIDE-Module", "org.my.module/3"); - m.getMainAttributes ().putValue ("OpenIDE-Module-Requires", tok + ", pepa.z.bota"); - File simpleJar = generateJar (new String[0], m); - - File parent = simpleJar.getParentFile (); - File output = new File(parent, "output"); - File ks = generateKeystore("jnlp", "netbeans-test"); - - java.io.File f = extractString ( - "" + - "" + - " " + - "" + - " " + - " " + - " " + - " " + - " " + - " " + - "" + - "" - ); - buildRule.configureProject(f.getAbsolutePath()); - buildRule.executeTarget("all"); - - assertFilenames(output, "org-my-module.jnlp", "org-my-module/s0.jar"); - - File jnlp = new File(output, "org-my-module.jnlp"); - String res = readFile (jnlp); - - assertTrue ("Component JNLP type: " + res, res.indexOf ("") >= 0); - assertTrue ("Resource is os dependant: " + res, res.indexOf (find) >= 0); - assertTrue ("We support all permissions by default: " + res, res.indexOf ("") >= 0); - - Matcher match = Pattern.compile(".*codebase=['\\\"]([^'\\\"]*)['\\\"]").matcher(res); - assertTrue("codebase is there", match.find()); - assertEquals("one group found", 1, match.groupCount()); - String base = match.group(1); - - assertEquals("By default the dest directory is $$codebase: ", "$$codebase", base); - - File jar = new File(output, "org-my-module/s0.jar"); - JarFile signed = new JarFile(jar); - Enumeration it = signed.entries(); - while (it.hasMoreElements()) { - JarEntry entry = it.nextElement(); - if (entry.getName().endsWith(".SF")) { - fail ("File should not be signed: " + jar); - } - } - - } - - public void testTheLocalizedAutoupdateProblem() throws Exception { - String UTfile = - "" + - "" + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - ""; - - Manifest m = createManifest (); - m.getMainAttributes ().putValue ("OpenIDE-Module", "org.netbeans.modules.autoupdate/1"); - m.getMainAttributes ().putValue ("Class-Path", "ext/updater.jar"); - File simpleJar = generateJar ("modules/", new String[0], m, null); - File moduleJar = new File(simpleJar.getParentFile(), "org-netbeans-modules-autoupdate.jar"); - simpleJar.renameTo(moduleJar); - - File p = simpleJar.getParentFile(); - - simpleJar = generateJar ("modules/locale/", new String[0], createManifest(), null); - simpleJar.renameTo(new File(simpleJar.getParentFile(), "org-netbeans-modules-autoupdate_ja.jar")); - - simpleJar = generateJar ("modules/locale/", new String[0], createManifest(), null); - simpleJar.renameTo(new File(simpleJar.getParentFile(), "org-netbeans-modules-autoupdate_zh_CN.jar")); - - simpleJar = generateJar ("modules/ext/", new String[0], createManifest(), null); - simpleJar.renameTo(new File(simpleJar.getParentFile(), "updater.jar")); - - simpleJar = generateJar ("modules/ext/locale/", new String[0], createManifest(), null); - simpleJar.renameTo(new File(simpleJar.getParentFile(), "updater_ja.jar")); - - simpleJar = generateJar ("modules/ext/locale/", new String[0], createManifest(), null); - simpleJar.renameTo(new File(simpleJar.getParentFile(), "updater_zh_CN.jar")); - - File xml = new File(p, "config/Modules/org-netbeans-modules-autoupdate.xml"); - xml.getParentFile().mkdirs(); - xml.createNewFile(); - - File updateTracking = new File(getWorkDir(), "update_tracking"); - updateTracking.mkdirs(); - assertTrue("Created", updateTracking.isDirectory()); - - File trackingFile = new File(updateTracking, "org-netbeans-modules-autoupdate.xml"); - try (FileWriter w = new FileWriter(trackingFile)) { - w.write(UTfile); - } - - File output = new File(getWorkDir(), "output"); - File ks = generateKeystore("jnlp", "netbeans-test"); - - java.io.File f = extractString ( - "" + - "" + - " " + - "" + - " " + - " " + - " " + - " " + - " " + - " " + - "" + - "" - ); - buildRule.configureProject(f.getAbsolutePath()); - buildRule.executeTarget("all"); - - assertFilenames(output, "org-netbeans-modules-autoupdate.jnlp", - "org-netbeans-modules-autoupdate/org-netbeans-modules-autoupdate.jar", - "org-netbeans-modules-autoupdate/locale-org-netbeans-modules-autoupdate_zh_CN.jar", - "org-netbeans-modules-autoupdate/locale-org-netbeans-modules-autoupdate_ja.jar", - "org-netbeans-modules-autoupdate/ext-locale-updater_zh_CN.jar", - "org-netbeans-modules-autoupdate/ext-locale-updater_ja.jar", - "org-netbeans-modules-autoupdate/ext-updater.jar"); - - File jnlp = new File(output, "org-netbeans-modules-autoupdate.jnlp"); - String res = readFile (jnlp); - - - assertTrue ("Component JNLP type: " + res, res.indexOf ("") >= 0); - assertTrue ("We support all permissions by default: " + res, res.indexOf ("") >= 0); - - Matcher match = Pattern.compile(".*codebase=['\\\"]([^'\\\"]*)['\\\"]").matcher(res); - assertTrue("codebase is there", match.find()); - assertEquals("one group found", 1, match.groupCount()); - String base = match.group(1); - - assertEquals("By default the dest directory is $$codebase: ", "$$codebase", base); - - assertResource(res, "ja", "org-netbeans-modules-autoupdate/ext-locale-updater_ja.jar"); - assertResource(res, "zh_CN", "org-netbeans-modules-autoupdate/ext-locale-updater_zh_CN.jar"); - assertResource(res, "ja", "org-netbeans-modules-autoupdate/locale-org-netbeans-modules-autoupdate_ja.jar"); - assertResource(res, "zh_CN", "org-netbeans-modules-autoupdate/locale-org-netbeans-modules-autoupdate_zh_CN.jar"); - - CHECK_SIGNED: for (File jar : new File(output, "org-netbeans-modules-autoupdate").listFiles()) { - if (!jar.getName().endsWith(".jar")) { - continue; - } - JarFile signed = new JarFile(jar); - Enumeration it = signed.entries(); - while (it.hasMoreElements()) { - JarEntry entry = it.nextElement(); - if (entry.getName().endsWith(".SF")) { - continue CHECK_SIGNED; - } - } - fail ("File does not seem to be signed: " + jar); - } - - } - public void testGenerateJNLPForMissingRegularModule() throws Exception { - Manifest m; - - m = createManifest (); - m.getMainAttributes ().putValue ("OpenIDE-Module", "org.netbeans.core.startup"); - File simpleJar = generateJar ("modules/", new String[0], m, null); - File coreJar = new File(simpleJar.getParentFile(), "core.jar"); - simpleJar.renameTo(coreJar); - simpleJar = coreJar; - - File parent = simpleJar.getParentFile (); - File localizedJarCZ = generateJar("modules/locale/", new String[0], createManifest(), null); - assertTrue("Successful rename", localizedJarCZ.renameTo(new File(localizedJarCZ.getParent(), "core_cs.jar"))); - - File updateTracking = new File(getWorkDir(), "update_tracking"); - updateTracking.mkdirs(); - assertTrue("Created", updateTracking.isDirectory()); - - File trackingFile = new File(updateTracking, "org-netbeans-core-startup.xml"); - try (FileWriter w = new FileWriter(trackingFile)) { - w.write( - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - " \n" + - "\n" - ); - } - - - File output = new File(parent, "output"); - File ks = generateKeystore("jnlp", "netbeans-test"); - - java.io.File f = extractString ( - "" + - "" + - " " + - "" + - " " + - " " + - " " + - " " + - " " + - " " + - "" + - "" - ); - buildRule.configureProject(f.getAbsolutePath()); - buildRule.executeTarget("all"); - - assertFilenames(output, "org-netbeans-core-startup.jnlp", - "org-netbeans-core-startup/core.jar", - "org-netbeans-core-startup/locale-core_cs.jar"); - } - - public void testGenerateJNLPAndSignedJarForSimpleLocalizedModule() throws Exception { - Manifest m; - - m = createManifest (); - m.getMainAttributes ().putValue ("OpenIDE-Module", "org.my.module/3"); - File simpleJar = generateJar ("modules/", new String[0], m, null); - - File parent = simpleJar.getParentFile (); - File localizedJarCZ = generateJar("modules/locale/", new String[0], createManifest(), null); - assertEquals("There need to have the same name", simpleJar.getName(), localizedJarCZ.getName()); - assertTrue("Successful rename", localizedJarCZ.renameTo(new File(localizedJarCZ.getParent(), "0_cs.jar"))); - - File localizedJarZH = generateJar("modules/locale/", new String[0], createManifest(), null); - assertEquals("There need to have the same name", simpleJar.getName(), localizedJarZH.getName()); - assertTrue("Successful rename", localizedJarZH.renameTo(new File(localizedJarCZ.getParent(), "0_zh_CN.jar"))); - - File localizedJarJA = generateJar("modules/locale/", new String[0], createManifest(), null); - assertEquals("There need to have the same name", simpleJar.getName(), localizedJarJA.getName()); - assertTrue("Successful rename", localizedJarJA.renameTo(new File(localizedJarCZ.getParent(), "0_ja.jar"))); - - File updateTracking = new File(getWorkDir(), "update_tracking"); - updateTracking.mkdirs(); - assertTrue("Created", updateTracking.isDirectory()); - - File trackingFile = new File(updateTracking, "org-my-module.xml"); - try (FileWriter w = new FileWriter(trackingFile)) { - w.write( - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - " \n" + - "\n" - ); - } - - - File output = new File(parent, "output"); - File ks = generateKeystore("jnlp", "netbeans-test"); - - java.io.File f = extractString ( - "" + - "" + - " " + - "" + - " " + - " " + - " " + - " " + - " " + - " " + - "" + - "" - ); - buildRule.configureProject(f.getAbsolutePath()); - buildRule.executeTarget("all"); - - assertFilenames(output, "org-my-module.jnlp", - "org-my-module/0.jar", - "org-my-module/locale-0_cs.jar", - "org-my-module/locale-0_zh_CN.jar", - "org-my-module/locale-0_ja.jar"); - - File jnlp = new File(output, "org-my-module.jnlp"); - String res = readFile (jnlp); - - assertTrue ("Component JNLP type: " + res, res.indexOf ("") >= 0); - assertTrue ("We support all permissions by default: " + res, res.indexOf ("") >= 0); - - Matcher match = Pattern.compile(".*codebase=['\\\"]([^'\\\"]*)['\\\"]").matcher(res); - assertTrue("codebase is there", match.find()); - assertEquals("one group found", 1, match.groupCount()); - String base = match.group(1); - - assertEquals("By default the dest directory is $$codebase: ", "$$codebase", base); - - assertResource(res, "cs", "org-my-module/locale-0_cs.jar"); - assertResource(res, "ja", "org-my-module/locale-0_ja.jar"); - assertResource(res, "zh_CN", "org-my-module/locale-0_zh_CN.jar"); - - CHECK_SIGNED: for (File jar : new File(output, "org-my-module").listFiles()) { - if (!jar.getName().endsWith(".jar")) { - continue; - } - - JarFile signed = new JarFile(jar); - Enumeration it = signed.entries(); - while (it.hasMoreElements()) { - JarEntry entry = it.nextElement(); - if (entry.getName().endsWith(".SF")) { - continue CHECK_SIGNED; - } - } - fail ("File does not seem to be signed: " + jar); - } - } - public void testGenerateJNLPForMissingCoreIssue103301() throws Exception { - Manifest m; - - m = createManifest (); - m.getMainAttributes ().putValue ("OpenIDE-Module", "org.netbeans.core.startup"); - File simpleJar = generateJar ("core/", new String[0], m, null); - File coreJar = new File(simpleJar.getParentFile(), "core.jar"); - simpleJar.renameTo(coreJar); - simpleJar = coreJar; - - File parent = simpleJar.getParentFile (); - File localizedJarCZ = generateJar("core/locale/", new String[0], createManifest(), null); - assertTrue("Successful rename", localizedJarCZ.renameTo(new File(localizedJarCZ.getParent(), "core_cs.jar"))); - - File updateTracking = new File(getWorkDir(), "update_tracking"); - updateTracking.mkdirs(); - assertTrue("Created", updateTracking.isDirectory()); - - File trackingFile = new File(updateTracking, "org-netbeans-core-startup.xml"); - try (FileWriter w = new FileWriter(trackingFile)) { - w.write( - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - " \n" + - "\n" - ); - } - - - File output = new File(parent, "output"); - File ks = generateKeystore("jnlp", "netbeans-test"); - - java.io.File f = extractString ( - "" + - "" + - " " + - "" + - " " + - " " + - " " + - " " + - " " + - " " + - "" + - "" - ); - buildRule.configureProject(f.getAbsolutePath()); - buildRule.executeTarget("all"); - - assertFilenames(output, "org-netbeans-core-startup.jnlp", - "org-netbeans-core-startup/core.jar", - "org-netbeans-core-startup/locale-core_cs.jar"); - } - - public void testGenerateJNLPAndUnSignedJarForSimpleLocalizedModule() throws Exception { - Manifest m; - - m = createManifest (); - m.getMainAttributes ().putValue ("OpenIDE-Module", "org.my.module/3"); - File simpleJar = generateJar ("modules/", new String[0], m, null); - - File parent = simpleJar.getParentFile (); - File localizedJarCZ = generateJar("modules/locale/", new String[0], createManifest(), null); - assertEquals("There need to have the same name", simpleJar.getName(), localizedJarCZ.getName()); - assertTrue("Successful rename", localizedJarCZ.renameTo(new File(localizedJarCZ.getParent(), "0_cs.jar"))); - - File localizedJarZH = generateJar("modules/locale/", new String[0], createManifest(), null); - assertEquals("There need to have the same name", simpleJar.getName(), localizedJarZH.getName()); - assertTrue("Successful rename", localizedJarZH.renameTo(new File(localizedJarCZ.getParent(), "0_zh_CN.jar"))); - - File localizedJarJA = generateJar("modules/locale/", new String[0], createManifest(), null); - assertEquals("There need to have the same name", simpleJar.getName(), localizedJarJA.getName()); - assertTrue("Successful rename", localizedJarJA.renameTo(new File(localizedJarCZ.getParent(), "0_ja.jar"))); - - File updateTracking = new File(getWorkDir(), "update_tracking"); - updateTracking.mkdirs(); - assertTrue("Created", updateTracking.isDirectory()); - - File trackingFile = new File(updateTracking, "org-my-module.xml"); - try (FileWriter w = new FileWriter(trackingFile)) { - w.write( - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - " \n" + - "\n" - ); - } - - - File output = new File(parent, "output"); - File ks = generateKeystore("jnlp", "netbeans-test"); - - java.io.File f = extractString ( - "" + - "" + - " " + - "" + - " " + - " " + - " " + - " " + - " " + - " " + - "" + - "" - ); - buildRule.configureProject(f.getAbsolutePath()); - buildRule.executeTarget("all"); - - assertFilenames(output, "org-my-module.jnlp", - "org-my-module/0.jar", - "org-my-module/locale-0_cs.jar", - "org-my-module/locale-0_zh_CN.jar", - "org-my-module/locale-0_ja.jar"); - - File jnlp = new File(output, "org-my-module.jnlp"); - String res = readFile (jnlp); - - assertTrue ("Component JNLP type: " + res, res.indexOf ("") >= 0); - assertTrue ("We support all permissions by default: " + res, res.indexOf ("") >= 0); - - Matcher match = Pattern.compile(".*codebase=['\\\"]([^'\\\"]*)['\\\"]").matcher(res); - assertTrue("codebase is there", match.find()); - assertEquals("one group found", 1, match.groupCount()); - String base = match.group(1); - - assertEquals("By default the dest directory is $$codebase: ", "$$codebase", base); - - assertResource(res, "cs", "org-my-module/locale-0_cs.jar"); - assertResource(res, "ja", "org-my-module/locale-0_ja.jar"); - assertResource(res, "zh_CN", "org-my-module/locale-0_zh_CN.jar"); - - for (File jar : new File(output, "org-my-module").listFiles()) { - if (!jar.getName().endsWith(".jar")) { - continue; - } - - JarFile signed = new JarFile(jar); - Enumeration it = signed.entries(); - while (it.hasMoreElements()) { - JarEntry entry = it.nextElement(); - if (entry.getName().endsWith(".SF")) { - fail ("File does not seem to be signed: " + jar); - } - } - } - } - - private static void assertResource(String where, String locale, String file) { - where = where.replace('\n', ' '); - Matcher match = Pattern.compile(".*.*").matcher(where); - assertTrue("File really referenced " + file + " in locale " + locale + "\n" + where, match.find()); - } - - public void testOneCanChangeTheCodeBase() throws Exception { - Manifest m; - - m = createManifest (); - m.getMainAttributes ().putValue ("OpenIDE-Module", "org.my.module/3"); - File simpleJar = generateJar (new String[0], m); - - File parent = simpleJar.getParentFile (); - File output = new File(parent, "output"); - File ks = generateKeystore("jnlp", "netbeans-test"); - - java.io.File f = extractString ( - "" + - "" + - " " + - "" + - " " + - " " + - " " + - " " + - " " + - " " + - "" + - "" - ); - buildRule.configureProject(f.getAbsolutePath()); - buildRule.executeTarget("all"); - - assertFilenames(output, "org-my-module.jnlp", - "org-my-module/s0.jar"); - - File jnlp = new File(output, "org-my-module.jnlp"); - String res = readFile (jnlp); - - assertTrue ("Component JNLP type: " + res, res.indexOf ("") >= 0); - assertTrue ("We support all permissions by default: " + res, res.indexOf ("") >= 0); - - Matcher match = Pattern.compile(".*codebase=['\\\"]([^'\\\"]*)['\\\"]").matcher(res); - assertTrue("codebase is there", match.find()); - assertEquals("one group found", 1, match.groupCount()); - String base = match.group(1); - - assertEquals("By default the codebases can be changed: ", "http://www.my.org/", base); - } - - public void testGenerateJNLPAndSignedJarForModuleWithClassPath() throws Exception { - File output = doClassPathModuleCheck( - "" + - "" + - " " + - "" + - " " + - " " + - " " + - " " + - " " + - " " + - "" + - "" - ); - - assertFilenames(output, "aaa-my-module.jnlp", "aaa-my-module/ext-t0.jar", "aaa-my-module/s0.jar"); - - File jnlp = new File(output, "aaa-my-module.jnlp"); - String res = readFile (jnlp); - - - Matcher m = Pattern.compile("").matcher(res); - for (int x = 0; x < 2; x++) { - assertTrue("Matches at least one" + "(" + x + ")", m.find()); - assertEquals("Found a group" + "(" + x + ")", m.groupCount(), 1); - File f = new File (jnlp.getParentFile(), m.group(1)); - assertTrue("The file " + f + " exists" + "(" + x + ")", f.exists()); - } - - } - - public void testGenerateJNLPAndSignedJarForModuleWithClassPathAndSignedJar() throws Exception { - File ks = generateKeystore("external", "netbeans-test"); - - File output = doClassPathModuleCheck( - "" + - "" + - " " + - "" + - " " + - " \n" + - " " + - " " + - " " + - " " + - " " + - "" + - "" - ); - - assertFilenames(output, "aaa-my-module.jnlp", "aaa-my-module/s0.jar", - "aaa-my-module/ext-t0.jar", - "aaa-my-module-ext-t0.jnlp"); - - JarFile f = new JarFile(new File(output, "aaa-my-module/ext-t0.jar")); - Enumeration en = f.entries(); - StringBuffer sb = new StringBuffer(); - int cnt = 0; - while (en.hasMoreElements()) { - JarEntry e = en.nextElement(); - if (e.getName().endsWith("SF")) { - cnt++; - if (!e.getName().equals("META-INF/EXTERNAL.SF")) { - fail("Signed with wrong entity: " + e.getName()); - } - } - sb.append(e.getName()); - sb.append('\n'); - } - - if (cnt == 0) { - fail("Signed with wrong file:\n" + sb); - } - - File jnlp = new File(output, "aaa-my-module.jnlp"); - - String res = readFile (jnlp); - - int first = res.indexOf("jar href"); - assertEquals("Just one jar href ", -1, res.indexOf("jar href", first + 1)); - - String extRes = readFile(new File(output, "aaa-my-module-ext-t0.jnlp")); - - Matcher m = Pattern.compile("(.*)").matcher(extRes); - assertTrue("title is there: " + extRes, m.find()); - assertEquals("Name of file is used for title", "t0", m.group(1)); - } - - public void testInformationIsTakenFromLocalizedBundle() throws Exception { - Manifest m; - - m = createManifest (); - m.getMainAttributes ().putValue ("OpenIDE-Module", "org.my.module/3"); - - Properties props = new Properties(); - props.put("OpenIDE-Module-Name", "Module Build Harness"); - props.put("OpenIDE-Module-Display-Category", "Developing NetBeans"); - props.put("OpenIDE-Module-Short-Description", "Lets you build external plug-in modules from sources."); - props.put("OpenIDE-Module-Long-Description", "XXX"); - - File simpleJar = generateJar (null, new String[0], m, props); - - File parent = simpleJar.getParentFile (); - File output = new File(parent, "output"); - File ks = generateKeystore("jnlp", "netbeans-test"); - - java.io.File f = extractString ( - "" + - "" + - " " + - "" + - " " + - " " + - " " + - " " + - " " + - " " + - "" + - "" - ); - buildRule.configureProject(f.getAbsolutePath()); - buildRule.executeTarget("all"); - - assertFilenames(output, "org-my-module.jnlp", "org-my-module/s0.jar"); - - File jnlp = new File(output, "org-my-module.jnlp"); - String res = readFile (jnlp); - - int infoBegin = res.indexOf(""); - int infoEnd = res.indexOf(""); - - if (infoEnd == -1 || infoBegin == -1) { - fail ("Both information tags must be present: " + res); - } - - String info = res.substring(infoBegin, infoEnd); - - if (info.indexOf("Module Build Harness") == -1) { - fail("Title should be there with Module Build Harness inside itself: " + info); - } - - if (info.indexOf("Lets you build external plug-in modules from sources.") == -1) { - fail("one-line should be there with 'lets you...' inside itself: " + info); - } - - if (info.indexOf("XXX") == -1) { - fail("short should be there with XXX inside itself: " + info); - } - } - - public void testGenerateJNLPFailsForModulesWithExtraFiles() throws Exception { - doCompareJNLPFileWithUpdateTracking(true, null, ""); - } - public void testGenerateJNLPSucceedsWithExtraFiles() throws Exception { - doCompareJNLPFileWithUpdateTracking(false, null, ""); - } - public void testGenerateJNLPSucceedsWhenExtraFileIsExcluded() throws Exception { - doCompareJNLPFileWithUpdateTracking(false, "lib/nbexec", " verifyexcludes=' one, lib/nbexec, three ' "); - } - public void testGenerateJNLPSucceedsWhenModuleAutoDepsArePresent() throws Exception { - doCompareJNLPFileWithUpdateTracking(false, "config/ModuleAutoDeps/aaa-my-module.xml", " verifyexcludes=' none ' "); - } - - private void doCompareJNLPFileWithUpdateTracking(boolean useNonModule, String fakeEntry, String extraScript) throws Exception { - File nonModule = generateJar (new String[0], createManifest()); - - Manifest m = createManifest (); - m.getMainAttributes ().putValue ("OpenIDE-Module", "aaa.my.module/3"); - File module = generateJar (new String[0], m); - - File updateTracking = new File(getWorkDir(), "update_tracking"); - updateTracking.mkdirs(); - assertTrue("Created", updateTracking.isDirectory()); - - File enableXML = new File(new File(getWorkDir(), "config"), "Modules"); - enableXML.getParentFile().mkdirs(); - enableXML.createNewFile(); - - File trackingFile = new File(updateTracking, "aaa-my-module.xml"); - try (FileWriter w = new FileWriter(trackingFile)) { - w.write( - "\n" + - "\n" + - "\n" + - (useNonModule ? ("\n") : "") + - "\n" + - "\n" + - (fakeEntry != null ? "\n" : "") + - " \n" + - "\n" - ); - } - - - - String script = - "" + - "" + - " " + - "" + - " " + - " " + - " " + - " " + - " " + - " " + - "" + - ""; - - assertEquals("Both modules in the same dir", module.getParentFile(), nonModule.getParentFile()); - - File output = new File(getWorkDir(), "output"); - File ks = generateKeystore("jnlp", "netbeans-test"); - - java.io.File f = extractString (script); - try { - System.setProperty("test.output", output.getAbsolutePath()); - System.setProperty("test.parent", module.getParentFile().getAbsolutePath()); - System.setProperty("test.name", module.getName()); - System.setProperty("test.ks", ks.getAbsolutePath()); - - buildRule.configureProject(f.getAbsolutePath()); - buildRule.executeTarget("all"); - /*execute (f, new String[] { - "-Dtest.output=" + output, - "-Dtest.parent=" + module.getParent(), - "-Dtest.name=" + module.getName(), - "-Dtest.ks=" + ks, - });*/ - if (useNonModule) { - fail("The task has to fail"); - } - - assertTrue ("Output exists", output.exists ()); - assertTrue ("Output directory created", output.isDirectory()); - - File ext = new File (output, module.getName()); - - - String[] files = ext.getParentFile().list(); - assertEquals("Two files are there", 2, files.length); - } catch (BuildException ex) { - if (!useNonModule) { - throw ex; - } else { - // ok, this is fine - assertTrue ("Output exists", output.exists ()); - assertTrue ("Output directory created", output.isDirectory()); - - File ext = new File (output, module.getName()); - - - String[] files = ext.getParentFile().list(); - assertEquals("Output dir is empty as nothing has been generated", 0, files.length); - } - } - - } - - private File doClassPathModuleCheck(String script) throws Exception { - Manifest m; - - File extJar = generateJar ("modules/ext", new String[0], createManifest(), null); - - m = createManifest (); - m.getMainAttributes ().putValue ("OpenIDE-Module", "aaa.my.module/3"); - m.getMainAttributes ().putValue ("Class-Path", "ext/" + extJar.getName()); - File simpleJar = generateJar ("modules", new String[0], m, null); - - File parent = simpleJar.getParentFile (); - - File output = new File(parent, "output"); - File ks = generateKeystore("jnlp", "netbeans-test"); - - java.io.File f = extractString (script); -/* execute (f, new String[] { - "-Dtest.output=" + output, - "-Dtest.parent=" + parent, - "-Dtest.name=" + simpleJar.getName(), - "-Dtest.ks=" + ks, - "-Dtest.ext=" + extJar - });*/ - System.setProperty("test.output", output.getAbsolutePath()); - System.setProperty("test.parent", parent.getAbsolutePath()); - System.setProperty("test.name", simpleJar.getName()); - System.setProperty("test.ks", ks.getAbsolutePath()); - System.setProperty("test.ext", extJar.getAbsolutePath()); - - buildRule.configureProject(f.getAbsolutePath()); - buildRule.executeTarget("all"); - return output; - } - - - private File createNewJarFile(String prefix) throws IOException { - if (prefix == null) { - prefix = "modules"; - } - String ss = prefix.substring(prefix.length()-1); - - File dir = new File(this.getWorkDir(), prefix); - dir.mkdirs(); - - int i = 0; - for (;;) { - File f = new File (dir, ss + i++ + ".jar"); - if (!f.exists()) { - return f; - } - } - } - - protected final File generateJar (String[] content, Manifest manifest) throws IOException { - return generateJar(null, content, manifest, null); - } - - protected final File generateJar (String prefix, String[] content, Manifest manifest, Properties props) throws IOException { - File f = createNewJarFile (prefix); - - if (props != null) { - manifest.getMainAttributes().putValue("OpenIDE-Module-Localizing-Bundle", "some/fake/prop/name/Bundle.properties"); - } - - try (JarOutputStream os = new JarOutputStream (new FileOutputStream (f), manifest)) { - if (props != null) { - os.putNextEntry(new JarEntry("some/fake/prop/name/Bundle.properties")); - props.store(os, "# properties for the module"); - os.closeEntry(); - } - - - for (int i = 0; i < content.length; i++) { - os.putNextEntry(new JarEntry (content[i])); - os.closeEntry(); - } - os.closeEntry (); - } - - return f; - } - - @SuppressWarnings("SleepWhileInLoop") - private File generateKeystore(String alias, String password) throws Exception { - BuildException lastEx = null; - for (int i = 0; i < 10; i++) { - File where = new File(getWorkDir(), "key" + i + ".ks"); - - String script = - "" + - "" + - "" + - "\n" + - "\n"; - - java.io.File f = extractString (script); - try { - buildRule.configureProject(f.getAbsolutePath()); - buildRule.executeTarget("all"); - } catch (BuildException ex) { - Logger.getAnonymousLogger().log(Level.WARNING, "Failed for " + i, ex); - lastEx = ex; - if (ex.getMessage().indexOf("CKR_KEY_SIZE_RANGE") >= 0) { - Thread.sleep(new Random().nextInt(1000)); - continue; - } - throw ex; - } - return where; - } - throw lastEx; - } - - public void testIndirectJars() throws Exception { - Manifest m = createManifest(); - m.getMainAttributes().putValue("OpenIDE-Module", "me"); - generateJar(new String[0], m); - generateJar("lib", new String[0], new Manifest(), null); - assertTrue(new File(getWorkDir(), "lib/b0.jar").isFile()); - File output = new File(getWorkDir(), "output"); - File ks = generateKeystore("jnlp", "netbeans-test"); - File f = extractString( - "" + - "" + - " " + - "" + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - "" + - "" - ); - buildRule.configureProject(f.getAbsolutePath()); - buildRule.executeTarget("all"); - assertFilenames(output, "me.jnlp", "me/s0.jar", "me/lib-b0.jar"); - File jnlp = new File(output, "me.jnlp"); - String res = readFile(jnlp); - assertTrue(res, res.contains("me/lib-b0.jar")); - JarFile otherJar = new JarFile(new File(output, "me/lib-b0.jar")); - assertNotNull(otherJar.getEntry("META-INF/clusterpath/lib/b0.jar")); - } - -} diff --git a/nbbuild/test/unit/src/org/netbeans/nbbuild/MakeMasterJNLPTest.java b/nbbuild/test/unit/src/org/netbeans/nbbuild/MakeMasterJNLPTest.java deleted file mode 100644 index 8acd5deaf4f4..000000000000 --- a/nbbuild/test/unit/src/org/netbeans/nbbuild/MakeMasterJNLPTest.java +++ /dev/null @@ -1,213 +0,0 @@ -/* - * 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.nbbuild; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.jar.JarEntry; -import java.util.jar.JarOutputStream; -import java.util.jar.Manifest; -import org.apache.tools.ant.BuildFileRule; -import org.junit.Rule; - -/** Is generation of Jnlp files correct? - * - * @author Jaroslav Tulach - */ -public class MakeMasterJNLPTest extends TestBase { - - @Rule - public final BuildFileRule buildRule = new BuildFileRule(); - - public MakeMasterJNLPTest (String name) { - super (name); - } - - public void testOSGiModule() throws Exception { - int cnt = 3; - Manifest m; - - m = createManifest (); - m.getMainAttributes ().putValue ("Bundle-SymbolicName", "org.my.module"); - File simpleJar = generateJar (new String[0], m); - - m = createManifest (); - m.getMainAttributes ().putValue ("OpenIDE-Module", "org.second.module/3"); - File secondJar = generateJar (new String[0], m); - - File parent = simpleJar.getParentFile (); - assertEquals("They are in the same folder", parent, secondJar.getParentFile()); - - File output = new File(parent, "output"); - - java.io.File f = extractString ( - "" + - "" + - " " + - "" + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - "" + - "" - ); - while (cnt-- > 0) { - buildRule.configureProject(f.getAbsolutePath()); - buildRule.executeTarget("all"); - } - - assertTrue ("Output exists", output.exists ()); - assertTrue ("Output directory created", output.isDirectory()); - - String[] files = output.list(); - assertEquals("It has two files", 2, files.length); - - java.util.Arrays.sort(files); - - assertEquals("The res1 file: " + files[0], "org-my-module.ref", files[0]); - assertEquals("The res2 file: "+ files[1], "org-second-module.ref", files[1]); - - File r1 = new File(output, "org-my-module.ref"); - String res1 = readFile (r1); - - File r2 = new File(output, "org-second-module.ref"); - String res2 = readFile (r2); - - assertExt(res1, "org.my.module"); - assertExt(res2, "org.second.module"); - } - - public void testGenerateReferenceFilesOnce() throws Exception { - doGenerateReferenceFiles(1); - } - public void testGenerateReferenceFilesThrice() throws Exception { - doGenerateReferenceFiles(3); - } - - private void doGenerateReferenceFiles(int cnt) throws Exception { - Manifest m; - - m = createManifest (); - m.getMainAttributes ().putValue ("OpenIDE-Module", "org.my.module/3"); - File simpleJar = generateJar (new String[0], m); - - m = createManifest (); - m.getMainAttributes ().putValue ("OpenIDE-Module", "org.second.module/3"); - File secondJar = generateJar (new String[0], m); - - File parent = simpleJar.getParentFile (); - assertEquals("They are in the same folder", parent, secondJar.getParentFile()); - - File output = new File(parent, "output"); - - java.io.File f = extractString ( - "" + - "" + - " " + - "" + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - "" + - "" - ); - while (cnt-- > 0) { - buildRule.configureProject(f.getAbsolutePath()); - buildRule.executeTarget("all"); - } - - assertTrue ("Output exists", output.exists ()); - assertTrue ("Output directory created", output.isDirectory()); - - String[] files = output.list(); - assertEquals("It has two files", 2, files.length); - - java.util.Arrays.sort(files); - - assertEquals("The res1 file: " + files[0], "org-my-module.ref", files[0]); - assertEquals("The res2 file: "+ files[1], "org-second-module.ref", files[1]); - - File r1 = new File(output, "org-my-module.ref"); - String res1 = readFile (r1); - - File r2 = new File(output, "org-second-module.ref"); - String res2 = readFile (r2); - - assertExt(res1, "org.my.module"); - assertExt(res2, "org.second.module"); - } - - private static void assertExt(String res, String module) { - int ext = res.indexOf("