This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 90498
Collapse All | Expand All

(-)ant/build.xml (-11 / +12 lines)
Lines 95-128 Link Here
95
    </target>
95
    </target>
96
96
97
    <target name="jnlp" depends="netbeans">
97
    <target name="jnlp" depends="netbeans">
98
        <mkdir dir="${jnlp.dest.dir}"/>
98
        <property name="dir" location="${jnlp.dest.dir}/org-apache-tools-ant-module"/>
99
        <copy todir="${jnlp.dest.dir}" flatten="true">
99
        <mkdir dir="${dir}"/>
100
        <copy todir="${dir}" flatten="true">
100
            <fileset dir="${cluster}">
101
            <fileset dir="${cluster}">
101
                <include name="${module.jar}"/>
102
                <include name="${module.jar}"/>
102
                <include name="ant/patches/*.jar"/>
103
                <include name="ant/patches/*.jar"/>
103
            </fileset>
104
            </fileset>
104
        </copy>
105
        </copy>
105
        <copy todir="${jnlp.dest.dir}">
106
        <copy todir="${dir}">
106
            <fileset dir="${cluster}">
107
            <fileset dir="${cluster}">
107
                <include name="ant/lib/*.jar"/>
108
                <include name="ant/lib/*.jar"/>
108
            </fileset>
109
            </fileset>
109
            <mapper type="glob" from="ant${file.separator}lib${file.separator}*.jar" to="apache-*-1.6.5.jar"/>
110
            <mapper type="glob" from="ant${file.separator}lib${file.separator}*.jar" to="apache-*-1.6.5.jar"/>
110
        </copy>
111
        </copy>
111
        <copy file="${cluster}/ant/nblib/bridge.jar" tofile="${jnlp.dest.dir}/org-apache-tools-ant-module-bridge.jar"/>
112
        <copy file="${cluster}/ant/nblib/bridge.jar" tofile="${dir}/org-apache-tools-ant-module-bridge.jar"/>
112
        <signjar alias="${jnlp.signjar.alias}" storepass="${jnlp.signjar.password}" keystore="${jnlp.signjar.keystore}">
113
        <signjar alias="${jnlp.signjar.alias}" storepass="${jnlp.signjar.password}" keystore="${jnlp.signjar.keystore}">
113
            <fileset dir="${jnlp.dest.dir}">
114
            <fileset dir="${dir}">
114
                <include name="org-apache-tools-ant-module.jar"/>
115
                <include name="org-apache-tools-ant-module.jar"/>
115
                <include name="org-apache-tools-ant-module-bridge.jar"/>
116
                <include name="org-apache-tools-ant-module-bridge.jar"/>
116
                <include name="apache-ant*.jar"/>
117
                <include name="apache-ant*.jar"/>
117
            </fileset>
118
            </fileset>
118
        </signjar>
119
        </signjar>
119
        <pathconvert property="ant-jar-resources" pathsep="'/&gt;&#10;    &lt;jar href='">
120
        <pathconvert property="ant-jar-resources" pathsep="'/&gt;&#10;    &lt;jar href='org-apache-tools-ant-module/">
120
            <path>
121
            <path>
121
                <fileset dir="${jnlp.dest.dir}">
122
                <fileset dir="${dir}">
122
                    <include name="apache-ant*.jar"/>
123
                    <include name="apache-ant*.jar"/>
123
                </fileset>
124
                </fileset>
124
            </path>
125
            </path>
125
            <mapper type="glob" from="${jnlp.dest.dir}${file.separator}*" to="*"/>
126
            <mapper type="glob" from="${dir}${file.separator}*" to="*"/>
126
        </pathconvert>
127
        </pathconvert>
