Index: apisupport/harness/release/README
===================================================================
RCS file: /cvs/apisupport/harness/release/README,v
retrieving revision 1.56
diff -u -r1.56 README
--- apisupport/harness/release/README 28 Mar 2007 16:49:32 -0000 1.56
+++ apisupport/harness/release/README 9 Apr 2007 22:10:35 -0000
@@ -832,9 +832,14 @@
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>
+ <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.
[XXX some of the above should be listed in "Suite Properties"]
Index: apisupport/harness/release/jnlp.xml
===================================================================
RCS file: /cvs/apisupport/harness/release/jnlp.xml,v
retrieving revision 1.41
diff -u -r1.41 jnlp.xml
--- apisupport/harness/release/jnlp.xml 26 Feb 2007 21:45:30 -0000 1.41
+++ apisupport/harness/release/jnlp.xml 9 Apr 2007 22:10:36 -0000
@@ -42,6 +42,9 @@
+
+
+
@@ -54,6 +57,21 @@
]]>
+
+
+
+ $${app.title}
+ $${app.title} vendor
+ $${app.name} application
+
+
+ $${jnlp.permissions}
+
+ $${jnlp.branding.jars}
+
+
+
+]]>
@@ -105,7 +123,7 @@
-
+
@@ -113,7 +131,6 @@
-
@@ -126,10 +143,24 @@
verify="true"
verifyexcludes="lib/nbexec.cmd,lib/nbexec,lib/nbexec.exe,core/ide.ks,LICENSE.txt,DISTRIBUTION.txt,THIRDPARTYLICENSEREADME.txt,docs/swing-layout-1.0-doc.zip,docs/swing-layout-1.0.1-doc.zip,docs/html40.zip,core/org-netbeans-modules-utilities-cli.jar,docs/org/netbeans/modules/usersguide/ide.css"
permissions="${jnlp.permissions}"
+ signjars="${jnlp.sign.jars}"
>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
- ${jnlp.branding.jars}
]]>
@@ -269,6 +285,14 @@
+
+
+
+
+
+
+
+
@@ -279,11 +303,44 @@
+
Your JNLP file is generated at ${jnlp.dest.dir}/master.jnlp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: nbbuild/antsrc/org/netbeans/nbbuild/MakeJNLP.java
===================================================================
RCS file: /cvs/nbbuild/antsrc/org/netbeans/nbbuild/MakeJNLP.java,v
retrieving revision 1.21
diff -u -r1.21 MakeJNLP.java
--- nbbuild/antsrc/org/netbeans/nbbuild/MakeJNLP.java 20 Dec 2006 20:52:32 -0000 1.21
+++ nbbuild/antsrc/org/netbeans/nbbuild/MakeJNLP.java 9 Apr 2007 22:10:40 -0000
@@ -134,6 +134,15 @@
indirectJars = fs;
}
+ private boolean signJars = true;
+ /**
+ * Whether the final jars should be signed or not. Deafults to true
+ * (if not supplied).
+ */
+ public void setSignJars(boolean s) {
+ this.signJars = s;
+ }
+
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");
@@ -239,10 +248,16 @@
}
File t = new File(new File(target, dashcnb), name);
- getSignTask().setJar(n);
- getSignTask().setSignedjar(t);
- getSignTask().execute();
-
+ if (signJars) {
+ getSignTask().setJar(n);
+ getSignTask().setSignedjar(t);
+ getSignTask().execute();
+ } else {
+ Copy copy = (Copy)getProject().createTask("copy");
+ copy.setFile(n);
+ copy.setTofile(t);
+ copy.execute();
+ }
writeJNLP.write(" \n");
}
@@ -259,10 +274,16 @@
w.write(writeJNLP.toString());
w.close();
- getSignTask().setJar(jar);
- getSignTask().setSignedjar(signed);
- getSignTask().execute();
-
+ if (signJars) {
+ getSignTask().setJar(jar);
+ getSignTask().setSignedjar(signed);
+ getSignTask().execute();
+ } else {
+ Copy copy = (Copy)getProject().createTask("copy");
+ copy.setFile(jar);
+ copy.setTofile(signed);
+ copy.execute();
+ }
theJar.close();
}
@@ -446,9 +467,16 @@
fileWriter.write(" \n");
- getSignTask().setJar(e);
- getSignTask().setSignedjar(ext);
- getSignTask().execute();
+ if (signJars) {
+ getSignTask().setJar(e);
+ getSignTask().setSignedjar(ext);
+ getSignTask().execute();
+ } else {
+ Copy copy = (Copy)getProject().createTask("copy");
+ copy.setFile(e);
+ copy.setTofile(ext);
+ copy.execute();
+ }
}
}
}
Index: nbbuild/templates/common.xml
===================================================================
RCS file: /cvs/nbbuild/templates/common.xml,v
retrieving revision 1.60
diff -u -r1.60 common.xml
--- nbbuild/templates/common.xml 6 Apr 2007 11:16:58 -0000 1.60
+++ nbbuild/templates/common.xml 9 Apr 2007 22:10:43 -0000
@@ -260,6 +260,7 @@
verify="true"
verifyexcludes="${jnlp.verify.excludes}"
permissions="${jnlp.permissions}"
+ signjars="${jnlp.sign.jars}"
>
Index: nbbuild/test/unit/src/org/netbeans/nbbuild/MakeJNLPTest.java
===================================================================
RCS file: /cvs/nbbuild/test/unit/src/org/netbeans/nbbuild/MakeJNLPTest.java,v
retrieving revision 1.15
diff -u -r1.15 MakeJNLPTest.java
--- nbbuild/test/unit/src/org/netbeans/nbbuild/MakeJNLPTest.java 20 Dec 2006 20:52:33 -0000 1.15
+++ nbbuild/test/unit/src/org/netbeans/nbbuild/MakeJNLPTest.java 9 Apr 2007 22:10:44 -0000
@@ -125,6 +125,60 @@
fail ("File does not seem to be signed: " + jar);
}
}
+
+ public void testGenerateJNLPAndUnSignedJarForSimpleModule() throws Exception {
+ Manifest m;
+
+ m = ModuleDependenciesTest.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 = PublicPackagesInProjectizedXMLTest.extractString (
+ "" +
+ "" +
+ " " +
+ "" +
+ " " +
+ " " +
+ " " +
+ " " +
+ " " +
+ " " +
+ "" +
+ ""
+ );
+ PublicPackagesInProjectizedXMLTest.execute (f, new String[] { "-verbose" });
+
+ assertFilenames(output, "org-my-module.jnlp", "org-my-module/s0.jar");
+
+ File jnlp = new File(output, "org-my-module.jnlp");
+ String res = ModuleDependenciesTest.readFile (jnlp);
+
+ assertTrue ("Component JNLP type: " + res, res.indexOf ("") >= 0);
+ assertTrue ("We support all permitions 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 = (JarEntry)it.nextElement();
+ if (entry.getName().endsWith(".SF")) {
+ fail ("File should not be signed: " + jar);
+ }
+ }
+
+ }
public void testTheLocalizedAutoupdateProblem() throws Exception {
String UTfile =
@@ -338,6 +392,105 @@
}
}
fail ("File does not seem to be signed: " + jar);
+ }
+ }
+
+ public void testGenerateJNLPAndUnSignedJarForSimpleLocalizedModule() throws Exception {
+ Manifest m;
+
+ m = ModuleDependenciesTest.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], ModuleDependenciesTest.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], ModuleDependenciesTest.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], ModuleDependenciesTest.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");
+ FileWriter w = new FileWriter(trackingFile);
+ w.write(
+"\n" +
+"\n" +
+ "\n" +
+ "\n" +
+ "\n" +
+ "\n" +
+ "\n" +
+ "\n" +
+" \n" +
+"\n"
+ );
+ w.close();
+
+
+ File output = new File(parent, "output");
+ File ks = generateKeystore("jnlp", "netbeans-test");
+
+ java.io.File f = PublicPackagesInProjectizedXMLTest.extractString (
+ "" +
+ "" +
+ " " +
+ "" +
+ " " +
+ " " +
+ " " +
+ " " +
+ " " +
+ " " +
+ "" +
+ ""
+ );
+ PublicPackagesInProjectizedXMLTest.execute (f, new String[] { "-verbose" });
+
+ 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 = ModuleDependenciesTest.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 = (JarEntry)it.nextElement();
+ if (entry.getName().endsWith(".SF")) {
+ fail ("File does not seem to be signed: " + jar);
+ }
+ }
}
}