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 152960
Collapse All | Expand All

(-)a/apisupport.harness/nbproject/project.properties (+2 lines)
Lines 70-75 Link Here
70
    org/netbeans/nbbuild/Branding*.class,\
70
    org/netbeans/nbbuild/Branding*.class,\
71
    org/netbeans/nbbuild/CreateModuleXML*.class,\
71
    org/netbeans/nbbuild/CreateModuleXML*.class,\
72
    org/netbeans/nbbuild/CustomJavac*.class,\
72
    org/netbeans/nbbuild/CustomJavac*.class,\
73
    org/netbeans/nbbuild/ConvertClusterPath*.class,\
73
    org/netbeans/nbbuild/FixDependencies*.class,\
74
    org/netbeans/nbbuild/FixDependencies*.class,\
74
    org/netbeans/nbbuild/FixTestDependencies*.class,\
75
    org/netbeans/nbbuild/FixTestDependencies*.class,\
75
    org/netbeans/nbbuild/JHIndexer*.class,\
76
    org/netbeans/nbbuild/JHIndexer*.class,\
Lines 84-89 Link Here
84
    org/netbeans/nbbuild/ModuleSelector*.class,\
85
    org/netbeans/nbbuild/ModuleSelector*.class,\
85
    org/netbeans/nbbuild/ModuleTracking*.class,\
86
    org/netbeans/nbbuild/ModuleTracking*.class,\
86
    org/netbeans/nbbuild/ParseProjectXml*.class,\
87
    org/netbeans/nbbuild/ParseProjectXml*.class,\
88
    org/netbeans/nbbuild/PathFileSet*.class,\
87
    org/netbeans/nbbuild/ShorterPaths*.class,\
89
    org/netbeans/nbbuild/ShorterPaths*.class,\
88
    org/netbeans/nbbuild/SortSuiteModules*.class,\
90
    org/netbeans/nbbuild/SortSuiteModules*.class,\
89
    org/netbeans/nbbuild/UpdateTracking*.class,\
91
    org/netbeans/nbbuild/UpdateTracking*.class,\
(-)a/apisupport.harness/release/build.xml (-6 / +16 lines)
Lines 48-58 Link Here
48
    <target name="taskdefs" unless="harness.taskdefs.done">
48
    <target name="taskdefs" unless="harness.taskdefs.done">
49
        <dirname property="harness.dir" file="${harness.file}"/>
49
        <dirname property="harness.dir" file="${harness.file}"/>
50
        <taskdef classpath="${harness.dir}/tasks.jar" resource="org/netbeans/nbbuild/taskdefs.properties"/>
50
        <taskdef classpath="${harness.dir}/tasks.jar" resource="org/netbeans/nbbuild/taskdefs.properties"/>
51
        <typedef name="pathfileset" classname="org.netbeans.nbbuild.PathFileSet"
52
                 classpath="${harness.dir}/tasks.jar"/>
51
        <property name="harness.taskdefs.done" value="true"/>
53
        <property name="harness.taskdefs.done" value="true"/>
52
    </target>
54
    </target>
53
55
54
    <target name="common-init" depends="taskdefs">
56
    <target name="common-init" depends="taskdefs">
55
        <property name="netbeans.javadoc.dir" location="build/javadoc"/>
57
        <property name="netbeans.javadoc.dir" location="build/javadoc"/>
58
        <convertclusterpath from="${cluster.path.evaluated}" to="cluster.path" id="cluster.path.id" basedir="${suite.dir}"/>
56
    </target>
59
    </target>
57
60
58
    <target name="basic-init" depends="projectized-common.basic-init">
61
    <target name="basic-init" depends="projectized-common.basic-init">
Lines 152-160 Link Here
152
        <path id="test.unit.lib.cp">
155
        <path id="test.unit.lib.cp">
153
            <pathelement path="${test.unit.lib.cp}"/> <!-- for manual override -->
156
            <pathelement path="${test.unit.lib.cp}"/> <!-- for manual override -->
154
            <!-- As a fallback for old platforms which do not include the right modules: -->
157
            <!-- As a fallback for old platforms which do not include the right modules: -->
155
            <fileset dir="${netbeans.dest.dir}">
158
            <pathfileset include="modules/ext/junit-*.jar">
156
                <include name="*/modules/ext/junit-*.jar"/>
159
                <path refid="cluster.path.id"/>
157
            </fileset>
160
            </pathfileset>
158
            <fileset dir="${netbeans.home}/..">
161
            <fileset dir="${netbeans.home}/..">
159
                <include name="*/modules/ext/junit-*.jar"/>
162
                <include name="*/modules/ext/junit-*.jar"/>
160
            </fileset>
163
            </fileset>
Lines 200-219 Link Here
200
    </target>
203
    </target>
201
204
202
    <target name="run" depends="netbeans">
205
    <target name="run" depends="netbeans">
203
        <ant antfile="${harness.dir}/run.xml" target="run"/>
206
        <ant antfile="${harness.dir}/run.xml" target="run">
207
            <reference refid="cluster.path.id"/>
208
        </ant>
204
    </target>
209
    </target>
205
210
206
    <target name="profile" depends="netbeans,-jdk-presetdef-nbprofiledirect">
211
    <target name="profile" depends="netbeans,-jdk-presetdef-nbprofiledirect">
207
        <ant antfile="${harness.dir}/run.xml" target="profile"/>
212
        <ant antfile="${harness.dir}/run.xml" target="profile">
213
            <reference refid="cluster.path.id"/>
214
        </ant>
208
    </target>
215
    </target>
209
216
210
    <target name="debug" depends="netbeans,-jdk-presetdef-nbjpdastart">
217
    <target name="debug" depends="netbeans,-jdk-presetdef-nbjpdastart">
211
        <ant antfile="${harness.dir}/run.xml" target="debug"/>
218
        <ant antfile="${harness.dir}/run.xml" target="debug">
219
            <reference refid="cluster.path.id"/>
220
        </ant>
212
    </target>
221
    </target>
213
222
214
    <target name="reload" depends="netbeans">
223
    <target name="reload" depends="netbeans">
215
        <ant antfile="${harness.dir}/run.xml" target="run">
224
        <ant antfile="${harness.dir}/run.xml" target="run">
216
            <property name="run.args" value='--reload "${cluster}/${module.jar}"'/>
225
            <property name="run.args" value='--reload "${cluster}/${module.jar}"'/>
226
            <reference refid="cluster.path.id"/>
217
        </ant>
227
        </ant>
218
    </target>
228
    </target>
219
229
(-)a/apisupport.harness/release/jnlp.xml (-10 / +13 lines)
Lines 110-121 Link Here
110
        <property name="enabled.clusters" value=""/>
110
        <property name="enabled.clusters" value=""/>
111
        <property name="disabled.clusters" value=""/>
111
        <property name="disabled.clusters" value=""/>
112
        
112
        
113
        <fileset id="jnlp.included.modules" dir="${netbeans.dest.dir}">
113
        <pathfileset id="jnlp.included.modules" >
114
            <path refid="cluster.path.id"/>
114
            <and>
115
            <and>
115
                <or>
116
                <or>
116
                    <filename name="*/modules/**/*.jar"/>
117
                    <filename name="**/modules/**/*.jar"/>
117
                    <filename name="*/lib/**/*.jar"/>
118
                    <filename name="**/lib/**/*.jar"/>
118
                    <filename name="*/core/**/*.jar"/>
119
                    <filename name="**/core/**/*.jar"/>
119
                </or>
120
                </or>
120
                <not>
121
                <not>
121
                    <filename name="**/update/**/*.jar"/>
122
                    <filename name="**/update/**/*.jar"/>
Lines 126-132 Link Here
126
                    <param name="excludeClusters" value="${disabled.clusters}"/>
127
                    <param name="excludeClusters" value="${disabled.clusters}"/>
127
                </custom>
128
                </custom>
128
            </and>
129
            </and>
129
        </fileset>
130
        </pathfileset>
130
        <property name="jnlp.sign.jars" value="true"/>
131
        <property name="jnlp.sign.jars" value="true"/>
131
        <property name="jnlp.signjar.keystore" location="build/default.keystore"/>
132
        <property name="jnlp.signjar.keystore" location="build/default.keystore"/>
132
        <property name="jnlp.signjar.alias" value="jnlp"/>
133
        <property name="jnlp.signjar.alias" value="jnlp"/>
Lines 171-177 Link Here
171
            permissions="${jnlp.permissions}"
172
            permissions="${jnlp.permissions}"
172
            signjars="${jnlp.sign.jars}"
173
            signjars="${jnlp.sign.jars}"
173
        >
174
        >
174
            <modules refid="jnlp.included.modules"/>
175
            <resources refid="jnlp.included.modules"/>
175
        </makejnlp>
176
        </makejnlp>
176
    </target>
177
    </target>
177
178
Lines 193-199 Link Here
193
            dir="${jnlp.master.dir}"
194
            dir="${jnlp.master.dir}"
194
            codebase="${jnlp.platform.codebase}"
195
            codebase="${jnlp.platform.codebase}"
195
        >
196
        >
196
            <modules refid="jnlp.included.modules"/>
197
            <resources refid="jnlp.included.modules"/>
197
        </makemasterjnlp>
198
        </makemasterjnlp>
198
    </target>
199
    </target>
199
    
200
    
Lines 413-421 Link Here
413
        <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
414
        <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
414
        <nbjpdastart name="NetBeans" addressproperty="debug.port" transport="dt_socket">
415
        <nbjpdastart name="NetBeans" addressproperty="debug.port" transport="dt_socket">
415
            <classpath>
416
            <classpath>
416
                <fileset dir="${netbeans.dest.dir}">
417
                <pathfileset>
417
                    <include name="**/*.jar"/>
418
                    <path refid="cluster.path.id"/>
418
                </fileset>
419
                    <filename name="**/*.jar"/>
420
                </pathfileset>
419
                <fileset dir="${cluster}">
421
                <fileset dir="${cluster}">
420
                    <include name="**/*.jar"/>
422
                    <include name="**/*.jar"/>
421
                </fileset>
423
                </fileset>
Lines 425-430 Link Here
425
        <property name="debug.args" value="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,suspend=${debug.pause},server=n,address=${debug.port}"/>
427
        <property name="debug.args" value="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,suspend=${debug.pause},server=n,address=${debug.port}"/>
