forked from TheInfiniteKind/appbundler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
202 lines (180 loc) · 8.12 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
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
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2012, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<project name="appbundler" default="package">
<property environment="env"/>
<property file="build.properties"/>
<property name="folder.src" value="src"/>
<property name="folder.native" value="native"/>
<property name="folder.bin" value="bin"/>
<property name="folder.classes" value="${folder.bin}/classes"/>
<property name="folder.res" value="res"/>
<!-- Compile target -->
<target name="compile">
<mkdir dir="${ant.project.name}/${folder.classes}"/>
<javac destDir="${ant.project.name}/${folder.classes}"
includejavaruntime="true"
includeantruntime="true"
target="1.8"
source="1.8"
deprecation="true"
debug="true"
encoding="UTF-8"
failonerror="true">
<src>
<dirset dir="${ant.project.name}">
<include name="${folder.src}"/>
</dirset>
</src>
<compilerarg line="-Xlint:all"/>
<classpath>
<dirset dir="${basedir}" includes="**/${folder.classes}"/>
<fileset dir="${ant.project.name}" includes="lib/**/*.jar"/>
</classpath>
</javac>
<copy todir="${ant.project.name}/${folder.classes}" includeEmptyDirs="false">
<fileset dir="${ant.project.name}/${folder.src}">
<exclude name="**/*.java"/>
<exclude name="**/package.html"/>
</fileset>
</copy>
<exec executable="/usr/libexec/java_home" outputproperty="libexec_javahome" />
<condition property="javahome" value="${env.JAVA_HOME}" else="${libexec_javahome}">
<isset property="env.JAVA_HOME"/>
</condition>
<exec executable="xcrun" outputproperty="osx.sdk.dir">
<arg value="--show-sdk-path" />
</exec>
<exec executable="${cc}" failonerror="true">
<arg line="${arch64}"/>
<arg value="-I"/>
<arg value="${javahome}/include"/>
<arg value="-I"/>
<arg value="${javahome}/include/darwin"/>
<arg value="-o"/>
<arg value="${ant.project.name}/${folder.classes}/com/oracle/appbundler/JavaAppLauncher"/>
<arg value='-DLIBJLI_DYLIB="${javahome}/jre/lib/jli/libjli.dylib"'/>
<arg value="-framework"/>
<arg value="Cocoa"/>
<arg value="-F"/>
<arg value="${javahome}/../.."/>
<arg value="-isysroot"/>
<arg value="${osx.sdk.dir}"/>
<arg value="-mmacosx-version-min=10.7"/>
<arg value="-fobjc-exceptions"/>
<arg value="-std=c99"/>
<arg value="appbundler/native/main.m"/>
</exec>
</target>
<!-- Clean target -->
<target name="clean">
<delete dir="${ant.project.name}/${folder.bin}"/>
<delete dir="HelloWorld.app"/>
<delete dir="SwingSet2.app"/>
<delete dir="SwingSet2Plugin.app"/>
</target>
<!-- Package target -->
<target name="package" depends="compile">
<zip destfile="${ant.project.name}/${folder.classes}/com/oracle/appbundler/res.zip">
<fileset dir="${ant.project.name}/${folder.res}"/>
</zip>
<jar destfile="${ant.project.name}/${folder.bin}/${ant.project.name}-${version}.jar" index="true">
<manifest>
<attribute name="Implementation-Vendor-Id" value="com.oracle"/>
<attribute name="Implementation-Vendor" value="Oracle"/>
<attribute name="Implementation-Title" value="App Bundler Ant Task"/>
<attribute name="Implementation-Version" value="${version}"/>
</manifest>
<fileset dir="${ant.project.name}/${folder.classes}"/>
<fileset dir="${ant.project.name}/${folder.bin}">
<include name="JavaAppLauncher"/>
<include name="*.zip"/>
</fileset>
</jar>
</target>
<!-- Test targets -->
<target name="test" depends="package">
<taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask"
classpath="${ant.project.name}/${folder.bin}/${ant.project.name}-${version}.jar"/>
<bundleapp outputdirectory="."
debug="true"
name="Test"
displayname="Test"
identifier="com.oracle.javafx.swing.Test"
shortversion="1.0"
applicationCategory="public.app-category.developer-tools"
mainclassname="com/javafx/main/Main">
<runtime dir="${env.JAVA_HOME}"/>
<classpath file="${ant.project.name}/SwingInterop.jar"/>
<option value="-Dapple.laf.useScreenMenuBar=true"/>
<argument value="foo=bar"/>
</bundleapp>
</target>
<target name="test-no-bundled-runtime" depends="package">
<taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask"
classpath="${ant.project.name}/${folder.bin}/${ant.project.name}-${version}.jar"/>
<bundleapp outputdirectory="."
debug="true"
name="Test"
displayname="Test (without a bundled runtime)"
identifier="com.oracle.javafx.swing.Test"
shortversion="1.0"
applicationCategory="public.app-category.developer-tools"
mainclassname="com/javafx/main/Main">
<classpath file="${ant.project.name}/SwingInterop.jar"/>
<option value="-Dapple.laf.useScreenMenuBar=true"/>
<argument value="foo=bar"/>
</bundleapp>
</target>
<target name="test-plugin" depends="package">
<taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask"
classpath="${ant.project.name}/${folder.bin}/${ant.project.name}-${version}.jar"/>
<bundleapp outputdirectory="."
debug="true"
name="TestPlugin"
displayname="Test (Plugin)"
identifier="com.oracle.javafx.swing.TestPlugin"
shortversion="1.0"
applicationCategory="public.app-category.developer-tools"
mainclassname="com/javafx/main/Main">
<classpath file="${ant.project.name}/SwingInterop.jar"/>
<option value="-Dapple.laf.useScreenMenuBar=true"/>
<argument value="foo=bar"/>
</bundleapp>
</target>
<!-- Trim whitespace target -->
<target name="trim-whitespace">
<fileset id="trimfiles" dir=".">
<include name="**/*.h"/>
<include name="**/*.html"/>
<include name="**/*.java"/>
<include name="**/*.m"/>
<include name="**/*.strings"/>
<include name="**/*.xml"/>
</fileset>
<replaceregexp match="[\t]" replace=" " flags="gm" byline="true">
<fileset refid="trimfiles"/>
</replaceregexp>
<replaceregexp match="[\t ]+$" replace="" flags="gm" byline="true">
<fileset refid="trimfiles"/>
</replaceregexp>
</target>
</project>