-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
293 lines (245 loc) · 13.5 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
<!-- for some information on what you could do (e.g. targets to override). -->
<!-- If you delete this file and reopen the project it will be recreated. -->
<project name="X3dEdit Module Suite" basedir="." default="quick.run">
<description>Builds the application module suite X3dEditModuleSuite.</description>
<import file="nbproject/build-impl.xml"/>
<property file="nbproject/project.properties"/>
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<!--
============
INIT SECTION
============
-->
<target name="platformInitialize" depends="-init,platformType,initializeWindows,initializeUnix,initializeMac"/>
<target name="platformType">
<condition property="isWindows" >
<os family="windows"/>
</condition>
<condition property="isMac" >
<os family="mac"/>
</condition>
<!-- Based on Apache Ant user-manual example -->
<condition property="isUnixNotMac">
<and>
<os family="unix"/>
<not>
<equals arg1="${os.name}" arg2="Mac OS X"/>
</not>
</and>
</condition>
</target>
<target name="initializeWindows" if="isWindows" depends="initializeXj3d">
<property name="run.xj3d.args" value="${win_runarguments}"/>
<property name="run.args" value="${common.args} ${win.run.args}"/>
</target>
<target name="initializeUnix" if="isUnixNotMac" depends="initializeXj3d">
<property name="run.xj3d.args" value="${unix_runarguments}"/>
<property name="run.args" value="${common.args} ${unix.run.args}"/>
</target>
<target name="initializeMac" if="isMac" depends="initializeXj3d">
<property name="run.xj3d.args" value="${mac_runarguments}"/>
<property name="run.args" value="${common.args} ${mac.run.args}"/>
</target>
<target name="initializeXj3d" >
<property name="win_runarguments" value="${common.xj3d.args} ${xj3darg6}"/>
<property name="unix_runarguments" value="${common.xj3d.args} ${xj3darg7}"/>
<property name="mac_runarguments" value="${common.xj3d.args} ${xj3darg8} ${xj3darg9} ${xj3darg10} ${xj3darg11} ${xj3darg12} ${xj3darg14}"/>
</target>
<!--
=============
BUILD SECTION
=============
-->
<!-- override build to add a way to update branding -->
<target name="build" depends="build-brand,suite.build">
<!-- TODO can we shift this message to become a dependency in a prerelease target? -->
<echo message="*** Release preparations: run target 'generate.nbm.signing.cert'"/>
</target>
<target name="build-brand" depends="-init">
<tstamp>
<!-- Good format example here: http://comp-phil.blogspot.com/2010/10/how-to-format-date-and-time-in-ant.html -->
<format property="TODAY" pattern="EEE, MMM dd, yyyy hh:mm:ss a z"/>
<format property="BUILD" pattern="YYYYMMdd" />
</tstamp>
<propertyfile file="${basedir}/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties"
comment="Updated by build script">
<entry key="currentVersion" value="${app.title} - ${TODAY} ${TSTAMP}" />
</propertyfile>
<ant dir="${project.org.web3d.x3d.palette}" inheritAll="false" target="moduleVersion"/>
<!-- Read API Version from module, then append to CTL_MainWindow_Title -->
<property file="${project.org.web3d.x3d.palette}/moduleVersion.properties"/>
<property name="MODULE_MANIFEST_VERSION" value="${module.version}"/>
<!-- trace -->
<echo message="MODULE_PROJECT_PROPERTIES_FILE=${project.org.web3d.x3d.palette}/moduleVersion.properties"/>
<echo message=" MODULE_MANIFEST_VERSION=${MODULE_MANIFEST_VERSION}"/>
<!-- CTL_MainWindow_Title result is also used by X3DEditAboutAction -->
<property name="CTL_MainWindow_Title" value="${app.title}, build ${BUILD}, module ${app.version}.${MODULE_MANIFEST_VERSION}"/>
<propertyfile file="${basedir}/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties"
comment="Updated by build script">
<entry key="CTL_MainWindow_Title" value="${CTL_MainWindow_Title}" />
<entry key="CTL_MainWindow_Title_No_Project" value="${CTL_MainWindow_Title}" />
</propertyfile>
<echo message="CTL_MainWindow_Title=${CTL_MainWindow_Title}"/>
</target>
<!--
===========
RUN SECTION
===========
-->
<!-- Override initializing the app before running -->
<target name="run" depends="platformInitialize,suite.run" description="Runs X3D-Edit"/>
<!-- Override building the app before running -->
<target name="quick.run" depends="platformInitialize,branding,-jdk-init"
description="Runs X3D-Edit without building">
<ant antfile="${harness.dir}/run.xml" target="run">
<reference refid="cluster.path.id"/>
</ant>
</target>
<target name="run.xj3d.browser"
depends="platformInitialize,-jdk-init"
description="Run the 3D Simulation Viewer App">
<!-- first look on command line, otherwise use ${scene} property from build.properties -->
<property name="args" location="${scene}"/>
<echo message="Xj3D launching ${args}"/>
<echo message="main.class=${main.class}"/>
<echo message="app.browser.args=${app.browser.args}"/>
<echo message="run.xj3d.args=${run.xj3d.args}"/>
<ant antfile="${harness.dir}/run.xml" target="-prepare-as-platform">
<reference refid="cluster.path.id"/>
</ant>
<!-- Working directory is apps/browser b/c that's where the javahelp helpset is -->
<java classname="${main.class}"
fork="true">
<!-- Comment out for native DIS handling -->
<!--sysproperty key="${dis.protocol.handler.prop}"
value="${dis.xmpp.protocol.handler}"/-->
<jvmarg line="${run.xj3d.args}"/>
<!-- Enable the Smack debugger -->
<!--jvmarg value="-Dsmack.debugEnabled=true"/-->
<classpath>
<fileset dir="${cluster}">
<include name="**/*.jar"/>
</fileset>
</classpath>
<!-- ${args} should be the full path to an X3D file -->
<!-- commandline given/supplied arguments args=%1 etc -->
<arg line="${app.browser.args} ${args}"/>
</java>
</target>
<!--
=============
DEBUG SECTION
=============
-->
<!-- Override -->
<target name="debug"
depends="platformInitialize,build,-jdk-init,-jdk-presetdef-nbjpdastart,do.debug"
description="Debug after building the entire suite first"/>
<target name="quick.debug"
depends="platformInitialize,branding,release,-hide-excluded-modules,-jdk-init,-jdk-presetdef-nbjpdastart,do.debug"
description="Debugs X3D-Edit in place without building"/>
<!-- Debug must be overridden here IOT avoid URLStreamHandler Error thrown.
Caused by vanilla ${harness.dir}/run.cml debug target not getting the
proper -add-opens=java.base/java.net=ALL-UNNAMED start up directive from
project.properties -->
<target name="do.debug">
<fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
<nbjpdastart name="NetBeans" addressproperty="debug.port" transport="dt_socket">
<classpath>
<pathfileset include="**/*.jar">
<path refid="cluster.path.id"/>
</pathfileset>
<fileset dir="${cluster}">
<include name="**/*.jar"/>
</fileset>
</classpath>
</nbjpdastart>
<property name="debug.pause" value="y"/>
<property name="debug.args" value="${run.args} -J-agentlib:jdwp=transport=dt_socket,suspend=${debug.pause},server=n,address=${debug.port}"/>
<ant antfile="${harness.dir}/run.xml" target="run">
<property name="run.args" value="${debug.args}"/>
<reference refid="cluster.path.id"/>
</ant>
</target>
<!--
============
MISC SECTION
============
-->
<!-- For generating a NBM self-signing certificate. Do this every 90 days
before building a NBM. -->
<!-- Based on https://netbeans.apache.org/wiki/DevFaqSignNbm.html -->
<target name="generate.nbm.signing.cert" depends="-init">
<!--Create/Update keystore-->
<delete file="${keystore.location}${keystore.name}"/>
<mkdir dir="${keystore.location}"/>
<genkey alias="${keystore.alias}" storepass="${keystore.password}"
dname="${keystore.dname}" keyalg="RSA" verbose="true"
keysize="2048" validity="90" storetype="PKCS12"
keystore="${keystore.location}${keystore.name}"/>
<!-- Now show the signing certificate -->
<antcall target="inspect.signing.cert"/>
<!--Update keystore info in projects-->
<antcall target="update-keystore-info"/>
</target>
<target name="inspect.signing.cert" depends="-init">
<exec executable="keytool">
<arg line="-list -v -keystore ${keystore.location}${keystore.name} -storepass ${keystore.password}"/>
</exec>
</target>
<!-- Don't run alone, invoke by the above task only -->
<target name="update-keystore-info" description="Run generate.nbm.signing.cert first!! Ensures proper keystore names, locations, aliases and passwords are recorded">
<for list="${modules}" delimiter=":" param="cur" trim="true">
<sequential>
<mkdir dir="@{cur}/nbproject/"/>
<!--Place the information in the properties file-->
<propertyfile file="@{cur}/nbproject/project.properties">
<entry key="keystore" value="../${keystore.location}${keystore.name}"/>
<entry key="nbm_alias" value="${keystore.alias}"/>
</propertyfile>
<mkdir dir="@{cur}/nbproject/private/"/>
<!--Place the password in the private properties file-->
<propertyfile file="@{cur}/nbproject/private/suite-private.properties">
<entry key="storepass" value="${keystore.password}"/>
</propertyfile>
<!-- First, delete the old alias. If a new savage server cert was generated,
then the alias will not be present and this error will show:
keytool error: java.lang.Exception: Alias <nbmsigner> does not exist
Result: 1
This is benign and will not occur on the next gen. of the self signed cert
-->
<!-- <exec executable="keytool">
<arg line="-delete -alias ${keystore.alias} -storepass ${keystore.password} -keystore @{cur}/release/modules/ext/server-cert-keystore.jks"/>
</exec>
Import newly generated self-signed cert
<exec executable="keytool">
<arg line="-importkeystore -v -srckeystore ${keystore.location}${keystore.name} -srcstorepass ${keystore.password} -storepass ${keystore.password} -destkeystore @{cur}/release/modules/ext/server-cert-keystore.jks"/>
</exec>-->
<!-- Keep the above, however, not likely we need this step as the
self signing certificate is only for generating an NBM that
will be hosted on the Apache Netbeans Plugin Portal -->
</sequential>
</for>
</target>
<target name="view.X3D-Edit.home.local" description="view local copy of X3D-Edit. home page in web browser (Netbeans only)">
<echo message="websites/savage.nps.edu/X3D-Edit/X3D-Edit.html" />
<nbbrowse file="websites/savage.nps.edu/X3D-Edit/X3D-Edit.html" />
<!-- TODO implementation-independent approach if possible, but note that other Ant approaches usually have to be customized for each OS. -->
</target>
<target name="view.X3D-Edit.home.online" description="view online copy of X3D-Edit. home page in web browser (Netbeans only)">
<echo message="https://savage.nps.edu/X3D-Edit" />
<nbbrowse url="https://savage.nps.edu/X3D-Edit" />
<!-- TODO implementation-independent approach if possible, but note that other Ant approaches usually have to be customized for each OS. -->
</target>
<target name="view.sourceforge.issues" description="view X3D-Edit issues on sourceforge. home page in web browser (Netbeans only)">
<echo message="https://sourceforge.net/p/x3d/tickets" />
<nbbrowse url="https://sourceforge.net/p/x3d/tickets" />
<!-- TODO implementation-independent approach if possible, but note that other Ant approaches usually have to be customized for each OS. -->
</target>
<target name="view.harness.readme" description="view the NetBeans harness README file">
<loadfile property="message" srcFile="${harness.readme}"/>
<echo message="${message}"/>
</target>
</project>