426
        <antcall target="run">
428
        <antcall target="run">
427
            <param name="run.args" value="${debug.args}"/>
429
            <param name="run.args" value="${debug.args}"/>
430
            <reference refid="cluster.path.id"/>
428
        </antcall>
431
        </antcall>
429
    </target>
432
    </target>
430
433
(-)a/apisupport.harness/release/run.xml (-38 / +29 lines)
Lines 44-58 Link Here
44
44
45
    <target name="-init">
45
    <target name="-init">
46
        <property name="run.jdkhome" location="${nbjdk.home}"/>
46
        <property name="run.jdkhome" location="${nbjdk.home}"/>
47
        <condition property="test.user.dir" value="${suite.dir}/build/testuserdir">
47
        <condition property="test.user.dir" value="${suite.dir}/build/testuserdir" else="build/testuserdir">
48
            <isset property="suite.dir"/>
48
            <isset property="suite.dir"/>
49
        </condition>
49
        </condition>
50
        <property name="test.user.dir" location="build/testuserdir"/>
50
        <condition property="suite.dir" value="${basedir}">
51
        <property name="install" location="${netbeans.dest.dir}"/>
51
            <not>
52
                <isset property="suite.dir"/>
53
            </not>
54
        </condition>
52
        <property name="run.args.common" value='--userdir "${test.user.dir}" -J-Dnetbeans.logger.console=true -J-ea'/>
55
        <property name="run.args.common" value='--userdir "${test.user.dir}" -J-Dnetbeans.logger.console=true -J-ea'/>
53
        <!-- In case run from a suite module, to get app.name and/or branding.token: -->
56
        <!-- In case run from a suite module, to get app.name and/or branding.token: -->
57
        <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
58
        <property file="${suite.dir}/nbproject/platform.properties"/>
54
        <property file="${suite.dir}/nbproject/private/private.properties"/>
59
        <property file="${suite.dir}/nbproject/private/private.properties"/>
55
        <property file="${suite.dir}/nbproject/project.properties"/>
60
        <property file="${suite.dir}/nbproject/project.properties"/>
61
        <!-- CP with id="cluster.path.id" is expected to be passed as parameter to run.xml -->
62
        <pathconvert property="install">
63
            <path refid="cluster.path.id"/>
64
            <regexpmapper from="(.*)platform[0-9]*$$" to="\1"/>
65
        </pathconvert>
56
        <property name="run.app.exe" value="bin\nb.exe"/>
66
        <property name="run.app.exe" value="bin\nb.exe"/>
57
        <property name="run.app.sh" value="bin/netbeans"/>
67
        <property name="run.app.sh" value="bin/netbeans"/>
58
        <property name="run.exe.candidate" location="${install}\${run.app.exe}"/>
68
        <property name="run.exe.candidate" location="${install}\${run.app.exe}"/>
Lines 88-132 Link Here
88
        <property name="run.sh" location="${run.sh.candidate}"/>
98
        <property name="run.sh" location="${run.sh.candidate}"/>
89
        <mkdir dir="${test.user.dir}/etc"/>
99
        <mkdir dir="${test.user.dir}/etc"/>
90
        <echo file="${test.user.dir}/etc/netbeans.conf">netbeans_extraclusters="${cluster}"</echo>
100
        <echo file="${test.user.dir}/etc/netbeans.conf">netbeans_extraclusters="${cluster}"</echo>
91
        <property name="run.args.prepared" value=""/>
101
        <property name="run.args.prepared" value=''/>
92
    </target>
102
    </target>
93
103
94
    <target name="-prepare-as-platform" depends="-init" if="app.name">
104
    <target name="-prepare-as-platform" depends="-init" if="app.name">
95
        <property name="disabled.modules" value=""/>
105
        <property name="disabled.modules" value=""/>
96
        <property name="enabled.clusters" value=""/>
106
        <fail message="Platform cluster is not present in cluster.path: '${cluster.path}'">
97
        <property name="disabled.clusters" value=""/>
98
        <pathconvert property="run.platform.update.tracking">
99
            <path>
100
                <fileset dir="${netbeans.dest.dir}">
101
                    <include name="**/update_tracking/*.xml"/>
102
                </fileset>
103
            </path>
104
        </pathconvert>
105
        <pathconvert property="run.platform.clusters.duplicates" pathsep=",">
106
            <path>
107
                <fileset dir="${netbeans.dest.dir}">
108
                    <selector>
109
                        <custom classpath="${harness.dir}/tasks.jar" classname="org.netbeans.nbbuild.ModuleSelector">
110
                            <param name="excludeModules" value="${disabled.modules}"/>
111
                            <param name="includeClusters" value="${enabled.clusters}"/>
112
                            <param name="excludeClusters" value="${disabled.clusters}"/>
113
                            <param name="updateTrackingFiles" value="${run.platform.update.tracking}"/>
114
                        </custom>
115
                    </selector>
116
                </fileset>
117
            </path>
118
            <mapper type="regexp" from="[/\\]([^/\\]+)[/\\](config[/\\]Modules|update_tracking)[/\\]" to="\1"/> <!-- #71849, #73494 -->
119
        </pathconvert>
120
        <fail message="Must have at least one cluster from the platform">
121
            <!-- Otherwise ${run.platform.clusters} gets filled with nonsense. -->
122
            <condition>
107
            <condition>
123
                <equals arg1="${run.platform.clusters.duplicates}" arg2=""/>
108
                <not>
109
                    <matches string="${cluster.path}" pattern="[\\/]platform[0-9]*([;:]|$)"/>
110
                </not>
124
            </condition>
111
            </condition>
125
        </fail>
112
        </fail>
126
        <pathconvert property="run.platform.clusters">
113
        <pathconvert property="run.platform.clusters">
127
            <path>
114
            <path>
128
                <pathelement location="${cluster}"/>
115
                <pathelement location="${cluster}"/>
129
                <dirset dir="${netbeans.dest.dir}" includes="${run.platform.clusters.duplicates}" excludes="platform*"/>
116
                <!-- Does not exclude clusters in which all modules are excluded, shouldn't be a problem -->
117
                <path refid="cluster.path.id"/>
130
            </path>
118
            </path>
131
        </pathconvert>
119
        </pathconvert>
132
        <pathconvert property="run.exe">
120
        <pathconvert property="run.exe">
Lines 144-149 Link Here
144
    </target>
132
    </target>
145
133
146
    <target name="run" depends="-prepare-as-app,-prepare-as-platform">
134
    <target name="run" depends="-prepare-as-app,-prepare-as-platform">
135
        <fail if="netbeans.dest.dir" message="APISupport module or suite should not set netbeans.dest.dir (= ${netbeans.dest.dir})."/>
147
        <touch file="${cluster}/.lastModified"/> <!-- #138427 -->
136
        <touch file="${cluster}/.lastModified"/> <!-- #138427 -->
148
        <property name="run.args" value=""/>
137
        <property name="run.args" value=""/>
149
        <property name="run.args.extra" value=""/>
138
        <property name="run.args.extra" value=""/>
Lines 183-191 Link Here
183
        <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
172
        <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
184
        <nbjpdastart name="NetBeans" addressproperty="debug.port" transport="dt_socket">
173
        <nbjpdastart name="NetBeans" addressproperty="debug.port" transport="dt_socket">
185
            <classpath>
174
            <classpath>
186
                <fileset dir="${netbeans.dest.dir}">
175
                <pathfileset include="**/*.jar">
187
                    <include name="**/*.jar"/>
176
                    <path refid="cluster.path.id"/>
188
                </fileset>
177
                </pathfileset>
189
                <fileset dir="${cluster}">
178
                <fileset dir="${cluster}">
190
                    <include name="**/*.jar"/>
179
                    <include name="**/*.jar"/>
191
                </fileset>
180
                </fileset>
Lines 195-200 Link Here
195
        <property name="debug.args" value="-J-Xdebug -J-Xnoagent -J-Xrunjdwp:transport=dt_socket,suspend=${debug.pause},server=n,address=${debug.port}"/>
184
        <property name="debug.args" value="-J-Xdebug -J-Xnoagent -J-Xrunjdwp:transport=dt_socket,suspend=${debug.pause},server=n,address=${debug.port}"/>
196
        <antcall target="run">
185
        <antcall target="run">
197
            <param name="run.args" value="${debug.args}"/>
186
            <param name="run.args" value="${debug.args}"/>
187
            <reference refid="cluster.path.id"/>
198
        </antcall>
188
        </antcall>
199
    </target>
189
    </target>
200
    
190
    
Lines 206-214 Link Here
206
            mainclass="org.netbeans.Main"
196
            mainclass="org.netbeans.Main"
207
        >
197
        >
208
            <classpath>
198
            <classpath>
209
                <fileset dir="${netbeans.dest.dir}">
199
                <pathfileset include="**/*.jar">
210
                    <include name="**/*.jar"/>
200
                    <path refid="cluster.path.id"/>
211
                </fileset>
201
                </pathfileset>
212
                <fileset dir="${cluster}">
202
                <fileset dir="${cluster}">
213
                    <include name="**/*.jar"/>
203
                    <include name="**/*.jar"/>
214
                </fileset>
204
                </fileset>
Lines 222-227 Link Here
222
        
212
        
223
        <antcall target="run">
213
        <antcall target="run">
224
            <param name="run.args" value='"${profiler.jvmargs}"'/>
214
            <param name="run.args" value='"${profiler.jvmargs}"'/>
215
            <reference refid="cluster.path.id"/>
225
        </antcall>
216
        </antcall>
226
    </target>
217
    </target>
227
    
218
    
(-)a/apisupport.harness/release/suite.xml (-61 / +117 lines)
Lines 49-63 Link Here
49
        <dirname property="harness.dir" file="${suite.file}"/>
49
        <dirname property="harness.dir" file="${suite.file}"/>
50
        <echo level="verbose">Using build harness in ${harness.dir}</echo>
50
        <echo level="verbose">Using build harness in ${harness.dir}</echo>
51
        <taskdef classpath="${harness.dir}/tasks.jar" resource="org/netbeans/nbbuild/taskdefs.properties"/>
51
        <taskdef classpath="${harness.dir}/tasks.jar" resource="org/netbeans/nbbuild/taskdefs.properties"/>
52
        <typedef name="pathfileset" classname="org.netbeans.nbbuild.PathFileSet"
