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
|
<?xml version="1.0" encoding="UTF-8"?>
<!--
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
Other names may be trademarks of their respective owners.
The contents of this file are subject to the terms of either the GNU
General Public License Version 2 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://www.netbeans.org/cddl-gplv2.html
or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License file at
nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the GPL Version 2 section of the License file that
accompanied this code. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
Contributor(s):
The Original Software is NetBeans. The Initial Developer of the Original
Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
Microsystems, Inc. All Rights Reserved.
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 2, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 2] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 2 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 2 code and therefore, elected the GPL
Version 2 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
-->
<project name="jnlp-impl" default="default" basedir="..">
<property name="master.jnlp.file" location="master.jnlp"/>
<property name="launch.jnlp.file" value="launch.jnlp"/>
<property name="jnlp.dest.dir" location="dist"/>
<!-- helper file to create list of arguments -->
<property name="args.file" location="args.txt"/>
<target name="default">
<echo message="Default target is not set."/>
</target>
<!-- Main target -->
<target name="jnlp" depends="-test-jnlp-enabled" if="is.jnlp.enabled">
<antcall target="generate-jnlp"/>
</target>
<!-- Generate master -->
<target name="-check-for-master.jnlp">
<available file="${master.jnlp.file}" property="master.jnlp.exists"/>
</target>
<target name="jnlp-init-generate-master" depends="-check-for-master.jnlp" unless="master.jnlp.exists">
<echo file="${master.jnlp.file}"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="$${jnlp.codebase}" href="launch.jnlp">
<information>
<title>$${APPLICATION.TITLE}</title>
<vendor>$${APPLICATION.VENDOR}</vendor>
<description>$${APPLICATION.DESC}</description>
<description kind="short">$${APPLICATION.DESC.SHORT}</description>
<homepage href="$${APPLICATION.HOMEPAGE}"/>
<!--$${JNLP.ICONS}-->
<!--$${JNLP.OFFLINE.ALLOWED}-->
</information>
<!--$${JNLP.SECURITY}-->
<resources>
<!--$${JNLP.RESOURCES.RUNTIME}-->
<!--$${JNLP.RESOURCES.MAIN.JAR}-->
<!--$${JNLP.RESOURCES.JARS}-->
</resources>
<application-desc main-class="$${jnlp.main.class}">
<!--$${JNLP.APPLICATION.ARGS}-->
</application-desc>
</jnlp>
]]></echo>
</target>
<!-- -->
<target name="-init-check">
<fail unless="application.title" message="Must set application title."/>
<fail unless="application.vendor" message="Must set application vendor."/>
</target>
<!-- Icons -->
<target name="-init-icons" depends="-preinit-icons,-set-icon-elem,-set-splash-elem">
<property name="jnlp.icon.elem" value=""/>
<property name="application.splash.elem" value=""/>
<property name="icon.separator" value=""/>
<property name="jnlp.icons.value" value="${jnlp.icon.elem}${icon.separator}${application.splash.elem}"/>
</target>
<target name="-preinit-icons" depends="-copy-app-icon,-copy-app-splash"/>
<target name="-copy-app-icon" if="jnlp.icon" depends="-get-app-icon-name">
<copy file="${jnlp.icon}" todir="${jnlp.dest.dir}" failonerror="false"/>
<available file="${jnlp.dest.dir}${file.separator}${jnlp.icon.name}" property="jnlp.icon.copied"/>
</target>
<target name="-copy-app-splash" if="application.splash" depends="-get-app-splash-name">
<copy file="${application.splash}" todir="${jnlp.dest.dir}" failonerror="false"/>
<available file="${jnlp.dest.dir}${file.separator}${application.splash.name}" property="application.splash.copied"/>
</target>
<target name="-get-app-icon-name" if="jnlp.icon">
<dirname file="${jnlp.icon}" property="jnlp.icon.basedir"/>
<pathconvert property="jnlp.icon.name" setonempty="false">
<path location="${jnlp.icon}"/>
<map from="${jnlp.icon.basedir}${file.separator}" to=""/>
</pathconvert>
</target>
<target name="-get-app-splash-name" if="application.splash">
<dirname file="${application.splash}" property="application.splash.basedir"/>
<pathconvert property="application.splash.name" setonempty="false">
<path location="${application.splash}"/>
<map from="${application.splash.basedir}${file.separator}" to=""/>
</pathconvert>
</target>
<target name="-set-icon-elem" if="jnlp.icon.copied">
<property name="jnlp.icon.elem" value=' <icon href="${jnlp.icon.name}" kind="default"/>'/>
</target>
<target name="-set-splash-elem" if="application.splash.copied" depends="-set-icon-elem">
<property name="application.splash.elem" value=' <icon href="${application.splash.name}" kind="splash"/>'/>
<condition property="icon.separator" value="${line.separator}">
<isset property="jnlp.icon.elem"/>
</condition>
</target>
<!-- Offline-Allowed -->
<target name="-init-offline" if="offline.allowed.set" depends="-preinit-offline">
<property name="jnlp.offline.allowed.value" value=" <offline-allowed/>"/>
</target>
<target name="-preinit-offline">
<condition property="offline.allowed.set">
<equals arg1="${jnlp.offline-allowed}" arg2="true" trim="true"/>
</condition>
</target>
<!-- Descriptions -->
<target name="-init-descriptions" depends="-descriptions-props-check,-init-desc-value,-init-desc-value-short">
<property name="application.desc.value" value="${application.title}"/>
<property name="application.desc.short.value" value="${application.title}"/>
</target>
<target name="-descriptions-props-check">
<condition property="application.desc.set">
<and>
<isset property="application.desc"/>
<not>
<equals arg1="${application.desc}" arg2="" trim="true"/>
</not>
</and>
</condition>
<condition property="application.desc.short.set">
<and>
<isset property="application.desc.short"/>
<not>
<equals arg1="${application.desc.short}" arg2="" trim="true"/>
</not>
</and>
</condition>
</target>
<target name="-init-desc-value" if="application.desc.set">
<property name="application.desc.value" value="${application.desc}"/>
</target>
<target name="-init-desc-value-short" if="application.desc.short.set">
<property name="application.desc.short.value" value="${application.desc.short}"/>
</target>
<!-- Security -->
<!-- Generating JNLP file -->
<target name="generate-jnlp" depends="jnlp-init-generate-master,-init-codebase,-init-resources-jars,-init-application-args,-init-icons,-init-offline,-init-descriptions,jnlp-init-notinited">
<copy file="master.jnlp" tofile="${jnlp.dest.dir}/${launch.jnlp.file}__" overwrite="true">
<filterchain>
<replacestring from="$${jnlp.codebase}" to="${jnlp.codebase.value}"/>
<replacestring from="<!--$${JNLP.ICONS}-->" to="${jnlp.icons.value}"/>
<replacestring from="<!--$${JNLP.SECURITY}-->" to="${jnlp.security}"/>
<replacestring from="<!--$${JNLP.OFFLINE.ALLOWED}-->" to="${jnlp.offline.allowed.value}"/>
<replacestring from="<!--$${JNLP.RESOURCES.RUNTIME}-->" to="${jnlp.resources.runtime.value}"/>
<replacestring from="<!--$${JNLP.RESOURCES.MAIN.JAR}-->" to="${jnlp.resources.main.jar.value}"/>
<replacestring from="<!--$${JNLP.RESOURCES.JARS}-->" to="${jnlp.resources.jars.value}"/>
<replacestring from="<!--$${JNLP.APPLICATION.ARGS}-->" to="${jnlp.application.args.value}"/>
<replacestring from="$${APPLICATION.TITLE}" to="${application.title}"/>
<replacestring from="$${APPLICATION.VENDOR}" to="${application.vendor}"/>
<replacestring from="$${APPLICATION.DESC}" to="${application.desc.value}"/>
<replacestring from="$${APPLICATION.DESC.SHORT}" to="${application.desc.short.value}"/>
<replacestring from="$${APPLICATION.HOMEPAGE}" to="${application.homepage}"/>
<replacestring from="$${jnlp.main.class}" to="${main.class}"/>
</filterchain>
</copy>
<antcall target="-strip-empty-lines"/>
<antcall target="-generate-html-page"/>
</target>
<target name="jnlp-init-notinited">
<property name="jnlp.security" value=""/>
<property name="jnlp.offline.allowed.value" value=""/>
<property name="application.homepage" value=""/>
<property name="jnlp.application.args.value" value=""/>
</target>
<target name="-strip-empty-lines">
<move file="${jnlp.dest.dir}/${launch.jnlp.file}__" tofile="${jnlp.dest.dir}/${launch.jnlp.file}" overwrite="true">
<filterchain>
<linecontainsregexp>
<regexp pattern=".+"/>
</linecontainsregexp>
</filterchain>
</move>
</target>
<!-- Codebase processing -->
<target name="-init-codebase" depends="-codebase-props-check,-init-non-user-codebase,-init-user-codebase"/>
<target name="-codebase-props-check">
<condition property="local.codebase">
<or>
<not>
<isset property="jnlp.codebase.type"/>
</not>
<equals arg1="${jnlp.codebase.type}" arg2="local" trim="true"/>
</or>
</condition>
<condition property="non.user.codebase">
<or>
<not>
<isset property="jnlp.codebase.type"/>
</not>
<equals arg1="${jnlp.codebase.type}" arg2="local" trim="true"/>
<equals arg1="${jnlp.codebase.type}" arg2="web" trim="true"/>
</or>
</condition>
<condition property="user.codebase">
<equals arg1="${jnlp.codebase.type}" arg2="user" trim="true"/>
</condition>
</target>
<target name="-init-non-user-codebase" if="non.user.codebase">
<property name="jnlp.codebase.value" value="${jnlp.codebase.url}"/>
</target>
<target name="-init-user-codebase" if="user.codebase">
<property name="jnlp.codebase.value" value="${jnlp.codebase.user}"/>
</target>
<!-- j2se resources -->
<target name="-init-resources-runtime" depends="-init-runtime-props">
<property name="run.jvmargs.value" value=""/>
<property name="initial-heap-size.value" value=""/>
<property name="max-heap-size.value" value=""/>
<property name="jnlp.resources.runtime.value"
value=' <j2se version="${javac.target}+"${initial-heap-size.value}${max-heap-size.value}${run.jvmargs.value}/>'/>
</target>
<target name="-init-runtime-props" depends="-runtime-props-check,-init-run-jvmargs-value,-init-initial-heap-size-value,-init-max-heap-size-value"/>
<target name="-runtime-props-check">
<condition property="run.jvmargs.set">
<and>
<isset property="run.jvmargs"/>
<not>
<equals arg1="${run.jvmargs}" arg2="" trim="true"/>
</not>
</and>
</condition>
<condition property="jnlp.initial-heap-size.set">
<and>
<isset property="jnlp.initial-heap-size"/>
<not>
<equals arg1="${jnlp.initial-heap-size}" arg2="" trim="true"/>
</not>
</and>
</condition>
<condition property="jnlp.max-heap-size.set">
<and>
<isset property="jnlp.max-heap-size"/>
<not>
<equals arg1="${jnlp.max-heap-size}" arg2="" trim="true"/>
</not>
</and>
</condition>
</target>
<target name="-init-run-jvmargs-value" if="run.jvmargs.set">
<property name="run.jvmargs.value" value=' java-wm-args="${run.jvmargs}"'/>
</target>
<target name="-init-initial-heap-size-value" if="jnlp.initial-heap-size.set">
<property name="initial-heap-size.value" value=' initial-heap-size="${jnlp.initial-heap-size}"'/>
</target>
<target name="-init-max-heap-size-value" if="jnlp.max-heap-size.set">
<property name="max-heap-size.value" value=' max-heap-size="${jnlp.max-heap-size}"'/>
</target>
<!-- JAR resources -->
<target name="-init-resources-jars" depends="-preinit-resources-jars,-init-resources-runtime"/>
<target name="-preinit-resources-jars" depends="-exclude-javaws-from-cp">
<pathconvert pathsep="${line.separator}" property="jnlp.resources.main.jar.value">
<path location="${dist.jar}"/>
<mapper type="regexp" from="^.*[/\\]([^/\\]+\.jar)"
to=' <jar href="\1" main="true" download="eager"/>'/>
</pathconvert>
<pathconvert pathsep="${line.separator}" property="jnlp.resources.jars.value">
<path path="${run.classpath.without.javaws.jar}"/>
<mapper type="regexp" from="^.*[/\\]([^/\\]+\.jar)"
to=' <jar href="lib/\1" download="eager"/>'/>
</pathconvert>
</target>
<target name="-exclude-javaws-from-cp">
<pathconvert property="path.element.to.be.removed">
<path path="${run.classpath}"/>
<mapper type="regexp" from="(^.*[/\\]javaws.jar)" to="\1"/>
</pathconvert>
<pathconvert property="run.classpath.without.javaws.jar">
<path path="${run.classpath}"/>
<map from="${path.element.to.be.removed}" to=""/>
</pathconvert>
</target>
<!-- Application arguments -->
<target name="-init-application-args" if="application.args">
<echo message="${application.args}" file="${args.file}"/>
<loadfile srcfile="${args.file}" property="jnlp.application.args.value">
<filterchain>
<tokenfilter delimoutput="\n">
<stringtokenizer/>
<replaceregex pattern="(.+)" replace=" <argument>\1</argument>"/>
</tokenfilter>
</filterchain>
</loadfile>
<delete file="${args.file}"/>
</target>
<!-- Running/Debugging -->
<target name="jws-run" depends="jar,-verify-jnlp-enabled,generate-jnlp,-verify-codebase" description="Start javaws execution">
<exec executable="${java.home}/bin/javaws">
<arg line="${jnlp.dest.dir}/${launch.jnlp.file}"/>
</exec>
</target>
<target name="jws-debug" if="netbeans.home" depends="jar,-verify-jnlp-enabled,generate-jnlp,-verify-codebase,-debug-start-debugger,-debug-javaws-debuggee"
description="Debug javaws project in IDE"/>
<target name="-init-debug-args">
<property name="version-output" value="java version "${ant.java.version}"/>
<condition property="have-jdk-older-than-1.4">
<or>
<contains string="${version-output}" substring="java version "1.0"/>
<contains string="${version-output}" substring="java version "1.1"/>
<contains string="${version-output}" substring="java version "1.2"/>
<contains string="${version-output}" substring="java version "1.3"/>
</or>
</condition>
<condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
<istrue value="${have-jdk-older-than-1.4}"/>
</condition>
<condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
<os family="windows"/>
</condition>
<condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
<isset property="debug.transport"/>
</condition>
</target>
<target name="-debug-javaws-debuggee" depends="-init-debug-args">
<exec executable="${java.home}/bin/javaws">
<env key="JAVAWS_VM_ARGS" value="${debug-args-line} -Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
<arg line="${jnlp.dest.dir}/${launch.jnlp.file}"/>
</exec>
</target>
<target name="-verify-codebase" unless="local.codebase">
<fail message="Project cannot be run with non-local codebase. Open project properties dialog and set Web Start Codebase to Local Execution."/>
</target>
<target name="-verify-jnlp-enabled" depends="-test-jnlp-enabled" unless="is.jnlp.enabled">
<fail message="Project cannot be run with selected Run Configuration when Java Web Start is disabled."/>
</target>
<!-- Signing -->
<property name="jnlp.signjar.default.keystore" location="build/default.keystore"/>
<property name="jnlp.signjar.default.alias" value="jnlp"/>
<property name="jnlp.signjar.default.password" value="netbeans"/>
<available property="jnlp.signjar.keystore.exists" file="${jnlp.signjar.keystore}"/>
<target name="jnlp-generate-keystore" unless="jnlp.signjar.keystore.exists">
<property name="jnlp.signjar.vendor" value="CN=${user.name}"/>
<echo message="Going to create default keystore in ${jnlp.signjar.keystore}"/>
<genkey alias="${jnlp.signjar.alias}" keystore="${jnlp.signjar.keystore}"
storepass="${jnlp.signjar.password}" dname="${jnlp.signjar.vendor}"/>
</target>
<target name="sign-jars" depends="jnlp-generate-keystore">
<signjar storepass="${jnlp.signjar.password}" keystore="${jnlp.signjar.keystore}"
alias="${jnlp.signjar.alias}">
<fileset dir="${jnlp.dest.dir}">
<include name="*.jar"/>
</fileset>
</signjar>
</target>
<!-- Test JNLP enabled-->
<target name="-test-jnlp-enabled">
<condition property="is.jnlp.enabled">
<equals arg1="${jnlp.enabled}" arg2="true" casesensitive="false" trim="true"/>
</condition>
</target>
<!-- -->
<target name="-generate-html-page">
<echo file="${jnlp.dest.dir}/launch.html"><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test page for launching the application via JNLP</title>
</head>
<body>
<h3>Test page for launching the application via JNLP</h3>
<a href="launch.jnlp">Launch the application</a>
</body>
</html>
]]></echo>
</target>
</project>
|