PageRenderTime 41ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/nbproject/jnlp-impl.xml

http://mp-rechnungs-und-kundenverwaltung.googlecode.com/
XML | 272 lines | 151 code | 37 blank | 84 comment | 0 complexity | 357c1207430bd8974a463fe65e747e7a MD5 | raw file
Possible License(s): LGPL-3.0, Apache-2.0, GPL-3.0, GPL-2.0, AGPL-3.0, JSON, BSD-3-Clause
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  4. Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
  5. The contents of this file are subject to the terms of either the GNU
  6. General Public License Version 2 only ("GPL") or the Common
  7. Development and Distribution License("CDDL") (collectively, the
  8. "License"). You may not use this file except in compliance with the
  9. License. You can obtain a copy of the License at
  10. http://www.netbeans.org/cddl-gplv2.html
  11. or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  12. specific language governing permissions and limitations under the
  13. License. When distributing the software, include this License Header
  14. Notice in each file and include the License file at
  15. nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
  16. particular file as subject to the "Classpath" exception as provided
  17. by Sun in the GPL Version 2 section of the License file that
  18. accompanied this code. If applicable, add the following below the
  19. License Header, with the fields enclosed by brackets [] replaced by
  20. your own identifying information:
  21. "Portions Copyrighted [year] [name of copyright owner]"
  22. Contributor(s):
  23. The Original Software is NetBeans. The Initial Developer of the Original
  24. Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
  25. Microsystems, Inc. All Rights Reserved.
  26. If you wish your version of this file to be governed by only the CDDL
  27. or only the GPL Version 2, indicate your decision by adding
  28. "[Contributor] elects to include this software in this distribution
  29. under the [CDDL or GPL Version 2] license." If you do not indicate a
  30. single choice of license, a recipient has the option to distribute
  31. your version of this file under either the CDDL, the GPL Version 2 or
  32. to extend the choice of license to its licensees as provided above.
  33. However, if you add GPL Version 2 code and therefore, elected the GPL
  34. Version 2 license, then the option applies only if the new code is
  35. made subject to such option by the copyright holder.
  36. -->
  37. <project name="jnlp-impl" default="default" basedir="..">
  38. <property name="jnlp.file.name.default" value="launch.jnlp"/>
  39. <property name="jnlp.dest.dir" location="dist"/>
  40. <!-- helper file to create list of arguments, etc. -->
  41. <property name="helper.file" location="helper.txt"/>
  42. <target name="default">
  43. <echo message="Default target is not set, you must specify which target you want to run."/>
  44. </target>
  45. <!-- Main target -->
  46. <target name="jnlp" depends="-init-filename,-test-jnlp-enabled" if="is.jnlp.enabled">
  47. <delete file="dist/lib/javaws.jar" failonerror="false"/>
  48. <antcall target="generate-jnlp"/>
  49. <antcall target="generate-html-preview"/>
  50. </target>
  51. <!-- Init jnlp filename -->
  52. <target name="-init-filename" depends="-check-filename-prop,-set-jnlp-filename-custom,-set-jnlp-filename-default"/>
  53. <target name="-set-jnlp-filename-custom" if="jnlp.file.name.set">
  54. <property name="jnlp.file" value="${jnlp.file.name}"/>
  55. </target>
  56. <target name="-set-jnlp-filename-default" unless="jnlp.file.name.set">
  57. <property name="jnlp.file" value="${jnlp.file.name.default}"/>
  58. </target>
  59. <target name="-check-filename-prop">
  60. <condition property="jnlp.file.name.set">
  61. <and>
  62. <isset property="jnlp.file.name"/>
  63. <not>
  64. <equals arg1="jnlp.file.name" arg2="" trim="true"/>
  65. </not>
  66. </and>
  67. </condition>
  68. </target>
  69. <!-- Test JNLP enabled-->
  70. <target name="-test-jnlp-enabled">
  71. <condition property="is.jnlp.enabled">
  72. <istrue value="${jnlp.enabled}"/>
  73. </condition>
  74. </target>
  75. <!-- Generating JNLP file -->
  76. <target name="generate-jnlp" depends="-test-generate-task-available,-unavailable-generate-task" if="generate.task.available">
  77. <taskdef name="generate-jnlp" classname="org.netbeans.modules.javawebstart.anttasks.GenerateJnlpFileTask"
  78. classpath="${libs.JWSAntTasks.classpath}"/>
  79. <generate-jnlp destfile="${jnlp.dest.dir}/${jnlp.file}_" template="master-${jnlp.descriptor}.jnlp" destdir="dist"/>
  80. <antcall target="-strip-empty-lines"/>
  81. </target>
  82. <target name="-strip-empty-lines">
  83. <copy file="${jnlp.dest.dir}/${jnlp.file}_" tofile="${jnlp.dest.dir}/${jnlp.file}" overwrite="true" encoding="UTF-8">
  84. <filterchain>
  85. <linecontainsregexp>
  86. <regexp pattern=".+"/>
  87. </linecontainsregexp>
  88. </filterchain>
  89. </copy>
  90. <delete file="${jnlp.dest.dir}/${jnlp.file}_" failonerror="false"/>
  91. </target>
  92. <target name="-test-generate-task-available">
  93. <available property="generate.task.available" classname="org.netbeans.modules.javawebstart.anttasks.GenerateJnlpFileTask"
  94. classpath="${libs.JWSAntTasks.classpath}"/>
  95. </target>
  96. <target name="-unavailable-generate-task" unless="generate.task.available">
  97. <echo message="Task required to generate JNLP file is missing, probably the library 'JWS Ant Tasks' is missing either from shared folder or from IDE installation."/>
  98. <fail/>
  99. </target>
  100. <!-- Codebase processing -->
  101. <target name="-codebase-props-check">
  102. <condition property="local.codebase">
  103. <or>
  104. <not>
  105. <isset property="jnlp.codebase.type"/>
  106. </not>
  107. <equals arg1="${jnlp.codebase.type}" arg2="local" trim="true"/>
  108. </or>
  109. </condition>
  110. <condition property="non.user.codebase">
  111. <or>
  112. <not>
  113. <isset property="jnlp.codebase.type"/>
  114. </not>
  115. <equals arg1="${jnlp.codebase.type}" arg2="local" trim="true"/>
  116. <equals arg1="${jnlp.codebase.type}" arg2="web" trim="true"/>
  117. </or>
  118. </condition>
  119. <condition property="user.codebase">
  120. <equals arg1="${jnlp.codebase.type}" arg2="user" trim="true"/>
  121. </condition>
  122. </target>
  123. <target name="-init-non-user-codebase" if="non.user.codebase">
  124. <property name="jnlp.codebase.value" value="${jnlp.codebase.url}"/>
  125. </target>
  126. <target name="-init-user-codebase" if="user.codebase">
  127. <property name="jnlp.codebase.value" value="${jnlp.codebase.user}"/>
  128. </target>
  129. <!-- Security -->
  130. <target name="-security-props-check">
  131. <condition property="jnlp.signed.true">
  132. <istrue value="${jnlp.signed}"/>
  133. </condition>
  134. </target>
  135. <target name="-jnlp-init-keystore" depends="-jnlp-init-keystore-props,-check-keystore-exists" unless="jnlp.signjar.keystore.exists">
  136. <echo message="${application.vendor}" file="${helper.file}"/>
  137. <loadfile property="application.vendor.filtered" srcfile="${helper.file}">
  138. <filterchain>
  139. <deletecharacters chars=","/>
  140. </filterchain>
  141. </loadfile>
  142. <delete file="${helper.file}"/>
  143. <property name="jnlp.signjar.vendor" value="CN=${application.vendor.filtered}"/>
  144. <echo message="Going to create default keystore in ${jnlp.signjar.keystore}"/>
  145. <genkey dname="${jnlp.signjar.vendor}" alias="${jnlp.signjar.alias}" keystore="${jnlp.signjar.keystore}"
  146. storepass="${jnlp.signjar.storepass}" keypass="${jnlp.signjar.keypass}"/>
  147. </target>
  148. <target name="-check-keystore-exists">
  149. <available property="jnlp.signjar.keystore.exists" file="${jnlp.signjar.keystore}"/>
  150. </target>
  151. <target name="-jnlp-init-keystore-props">
  152. <property name="jnlp.signjar.keystore" value="${basedir}/build/nb-jws.ks"/>
  153. <property name="jnlp.signjar.storepass" value="storepass"/>
  154. <property name="jnlp.signjar.keypass" value="keypass"/>
  155. <property name="jnlp.signjar.alias" value="nb-jws"/>
  156. </target>
  157. <!-- Signing
  158. <target name="-test-signjars-task-available">
  159. <available property="signjars.task.available"
  160. classname="org.netbeans.modules.javawebstart.anttasks.SignJarsTask"
  161. classpath="${libs.JWSAntTasks.classpath}"/>
  162. </target>
  163. <target name="-check-signing-possible" depends="-security-props-check,-test-signjars-task-available,-unavailable-signjars-task">
  164. <condition property="jnlp.signed.true+signjars.task.available">
  165. <and>
  166. <isset property="jnlp.signed.true"/>
  167. <isset property="signjars.task.available"/>
  168. </and>
  169. </condition>
  170. </target>
  171. <target name="-unavailable-signjars-task" depends="-test-signjars-task-available" unless="signjars.task.available">
  172. <echo message="Task required to sign JAR file is missing, probably the library 'JWS Ant Tasks' is missing either from shared folder or from IDE installation. JAR files will not be signed."/>
  173. </target>
  174. <target name="sign-jars" depends="-jnlp-init-keystore,-check-signing-possible" if="jnlp.signed.true+signjars.task.available">
  175. <taskdef name="sign-jars" classname="org.netbeans.modules.javawebstart.anttasks.SignJarsTask"
  176. classpath="${libs.JWSAntTasks.classpath}"/>
  177. <sign-jars keystore="${jnlp.signjar.keystore}" storepass="${jnlp.signjar.storepass}"
  178. keypass="${jnlp.signjar.keypass}" alias="${jnlp.signjar.alias}" mainjar="${dist.jar}" destdir="dist"
  179. codebase="${jnlp.codebase.value}" signedjarsprop="jnlp.signed.jars"
  180. componentsprop="jnlp.components">
  181. <fileset dir="dist/lib">
  182. <include name="*.jar"/>
  183. </fileset>
  184. </sign-jars>
  185. </target>
  186. -->
  187. <target name="jws-run" depends="jar,-verify-jnlp-enabled,-verify-codebase" description="Start javaws execution">
  188. <exec executable="${java.home}/bin/javaws">
  189. <arg file="${jnlp.dest.dir}/${jnlp.file}"/>
  190. </exec>
  191. </target>
  192. <target name="jws-debug" if="netbeans.home" depends="jar,-verify-jnlp-enabled,-verify-codebase,-debug-start-debugger,-debug-javaws-debuggee"
  193. description="Debug javaws project in IDE"/>
  194. <target name="-debug-javaws-debuggee">
  195. <exec executable="${java.home}/bin/javaws">
  196. <env key="JAVAWS_VM_ARGS" value="-Xdebug -Xnoagent -Djava.compiler=none -Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
  197. <arg file="${jnlp.dest.dir}/${jnlp.file}"/>
  198. </exec>
  199. </target>
  200. <target name="-verify-codebase" depends="-codebase-props-check" unless="local.codebase">
  201. <fail message="Project cannot be run with non-local codebase. Open project properties dialog and set Web Start Codebase to Local Execution."/>
  202. </target>
  203. <target name="-verify-jnlp-enabled" depends="-test-jnlp-enabled" unless="is.jnlp.enabled">
  204. <fail message="Project cannot be run with selected Run Configuration when Java Web Start is disabled."/>
  205. </target>
  206. <!-- Generate simple HTML preview page -->
  207. <target name="-check-html-preview">
  208. <condition property="generate.html.preview">
  209. <or>
  210. <equals arg1="${jnlp.descriptor}" arg2="application"/>
  211. <equals arg1="${jnlp.descriptor}" arg2="applet"/>
  212. </or>
  213. </condition>
  214. </target>
  215. <target name="generate-html-preview" depends="-check-html-preview" if="generate.html.preview">
  216. <copy file="preview-${jnlp.descriptor}.html" tofile="${jnlp.dest.dir}/launch.html" overwrite="true" encoding="UTF-8">
  217. <filterchain>
  218. <replacestring from="${JNLP.FILE}" to="${jnlp.file}"/>
  219. <replacestring from="${JNLP.APPLET.WIDTH}" to="${jnlp.applet.width}"/>
  220. <replacestring from="${JNLP.APPLET.HEIGHT}" to="${jnlp.applet.height}"/>
  221. </filterchain>
  222. </copy>
  223. </target>
  224. </project>