53
                 classpath="${harness.dir}/tasks.jar"/>
52
        <property name="harness.taskdefs.done" value="true"/>
54
        <property name="harness.taskdefs.done" value="true"/>
53
    </target>
55
    </target>
54
56
55
    <target name="-init" depends="-taskdefs">
57
    <target name="-init" depends="-taskdefs">
58
        <convertclusterpath from="${cluster.path.evaluated}" to="cluster.path" id="cluster.path.id"/>
56
        <property file="nbproject/private/private.properties"/>
59
        <property file="nbproject/private/private.properties"/>
57
        <property file="nbproject/project.properties"/>
60
        <property file="nbproject/project.properties"/>
58
        <sortsuitemodules unsortedmodules="${modules}" sortedmodulesproperty="modules.sorted"/>
61
        <sortsuitemodules unsortedmodules="${modules}" sortedmodulesproperty="modules.sorted"/>
59
        <property name="cluster" location="build/cluster"/>
62
        <property name="cluster" location="build/cluster"/>
60
        <echo level="verbose">Suite in ${basedir} with target platform ${netbeans.dest.dir}, build cluster ${cluster}, and sorted modules ${modules.sorted}</echo>
63
        <echo level="verbose">Suite in ${basedir} with clusters ${cluster.path}, build cluster ${cluster}, and sorted modules ${modules.sorted}</echo>
61
        <!-- synchronize with SuiteProject -->
64
        <!-- synchronize with SuiteProject -->
62
        <property name="disabled.modules" value=""/>
65
        <property name="disabled.modules" value=""/>
63
        <property name="enabled.clusters" value=""/>
66
        <property name="enabled.clusters" value=""/>
Lines 105-118 Link Here
105
    <target name="build" depends="-init,branding,release" description="Build all modules in the suite.">
108
    <target name="build" depends="-init,branding,release" description="Build all modules in the suite.">
106
        <subant target="netbeans" buildpath="${modules.sorted}" inheritrefs="false" inheritall="false"/>
109
        <subant target="netbeans" buildpath="${modules.sorted}" inheritrefs="false" inheritall="false"/>
107
        <mkdir dir="${cluster}/config/Modules"/>
110
        <mkdir dir="${cluster}/config/Modules"/>
108
        <createmodulexml xmldir="${cluster}/config/Modules">
111
        <pathconvert pathsep="," property="disabled.modules.paths.list">
109
            <hidden dir="${netbeans.dest.dir}">
112
            <pathfileset>
113
                <path refid="cluster.path.id"/>
110
                <custom classpath="${harness.dir}/tasks.jar" classname="org.netbeans.nbbuild.ModuleSelector">
114
                <custom classpath="${harness.dir}/tasks.jar" classname="org.netbeans.nbbuild.ModuleSelector">
111
                    <param name="excludeModules" value="${disabled.modules}"/>
115
                    <param name="excludeModules" value="${disabled.modules}"/>
112
                    <param name="excluded" value="true"/>
116
                    <param name="excluded" value="true"/>
113
                </custom>
117
                </custom>
114
            </hidden>
118
            </pathfileset>
115
        </createmodulexml>
119
        </pathconvert>
120
        <createmodulexml xmldir="${cluster}/config/Modules" hidden="${disabled.modules.paths.list}"/>
116
    </target>
121
    </target>
117
122
118
    <target name="nbms" depends="build" description="Build NBMs and an Auto Update site descriptor for all modules in the suite.">
123
    <target name="nbms" depends="build" description="Build NBMs and an Auto Update site descriptor for all modules in the suite.">
Lines 122-136 Link Here
122
            <isset property="nbm.target.cluster"/>
127
            <isset property="nbm.target.cluster"/>
123
        </condition>
128
        </condition>
124
        <!-- reads app.name if exists -->
129
        <!-- reads app.name if exists -->
130
        <pathfileset id="updater.jar">
131
            <path refid="cluster.path.id"/>
132
            <filename name="modules/ext/updater.jar"/>
133
        </pathfileset>
125
        <condition property="help.target.cluster" value="${app.name}" >
134
        <condition property="help.target.cluster" value="${app.name}" >
126
            <and>
135
            <and>
127
                <isset property="app.name"/>
136
                <isset property="app.name"/>
128
                <!-- #74866: only works for 6.0+ platforms. -->
137
                <!-- #74866: only works for 6.0+ platforms. -->
129
                <available resource="org/netbeans/updater/resources/autoupdate-info-2_4.dtd">
138
                <available resource="org/netbeans/updater/resources/autoupdate-info-2_4.dtd">
130
                    <classpath>
139
                    <classpath>
131
                        <fileset dir="${netbeans.dest.dir}">
140
                        <resources refid="updater.jar"/>
132
                            <include name="platform*/modules/ext/updater.jar"/>
133
                        </fileset>
134
                    </classpath>
141
                    </classpath>
135
                </available>
142
                </available>
136
            </and>
143
            </and>
Lines 150-156 Link Here
150
                <include name="*.nbm"/>
157
                <include name="*.nbm"/>
151
            </fileset>
158
            </fileset>
152
            <updaterjar>
159
            <updaterjar>
153
                <fileset dir="${netbeans.dest.dir}" includes="platform*/modules/ext/updater.jar"/>
160
                <resources refid="updater.jar"/>
154
            </updaterjar>
161
            </updaterjar>
155
        </makeupdatedesc>
162
        </makeupdatedesc>
156
    </target>
163
    </target>
Lines 159-196 Link Here
159
        <fail unless="app.name">Must have set at least an application name ('app.name')</fail>
166
        <fail unless="app.name">Must have set at least an application name ('app.name')</fail>
160
        
167
        
161
        <pathconvert property="zip.platform.update.tracking">
168
        <pathconvert property="zip.platform.update.tracking">
162
            <path>
169
            <pathfileset>
163
                <fileset dir="${netbeans.dest.dir}">
170
                <path refid="cluster.path.id"/>
164
                    <include name="**/update_tracking/*.xml"/>
171
                <filename name="**/update_tracking/*.xml"/>
165
                </fileset>
172
            </pathfileset>
166
            </path>
167
        </pathconvert>
173
        </pathconvert>
168
174
169
        <selector id="zip.platform.included.files">
175
        <selector id="zip.platform.included.files">
170
            <custom classpath="${harness.dir}/tasks.jar" classname="org.netbeans.nbbuild.ModuleSelector">
176
            <custom classpath="${harness.dir}/tasks.jar" classname="org.netbeans.nbbuild.ModuleSelector">
171
                <param name="excludeModules" value="${disabled.modules}"/>
177
                <param name="excludeModules" value="${disabled.modules}"/>
178
                <!-- XXX inc/exc clusters -->
172
                <param name="includeClusters" value="${enabled.clusters}"/>
179
                <param name="includeClusters" value="${enabled.clusters}"/>
173
                <param name="excludeClusters" value="${disabled.clusters}"/>
180
                <param name="excludeClusters" value="${disabled.clusters}"/>
174
                <param name="updateTrackingFiles" value="${zip.platform.update.tracking}"/>
181
                <param name="updateTrackingFiles" value="${zip.platform.update.tracking}"/>
175
            </custom>
182
            </custom>
176
        </selector>
183
        </selector>
177
184
178
        <pathconvert property="zip.platform.clusters.duplicates" pathsep=",">
185
        <pathconvert property="zip.platform.clusters.duplicates" pathsep="&#10;">
179
            <path>
186
            <pathfileset>
180
                <fileset dir="${netbeans.dest.dir}">
187
                <path refid="cluster.path.id"/>
181
                    <selector refid="zip.platform.included.files"/>
188
                <selector refid="zip.platform.included.files"/>
182
                </fileset>
189
            </pathfileset>
183
            </path>
190
            <chainedmapper>
184
            <mapper type="regexp" from="[/\\]([^/\\]+)[/\\]config[/\\]Modules[/\\]" to="\1"/> <!-- #71849 -->
191
                <mapper type="regexp" from="(^.+)[/\\]config[/\\]Modules[/\\]" to="\1"/> <!-- #71849 -->
192
                <filtermapper>
193
                    <linecontainsregexp negate="true">
194
                        <regexp pattern="update[/\\]backup[/\\]netbeans[/\\]?$"/>
195
                    </linecontainsregexp>
196
                </filtermapper>
197
            </chainedmapper>
185
        </pathconvert>
198
        </pathconvert>
186
        
199
        <tempfile property="zip.platform.clusters.duplicates.file" destdir="${basedir}/build" deleteonexit="true"/>
187
        <dirset id="zip.platform.clusters" dir="${netbeans.dest.dir}" includes="${zip.platform.clusters.duplicates}" excludes="platform*"/>
200
        <echo file="${zip.platform.clusters.duplicates.file}" message="${zip.platform.clusters.duplicates}"/>
188
        
201
202
        <union id="zip.platform.clusters"> <!-- union removes duplicates -->
203
            <files includesfile="${zip.platform.clusters.duplicates.file}"/>
204
        </union>
189
        <pathconvert property="zip.platform.clusters.bare" pathsep="&#10;"> <!-- #71128: \n OK on Win but \r\n bad on Unix -->
205
        <pathconvert property="zip.platform.clusters.bare" pathsep="&#10;"> <!-- #71128: \n OK on Win but \r\n bad on Unix -->
190
            <path>
206
            <resources refid="zip.platform.clusters"/>
191
                <dirset refid="zip.platform.clusters"/>
207
            <chainedmapper>
192
            </path>
208
                <filtermapper>
193
            <mapper type="regexp" from="[/\\]([^/\\]+)[/\\]?$" to="\1"/> <!-- #71849 -->
209
                    <linecontainsregexp negate="true">
210
                        <regexp pattern="platform[0-9]*[/\\]?$"/>
211
                    </linecontainsregexp>
212
                </filtermapper>
213
                <mapper type="regexp" from="[/\\]([^/\\]+)[/\\]?$" to="\1"/> <!-- #71849 -->
214
            </chainedmapper>
194
        </pathconvert>
215
        </pathconvert>
195
216
196
        <property name="build.launcher.dir" location="build/launcher"/>
217
        <property name="build.launcher.dir" location="build/launcher"/>
Lines 215-236 Link Here
215
    
236
    
216
    <target name="build-zip" depends="build,build-launchers" description="Builds a ZIP distribution of the suite, launchers, and selected modules from the platform.">
