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