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 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458
|
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project name="suite-jnlp" basedir=".">
<!-- if jnlp.codebase is provided make both the app and the platform relative to it -->
<condition property="jnlp.codebase.app" value="${jnlp.codebase}app/" >
<isset property="jnlp.codebase" />
</condition>
<!-- if not specified, assign all codebases to value suitable for jnlp-servlet.jar -->
<property name="jnlp.codebase" value="$$$$codebase" />
<property name="jnlp.codebase.app" value="$$$$codebase" />
<target name="-check-for-master.jnlp">
<available file="master.jnlp" property="master.jnlp.exists"/>
</target>
<target name="jnlp-init-generate-master" depends="-check-for-master.jnlp" unless="master.jnlp.exists">
<echo file="master.jnlp"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jnlp PUBLIC "-//Sun Microsystems, Inc//DTD JNLP Descriptor 6.0//EN" "http://java.sun.com/dtd/JNLP-6.0.dtd">
<jnlp spec="1.0+" codebase="${jnlp.codebase}" href="master.jnlp">
<information>
<title>$${app.title}</title>
<vendor>$${app.title} vendor</vendor>
<description>$${app.name} application</description>
<icon href="$${app.icon}"/>
</information>
<security><all-permissions/></security>
<resources>
<!-- The following property is needed when running with unsigned jars: -->
<property name="netbeans.jnlp.fixPolicy" value="$${netbeans.jnlp.fixPolicy}"/>
<extension name='branding' href='branding.jnlp' />
<!-- The following line will be replaced with an automatically generated list of resources: -->
<!--$${jnlp.resources}-->
</resources>
<resources os="Mac OS X">
<property name="jnlp.netbeans.user" value="$${user.home}/Library/Application Support/$${app.name}"/>
</resources>
<application-desc>
<argument>--branding</argument>
<argument>$${branding.token}</argument>
</application-desc>
</jnlp>
]]></echo>
<echo file="branding.jnlp"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jnlp PUBLIC "-//Sun Microsystems, Inc//DTD JNLP Descriptor 6.0//EN" "http://java.sun.com/dtd/JNLP-6.0.dtd">
<jnlp spec="1.0+" codebase="${jnlp.codebase}">
<information>
<title>$${app.title}</title>
<vendor>$${app.title} vendor</vendor>
<description>$${app.name} application</description>
<icon href="$${app.icon}"/>
</information>
$${jnlp.permissions}
<resources>
$${jnlp.branding.jars}
</resources>
<component-desc/>
</jnlp>
]]></echo>
</target>
<target name="jnlp-init" depends="jnlp-init-generate-master">
<fail unless="app.name">Must have set at least an application name ('app.name')</fail>
<property name="jnlp.dest.dir" location="${suite.build.dir}/jnlp"/>
<property name="jnlp.master.dir" location="${suite.build.dir}/tmp/master-jnlp"/>
<mkdir dir="${jnlp.master.dir}"/>
<property name="dist.dir" location="dist"/>
<property name="disabled.modules" value=""/>
<property name="enabled.clusters" value=""/>
<property name="disabled.clusters" value=""/>
<pathfileset id="jnlp.included.modules" >
<path refid="cluster.path.id"/>
<and>
<or>
<filename name="modules/**/*.jar"/>
<filename name="lib/**/*.jar"/>
<filename name="core/**/*.jar"/>
</or>
<not>
<filename name="**/update/**/*.jar"/>
</not>
<custom classpath="${harness.dir}/tasks.jar" classname="org.netbeans.nbbuild.ModuleSelector">
<param name="excludeModules" value="${disabled.modules}"/>
<param name="includeClusters" value="${enabled.clusters}"/>
<param name="excludeClusters" value="${disabled.clusters}"/>
</custom>
</and>
</pathfileset>
<property name="jnlp.sign.jars" value="true"/>
<property name="jnlp.signjar.keystore" location="${suite.build.dir}/default.keystore"/>
<property name="jnlp.signjar.alias" value="jnlp"/>
<property name="jnlp.signjar.password" value="netbeans"/>
<available property="jnlp.signjar.keystore.exists" file="${jnlp.signjar.keystore}"/>
<condition property="jnlp.included.locales.impl" value="${jnlp.included.locales}" else="*">
<isset property="jnlp.included.locales"/>
</condition>
</target>
<target name="jnlp-generate-keystore" depends="jnlp-init" unless="jnlp.signjar.keystore.exists">
<property name="jnlp.signjar.vendor" value="CN=${user.name}"/>
<mkdir dir="${jnlp.signjar.keystore}/../"/>
<echo message="Going to create default keystore in ${jnlp.signjar.keystore}"/>
<genkey validity="365"
alias="${jnlp.signjar.alias}"
keystore="${jnlp.signjar.keystore}"
storepass="${jnlp.signjar.password}"
dname="${jnlp.signjar.vendor}"
/>
</target>
<target name="jnlp-generate-platform" depends="jnlp-generate-platform-repository,jnlp-generate-platform-master"/>
<target name="jnlp-generate-platform-repository" depends="jnlp-generate-keystore,jnlp-init,set-all-permissions,set-empty-permissions" unless="jnlp.platform.codebase">
<condition property="jnlp.platform.codebase.own" value="${jnlp.codebase}netbeans/" >
<not>
<equals arg1="${jnlp.codebase}" arg2="$$$$codebase" />
</not>
</condition>
<property name="jnlp.platform.codebase.own" value="$$$$codebase"/>
<property name="jnlp.platform.codebase" value="netbeans/"/>
<mkdir dir="${jnlp.dest.dir}/netbeans"/>
<!-- See #70477 for why there is no verify=true here: -->
<makejnlp
appname="${app.name}"
includelocales="${jnlp.included.locales.impl}"
alias="${jnlp.signjar.alias}"
keystore="${jnlp.signjar.keystore}"
storepass="${jnlp.signjar.password}"
dir="${jnlp.dest.dir}/netbeans/"
codebase="${jnlp.platform.codebase.own}"
permissions="${jnlp.permissions}"
signjars="${jnlp.sign.jars}"
processjarversions="${jnlp.generate.versions}"
>
<resources refid="jnlp.included.modules"/>
</makejnlp>
</target>
<target name="set-all-permissions" depends="check-signjars" if="unsign-the-jars">
<property name="jnlp.permissions" value="<security/>"/>
</target>
<target name="set-empty-permissions" depends="check-signjars" unless="unsign-the-jars">
<property name="jnlp.permissions" value="<security><all-permissions/></security>"/>
</target>
<target name="check-signjars">
<condition property="unsign-the-jars">
<isfalse value="${jnlp.sign.jars}"/>
</condition>
</target>
<target name="jnlp-generate-platform-master" depends="jnlp-generate-platform-repository">
<makemasterjnlp
dir="${jnlp.master.dir}"
codebase="${jnlp.platform.codebase}"
>
<resources refid="jnlp.included.modules"/>
</makemasterjnlp>
</target>
<target name="build"
depends="build-jnlp-nowar"
description="Build JNLP files and signed JARs for all modules in the suite."
>
<available file="${nbjdk.home}/sample/jnlp/servlet/jnlp-servlet.jar" property="jnlp.servlet.jar"
value="${nbjdk.home}/sample/jnlp/servlet/jnlp-servlet.jar"
/>
<property name="jnlp.servlet.jar" location="${harness.dir}/jnlp/jnlp-servlet.jar"/>
<fail message="Cannot find -Djnlp.servlet.jar pointing to ${jnlp.servlet.jar}">
<condition>
<not>
<available file="${jnlp.servlet.jar}"/>
</not>
</condition>
</fail>
<echo file="${suite.build.dir}/tmp/web.xml"><![CDATA[
<web-app>
<servlet>
<servlet-name>JnlpDownloadServlet</servlet-name>
<servlet-class>jnlp.sample.servlet.JnlpDownloadServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>JnlpDownloadServlet</servlet-name>
<url-pattern>*.jnlp</url-pattern>
</servlet-mapping>
</web-app>
]]></echo>
<mkdir dir="${dist.dir}"/>
<war basedir="${jnlp.dest.dir}" destfile="${dist.dir}/${app.name}.war" webxml="${suite.build.dir}/tmp/web.xml">
<zipfileset dir="${jnlp.servlet.jar}/.." prefix="WEB-INF/lib"/>
<zipfileset file="${jnlp.servlet.jar}" prefix="WEB-INF/lib"/>
</war>
</target>
<target name="build-jnlp-local" depends="build-jnlp-nowar">
<property name="build.jnlp.local.dir" location="${dist.dir}/jnlp/local"/>
<mkdir dir="${build.jnlp.local.dir}"/>
<mkdir dir="${build.jnlp.local.dir}/netbeans/"/>
<mkdir dir="${build.jnlp.local.dir}/app/"/>
<makeurl property="build.jnlp.local.url" file="${build.jnlp.local.dir}"/>
<copy todir="${build.jnlp.local.dir}">
<fileset dir="${suite.build.dir}/jnlp">
<include name="*.jnlp"/>
</fileset>
<filterchain>
<replacestring from="$$$$codebase" to="${build.jnlp.local.url}"/>
</filterchain>
</copy>
<jnlpupdatemanifeststartup appname="${app.name}"
alias="${jnlp.signjar.alias}"
keystore="${jnlp.signjar.keystore}"
storepass="${jnlp.signjar.password}"
jar="${harness.dir}/jnlp/jnlp-launcher.jar"
masterJnlp="${build.jnlp.local.dir}/master.jnlp"
destjar="${build.jnlp.local.dir}/startup.jar"/>
<mkdir dir="${suite.build.dir}/jnlp/netbeans"/> <!-- else fileset will croak -->
<copy todir="${build.jnlp.local.dir}/netbeans/">
<fileset dir="${suite.build.dir}/jnlp/netbeans">
<include name="**/*.jnlp"/>
</fileset>
<filterchain>
<replacestring from="$$$$codebase" to="${build.jnlp.local.url}netbeans/"/>
</filterchain>
</copy>
<copy todir="${build.jnlp.local.dir}/app/">
<fileset dir="${suite.build.dir}/jnlp/app">
<include name="**/*.jnlp"/>
</fileset>
<filterchain>
<replacestring from="$$$$codebase" to="${build.jnlp.local.url}app/"/>
</filterchain>
</copy>
<copy todir="${build.jnlp.local.dir}">
<fileset dir="${suite.build.dir}/jnlp">
<exclude name="**/*.jnlp"/>
</fileset>
</copy>
<verifyjnlp>
<fileset file="${build.jnlp.local.dir}/master.jnlp"/>
</verifyjnlp>
</target>
<target name="build-jnlp-nowar" depends="jnlp-init,jnlp-generate-keystore,jnlp-generate-platform">
<mkdir dir="${jnlp.dest.dir}/app"/>
<subant target="jnlp" buildpath="${modules.sorted}" inheritrefs="false" inheritall="false">
<property name="jnlp.dest.dir" value="${jnlp.dest.dir}/app"/>
<property name="jnlp.master.dir" value="${jnlp.master.dir}"/>
<property name="jnlp.master.codebase" value="app/"/>
<property name="jnlp.codebase" value="${jnlp.codebase.app}"/>
<property name="jnlp.signjar.alias" value="${jnlp.signjar.alias}"/>
<property name="jnlp.signjar.keystore" location="${jnlp.signjar.keystore}"/>
<property name="jnlp.signjar.password" value="${jnlp.signjar.password}"/>
<property name="jnlp.sign.jars" value="${jnlp.sign.jars}"/>
<property name="jnlp.permissions" value="${jnlp.permissions}"/>
</subant>
<antcall target="copy-branding"/>
<pathconvert pathsep="${line.separator}" property="jnlp.branding.jars">
<path>
<fileset dir="${jnlp.dest.dir}/branding">
<include name="*_${branding.token}.jar"/>
</fileset>
</path>
<mapper type="regexp" from="^.*[/\\]([^/\\]+\.jar)" to=' <jar href="branding/\1"/>'/>
</pathconvert>
<echo file="${jnlp.master.dir}/resources.xml"><![CDATA[
<java version="1.6+"/>
<jar href="startup.jar" main="true"/>
<property name="jnlp.netbeans.user" value="$${user.home}/.nbapp-${app.name}"/>
]]></echo>
<concat append="true" destfile="${jnlp.master.dir}/resources.xml">
<fileset dir="${jnlp.master.dir}">
<include name="*.ref"/>
</fileset>
</concat>
<loadfile property="jnlp.resources" srcfile="${jnlp.master.dir}/resources.xml"/>
<condition property="netbeans.jnlp.fixPolicy">
<isfalse value="${jnlp.sign.jars}"/>
</condition>
<!-- Anyone knows a better way to negate a property value? -->
<condition property="netbeans.jnlp.fixPolicy" value="false">
<istrue value="${jnlp.sign.jars}"/>
</condition>
<condition property="app.icon.safe" value="${app.icon}" else=".png">
<isset property="app.icon" />
</condition>
<pathconvert property="app.icon.ext">
<path path="${app.icon.safe}"/>
<mapper type="regexp" from="^(.*)\.(.*)$$" to="\2"/>
</pathconvert>
<copy file="${app.icon}" tofile="${jnlp.dest.dir}/master.${app.icon.ext}" failonerror="false"/>
<copy file="master.jnlp" tofile="${jnlp.dest.dir}/master.jnlp">
<filterchain>
<replacestring from="<!--$${jnlp.resources}-->" to="${jnlp.resources}"/>
<replacestring from="$${jnlp.resources}" to="${jnlp.resources}"/>
<replacestring from="$${app.name}" to="${app.name}"/>
<replacestring from="$${user.home}" to="${user.home}"/>
<replacestring from="$${app.title}" to="${app.title}"/>
<replacestring from="$${app.icon}" to="master.${app.icon.ext}"/>
<replacestring from="$${branding.token}" to="${branding.token}"/>
<replacestring from="$${netbeans.jnlp.fixPolicy}" to="${netbeans.jnlp.fixPolicy}"/>
</filterchain>
</copy>
<jnlpupdatemanifeststartup appname="${app.name}"
alias="${jnlp.signjar.alias}"
keystore="${jnlp.signjar.keystore}"
storepass="${jnlp.signjar.password}"
jar="${harness.dir}/jnlp/jnlp-launcher.jar"
masterJnlp="${jnlp.dest.dir}/master.jnlp"
destjar="${jnlp.dest.dir}/startup.jar"/>
<echo>Your JNLP file is generated at ${jnlp.dest.dir}/master.jnlp</echo>
<!-- The following line will not fail if the branding.jnlp
is not present, e.g. when the main file was generated using
harness from 5.x days. -->
<copy file="branding.jnlp" tofile="${jnlp.dest.dir}/branding.jnlp" failonerror="false">
<filterchain>
<replacestring from="$${jnlp.branding.jars}" to="${jnlp.branding.jars}"/>
<replacestring from="$${app.name}" to="${app.name}"/>
<replacestring from="$${app.title}" to="${app.title}"/>
<replacestring from="$${app.icon}" to="master.${app.icon.ext}"/>
<replacestring from="$${jnlp.permissions}" to="${jnlp.permissions}"/>
</filterchain>
</copy>
<taskdef name="verifyjnlp" classname="org.netbeans.nbbuild.VerifyJNLP" classpath="${harness.dir}/tasks.jar"/>
<verifyjnlp>
<fileset file="${jnlp.dest.dir}/master.jnlp"/>
</verifyjnlp>
</target>
<target name="sign-branding-jars" unless="unsign-the-jars" depends="copy-branding-jars">
<jnlpupdatemanifestbranding appname="${app.name}"
alias="${jnlp.signjar.alias}"
keystore="${jnlp.signjar.keystore}"
storepass="${jnlp.signjar.password}">
<fileset dir="${jnlp.dest.dir}/branding">
<include name="*_${branding.token}.jar"/>
</fileset>
</jnlpupdatemanifestbranding>
</target>
<target name="copy-branding" depends="copy-branding-jars, sign-branding-jars"/>
<target name="copy-branding-jars">
<mkdir dir="${jnlp.dest.dir}/branding"/>
<copy todir="${jnlp.dest.dir}/branding" flatten="true">
<fileset dir="${cluster}">
<include name="**/locale/*.jar"/>
</fileset>
</copy>
</target>
<target name="run" depends="build-jnlp-local" description="Executes this suite as JNLP application">
<condition property="run.javaws" value="${nbjdk.home}/jre/bin/javaws">
<available file="${nbjdk.home}/jre/bin/javaws"/>
</condition>
<condition property="run.javaws" value="${nbjdk.home}/bin/javaws">
<available file="${nbjdk.home}/bin/javaws"/>
</condition>
<condition property="run.javaws" value="${nbjdk.home}\jre\bin\javaws.exe">
<available file="${nbjdk.home}\jre\bin\javaws.exe"/>
</condition>
<condition property="run.javaws" value="${nbjdk.home}\bin\javaws.exe">
<available file="${nbjdk.home}\bin\javaws.exe"/>
</condition>
<property name="run.javaws" value="javaws"/>
<property name="run.args" value=""/>
<exec executable="${run.javaws}">
<arg value="-wait"/>
<arg file="${build.jnlp.local.dir}/master.jnlp"/>
<env key="JAVAWS_VM_ARGS" value="${run.args}"/>
</exec>
</target>
<target name="debug" depends="build-jnlp-local" description="Executes this suite as JNLP application under debugger">
<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>
<path refid="cluster.path.id"/>
<filename name="**/*.jar"/>
</pathfileset>
<fileset dir="${cluster}">
<include name="**/*.jar"/>
</fileset>
</classpath>
</nbjpdastart>
<property name="debug.pause" value="y"/>
<property name="debug.args" value="-agentlib:jdwp=transport=dt_socket,suspend=${debug.pause},server=n,address=${debug.port}"/>
<antcall target="run">
<param name="run.args" value="${debug.args}"/>
<reference refid="cluster.path.id"/>
</antcall>
</target>
<target name="-profile-check" if="netbeans.home">
<condition property="profiler.configured">
<or>
<contains string="${run.jvmargs.ide}" substring="-agentpath:" casesensitive="true"/>
<contains string="${run.jvmargs.ide}" substring="-javaagent:" casesensitive="true"/>
</or>
</condition>
</target>
<target name="profile" depends="-profile-check,build-jnlp-local" description="Executes this suite as JNLP application under profiler" if="profiler.configured" unless="profiler.info.jvmargs.agent">
<startprofiler/>
<antcall target="run"/>
</target>
<target name="-check-for-jnlp-userdir">
<property name="jnlp.userdir" location="${user.home}/.nbapp-${app.name}"/>
<condition property="have.jnlp.userdir">
<and>
<isset property="app.name"/>
<available file="${jnlp.userdir}" type="dir"/>
</and>
</condition>
</target>
<target name="-clean-jnlp-userdir" depends="-check-for-jnlp-userdir" if="have.jnlp.userdir">
<property name="jnlp.userdir.bak" location="${jnlp.userdir}.bak"/>
<delete dir="${jnlp.userdir.bak}" failonerror="false"/>
<move file="${jnlp.userdir}" tofile="${jnlp.userdir.bak}" failonerror="false"/>
</target>
<target name="clean" depends="-clean-jnlp-userdir" description="Make sure default JNLP user directory is removed so run-jnlp will not get old test settings."/> <!-- #64249 -->
</project>
|