237
    <target name="build-zip" depends="build,build-launchers" description="Builds a ZIP distribution of the suite, launchers, and selected modules from the platform.">
217
        <mkdir dir="${dist.dir}"/>
238
        <mkdir dir="${dist.dir}"/>
239
        <!-- pathfileset does not support 'prefix' and 'filemode' parameters,
240
             we have to copy them to temp location -->
241
        <tempfile property="temp.dir.nbexec" destdir="${basedir}/build" deleteonexit="true"/>
242
        <tempfile property="temp.dir.rest" destdir="${basedir}/build" deleteonexit="delete"/>
243
        <subant genericantfile="${harness.dir}/suite.xml" target="copy-cluster" inheritrefs="true">
244
            <property name="dest.dir" value="${temp.dir.rest}"/>
245
            <property name="nbexec.dir" value="${temp.dir.nbexec}"/>
246
            <property name="build.dir" value="${basedir}/build"/>
247
            <resources refid="zip.platform.clusters"/>
248
        </subant>
218
        <zip destfile="${dist.dir}/${app.name}.zip">
249
        <zip destfile="${dist.dir}/${app.name}.zip">
219
            <zipfileset dir="${build.launcher.dir}/bin/" filemode="755" prefix="${app.name}/bin"/>
250
            <zipfileset dir="${build.launcher.dir}/bin/" filemode="755" prefix="${app.name}/bin"/>
220
            <zipfileset dir="${build.launcher.dir}/etc/" prefix="${app.name}/etc"/>
251
            <zipfileset dir="${build.launcher.dir}/etc/" prefix="${app.name}/etc"/>
221
            <zipfileset dir="${netbeans.dest.dir}" filemode="755" prefix="${app.name}">
252
            <zipfileset dir="${temp.dir.nbexec}" filemode="755" prefix="${app.name}"/>
222
                <include name="**/lib/nbexec*"/>
253
            <zipfileset dir="${temp.dir.rest}" prefix="${app.name}"/>
223
            </zipfileset>
254
224
                
225
            <zipfileset dir="${netbeans.dest.dir}" prefix="${app.name}">
226
                <and>
227
                    <not>
228
                        <filename name="**/lib/nbexec*"/>
229
                    </not>
230
                    <selector refid="zip.platform.included.files"/>
231
                </and>
232
            </zipfileset>
233
            
234
            <!-- Yes, the doubled app.name is a bit ugly, but better than the alternative; cf. #66441: -->
255
            <!-- Yes, the doubled app.name is a bit ugly, but better than the alternative; cf. #66441: -->
235
            <zipfileset dir="${cluster}" prefix="${app.name}/${app.name}">
256
            <zipfileset dir="${cluster}" prefix="${app.name}/${app.name}">
236
                <exclude name="config/Modules/*.xml_hidden"/>
257
                <exclude name="config/Modules/*.xml_hidden"/>
Lines 238-243 Link Here
238
            
259
            
239
        </zip>
260
        </zip>
240
    </target>
261
    </target>
262
263
    <target name="copy-cluster" description="Copies cluster specified by basedir to dir ${dest.dir}">
264
        <pathconvert property="cluster.name">
265
            <path path="${basedir}"/>
266
            <mapper type="regexp" from="[/\\]([^/\\]+)[/\\]?$" to="\1"/>
267
        </pathconvert>
268
        <copy todir="${dest.dir}/${cluster.name}">
269
            <fileset dir="${basedir}">
270
                <and>
271
                    <not>
272
                        <filename name="**/lib/nbexec*"/>
273
                    </not>
274
                    <selector refid="zip.platform.included.files"/>
275
                </and>
276
            </fileset>
277
        </copy>
278
        <condition property="copy.nbexec" value="true">
279
            <matches pattern="^platform[0-9]*$" string="${cluster.name}"/>
280
        </condition>
281
        <antcall target="copy-nbexec"/>
282
    </target>
283
284
    <target name="copy-nbexec" if="copy.nbexec" description="Copies nbexec from given cluster to specified location">
285
        <copy todir="${nbexec.dir}/${cluster.name}">
286
            <fileset dir="${basedir}">
287
                <filename name="**/lib/nbexec*"/>
288
            </fileset>
289
        </copy>
290
    </target>
291
241
    <target name="create-platform" depends="build-zip" description="Creates an unzipped platform from the suite, launchers, and selected modules from the platform.">
292
    <target name="create-platform" depends="build-zip" description="Creates an unzipped platform from the suite, launchers, and selected modules from the platform.">
242
        <mkdir dir="${dist.dir}/${app.name}"/>
293
        <mkdir dir="${dist.dir}/${app.name}"/>
243
        <unzip src="${dist.dir}/${app.name}.zip" dest="${dist.dir}/${app.name}">
294
        <unzip src="${dist.dir}/${app.name}.zip" dest="${dist.dir}/${app.name}">
Lines 258-277 Link Here
258
        <copy todir="${dist.dir}/${app.name}.app/Contents/Resources/${app.name}/etc">
309
        <copy todir="${dist.dir}/${app.name}.app/Contents/Resources/${app.name}/etc">
259
            <fileset dir="${build.launcher.dir}/etc/" />
310
            <fileset dir="${build.launcher.dir}/etc/" />
260
        </copy>
311
        </copy>
261
        <copy todir="${dist.dir}/${app.name}.app/Contents/Resources/${app.name}">
312
        <subant genericantfile="${harness.dir}/suite.xml" target="copy-cluster" inheritrefs="true">
262
            <fileset dir="${netbeans.dest.dir}">
313
            <property name="dest.dir" value="${dist.dir}/${app.name}.app/Contents/Resources/${app.name}"/>
263
                <include name="**/lib/nbexec*"/>
314
            <property name="nbexec.dir" value="${dist.dir}/${app.name}.app/Contents/Resources/${app.name}"/>
264
            </fileset>
315
            <property name="build.dir" value="${basedir}/build"/>
265
                
316
            <resources refid="zip.platform.clusters"/>
266
            <fileset dir="${netbeans.dest.dir}">
317
        </subant>
267
                <and>
318
268
                    <not>
269
                        <filename name="**/lib/nbexec*"/>
270
                    </not>
271
                    <selector refid="zip.platform.included.files"/>
272
                </and>
273
            </fileset>
274
        </copy>
275
        <copy todir="${dist.dir}/${app.name}.app/Contents/Resources/${app.name}/${app.name}">
319
        <copy todir="${dist.dir}/${app.name}.app/Contents/Resources/${app.name}/${app.name}">
276
            
320
            
277
            <fileset dir="${cluster}"/>
321
            <fileset dir="${cluster}"/>
Lines 335-361 Link Here
335
    </target>
379
    </target>
336
380
337
    <target name="run" depends="build,-jdk-init" description="Runs this suite in place.">
381
    <target name="run" depends="build,-jdk-init" description="Runs this suite in place.">
338
        <ant antfile="${harness.dir}/run.xml" target="run"/>
382
        <ant antfile="${harness.dir}/run.xml" target="run">
383
            <reference refid="cluster.path.id"/>
384
        </ant>
339
    </target>
385
    </target>
340
        
386
        
341
    <target name="debug" depends="build,-jdk-init,-jdk-presetdef-nbjpdastart" description="Runs this suite in place in the debugger.">
387
    <target name="debug" depends="build,-jdk-init,-jdk-presetdef-nbjpdastart" description="Runs this suite in place in the debugger.">
342
        <ant antfile="${harness.dir}/run.xml" target="debug"/>
388
        <ant antfile="${harness.dir}/run.xml" target="debug">
389
            <reference refid="cluster.path.id"/>
390
        </ant>
343
    </target>
391
    </target>
344
392
345
    <target name="profile" depends="build,-jdk-init,-jdk-presetdef-nbprofiledirect" description="Runs this suite in place in the profiler.">
393
    <target name="profile" depends="build,-jdk-init,-jdk-presetdef-nbprofiledirect" description="Runs this suite in place in the profiler.">
346
        <ant antfile="${harness.dir}/run.xml" target="profile"/>
394
        <ant antfile="${harness.dir}/run.xml" target="profile">
395
            <reference refid="cluster.path.id"/>
396
        </ant>
347
    </target>
397
    </target>
348
    
398
    
349
    <target name="build-jnlp" depends="build,-jdk-init" description="Packages this suite as a JNLP application.">
399
    <target name="build-jnlp" depends="build,-jdk-init" description="Packages this suite as a JNLP application.">
350
        <ant antfile="${harness.dir}/jnlp.xml" target="build"/>
400
        <ant antfile="${harness.dir}/jnlp.xml" target="build">
401
            <reference refid="cluster.path.id"/>
402
        </ant>
351
    </target>
403
    </target>
352
    
404
    
353
    <target name="run-jnlp" depends="build,-jdk-init" description="Runs this suite as a JNLP application.">
405
    <target name="run-jnlp" depends="build,-jdk-init" description="Runs this suite as a JNLP application.">
354
        <ant antfile="${harness.dir}/jnlp.xml" target="run"/>
406
        <ant antfile="${harness.dir}/jnlp.xml" target="run">
407
            <reference refid="cluster.path.id"/>
408
        </ant>
355
    </target>
409
    </target>
356
    
410
    
357
    <target name="debug-jnlp" depends="build,-jdk-init,-jdk-presetdef-nbjpdastart" description="Runs this suite as a JNLP application in the debugger.">
411
    <target name="debug-jnlp" depends="build,-jdk-init,-jdk-presetdef-nbjpdastart" description="Runs this suite as a JNLP application in the debugger.">
358
        <ant antfile="${harness.dir}/jnlp.xml" target="debug"/>
412
        <ant antfile="${harness.dir}/jnlp.xml" target="debug">
413
            <reference refid="cluster.path.id"/>
414
        </ant>
359
    </target>
415
    </target>
360
    
416
    
361
    <target name="test" depends="build" description="Runs tests for all modules in the suite.">
417
    <target name="test" depends="build" description="Runs tests for all modules in the suite.">