127
        <echo file="${jnlp.dest.dir}/org-apache-tools-ant-module.jnlp"><![CDATA[<?xml version='1.0' encoding='UTF-8'?>
128
        <echo file="${jnlp.dest.dir}/org-apache-tools-ant-module.jnlp"><![CDATA[<?xml version='1.0' encoding='UTF-8'?>
128
<jnlp spec='1.0+' codebase='${jnlp.codebase}'>
129
<jnlp spec='1.0+' codebase='${jnlp.codebase}'>
Lines 134-142 Link Here
134
  </information>
135
  </information>
135
  <security><all-permissions/></security>
136
  <security><all-permissions/></security>
136
  <resources>
137
  <resources>
137
    <jar href='org-apache-tools-ant-module.jar'/>
138
    <jar href='org-apache-tools-ant-module/org-apache-tools-ant-module.jar'/>
138
    <jar href='org-apache-tools-ant-module-bridge.jar'/>
139
    <jar href='org-apache-tools-ant-module/org-apache-tools-ant-module-bridge.jar'/>
139
    <jar href='${ant-jar-resources}'/>
140
    <jar href='org-apache-tools-ant-module/${ant-jar-resources}'/>
140
  </resources>
141
  </resources>
141
  <component-desc/>
142
  <component-desc/>
142
</jnlp>
143
</jnlp>
(-)apisupport/harness/build.xml (-1 / +1 lines)
Lines 37-43 Link Here
37
 
37
 
38
    <target name="compile-jnlp-launcher" depends="init,compile">
38
    <target name="compile-jnlp-launcher" depends="init,compile">
39
        <mkdir dir="build/jnlp-launcher-classes"/>
39
        <mkdir dir="build/jnlp-launcher-classes"/>
40
        <javac srcdir="jnlp-src" destdir="build/jnlp-launcher-classes" deprecation="${build.compiler.deprecation}" debug="${build.compiler.debug}" source="1.4" includeantruntime="false">
40
        <javac srcdir="jnlp-src" destdir="build/jnlp-launcher-classes" deprecation="${build.compiler.deprecation}" debug="${build.compiler.debug}" source="1.5" includeantruntime="false">
41
            <classpath>
41
            <classpath>
42
                <path path="${jnlp.cp}"/>
42
                <path path="${jnlp.cp}"/>
43
            </classpath>
43
            </classpath>
(-)apisupport/harness/jnlp-src/META-INF/services/org.openide.modules.InstalledFileLocator (+2 lines)
Added Link Here
1
#-org.netbeans.core.startup.InstalledFileLocatorImpl
2
org.netbeans.modules.apisupport.jnlplauncher.InstalledFileLocatorImpl
(-)apisupport/harness/jnlp-src/org/netbeans/modules/apisupport/jnlplauncher/InstalledFileLocatorImpl.java (+86 lines)
Added Link Here
1
/*
2
 * The contents of this file are subject to the terms of the Common Development
3
 * and Distribution License (the License). You may not use this file except in
4
 * compliance with the License.
5
 *
6
 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7
 * or http://www.netbeans.org/cddl.txt.
8
 *
9
 * When distributing Covered Code, include this CDDL Header Notice in each file
10
 * and include the License file at http://www.netbeans.org/cddl.txt.
11
 * If applicable, add the following below the CDDL Header, with the fields
12
 * enclosed by brackets [] replaced by your own identifying information:
13
 * "Portions Copyrighted [year] [name of copyright owner]"
14
 *
15
 * The Original Software is NetBeans. The Initial Developer of the Original
16
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17
 * Microsystems, Inc. All Rights Reserved.
18
 */
19
20
package org.netbeans.modules.apisupport.jnlplauncher;
21
22
import java.io.File;
23
import java.net.URI;
24
import java.net.URL;
25
import java.util.Iterator;
26
import org.openide.modules.InstalledFileLocator;
27
import org.openide.util.NbBundle;
28
29
/**
30
 * Special locator for JNLP mode.
31
 * Currently just locates JARs with the special META-INF/exists/$relpath
32
 * entry inserted by common.xml -> <makenjnlp>.
33
 * @author Jesse Glick
34
 */
35
public class InstalledFileLocatorImpl extends InstalledFileLocator {
36
37
    public InstalledFileLocatorImpl() {}
38
39
    public File locate(String relativePath, String codeNameBase, boolean localized) {
40
        if (localized) {
41
            int i = relativePath.lastIndexOf('.');
42
            String baseName, ext;
43
            if (i == -1 || i < relativePath.lastIndexOf('/')) {
44
                baseName = relativePath;
45
                ext = "";
46
            } else {
47
                baseName = relativePath.substring(0, i);
48
                ext = relativePath.substring(i);
49
            }
50
            Iterator<String> it = NbBundle.getLocalizingSuffixes();
51
            while (it.hasNext()) {
52
                String locName = baseName + it.next() + ext;
53
                File f = locate(locName, codeNameBase, false);
54
                if (f != null) {
55
                    return f;
56
                }
57
            }
58
        } else {
59
            String userdir = System.getProperty("netbeans.user");
60
            if (userdir != null) {
61
                File f = new File(userdir, relativePath.replace('/', File.separatorChar));
62
                if (f.exists()) {
63
                    return f;
64
                }
65
            }
66
            String resource = "META-INF/exists/" + relativePath;
67
            ClassLoader loader = Thread.currentThread().getContextClassLoader();
68
            URL found = loader.getResource(resource);
69
            if (found != null) {
70
                String foundS = found.toExternalForm();
71
                String prefix = "jar:";
72
                String suffix = "!/" + resource;
73
                if (foundS.startsWith(prefix) && foundS.endsWith(suffix)) {
74
                    String infix = foundS.substring(prefix.length(), foundS.length() - suffix.length());
75
                    if (infix.startsWith("file:")) {
76
                        File jar = new File(URI.create(infix));
77
                        assert jar.isFile();
78
                        return jar;
79
                    }
80
                }
81
            }
82
        }
83
        return null;
84
    }
85
86
}
(-)apisupport/harness/nbproject/project.properties (-1 / +4 lines)
Lines 15-21 Link Here
15
# Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
15
# Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
16
# Microsystems, Inc. All Rights Reserved.
16
# Microsystems, Inc. All Rights Reserved.
17
17
18
jnlp.cp=${core/bootstrap.dir}/lib/boot.jar
18
jnlp.cp=\
19
    ${core/bootstrap.dir}/lib/boot.jar:\
20
    ${openide/modules.dir}/lib/org-openide-modules.jar:\
21
    ${openide/util.dir}/lib/org-openide-util.jar
19
22
20
extra.module.files=\
23
extra.module.files=\
21
    jnlp/jnlp-launcher.jar,\
24
    jnlp/jnlp-launcher.jar,\
(-)apisupport/harness/nbproject/project.xml (+1 lines)
Lines 38-43 Link Here
38
                <classpath>${jnlp.cp}</classpath>
38
                <classpath>${jnlp.cp}</classpath>
39
                <built-to>build/jnlp-launcher-classes</built-to>
39
                <built-to>build/jnlp-launcher-classes</built-to>
40
                <built-to>${cluster}/jnlp/jnlp-launcher.jar</built-to>
40
                <built-to>${cluster}/jnlp/jnlp-launcher.jar</built-to>
41
                <source-level>1.5</source-level>
41
            </extra-compilation-unit>
42
            </extra-compilation-unit>
42
        </data>
43
        </data>
43
    </configuration>
44
    </configuration>
(-)apisupport/harness/release/README (+9 lines)
Lines 807-812 Link Here
807
http://www.netbeans.org/download/6_0/jnlp/
807
http://www.netbeans.org/download/6_0/jnlp/
808
http://deadlock.nbextras.org/hudson/job/javadoc-nbms/lastSuccessfulBuild/artifact/nbbuild/build/jnlp/
808
http://deadlock.nbextras.org/hudson/job/javadoc-nbms/lastSuccessfulBuild/artifact/nbbuild/build/jnlp/
809
809
810
jnlp.indirect.jars [since 6.0] - optional pattern of JARs in the cluster to load
811
  in JNLP mode even though they are not listed as Class-Path extensions of the
812
  module JAR. The module ought not directly refer to classes in these JARs (it
813
  could not do so in non-JNLP mode) but it may load them reflectively using
814
  InstalledFileLocator using the same path in regular as in JNLP mode. Note that
815
  the physical path on disk to the resulting JAR will not necessarily contain
816
  the directory prefix that the JAR in the cluster uses, so do not expect that
817
  jar.getParentFile() is meaningful.
818
810
jnlp.verify.excludes - the default implementation of "jnlp" task in common.xml
819
jnlp.verify.excludes - the default implementation of "jnlp" task in common.xml
811
  does verification and compares that all files from module NBM are really
820
  does verification and compares that all files from module NBM are really
812
  referenced from the JNLP file. Sometimes not all of them need to be, for
821
  referenced from the JNLP file. Sometimes not all of them need to be, for
(-)apisupport/harness/release/jnlp.xml (+1 lines)
Lines 185-190 Link Here
185
                <replacestring from="$$$$codebase" to="file:${build.jnlp.local.dir}"/><!-- XXX potential SPACE_IN_PATH bug -->
185
                <replacestring from="$$$$codebase" to="file:${build.jnlp.local.dir}"/><!-- XXX potential SPACE_IN_PATH bug -->
186
            </filterchain>
186
            </filterchain>
187
        </copy>
187
        </copy>
188
        <mkdir dir="build/jnlp/netbeans"/> <!-- else fileset will croak -->
188
        <copy todir="${build.jnlp.local.dir}/netbeans/">
189
        <copy todir="${build.jnlp.local.dir}/netbeans/">
189
            <fileset dir="build/jnlp/netbeans">
190
            <fileset dir="build/jnlp/netbeans">
190
                <include name="*.jnlp"/>
191
                <include name="*.jnlp"/>
(-)extbrowser/build.xml (+37 lines)
Lines 18-22 Link Here
18
Microsystems, Inc. All Rights Reserved.
18
Microsystems, Inc. All Rights Reserved.
19
-->
19
-->
20
<project name="extbrowser" default="netbeans" basedir=".">
20
<project name="extbrowser" default="netbeans" basedir=".">
21
21
    <import file="../nbbuild/templates/projectized.xml"/>
22
    <import file="../nbbuild/templates/projectized.xml"/>
23
24
    <target name="jnlp" depends="netbeans">
25
        <property name="dir" location="${jnlp.dest.dir}/${code.name.base.dashes}"/>
26
        <mkdir dir="${dir}"/>
27
        <copy file="${cluster}/${module.jar}" todir="${dir}"/>
28
        <jar jarfile="${dir}/windows.jar">
29
            <fileset dir="${cluster}/modules/lib">
30
                <include name="extbrowser*.dll"/>
31
            </fileset>
32
        </jar>
33
        <signjar alias="${jnlp.signjar.alias}" storepass="${jnlp.signjar.password}" keystore="${jnlp.signjar.keystore}">
34
            <fileset dir="${dir}">
35
                <include name="*.jar"/>
36
            </fileset>
37
        </signjar>
38
        <property file="${manifest.mf}"/>
39
        <property file="${src.dir}/${OpenIDE-Module-Localizing-Bundle}"/>
40
        <echo file="${jnlp.dest.dir}/${code.name.base.dashes}.jnlp"><![CDATA[<?xml version='1.0' encoding='UTF-8'?>
41
<jnlp spec='1.0+' codebase='${jnlp.codebase}'>
42
  <information>
43
   <title>${OpenIDE-Module-Name}</title>
44
   <vendor>NetBeans</vendor>
45
   <description kind='one-line'>${OpenIDE-Module-Short-Description}</description>
46
   <description kind='short'>${OpenIDE-Module-Long-Description}</description>
47
  </information>
48
  <security><all-permissions/></security>
49
  <resources>
50
    <jar href='${code.name.base.dashes}/${code.name.base.dashes}.jar'/>
51
    <jar href='${code.name.base.dashes}/windows.jar'/>
52
  </resources>
53
  <component-desc/>
54
</jnlp>
55
            ]]>
56
        </echo>
57
    </target>
58
22
</project>
59
</project>
(-)java/j2seplatform/nbproject/project.properties (-1 / +1 lines)
Lines 18-23 Link Here
18
javac.compilerargs=-Xlint:unchecked
18
javac.compilerargs=-Xlint:unchecked
19
spec.version.base=1.7.0
19
spec.version.base=1.7.0
20
extra.module.files=modules/ext/org-netbeans-modules-java-j2seplatform-probe.jar
20
extra.module.files=modules/ext/org-netbeans-modules-java-j2seplatform-probe.jar
21
jnlp.indirect.jars=modules/ext/org-netbeans-modules-java-j2seplatform-probe.jar
21
22
22
javadoc.arch=${basedir}/arch.xml
23
javadoc.arch=${basedir}/arch.xml
23
(-)java/j2seproject/nbproject/project.properties (+1 lines)
Lines 27-29 Link Here
27
test-unit-sys-prop.test.ant.home=${cluster}/ant
27
test-unit-sys-prop.test.ant.home=${cluster}/ant
28
test-unit-sys-prop.test.junit.jar=${junit.dir}/modules/ext/junit-3.8.2.jar
28
test-unit-sys-prop.test.junit.jar=${junit.dir}/modules/ext/junit-3.8.2.jar
29
extra.module.files=ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar
29
extra.module.files=ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar
30
jnlp.indirect.jars=ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar
(-)junit/nbproject/project.properties (+3 lines)
Lines 24-26 Link Here
24
extra.module.files=\
24
extra.module.files=\
25
    docs/junit-3.8.2-api.zip,\
25
    docs/junit-3.8.2-api.zip,\
26
    modules/ext/junit*.jar
26
    modules/ext/junit*.jar
27
jnlp.indirect.jars=\
28
    docs/junit-3.8.2-api.zip,\
29
    modules/ext/junit*.jar
(-)nbbuild/build.properties (-5 / +3 lines)
Lines 351-361 Link Here
351
351
352
# list of modules for jnlp:
352
# list of modules for jnlp:
353
config.fixedmodules.jnlp=
353
config.fixedmodules.jnlp=
354
config.modules.jnlp=${nb.cluster.platform},\
354
config.modules.jnlp=\
355
    ${nb.pkg.ideextensions},\
355
    ${nb.cluster.platform},\
356
    ${nb.pkg.idesupport},\
356
    ${nb.cluster.ide}
357
    ant,\
358
    ant/browsetask
359
357
360
# commit validation test depencies
358
# commit validation test depencies
361
config.commit.validation=openide/windows,\
359
config.commit.validation=openide/windows,\
(-)nbbuild/antsrc/org/netbeans/nbbuild/MakeJNLP.java (-28 / +95 lines)
Lines 26-37 Link Here
26
import java.io.StringWriter;
26
import java.io.StringWriter;
27
import java.io.Writer;
27
import java.io.Writer;
28
import java.util.ArrayList;
28
import java.util.ArrayList;
29
import java.util.Collections;
29
import java.util.Enumeration;
30
import java.util.Enumeration;
30
import java.util.HashMap;
31
import java.util.HashMap;
32
import java.util.HashSet;
31
import java.util.Iterator;
33
import java.util.Iterator;
32
import java.util.List;
34
import java.util.List;
33
import java.util.Map;
35
import java.util.Map;
34
import java.util.Properties;
36
import java.util.Properties;
37
import java.util.Set;
35
import java.util.StringTokenizer;
38
import java.util.StringTokenizer;
36
import java.util.jar.JarEntry;
39
import java.util.jar.JarEntry;
37
import java.util.jar.JarFile;
40
import java.util.jar.JarFile;
Lines 46-52 Link Here
46
import org.apache.tools.ant.Task;
49
import org.apache.tools.ant.Task;
47
import org.apache.tools.ant.taskdefs.Copy;
50
import org.apache.tools.ant.taskdefs.Copy;
48
import org.apache.tools.ant.taskdefs.SignJar;
51
import org.apache.tools.ant.taskdefs.SignJar;
52
import org.apache.tools.ant.taskdefs.Zip;
49
import org.apache.tools.ant.types.FileSet;
53
import org.apache.tools.ant.types.FileSet;
54
import org.apache.tools.ant.types.ZipFileSet;
50
import org.xml.sax.SAXException;
55
import org.xml.sax.SAXException;
51
56
52
/** Generates JNLP files for signed versions of the module JAR files.
57
/** Generates JNLP files for signed versions of the module JAR files.
Lines 116-121 Link Here
116
        permissions = s;
121
        permissions = s;
117
    }
122
    }
118
    
123
    
124
    private FileSet indirectJars;
125
    /**
126
     * Other JARs which should be copied into the destination directory and referred to as resources,
127
     * even though they are not listed as Class-Path extensions of the module and would not normally
128
     * be in its effective classpath. The basedir of the fileset should be a cluster root; for each
129
     * such JAR, a file META-INF/exists/$relpath will be inserted in the JAR, where $relpath is the
130
     * relative path within the cluster. This permits the JAR to be located at runtime in a flat classpath,
131
     * using ClassLoader.getResource.
132
     */
133
    public void addIndirectJars(FileSet fs) {
134
        indirectJars = fs;
135
    }
136
    
119
    public void execute() throws BuildException {
137
    public void execute() throws BuildException {
120
        if (target == null) throw new BuildException("Output dir must be provided");
138
        if (target == null) throw new BuildException("Output dir must be provided");
121
        if (files == null) throw new BuildException("modules must be provided");
139
        if (files == null) throw new BuildException("modules must be provided");
Lines 128-133 Link Here
128
    }
146
    }
129
    
147
    
130
    private void generateFiles() throws IOException, BuildException {
148
    private void generateFiles() throws IOException, BuildException {
149
        Set<String> indirectJarPaths = Collections.emptySet();
150
        if (indirectJars != null) {
151
            DirectoryScanner scan = indirectJars.getDirectoryScanner(getProject());
152
            indirectJarPaths = new HashSet<String>();
153
            for (String f : scan.getIncludedFiles()) {
154
                indirectJarPaths.add(f.replace(File.pathSeparatorChar, '/'));
155
            }
156
        }
157
131
        DirectoryScanner scan = files.getDirectoryScanner(getProject());
158
        DirectoryScanner scan = files.getDirectoryScanner(getProject());
132
        for (String f : scan.getIncludedFiles()) {
159
        for (String f : scan.getIncludedFiles()) {
133
            File jar = new File (files.getDir(getProject()), f);
160
            File jar = new File (files.getDir(getProject()), f);
Lines 170-179 Link Here
170
                shrt = prop.getProperty("OpenIDE-Module-Long-Description", oneline);
197
                shrt = prop.getProperty("OpenIDE-Module-Long-Description", oneline);
171
            }
198
            }
172
            
199
            
173
            Map<String,List<File>> localizedFiles = verifyExtensions(jar, theJar.getManifest(), dashcnb, codenamebase, verify);
200
            Map<String,List<File>> localizedFiles = verifyExtensions(jar, theJar.getManifest(), dashcnb, codenamebase, verify, indirectJarPaths);
174
            
201
            
202
            new File(target, dashcnb).mkdir();
175
203
176
            File signed = new File(target, jar.getName());
204
            File signed = new File(new File(target, dashcnb), jar.getName());
177
            File jnlp = new File(target, dashcnb + ".jnlp");
205
            File jnlp = new File(target, dashcnb + ".jnlp");
178
            
206
            
179
            StringWriter writeJNLP = new StringWriter();
207
            StringWriter writeJNLP = new StringWriter();
Lines 187-195 Link Here
187
            writeJNLP.write("  </information>\n");
215
            writeJNLP.write("  </information>\n");
188
            writeJNLP.write(permissions +"\n");
216
            writeJNLP.write(permissions +"\n");
189
            writeJNLP.write("  <resources>\n");
217
            writeJNLP.write("  <resources>\n");
190
            writeJNLP.write("     <jar href='"); writeJNLP.write(jar.getName()); writeJNLP.write("'/>\n");
218
            writeJNLP.write("     <jar href='" + dashcnb + '/' + jar.getName() + "'/>\n");
191
            
219
            
192
            processExtensions(jar, theJar.getManifest(), writeJNLP, dashcnb, codebase);
220
            processExtensions(jar, theJar.getManifest(), writeJNLP, dashcnb, codebase);
221
            processIndirectJars(writeJNLP, dashcnb, codebase);
193
            
222
            
194
            writeJNLP.write("  </resources>\n");
223
            writeJNLP.write("  </resources>\n");
195
            
224
            
Lines 202-214 Link Here
202
                    writeJNLP.write("  <resources locale='" + locale + "'>\n");
231
                    writeJNLP.write("  <resources locale='" + locale + "'>\n");
203
232
204
                    for (File n : files) {
233
                    for (File n : files) {
205
                        File t = new File(target, n.getName());
234
                        File t = new File(new File(target, dashcnb), n.getName());
206
                        
235
                        
207
                        getSignTask().setJar(n);
236
                        getSignTask().setJar(n);
208
                        getSignTask().setSignedjar(t);
237
                        getSignTask().setSignedjar(t);
209
                        getSignTask().execute();
238
                        getSignTask().execute();
210
                        
239
                        
211
                        writeJNLP.write("     <jar href='"); writeJNLP.write(n.getName()); writeJNLP.write("'/>\n");
240
                        writeJNLP.write("    <jar href='" + dashcnb + '/' + n.getName() + "'/>\n");
212
                    }
241
                    }
213
242
214
                    writeJNLP.write("  </resources>\n");
243
                    writeJNLP.write("  </resources>\n");
Lines 234-240 Link Here
234
        
263
        
235
    }
264
    }
236
    
265
    
237
    private Map<String,List<File>> verifyExtensions(File f, Manifest mf, String dashcnb, String codebasename, boolean verify) throws IOException, BuildException {
266
    private Map<String,List<File>> verifyExtensions(File f, Manifest mf, String dashcnb, String codebasename, boolean verify, Set<String> indirectJarPaths) throws IOException, BuildException {
238
        Map<String,List<File>> localizedFiles = new HashMap<String,List<File>>();
267
        Map<String,List<File>> localizedFiles = new HashMap<String,List<File>>();
239
        
268
        
240
        
269
        
Lines 302-307 Link Here
302
        }
331
        }
303
332
304
        fileToOwningModule.remove("ant/nblib/" + dashcnb + ".jar");
333
        fileToOwningModule.remove("ant/nblib/" + dashcnb + ".jar");
334
335
        fileToOwningModule.keySet().removeAll(indirectJarPaths);
305
        
336
        
306
        if (verifyExcludes != null) {
337
        if (verifyExcludes != null) {
307
            StringTokenizer tok = new StringTokenizer(verifyExcludes, ", ");
338
            StringTokenizer tok = new StringTokenizer(verifyExcludes, ", ");
Lines 352-361 Link Here
352
    private void processExtensions(File f, Manifest mf, Writer fileWriter, String dashcnb, String codebase) throws IOException, BuildException {
383
    private void processExtensions(File f, Manifest mf, Writer fileWriter, String dashcnb, String codebase) throws IOException, BuildException {
353
384
354
        File nblibJar = new File(new File(new File(f.getParentFile().getParentFile(), "ant"), "nblib"), dashcnb + ".jar");
385
        File nblibJar = new File(new File(new File(f.getParentFile().getParentFile(), "ant"), "nblib"), dashcnb + ".jar");
355
        //System.err.println(nblibJar + ".isFile=" + nblibJar.isFile());
356
        if (nblibJar.isFile()) {
386
        if (nblibJar.isFile()) {
357
            File ext = new File(target, "ant-nblib-" + nblibJar.getName());
387
            File ext = new File(new File(target, dashcnb), "ant-nblib-" + nblibJar.getName());
358
            fileWriter.write("    <jar href='" + ext.getName() + "'/>\n");
388
            fileWriter.write("    <jar href='" + dashcnb + '/' + ext.getName() + "'/>\n");
359
            getSignTask().setJar(nblibJar);
389
            getSignTask().setJar(nblibJar);
360
            getSignTask().setSignedjar(ext);
390
            getSignTask().setSignedjar(ext);
361
            getSignTask().execute();
391
            getSignTask().execute();
Lines 379-414 Link Here
379
                n = n.substring(0, n.length() - 4);
409
                n = n.substring(0, n.length() - 4);
380
            }
410
            }
381
            
411
            
382
            if (isSigned (e)) {
412
            if (isSigned(e) != null) {
383
                Copy copy = (Copy)getProject().createTask("copy");
413
                Copy copy = (Copy)getProject().createTask("copy");
384
                copy.setFile(e);
414
                copy.setFile(e);
385
                File t = new File(target, e.getName());
415
                File t = new File(new File(target, dashcnb), s.replace('/', '-'));
386
                copy.setTofile(t);
416
                copy.setTofile(t);
387
                copy.execute();
417
                copy.execute();
388
                
418
                
389
                String  extJnlpName = dashcnb + "-ext-" + n + ".jnlp";
419
                String extJnlpName = t.getName().replaceFirst("\\.jar$", "") + ".jnlp";
390
                File jnlp = new File(target, extJnlpName);
420
                File jnlp = new File(new File(target, dashcnb), extJnlpName);
391
421
392
                FileWriter writeJNLP = new FileWriter(jnlp);
422
                FileWriter writeJNLP = new FileWriter(jnlp);
393
                writeJNLP.write("<?xml version='1.0' encoding='UTF-8'?>\n");
423
                writeJNLP.write("<?xml version='1.0' encoding='UTF-8'?>\n");
394
                writeJNLP.write("<jnlp spec='1.0+' codebase='" + codebase + "' >\n");
424
                writeJNLP.write("<jnlp spec='1.0+' codebase='" + codebase + "' >\n");
395
                writeJNLP.write("  <information>\n");
425
                writeJNLP.write("  <information>\n");
396
                writeJNLP.write("   <title>" + n + "</title>\n");
426
                writeJNLP.write("    <title>" + n + "</title>\n");
397
                writeJNLP.write("   <vendor>NetBeans</vendor>\n");
427
                writeJNLP.write("    <vendor>NetBeans</vendor>\n");
398
                writeJNLP.write("  </information>\n");
428
                writeJNLP.write("  </information>\n");
399
                writeJNLP.write(permissions +"\n");
429
                writeJNLP.write(permissions +"\n");
400
                writeJNLP.write("  <resources>\n");
430
                writeJNLP.write("  <resources>\n");
401
                writeJNLP.write("     <jar href='"); writeJNLP.write(e.getName()); writeJNLP.write("'/>\n");
431
                writeJNLP.write("    <jar href='" + dashcnb + '/' + t.getName() + "'/>\n");
402
                writeJNLP.write("  </resources>\n");
432
                writeJNLP.write("  </resources>\n");
403
                writeJNLP.write("  <component-desc/>\n");
433
                writeJNLP.write("  <component-desc/>\n");
404
                writeJNLP.write("</jnlp>\n");
434
                writeJNLP.write("</jnlp>\n");
405
                writeJNLP.close();
435
                writeJNLP.close();
406
                
436
                
407
                fileWriter.write("    <extension name='" + e.getName() + "' href='" + extJnlpName + "'/>\n");
437
                fileWriter.write("    <extension name='" + e.getName().replaceFirst("\\.jar$", "") + "' href='" + dashcnb + '/' + extJnlpName + "'/>\n");
408
            } else {
438
            } else {
409
                File ext = new File(target, e.getName());
439
                File ext = new File(new File(target, dashcnb), s.replace('/', '-'));
410
                
440
                
411
                fileWriter.write("    <jar href='" + e.getName() + "'/>\n");
441
                fileWriter.write("    <jar href='" + dashcnb + '/' + ext.getName() + "'/>\n");
412
442
413
                getSignTask().setJar(e);
443
                getSignTask().setJar(e);
414
                getSignTask().setSignedjar(ext);
444
                getSignTask().setSignedjar(ext);
Lines 416-421 Link Here
416
            }
446
            }
417
        }
447
        }
418
    }
448
    }
449
450
    private void processIndirectJars(Writer fileWriter, String dashcnb, String codebase) throws IOException, BuildException {
451
        DirectoryScanner scan = indirectJars.getDirectoryScanner(getProject());
452
        for (String f : scan.getIncludedFiles()) {
453
            File jar = new File(scan.getBasedir(), f);
454
            String rel = f.replace(File.separatorChar, '/');
455
            String sig = isSigned(jar);
456
            // javaws will reject .zip files even with signatures.
457
            String rel2 = rel.endsWith(".jar") ? rel : rel.replaceFirst("(\\.zip)?$", ".jar");
458
            File ext = new File(new File(target, dashcnb), rel2.replace('/', '-').replaceFirst("^modules-", ""));
459
            Zip jartask = (Zip) getProject().createTask("jar");
460
            jartask.setDestFile(ext);
461
            ZipFileSet zfs = new ZipFileSet();
462
            zfs.setSrc(jar);
463
            if (sig != null) {
464
                // Need to cancel original signature since we are adding one entry to the JAR.
465
                zfs.setExcludes("META-INF/" + sig + ".*");
466
            }
467
            jartask.addZipfileset(zfs);
468
            zfs = new ZipFileSet();
469
            File blank = File.createTempFile("empty", "");
470
            blank.deleteOnExit();
471
            zfs.setFile(blank);
472
            zfs.setFullpath("META-INF/exists/" + rel);
473
            jartask.addZipfileset(zfs);
474
            jartask.execute();
475
            blank.delete();
476
            fileWriter.write("    <jar href='" + dashcnb + '/' + ext.getName() + "'/>\n");
477
            getSignTask().setJar(ext);
478
            getSignTask().setSignedjar(null);
479
            getSignTask().execute();
480
        }
481
    }
419
    
482
    
420
    private static String relative(File file, File root) {
483
    private static String relative(File file, File root) {
421
        String sfile = file.toString().replace(File.separatorChar, '/');
484
        String sfile = file.toString().replace(File.separatorChar, '/');
Lines 426-443 Link Here
426
        return sfile;
489
        return sfile;
427
    }
490
    }
428
    
491
    
429
    private static boolean isSigned(File f) throws IOException {
492
    /** return alias if signed, or null if not */
493
    private static String isSigned(File f) throws IOException {
430
        JarFile jar = new JarFile(f);
494
        JarFile jar = new JarFile(f);
431
        Enumeration<JarEntry> en = jar.entries();
495
        try {
432
        while (en.hasMoreElements()) {
496
            Enumeration<JarEntry> en = jar.entries();
433
            JarEntry e = en.nextElement();
497
            while (en.hasMoreElements()) {
434
            if (e.getName().endsWith(".SF")) {
498
                Matcher m = SF.matcher(en.nextElement().getName());
435
                jar.close();
499
                if (m.matches()) {
436
                return true;
500
                    return m.group(1);
501
                }
437
            }
502
            }
503
            return null;
504
        } finally {
505
            jar.close();
438
        }
506
        }
439
        jar.close();
440
        return false;
441
    }
507
    }
508
    private static final Pattern SF = Pattern.compile("META-INF/(.+)\\.SF");
442
    
509
    
443
}
510
}
(-)nbbuild/templates/common.xml (+1 lines)
Lines 259-264 Link Here
259
            <modules dir="${cluster}" >
259
            <modules dir="${cluster}" >
260
                <include name="${module.jar}" />
260
                <include name="${module.jar}" />
261
            </modules>
261
            </modules>
262
            <indirectjars dir="${cluster}" includes="${jnlp.indirect.jars}"/>
262
        </makejnlp>
263
        </makejnlp>
263
    </target>
264
    </target>
264
    
265
    
(-)websvc/jaxrpc16/nbproject/project.properties (+1 lines)
Lines 29-31 Link Here
29
    modules/ext/jaxrpc16/saaj-api.jar,\
29
    modules/ext/jaxrpc16/saaj-api.jar,\
30
    modules/ext/jaxrpc16/saaj-impl.jar,\
30
    modules/ext/jaxrpc16/saaj-impl.jar,\
31
    modules/ext/jaxrpc16/xsdlib.jar
31
    modules/ext/jaxrpc16/xsdlib.jar
32
jnlp.indirect.jars=${extra.module.files}
(-)websvc/jaxws20/nbproject/project.properties (+7 lines)
Lines 32-34 Link Here
32
    modules/ext/jaxws20/saaj-api.jar,\
32
    modules/ext/jaxws20/saaj-api.jar,\
33
    modules/ext/jaxws20/saaj-impl.jar,\
33
    modules/ext/jaxws20/saaj-impl.jar,\
34
    modules/ext/jaxws20/sjsxp.jar
34
    modules/ext/jaxws20/sjsxp.jar
35
jnlp.indirect.jars=\
36
    modules/ext/jaxws20/FastInfoset.jar,\
37
    modules/ext/jaxws20/resolver.jar,\
38
    modules/ext/jaxws20/saaj-impl.jar,\
39
    modules/ext/jaxws20/saaj-api.jar,\
40
    modules/ext/jaxws20/jsr250-api.jar,\
41
    modules/ext/jaxws20/http.jar

Return to bug 90498