forked from jpasqua/VisibleTesla
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
173 lines (146 loc) · 8.07 KB
/
build.xml
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
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<project name="VisibleTesla" default="default" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant">
<description>Builds, tests, and runs the project VisibleTesla.</description>
<target name="-post-compile">
<!--
<copy todir="${dist.dir}/Documentation"> <fileset dir="Documentation"/> </copy>
<copy file="src/org/noroomattheinn/TeslaResources/FobIcon.png" todir="${dist.dir}"/>
<copy file="src/org/noroomattheinn/TeslaResources/FobIcon.ico" todir="${dist.dir}"/>
<copy file="src/org/noroomattheinn/TeslaResources/VTIcon.ico" todir="${dist.dir}"/>
<copy file="InstallSupport/MacAppTemplate/Contents/Resources/VTIcon.icns" todir="${dist.dir}"/>
<copy file="InstallSupport/Windows/vtrunner.bat" todir="${dist.dir}"/>
<copy file="InstallSupport/Windows/Make_Windows_Shortcut.vbs" todir="${dist.dir}"/>
<mkdir dir="${dist.dir}/VisibleTesla.app"/>
<exec executable="cp">
<arg line="-R InstallSupport/MacAppTemplate/ ${dist.dir}/VisibleTesla.app"/>
</exec>
-->
</target>
<target name="-post-jfx-deploy">
<delete file="${dist.dir}/VisibleTesla.jnlp" />
<delete file="${dist.dir}/VisibleTesla.html" />
<delete dir="${dist.dir}/web-files" />
</target>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. Those of them relevant for JavaFX project are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-jfx-jar: called before FX SDK specific <fx:jar> task
-post-jfx-jar: called after FX SDK specific <fx:jar> task
-pre-jfx-deploy: called before FX SDK specific <fx:deploy> task
-post-jfx-deploy: called after FX SDK specific <fx:deploy> task
-pre-jfx-native: called just after -pre-jfx-deploy if <fx:deploy> runs in native packaging mode
-post-jfx-native: called just after -post-jfx-deploy if <fx:deploy> runs in native packaging mode
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting a HTML postprocessor after javaFX SDK deployment:
<target name="-post-jfx-deploy">
<basename property="jfx.deployment.base" file="${jfx.deployment.jar}" suffix=".jar"/>
<property name="jfx.deployment.html" location="${jfx.deployment.dir}${file.separator}${jfx.deployment.base}.html"/>
<custompostprocess>
<fileset dir="${jfx.deployment.html}"/>
</custompostprocess>
</target>
Example of calling an Ant task from JavaFX SDK. Note that access to JavaFX SDK Ant tasks must be
initialized; to ensure this is done add the dependence on -check-jfx-sdk-version target:
<target name="-post-jfx-jar" depends="-check-jfx-sdk-version">
<echo message="Calling jar task from JavaFX SDK"/>
<fx:jar ...>
...
</fx:jar>
</target>
For more details about JavaFX SDK Ant tasks go to
http://docs.oracle.com/javafx/2/deployment/jfxpub-deployment.htm
For list of available properties check the files
nbproject/build-impl.xml and nbproject/jfx-impl.xml.
-->
<property environment="env" />
<taskdef name="bundleapp"
classname="com.oracle.appbundler.AppBundlerTask"
classpath="../../ThirdParty/appbundler-1.0.jar" />
<target name="get-version">
<exec executable="/bin/bash" outputproperty="vt.version">
<arg value="-c" />
<arg value="grep APP_VERSION src/org/noroomattheinn/visibletesla/VT.properties| sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'"/>
</exec>
<echo>Version: ${vt.version}</echo>
</target>
<target name="bundle-VisibleTesla" depends="get-version">
<bundleapp outputdirectory="dist"
name="VisibleTesla"
shortversion="${vt.version}"
copyright="Copyright(c) 2013, 2014, 2015 Joe Pasqua"
icon="src/org/noroomattheinn/TeslaResources/VTIcon.icns"
displayname="VisibleTesla"
identifier="org.noroomattheinn.visibletesla"
mainclassname="org.noroomattheinn.visibletesla.VisibleTesla">
<runtime dir="${env.JAVA_HOME}" />
<classpath file="dist/VisibleTesla.jar" />
<classpath file="${env.JAVA_HOME}/jre/lib/jfxrt.jar" />
<classpath dir="dist/lib" />
<option value="-Xmx1024m" />
</bundleapp>
<!-- Remove redundant jar. It's not found automatically here so it was copied above -->
<delete verbose="true" >
<fileset dir="dist/VisibleTesla.app/Contents/PlugIns" includes="**/lib/jfxrt.jar" />
</delete>
<move verbose="true" file="dist/VisibleTesla.app/Contents/Java/jfxrt.jar" tofile="dist/VisibleTesla.app/Contents/Java/zzz_jfxrt.jar" />
</target>
<target name="sign-mac">
<exec executable="codesign" dir="dist">
<arg value='-v' />
<arg value='-s' />
<arg value='${env.MAC_SIGNER}' />
<arg value='VisibleTesla.app' />
<arg value='--deep' />
</exec>
</target>
<target name="package-mac" depends="bundle-VisibleTesla,sign-mac">
<!-- Don't use the zip Ant task, it won't preserve permissions and this screws the executable! -->
<exec executable="zip" dir="dist">
<arg line="-r VTMac.zip VisibleTesla.app"/>
</exec>
<delete dir="dist/VisibleTesla.app" />
</target>
<target name="package-win" depends="get-version">
<!-- Make a staging directory and copy all needed files to it -->
<mkdir dir="dist/VisibleTesla"/>
<copy todir="dist/VisibleTesla/jre1.7"> <fileset dir="InstallSupport/Windows/jre1.7.0_60"/> </copy>
<copy todir="dist/VisibleTesla/lib"> <fileset dir="dist/lib"/> </copy>
<copy file="dist/VisibleTesla.jar" todir="dist/VisibleTesla"/>
<copy file="InstallSupport/Windows/VTIcon.ico" todir="dist/VisibleTesla"/>
<copy file="InstallSupport/Windows/Make_Windows_Shortcut.vbs" todir="dist/VisibleTesla"/>
<copy file="InstallSupport/Windows/vtrunner.bat" todir="dist/VisibleTesla"/>
<zip destfile="dist/VTWin.zip"> <zipfileset dir="dist/VisibleTesla" prefix="VisibleTesla ${vt.version}"/> </zip>
<!-- The following creates a self-extracting zip which may be useful in the future, but really needs to be signed
<concat destfile="dist/InstallVT.exe" binary="yes">
<fileset file="InstallSupport/Windows/unzipsfx.exe" />
<fileset file="dist/VisibleTesla.zip" />
</concat>
<exec executable="zip"> <arg line="-A dist/InstallVT.exe"/> </exec>
-->
<!-- Cleanup temporary files and directories -->
<delete dir="dist/VisibleTesla" />
</target>
<target name="package-generic" depends="get-version">
<!-- Make a staging directory and copy all needed files to it -->
<mkdir dir="dist/VisibleTesla"/>
<copy todir="dist/VisibleTesla/lib"> <fileset dir="dist/lib"/> </copy>
<copy file="dist/VisibleTesla.jar" todir="dist/VisibleTesla"/>
<copy file="src/org/noroomattheinn/TeslaResources/VTIcon.png" todir="dist/VisibleTesla"/>
<zip destfile="dist/VTGeneric.zip"> <zipfileset dir="dist/VisibleTesla" prefix="VisibleTesla ${vt.version}"/> </zip>
<!-- Cleanup temporary files and directories -->
<delete dir="dist/VisibleTesla" />
</target>
</project>