You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2010/08/19 18:17:23 UTC

svn commit: r987217 - in /pivot/trunk: deploy-example.xml deployment-example.xml

Author: gbrown
Date: Thu Aug 19 16:17:23 2010
New Revision: 987217

URL: http://svn.apache.org/viewvc?rev=987217&view=rev
Log:
Add Windows .exe to deployment example.

Added:
    pivot/trunk/deployment-example.xml
Removed:
    pivot/trunk/deploy-example.xml

Added: pivot/trunk/deployment-example.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/deployment-example.xml?rev=987217&view=auto
==============================================================================
--- pivot/trunk/deployment-example.xml (added)
+++ pivot/trunk/deployment-example.xml Thu Aug 19 16:17:23 2010
@@ -0,0 +1,143 @@
+<?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="examples" default="deploy">
+    <property file="build.properties"/>
+
+    <property name="folder.src" value="src"/>
+    <property name="folder.bin" value="ant-bin"/>
+    <property name="folder.lib" value="lib"/>
+    <property name="folder.www" value="www"/>
+
+    <property name="example.path" value="org/apache/pivot/examples/deployment"/>
+    <property name="example.war" value="${folder.lib}/deployment-example.war"/>
+    <property name="example.exe" value="deployment-example.exe"/>
+    <property name="example.app" value="Deployment Example.app"/>
+
+    <!-- Define the launch4j task -->
+    <taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask"
+        classpath="${launch4j.dir}/launch4j.jar:${launch4j.dir}/lib/xstream.jar"/>
+
+    <!-- Define a condition that checks for Mac OS X -->
+    <condition property="isMac">
+        <os family="mac"/>
+    </condition>
+  
+    <!-- Compile the example application -->
+    <target name="compile">
+        <echo message="Compiling..."/>
+        <ant target="compile"/>
+        
+        <mkdir dir="${ant.project.name}/${folder.bin}"/>
+        <javac srcDir="${ant.project.name}/${folder.src}"
+            destDir="${ant.project.name}/${folder.bin}"
+            classpath="core/${folder.bin}:wtk/${folder.bin}"
+            includejavaruntime="true"
+            includeantruntime="true"
+            deprecation="true"
+            debug="true"
+            target="1.6"
+            encoding="UTF-8"
+            failonerror="true">
+            <include name="${example.path}/**"/>
+        </javac>
+    </target>
+
+    <!-- Generate the example JAR -->
+    <target name="package" depends="compile">
+        <echo message="Packaging..."/>
+        <ant target="package"/>
+        
+        <jar destfile="${folder.lib}/deployment-example.jar">
+            <dirset dir="${ant.project.name}/${folder.bin}"/>
+            <fileset dir="${ant.project.name}/${folder.src}">
+                <exclude name="**/*.java"/>
+            </fileset>
+        </jar>
+    </target>
+
+    <!-- Clean up -->
+    <target name="clean">
+        <ant target="clean"/>
+
+        <delete dir="${ant.project.name}/${folder.bin}"/>
+        <delete dir="${ant.project.name}/${folder.www}"/>
+        <delete file="${example.war}"/>
+        <delete file="${example.exe}"/>
+        <delete dir="${example.app}"/>
+    </target>
+
+    <target name="deploy" depends="deploy-applet, deploy-windows, deploy-osx"/>
+
+    <!-- Package example application for deployment via web browser -->
+    <target name="deploy-applet" depends="package">
+        <echo message="Generating WAR file..."/>
+        
+        <mkdir dir="${ant.project.name}/${folder.www}"/>
+        <mkdir dir="${ant.project.name}/${folder.www}/lib"/>
+
+        <!-- Copy the platform JARs -->
+        <copy todir="${ant.project.name}/${folder.www}/lib">
+            <fileset dir="${folder.lib}">
+                <include name="pivot-core-${version}.jar"/>
+                <include name="pivot-wtk-${version}.jar"/>
+                <include name="pivot-wtk-terra-${version}.jar"/>
+            </fileset>
+        </copy>
+        
+        <!-- Copy the example JAR -->
+        <copy file="${folder.lib}/deployment-example.jar"
+            todir="${ant.project.name}/${folder.www}/lib"/>
+
+        <!-- Generate the host page -->
+        <copy file="${ant.project.name}/${folder.src}/${example.path}/index.html"
+            tofile="${ant.project.name}/${folder.www}/index.html">
+            <filterset>
+                <filter token="version" value="${version}"/>
+            </filterset>
+        </copy>
+
+        <!-- Generate the WAR file -->
+        <war destfile="${example.war}"
+            webxml="${ant.project.name}/${folder.src}/${example.path}/web.xml">
+            <fileset dir="${ant.project.name}/${folder.www}"/>
+        </war>
+    </target>
+
+    <!-- Package example application for deployment via Windows executable -->
+    <target name="deploy-windows" depends="package">
+        <echo message="Generating Windows executable..."/>
+        
+        <launch4j>
+            <config headerType="gui" jar="${folder.lib}/deployment-example.jar" 
+                outfile="${example.exe}">
+                <classPath mainClass="org.apache.pivot.examples.deployment.DeploymentExample">
+                    <cp>${folder.lib}/pivot-core-${version}.jar</cp>
+                    <cp>${folder.lib}/pivot-wtk-${version}.jar</cp>
+                    <cp>${folder.lib}/pivot-wtk-terra-${version}.jar</cp>
+                </classPath>
+                <jre minVersion="1.6.0"/>
+            </config>
+        </launch4j>
+    </target>
+
+    <!-- Package example application for deployment via Mac OS X bundle -->
+    <target name="deploy-osx" if="isMac" depends="package">
+        <echo message="Generating OS X application bundle..."/>
+    </target>
+</project>