(-)a/apisupport.harness/taskdefs.properties (+1 lines)
Lines 54-56 Link Here
54
fixtestdeps=org.netbeans.nbbuild.FixTestDependencies
54
fixtestdeps=org.netbeans.nbbuild.FixTestDependencies
55
shorterpaths=org.netbeans.nbbuild.ShorterPaths
55
shorterpaths=org.netbeans.nbbuild.ShorterPaths
56
custom-javac=org.netbeans.nbbuild.CustomJavac
56
custom-javac=org.netbeans.nbbuild.CustomJavac
57
convertclusterpath=org.netbeans.nbbuild.ConvertClusterPath
(-)a/nbbuild/antsrc/org/netbeans/nbbuild/ConvertClusterPath.java (+113 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL
25
 * or only the GPL Version 2, indicate your decision by adding
26
 * "[Contributor] elects to include this software in this distribution
27
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
28
 * single choice of license, a recipient has the option to distribute
29
 * your version of this file under either the CDDL, the GPL Version 2 or
30
 * to extend the choice of license to its licensees as provided above.
31
 * However, if you add GPL Version 2 code and therefore, elected the GPL
32
 * Version 2 license, then the option applies only if the new code is
33
 * made subject to such option by the copyright holder.
34
 *
35
 * Contributor(s):
36
 *
37
 * Portions Copyrighted 2008 Sun Microsystems, Inc.
38
 */
39
40
package org.netbeans.nbbuild;
41
42
import org.apache.tools.ant.BuildException;
43
import org.apache.tools.ant.Project;
44
import org.apache.tools.ant.Task;
45
import org.apache.tools.ant.types.Path;
46
import org.apache.tools.ant.util.FileUtils;
47
48
/**
49
 * Converts cluster.path from value specified in platform.properties
50
 * to value usable by harness.
51
 *
52
 * TODO - describe actual changes
53
 *
54
 * @author Richard Michalsky
55
 */
56
public class ConvertClusterPath extends Task {
57
    private String from;
58
    private String id;
59
    private String basedir;
60
    private String to;
61
62
    /**
63
     * Name of property to which stores
64
     * @param to
65
     */
66
    public void setTo(String to) {
67
        this.to = to;
68
    }
69
70
    public void setBasedir(String basedir) {
71
        this.basedir = basedir;
72
    }
73
74
    public void setFrom(String from) {
75
        this.from = from;
76
    }
77
78
    public void setId(String id) {
79
        this.id = id;
80
    }
81
82
    public ConvertClusterPath() {
83
84
    }
85
86
    @Override
87
    public void execute() throws BuildException {
88
        try {
89
            if (from == null || from.length() == 0)
90
                throw new BuildException("From parameter not specified.");
91
            if ((id == null || id.length() == 0)
92
                    && (to == null && to.length() == 0))
93
                throw new BuildException("Either 'to' or 'id' parameter for converted path must be specified.");
94
            if (basedir == null || basedir.length() == 0)
95
                basedir = getProject().getBaseDir().getAbsolutePath();
96
97
            log("Converting cluster.path from '" + from + "' relative to '" + basedir + "'.", Project.MSG_VERBOSE);
98
            FileUtils fu = FileUtils.getFileUtils();
99
            Project fakeproj = new Project();
100
            fakeproj.setBasedir(basedir);
101
            Path convPath = new Path(fakeproj, from);
102
            log("Converted path: '" + convPath.toString() + "'.", Project.MSG_VERBOSE);
103
            if (id != null && id.length() > 0)
104
                getProject().addReference(id, convPath);
105
            if (to != null && to.length() > 0)
106
                getProject().setProperty(to, convPath.toString());
107
        } catch (Exception e) {
108
            throw new BuildException(e);
109
        }
110
    }
111
112
113
}
(-)a/nbbuild/antsrc/org/netbeans/nbbuild/CreateModuleXML.java (-107 / +140 lines)
Lines 104-116 Link Here
104
    private List<String> autoloadNames = new ArrayList<String>(10);
104
    private List<String> autoloadNames = new ArrayList<String>(10);
105
    private List<String> eagerNames = new ArrayList<String>(10);
105
    private List<String> eagerNames = new ArrayList<String>(10);
106
    private List<String> hiddenNames = new ArrayList<String>(10);
106
    private List<String> hiddenNames = new ArrayList<String>(10);
107
    
107
    private String hiddenList;
108
109
    /**
110
     * In addition to &gt;hidden&lt; nested fileset, list of hidden modules can
111
     * be specified as comma-separated list in attribute 'hidden'.
112
     * @param hiddenList
113
     */
114
    public void setHidden(String hiddenList) {
115
        // Only hidden parameters can be specified as list of absolute file paths,
116
        // enabled, eager and autoload modules need relative path to create proper module xml
117
        this.hiddenList = hiddenList;
118
    }
119
108
    public void execute() throws BuildException {
120
    public void execute() throws BuildException {
109
        if (xmldir == null) throw new BuildException("Must set xmldir attribute", getLocation());
121
        if (xmldir == null) throw new BuildException("Must set xmldir attribute", getLocation());
110
        if (!xmldir.exists ()) {
122
        if (!xmldir.exists ()) {
111
            if (!xmldir.mkdirs()) throw new BuildException("Cannot create directory " + xmldir, getLocation());
123
            if (!xmldir.mkdirs()) throw new BuildException("Cannot create directory " + xmldir, getLocation());
112
        }
124
        }
113
        if (enabled.isEmpty() && disabled.isEmpty() && autoload.isEmpty() && eager.isEmpty() && hidden.isEmpty()) {
125
        if (enabled.isEmpty() && disabled.isEmpty() && autoload.isEmpty() && eager.isEmpty() && hidden.isEmpty()
126
                && hiddenList == null) {
114
            log("Warning: <createmodulexml> with no modules listed", Project.MSG_WARN);
127
            log("Warning: <createmodulexml> with no modules listed", Project.MSG_WARN);
115
        }
128
        }
116
        for (FileSet fs : enabled) {
129
        for (FileSet fs : enabled) {
Lines 128-133 Link Here
128
        for (FileSet fs : hidden) {
141
        for (FileSet fs : hidden) {
129
            scanModules(fs, false, false, false, true, hiddenNames);
142
            scanModules(fs, false, false, false, true, hiddenNames);
130
        }
143
        }
144
        if (hiddenList != null && hiddenList.length() > 0)
145
            scanModulesInList(hiddenList, false, false, false, true, hiddenNames);
131
        Collections.sort(enabledNames);
146
        Collections.sort(enabledNames);
132
        Collections.sort(disabledNames);
147
        Collections.sort(disabledNames);
133
        Collections.sort(autoloadNames);
148
        Collections.sort(autoloadNames);
Lines 155-273 Link Here
155
        File dir = scan.getBasedir();
170
        File dir = scan.getBasedir();
156
        for (String kid : scan.getIncludedFiles()) {
171
        for (String kid : scan.getIncludedFiles()) {
157
            File module = new File(dir, kid);
172
            File module = new File(dir, kid);
158
            if (!module.exists()) throw new BuildException("Module file does not exist: " + module, getLocation());
173
            scanOneModule(module, kid, isEnabled, isAutoload, isEager, isHidden, names);
159
            if (!module.getName().endsWith(".jar")) throw new BuildException("Only *.jar may be listed, check the fileset: " + module, getLocation());
174
        }
175
    }
176
177
    private void scanModulesInList(String modulesList, boolean isEnabled, boolean isAutoload,
178
            boolean isEager, boolean isHidden, List<String> names) throws BuildException {
179
        String[] modules = modulesList.split(",");
180
        for (String modulePath : modules) {
181
            File module = new File(modulePath);
182
            scanOneModule(module, null, isEnabled, isAutoload, isEager, isHidden, names);
183
        }
184
    }
185
186
    private void scanOneModule(File module, String kid, boolean isEnabled,boolean isAutoload, boolean isEager, boolean isHidden, List<String> names) throws BuildException {
187
        if (!module.exists()) {
188
            throw new BuildException("Module file does not exist: " + module, getLocation());
189
        }
190
        if (!module.getName().endsWith(".jar")) {
191
            throw new BuildException("Only *.jar may be listed, check the fileset: " + module, getLocation());
192
        }
193
        try {
194
            JarFile jar = new JarFile(module);
160
            try {
195
            try {
161
                JarFile jar = new JarFile(module);
196
                Manifest m = jar.getManifest();
162
                try {
197
                Attributes attr = m.getMainAttributes();
163
                    Manifest m = jar.getManifest();
198
                String codename = attr.getValue("OpenIDE-Module");
164
                    Attributes attr = m.getMainAttributes();
199
                if (codename == null) {
165
                    String codename = attr.getValue("OpenIDE-Module");
200
                    throw new BuildException("Missing manifest tag OpenIDE-Module; " + module + " is not a module", getLocation());
166
                    if (codename == null) {
201
                }
167
                        throw new BuildException("Missing manifest tag OpenIDE-Module; " + module + " is not a module", getLocation());
202
                if (codename.endsWith(" ") || codename.endsWith("\t")) {
203
                    // #62887
204
                    throw new BuildException("Illegal trailing space in OpenIDE-Module value from " + module, getLocation());
205
                }
206
                int idx = codename.lastIndexOf('/');
207
                String codenamebase;
208
                int rel;
209
                if (idx == -1) {
210
                    codenamebase = codename;
211
                    rel = -1;
212
                } else {
213
                    codenamebase = codename.substring(0, idx);
214
                    try {
215
                        rel = Integer.parseInt(codename.substring(idx + 1));
216
                    } catch (NumberFormatException e) {
217
                        throw new BuildException("Invalid OpenIDE-Module '" + codename + "' in " + module, getLocation());
168
                    }
218
                    }
169
                    if (codename.endsWith(" ") || codename.endsWith("\t")) { // #62887
219
                }
170
                        throw new BuildException("Illegal trailing space in OpenIDE-Module value from " + module, getLocation());
220
                File xml = new File(xmldir, codenamebase.replace('.', '-') + ".xml");
171
                    }
221
                if (xml.exists()) {
172
                    int idx = codename.lastIndexOf('/');
222
                    // XXX should check that the old file actually matches what we would have written
173
                    String codenamebase;
223
                    log("Will not overwrite " + xml + "; skipping...", Project.MSG_VERBOSE);
174
                    int rel;
224
                    return;
175
                    if (idx == -1) {
225
                }
176
                        codenamebase = codename;
226
                String displayname = attr.getValue("OpenIDE-Module-Name");
177
                        rel = -1;
227
                if (displayname == null) {
178
                    } else {
228
                    String bundle = attr.getValue("OpenIDE-Module-Localizing-Bundle");
179
                        codenamebase = codename.substring(0, idx);
229
                    if (bundle != null) {
230
                        // Display name actually found in a bundle, not manifest.
231
                        ZipEntry entry = jar.getEntry(bundle);
232
                        InputStream is;
233
                        if (entry != null) {
234
                            is = jar.getInputStream(entry);
235
                        } else {
236
                            File moduleloc = new File(new File(module.getParentFile(), "locale"), module.getName());
237
                            if (!moduleloc.isFile()) {
238
                                throw new BuildException("Expecting localizing bundle: " + bundle + " in: " + module);
239
                            }
240
                            JarFile jarloc = new JarFile(moduleloc);
241
                            try {
242
                                ZipEntry entry2 = jarloc.getEntry(bundle);
243
                                if (entry2 == null) {
244
                                    throw new BuildException("Expecting localizing bundle: " + bundle + " in: " + module);
245
                                }
246
                                is = jarloc.getInputStream(entry2);
247
                            } finally {
248
                                jarloc.close();
249
                            }
250
                        }
180
                        try {
251
                        try {
181
                            rel = Integer.parseInt(codename.substring(idx + 1));
252
                            Properties p = new Properties();
182
                        } catch (NumberFormatException e) {
253
                            p.load(is);
183
                            throw new BuildException("Invalid OpenIDE-Module '" + codename + "' in " + module, getLocation());
254
                            displayname = p.getProperty("OpenIDE-Module-Name");
255
                        } finally {
256
                            is.close();
184
                        }
257
                        }
185
                    }
258
                    }
186
                    File xml = new File(xmldir, codenamebase.replace('.', '-') + ".xml");
259
                }
187
                    if (xml.exists()) {
260
                if (displayname == null) {
188
                        // XXX should check that the old file actually matches what we would have written
261
                    displayname = codename;
189
                        log("Will not overwrite " + xml + "; skipping...", Project.MSG_VERBOSE);
262
                }
190
                        continue;
263
                names.add(displayname);
264
                String spec = attr.getValue("OpenIDE-Module-Specification-Version");
265
                if (isHidden) {
266
                    File h = new File(xml.getParentFile(), xml.getName() + "_hidden");
267
                    h.createNewFile();
268
                }
269
                if (isEager || isAutoload || isEnabled) {
270
                    OutputStream os = new FileOutputStream(xml);
271
                    try {
272
                        PrintWriter pw = new PrintWriter(new OutputStreamWriter(os, "UTF-8"));
273
                        // Please make sure formatting matches what the IDE actually spits
274
                        // out; it could matter.
275
                        pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
276
                        pw.println("<!DOCTYPE module PUBLIC \"-//NetBeans//DTD Module Status 1.0//EN\"");
277
                        pw.println("                        \"http://www.netbeans.org/dtds/module-status-1_0.dtd\">");
278
                        pw.println("<module name=\"" + codenamebase + "\">");
279
                        pw.println("    <param name=\"autoload\">" + isAutoload + "</param>");
280
                        pw.println("    <param name=\"eager\">" + isEager + "</param>");
281
                        if (!isAutoload && !isEager) {
282
                            pw.println("    <param name=\"enabled\">" + isEnabled + "</param>");
283
                        }
284
                        pw.println("    <param name=\"jar\">" + kid.replace(File.separatorChar, '/') + "</param>");
285
                        if (rel != -1) {
286
                            pw.println("    <param name=\"release\">" + rel + "</param>");
287
                        }
288
                        pw.println("    <param name=\"reloadable\">false</param>");
289
                        if (spec != null) {
290
                            pw.println("    <param name=\"specversion\">" + spec + "</param>");
291
                        }
292
                        pw.println("</module>");
293
                        pw.flush();
294
                        pw.close();
295
                    } finally {
296
                        os.close();
191
                    }
297
                    }
192
                    String displayname = attr.getValue("OpenIDE-Module-Name");
193
                    if (displayname == null) {
194
                        String bundle = attr.getValue("OpenIDE-Module-Localizing-Bundle");
195
                        if (bundle != null) {
196
                            // Display name actually found in a bundle, not manifest.
197
                            ZipEntry entry = jar.getEntry(bundle);
198
                            InputStream is;
199
                            if (entry != null) {
200
                                is = jar.getInputStream(entry);
201
                            } else {
202
                                File moduleloc = new File(new File(module.getParentFile(), "locale"), module.getName());
203
                                if (! moduleloc.isFile()) {
204
                                    throw new BuildException("Expecting localizing bundle: " + bundle + " in: " + module);
205
                                }
206
                                JarFile jarloc = new JarFile(moduleloc);
207
                                try {
208
                                    ZipEntry entry2 = jarloc.getEntry(bundle);
209
                                    if (entry2 == null) {
210
                                        throw new BuildException("Expecting localizing bundle: " + bundle + " in: " + module);
211
                                    }
212
                                    is = jarloc.getInputStream(entry2);
213
                                } finally {
214
                                    jarloc.close();
215
                                }
216
                            }
217
                            try {
218
                                Properties p = new Properties();
219
                                p.load(is);
220
                                displayname = p.getProperty("OpenIDE-Module-Name");
221
                            } finally {
222
                                is.close();
223
                            }
224
                        }
225
                    }
226
                    if (displayname == null) displayname = codename;
227
                    names.add(displayname);
228
                    String spec = attr.getValue("OpenIDE-Module-Specification-Version");
229
                    
230
                    if (isHidden) {
231
                        File h = new File(xml.getParentFile(), xml.getName() + "_hidden");
232
                        h.createNewFile();
233
                    }
234
                    
235
                    if (isEager || isAutoload || isEnabled) {
236
                        OutputStream os = new FileOutputStream(xml);
237
                        try {
238
                            PrintWriter pw = new PrintWriter(new OutputStreamWriter(os, "UTF-8"));
239
                            // Please make sure formatting matches what the IDE actually spits
240
                            // out; it could matter.
241
                            pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
242
                            pw.println("<!DOCTYPE module PUBLIC \"-//NetBeans//DTD Module Status 1.0//EN\"");
243
                            pw.println("                        \"http://www.netbeans.org/dtds/module-status-1_0.dtd\">");
244
                            pw.println("<module name=\"" + codenamebase + "\">");
245
                            pw.println("    <param name=\"autoload\">" + isAutoload + "</param>");
246
                            pw.println("    <param name=\"eager\">" + isEager + "</param>");
247
                            if (!isAutoload && !isEager) {
248
                                pw.println("    <param name=\"enabled\">" + isEnabled + "</param>");
249
                            }
250
                            pw.println("    <param name=\"jar\">" + kid.replace(File.separatorChar, '/') + "</param>");
251
                            if (rel != -1) {
252
                                pw.println("    <param name=\"release\">" + rel + "</param>");
253
                            }
254
                            pw.println("    <param name=\"reloadable\">false</param>");
255
                            if (spec != null) {
256
                                pw.println("    <param name=\"specversion\">" + spec + "</param>");
257
                            }
258
                            pw.println("</module>");
259
                            pw.flush();
260
                            pw.close();
261
                        } finally {
262
                            os.close();
263
                        }
264
                    }
265
                } finally {
266
                    jar.close();
267
                }
298
                }
268
            } catch (IOException ioe) {
299
            } finally {
269
                throw new BuildException("Caught while processing " + module + ": " + ioe, ioe, getLocation());
300
                jar.close();
270
            }
301
            }
302
        } catch (IOException ioe) {
303
            throw new BuildException("Caught while processing " + module + ": " + ioe, ioe, getLocation());
271
        }
304
        }
272
    }
305
    }
273
    
306
    
(-)a/nbbuild/antsrc/org/netbeans/nbbuild/MakeJNLP.java (-9 / +15 lines)
Lines 73-79 Link Here
73
import org.apache.tools.ant.taskdefs.SignJar;
73
import org.apache.tools.ant.taskdefs.SignJar;
74
import org.apache.tools.ant.taskdefs.Zip;
74
import org.apache.tools.ant.taskdefs.Zip;
75
import org.apache.tools.ant.types.FileSet;
75
import org.apache.tools.ant.types.FileSet;
76
import org.apache.tools.ant.types.ResourceCollection;
76
import org.apache.tools.ant.types.ZipFileSet;
77
import org.apache.tools.ant.types.ZipFileSet;
78
import org.apache.tools.ant.types.resources.FileResource;
77
import org.xml.sax.SAXException;
79
import org.xml.sax.SAXException;
78
80
79
/** Generates JNLP files for signed versions of the module JAR files.
81
/** Generates JNLP files for signed versions of the module JAR files.
Lines 82-97 Link Here
82
 */
84
 */
83
public class MakeJNLP extends Task {
85
public class MakeJNLP extends Task {
84
    /** the files to work on */
86
    /** the files to work on */
85
    private FileSet files;
87
    private ResourceCollection files;
86
    private SignJar signTask;
88
    private SignJar signTask;
87
    
89
    
88
    public FileSet createModules() 
90
    public FileSet createModules() 
89
    throws BuildException {
91
    throws BuildException {
90
        if (files != null) throw new BuildException("modules can be created just once");
92
        addConfigured(new FileSet());
91
        files = new FileSet();
93
        return (FileSet) files;
92
        return files;
93
    }
94
    }
94
    
95
96
    public void addConfigured(ResourceCollection rc) throws BuildException {
97
        if (files != null) throw new BuildException("modules can be specified just once");
98
        files = rc;
99
    }
100
95
    private SignJar getSignTask() {
101
    private SignJar getSignTask() {
96
        if (signTask == null) {
102
        if (signTask == null) {
97
            signTask = (SignJar)getProject().createTask("signjar");
103
            signTask = (SignJar)getProject().createTask("signjar");
Lines 213-222 Link Here
213
            }
219
            }
214
        }
220
        }
215
221
216
        DirectoryScanner scan = files.getDirectoryScanner(getProject());
222
        for (Iterator fileIt = files.iterator(); fileIt.hasNext();) {
217
        for (String f : scan.getIncludedFiles()) {
223
            FileResource fr = (FileResource) fileIt.next();
218
            File jar = new File (files.getDir(getProject()), f);
224
            File jar = fr.getFile();
219
            
225
220
            if (!jar.canRead()) {
226
            if (!jar.canRead()) {
221
                throw new BuildException("Cannot read file: " + jar);
227
                throw new BuildException("Cannot read file: " + jar);
222
            }
228
            }
(-)a/nbbuild/antsrc/org/netbeans/nbbuild/MakeMasterJNLP.java (-7 / +15 lines)
Lines 44-53 Link Here
44
import java.io.File;
44
import java.io.File;
45
import java.io.FileWriter;
45
import java.io.FileWriter;
46
import java.io.IOException;
46
import java.io.IOException;
47
import java.util.Iterator;
47
import java.util.jar.JarFile;
48
import java.util.jar.JarFile;
48
import org.apache.tools.ant.BuildException;
49
import org.apache.tools.ant.BuildException;
49
import org.apache.tools.ant.Task;
50
import org.apache.tools.ant.Task;
50
import org.apache.tools.ant.types.FileSet;
51
import org.apache.tools.ant.types.FileSet;
52
import org.apache.tools.ant.types.ResourceCollection;
53
import org.apache.tools.ant.types.resources.FileResource;
51
54
52
/** Generates JNLP files for signed versions of the module JAR files.
55
/** Generates JNLP files for signed versions of the module JAR files.
53
 *
56
 *
Lines 55-67 Link Here
55
 */
58
 */
56
public class MakeMasterJNLP extends Task {
59
public class MakeMasterJNLP extends Task {
57
    /** the files to work on */
60
    /** the files to work on */
58
    private FileSet files;
61
    private ResourceCollection files;
59
    
62
    
60
    public FileSet createModules() 
63
    public FileSet createModules() 
61
    throws BuildException {
64
    throws BuildException {
62
        if (files != null) throw new BuildException("modules can be created just once");
65
        addConfigured(new FileSet());
63
        files = new FileSet();
66
        return (FileSet) files;
64
        return files;
67
    }
68
69
    public void addConfigured(ResourceCollection rc) throws BuildException {
70
        if (files != null) throw new BuildException("modules can be specified just once");
71
        files = rc;
65
    }
72
    }
66
    
73
    
67
    private File target;
74
    private File target;
Lines 86-94 Link Here
86
    }
93
    }
87
    
94
    
88
    private void generateFiles() throws IOException, BuildException {
95
    private void generateFiles() throws IOException, BuildException {
89
        for (String nm : files.getDirectoryScanner(getProject()).getIncludedFiles()) {
96
        for (Iterator fileIt = files.iterator(); fileIt.hasNext();) {
90
            File jar = new File (files.getDir(getProject()), nm);
97
            FileResource fr = (FileResource) fileIt.next();
91
            
98
            File jar = fr.getFile();
99
92
            if (!jar.canRead()) {
100
            if (!jar.canRead()) {
93
                throw new BuildException("Cannot read file: " + jar);
101
                throw new BuildException("Cannot read file: " + jar);
94
            }
102
            }
(-)a/nbbuild/antsrc/org/netbeans/nbbuild/ModuleListParser.java (-34 / +74 lines)
Lines 500-519 Link Here
500
    /**
500
    /**
501
     * Find all modules in a binary build, possibly from cache.
501
     * Find all modules in a binary build, possibly from cache.
502
     */
502
     */
503
    private static Map<String,Entry> scanBinaries(Project project, File build) throws IOException {
503
    private static Map<String,Entry> scanBinaries(Project project, File[] clusters) throws IOException {
504
        Map<String,Entry> entries = BINARY_SCAN_CACHE.get(build);
504
        Map<String,Entry> allEntries = new HashMap<String,Entry>();
505
        if (entries == null) {
505
506
            if (project != null) {
506
        for (File cluster : clusters) {
507
                project.log("Scanning for modules in " + build);
507
            Map<String, Entry> entries = BINARY_SCAN_CACHE.get(cluster);
508
            if (entries == null) {
509
                if (project != null) {
510
                    project.log("Scanning for modules in " + cluster);
511
                }
512
                entries = new HashMap<String, Entry>();
513
                doScanBinaries(cluster, entries);
514
                if (project != null) {
515
                    project.log("Found modules: " + entries.keySet(), Project.MSG_VERBOSE);
516
                }
517
                BINARY_SCAN_CACHE.put(cluster, entries);
508
            }
518
            }
509
            entries = new HashMap<String,Entry>();
519
            allEntries.putAll(entries);
510
            doScanBinaries(build, entries);
511
            if (project != null) {
512
                project.log("Found modules: " + entries.keySet(), Project.MSG_VERBOSE);
513
            }
514
            BINARY_SCAN_CACHE.put(build, entries);
515
        }
520
        }
516
        return entries;
521
        return allEntries;
517
    }
522
    }
518
    
523
    
519
    private static final String[] MODULE_DIRS = {
524
    private static final String[] MODULE_DIRS = {
Lines 528-541 Link Here
528
     * Checks modules/{,autoload/,eager/}*.jar as well as well-known core/*.jar and lib/boot.jar in each cluster.
533
     * Checks modules/{,autoload/,eager/}*.jar as well as well-known core/*.jar and lib/boot.jar in each cluster.
529
     * XXX would be slightly more precise to check config/Modules/*.xml rather than scan for module JARs.
534
     * XXX would be slightly more precise to check config/Modules/*.xml rather than scan for module JARs.
530
     */
535
     */
531
    private static void doScanBinaries(File build, Map<String,Entry> entries) throws IOException {
536
    private static void doScanBinaries(File cluster, Map<String,Entry> entries) throws IOException {
532
        File[] clusters = build.listFiles();
533
        if (clusters == null) {
534
            throw new IOException("Cannot examine dir " + build);
535
        }
536
        for (int i = 0; i < clusters.length; i++) {
537
            for (int j = 0; j < MODULE_DIRS.length; j++) {
537
            for (int j = 0; j < MODULE_DIRS.length; j++) {
538
                File dir = new File(clusters[i], MODULE_DIRS[j].replace('/', File.separatorChar));
538
                File dir = new File(cluster, MODULE_DIRS[j].replace('/', File.separatorChar));
539
                if (!dir.isDirectory()) {
539
                if (!dir.isDirectory()) {
540
                    continue;
540
                    continue;
541
                }
541
                }
Lines 577-583 Link Here
577
                        String moduleDependencies = attr.getValue("OpenIDE-Module-Module-Dependencies");
577
                        String moduleDependencies = attr.getValue("OpenIDE-Module-Module-Dependencies");
578
                        
578
                        
579
                        
579
                        
580
                        Entry entry = new Entry(codenamebase, m, exts,dir, null, null, clusters[i].getName(),
580
                        Entry entry = new Entry(codenamebase, m, exts,dir, null, null, cluster.getName(),
581
                                parseRuntimeDependencies(moduleDependencies), Collections.<String,String[]>emptyMap());
581
                                parseRuntimeDependencies(moduleDependencies), Collections.<String,String[]>emptyMap());
582
                        if (entries.containsKey(codenamebase)) {
582
                        if (entries.containsKey(codenamebase)) {
583
                            throw new IOException("Duplicated module " + codenamebase + ": found in " + entries.get(codenamebase) + " and " + entry);
583
                            throw new IOException("Duplicated module " + codenamebase + ": found in " + entries.get(codenamebase) + " and " + entry);
Lines 589-595 Link Here
589
                    }
589
                    }
590
                }
590
                }
591
            }
591
            }
592
        }
593
    }
592
    }
594
    
593
    
595
    private static Map<String,Entry> scanSuiteSources(Map<String,String> properties, Project project) throws IOException {
594
    private static Map<String,Entry> scanSuiteSources(Map<String,String> properties, Project project) throws IOException {
Lines 666-672 Link Here
666
     * Properties interpreted:
665
     * Properties interpreted:
667
     * <ol>
666
     * <ol>
668
     * <li> ${nb_all} - location of NB sources (used only for netbeans.org modules)
667
     * <li> ${nb_all} - location of NB sources (used only for netbeans.org modules)
669
     * <li> ${netbeans.dest.dir} - location of NB build
668
     * <li> ${netbeans.dest.dir} - location of NB build (used only for NB.org modules)
669
     * <li> ${cluster.path} - location of clusters to build against (used only for suite and standalone modules)
670
     * <li> ${basedir} - directory of the project initiating the scan (most significant for standalone modules)
670
     * <li> ${basedir} - directory of the project initiating the scan (most significant for standalone modules)
671
     * <li> ${suite.dir} - directory of the suite (used only for suite modules)
671
     * <li> ${suite.dir} - directory of the suite (used only for suite modules)
672
     * <li> ${nb.cluster.TOKEN} - list of module paths included in cluster TOKEN (comma-separated) (used only for netbeans.org modules)
672
     * <li> ${nb.cluster.TOKEN} - list of module paths included in cluster TOKEN (comma-separated) (used only for netbeans.org modules)
Lines 679-701 Link Here
679
     */
679
     */
680
    public ModuleListParser(Map<String,String> properties, int type, Project project) throws IOException {
680
    public ModuleListParser(Map<String,String> properties, int type, Project project) throws IOException {
681
        String nball = properties.get("nb_all");
681
        String nball = properties.get("nb_all");
682
        String buildS = properties.get("netbeans.dest.dir");
683
        File basedir = new File(properties.get("basedir"));
682
        File basedir = new File(properties.get("basedir"));
684
        if (buildS == null) {
683
        final FileUtils fu = FileUtils.getFileUtils();
685
            throw new IOException("No definition of netbeans.dest.dir in " + basedir);
684
686
        }
687
        // Resolve against basedir, and normalize ../ sequences and so on in case they are used.
688
        // Neither operation is likely to be needed, but just in case.
689
        File build = FileUtils.getFileUtils().normalize(FileUtils.getFileUtils().resolveFile(basedir, buildS).getAbsolutePath());
690
        if (!build.isDirectory()) {
691
            throw new IOException("No such netbeans.dest.dir: " + build);
692
        }
693
        if (type != ParseProjectXml.TYPE_NB_ORG) {
685
        if (type != ParseProjectXml.TYPE_NB_ORG) {
686
            // add extra clusters
687
            String suiteDirS = properties.get("suite.dir");
688
            boolean hasSuiteDir = suiteDirS != null && suiteDirS.length() > 0;
689
            String clusterPath = properties.get("cluster.path");
690
            File[] clusters = null;
691
692
            if (clusterPath != null) {
693
                String[] clustersS;
694
                if (hasSuiteDir) {
695
                    // resolve suite modules against fake suite project
696
                    Project fakeproj = new Project();
697
                    fakeproj.setBaseDir(new File(suiteDirS));
698
                    clustersS = Path.translatePath(fakeproj, clusterPath);
699
                } else {
700
                    clustersS = Path.translatePath(project, clusterPath);
701
                }
702
                clusters = new File[clustersS.length];
703
                if (clustersS != null && clustersS.length > 0) {
704
                    for (int j = 0; j < clustersS.length; j++) {
705
                        File cluster = new File(clustersS[j]);
706
                        if (! cluster.isDirectory()) {
707
                            throw new IOException("No such cluster " + cluster + " referred to from ${cluster.path}: " + clusterPath);
708
                        }
709
                        clusters[j] = cluster;
710
                    }
711
                }
712
            }
713
714
            if (clusters == null || clusters.length == 0)
715
                throw new IOException("Invalid ${cluster.path}: " + clusterPath);
716
694
            // External module.
717
            // External module.
695
            if (nball != null && project != null) {
718
            if (nball != null && project != null) {
696
                project.log("You must *not* declare <suite-component/> or <standalone/> for a netbeans.org module in " + basedir + "; fix project.xml to use the /2 schema", Project.MSG_WARN);
719
                project.log("You must *not* declare <suite-component/> or <standalone/> for a netbeans.org module in " + basedir + "; fix project.xml to use the /2 schema", Project.MSG_WARN);
697
            }
720
            }
698
            entries = scanBinaries(project, build);
721
            entries = scanBinaries(project, clusters);
699
            if (type == ParseProjectXml.TYPE_SUITE) {
722
            if (type == ParseProjectXml.TYPE_SUITE) {
700
                entries.putAll(scanSuiteSources(properties, project));
723
                entries.putAll(scanSuiteSources(properties, project));
701
            } else {
724
            } else {
Lines 705-716 Link Here
705
            }
728
            }
706
        } else {
729
        } else {
707
            // netbeans.org module.
730
            // netbeans.org module.
731
            String buildS = properties.get("netbeans.dest.dir");
732
            if (buildS == null) {
733
                throw new IOException("No definition of netbeans.dest.dir in " + basedir);
734
            }
735
            // Resolve against basedir, and normalize ../ sequences and so on in case they are used.
736
            // Neither operation is likely to be needed, but just in case.
737
            File build = fu.normalize(fu.resolveFile(basedir, buildS).getAbsolutePath());
738
            if (!build.isDirectory()) {
739
                throw new IOException("No such netbeans.dest.dir: " + build);
740
            }
741
742
            // expand clusters in build
743
            File[] clusters = build.listFiles();
744
            if (clusters == null) {
745
                throw new IOException("Cannot examine dir " + build);
746
            }
747
708
            if (nball == null) {
748
            if (nball == null) {
709
                throw new IOException("You must declare either <suite-component/> or <standalone/> for an external module in " + new File(properties.get("basedir")));
749
                throw new IOException("You must declare either <suite-component/> or <standalone/> for an external module in " + new File(properties.get("basedir")));
710
            }
750
            }
711
            if (!build.equals(new File(new File(nball, "nbbuild"), "netbeans"))) {
751
            if (!build.equals(new File(new File(nball, "nbbuild"), "netbeans"))) {
712
                // Potentially orphaned module to be built against specific binaries, plus perhaps other source deps.
752
                // Potentially orphaned module to be built against specific binaries, plus perhaps other source deps.
713
                entries = scanBinaries(project, build);
753
                entries = scanBinaries(project, clusters);
714
                // Add referenced module in case it does not appear otherwise.
754
                // Add referenced module in case it does not appear otherwise.
715
                Entry e = scanStandaloneSource(properties, project);
755
                Entry e = scanStandaloneSource(properties, project);
716
                if (e != null) {
756
                if (e != null) {
(-)a/nbbuild/antsrc/org/netbeans/nbbuild/ParseProjectXml.java (-11 / +14 lines)
Lines 899-915 Link Here
899
        if (module == null) {
899
        if (module == null) {
900
            throw new BuildException("No dependent module " + cnb, getLocation());
900
            throw new BuildException("No dependent module " + cnb, getLocation());
901
        }
901
        }
902
        String cluster = module.getClusterName();
902
//  XXX - no more included/excluded clusters
903
        if (cluster != null) { // #68716
903
//        String cluster = module.getClusterName();   // TODO - abs. path in clusterName, get rid of netbeans.dest.dir altogether
904
            if ((includedClusters != null && !includedClusters.isEmpty() && ! ModuleSelector.clusterMatch(includedClusters, cluster)) ||
904
//        if (cluster != null) { // #68716
905
                    ((includedClusters == null || includedClusters.isEmpty()) && excludedClusters != null && excludedClusters.contains(cluster))) {
905
//            if ((includedClusters != null && !includedClusters.isEmpty() && ! ModuleSelector.clusterMatch(includedClusters, cluster)) ||
906
                throw new BuildException("The module " + cnb + " cannot be compiled against because it is part of the cluster " + cluster +
906
//                    ((includedClusters == null || includedClusters.isEmpty()) && excludedClusters != null && excludedClusters.contains(cluster))) {
907
                                         " which has been excluded from the target platform in your suite configuration", getLocation());
907
//                throw new BuildException("The module " + cnb + " cannot be compiled against because it is part of the cluster " + cluster +
908
            }
908
//                                         " which has been excluded from the target platform in your suite configuration", getLocation());
909
            if (excludedModules != null && excludedModules.contains(cnb)) { // again #68716
909
//            }
910
                throw new BuildException("Module " + cnb + " excluded from the target platform", getLocation());
910
//            if (excludedModules != null && excludedModules.contains(cnb)) { // again #68716
911
            }
911
//                throw new BuildException("Module " + cnb + " excluded from the target platform", getLocation());
912
        }
912
//            }
913
//        }
913
        return module.getJar();
914
        return module.getJar();
914
    }
915
    }
915
 
916
 
Lines 966-971 Link Here
966
                // no cluster name is specified for standalone or module in module suite
967
                // no cluster name is specified for standalone or module in module suite
967
                cluster = "cluster";
968
                cluster = "cluster";
968
            }
969
            }
970
            // TODO - path probably composed wrongly with respect to cluster.path
969
            return ParseProjectXml.cachedTestDistLocation + sep + testtype + sep + cluster + sep + cnb.replace('.','-');
971
            return ParseProjectXml.cachedTestDistLocation + sep + testtype + sep + cluster + sep + cnb.replace('.','-');
970
        }
972
        }
971
973
Lines 1176-1181 Link Here
1176
        if (cluster == null) {
1178
        if (cluster == null) {
1177
            cluster = "cluster";
1179
            cluster = "cluster";
1178
        }
1180
        }
1181
        // TODO - path probably composed wrongly with respect to cluster.path
1179
        return ParseProjectXml.cachedTestDistLocation + sep + testType + sep + cluster + sep + entry.getCnb().replace('.', '-') + sep + "tests.jar";
1182
        return ParseProjectXml.cachedTestDistLocation + sep + testType + sep + cluster + sep + entry.getCnb().replace('.', '-') + sep + "tests.jar";
1180
    }
1183
    }
1181
1184
(-)a/nbbuild/default.xml (+14 lines)
Lines 108-113 Link Here
108
    <taskdef name="convertimport"
108
    <taskdef name="convertimport"
109
         classname="org.netbeans.nbbuild.ConvertImport"
109
         classname="org.netbeans.nbbuild.ConvertImport"
110
         classpath="${nb_all}/nbbuild/nbantext.jar"/>
110
         classpath="${nb_all}/nbbuild/nbantext.jar"/>
111
    <taskdef name="convertclusterpath"
112
         classname="org.netbeans.nbbuild.ConvertClusterPath"
113
         classpath="${nb_all}/nbbuild/nbantext.jar"/>
114
    <typedef name="pathfileset" classname="org.netbeans.nbbuild.PathFileSet"
115
         classpath="${nb_all}/nbbuild/nbantext.jar"/>
111
    <property name="tasks-already-set" value="true"/>
116
    <property name="tasks-already-set" value="true"/>
112
  </target>
117
  </target>
113
  
118
  
Lines 128-133 Link Here
128
      <entry  key="${module.name}.dir" value="$${netbeans.dest.dir}/${cluster.dir}"/>
133
      <entry  key="${module.name}.dir" value="$${netbeans.dest.dir}/${cluster.dir}"/>
129
    </propertyfile>
134
    </propertyfile>
130
    <property name="${module.name}.dir" value="${netbeans.dest.dir}/${cluster.dir}"/>
135
    <property name="${module.name}.dir" value="${netbeans.dest.dir}/${cluster.dir}"/>
136
137
    <!-- netbeans.dest.dir -> cluster.path.id translation for NB.org modules -->
138
    <!-- XXX Does not preserve order of clusters specified in etc/netbeans.clusters -->
139
    <pathconvert property="cluster.path.evaluated">
140
        <path>
141
            <dirset dir="${netbeans.dest.dir}" includesfile="${netbeans.dest.dir}/etc/netbeans.clusters"/>
142
        </path>
143
    </pathconvert>
144
    <convertclusterpath from="${cluster.path.evaluated}" to="cluster.path" id="cluster.path.id"/>
131
  </target>
145
  </target>
132
  
146
  
133
</project>
147
</project>
(-)a/nbbuild/templates/common.xml (-1 / +4 lines)
Lines 337-343 Link Here
337
            <license file="${license.file.override}"/>
337
            <license file="${license.file.override}"/>
338
            <signature keystore="${keystore}" storepass="${storepass}" alias="${nbm_alias}"/>
338
            <signature keystore="${keystore}" storepass="${storepass}" alias="${nbm_alias}"/>
339
            <updaterjar>
339
            <updaterjar>
340
                <fileset dir="${netbeans.dest.dir}" includes="platform*/modules/ext/updater.jar"/>
340
                <pathfileset>
341
                    <path refid="cluster.path.id"/>
342
                    <filename name="**/modules/ext/updater.jar"/>
343
                </pathfileset>
341
            </updaterjar>
344
            </updaterjar>
342
        </makenbm>
345
        </makenbm>
343
    </target>
346
    </target>

Return to bug 152960