This repository has been archived by the owner on Jul 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
j2se.xml
182 lines (138 loc) · 5.19 KB
/
j2se.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
<project name="JavaGear" default="dist_launch4j" basedir=".">
<description>
JavaGear Build File
</description>
<!-- Load properties file -->
<property file="${basedir}/build.properties" />
<!-- Target platform (default to J2SE) -->
<condition property="target" value="j2se">
<not>
<isset property="target" />
</not>
</condition>
<!-- Accuracy Label -->
<condition property="buildType" value="accurate" else="fast">
<equals arg1="${ACCURATE}" arg2="true" />
</condition>
<!-- Target platform properties -->
<property file="${basedir}/platforms/${target}/platform.properties"/>
<!-- set global properties for this build -->
<property name="src" location="${basedir}/src"/>
<property name="classes" location="${basedir}/classes"/>
<property name="dist" location="${basedir}/dist"/>
<property name="res" location="${basedir}/res"/>
<property name="romtool" location="${basedir}/romtool"/>
<property name="jdk" value="${sun.boot.library.path}\..\lib\rt.jar" />
<property name="classpath" value="${java.class.path};${jdk}" />
<property name="baseName" value="JavaGear_${target}_${buildType}_${VERSION}" />
<condition property="doObfuscate">
<equals arg1="${OBFUSCATE}" arg2="true" />
</condition>
<!-- setup patternsets for each device -->
<patternset id="sourcePattern">
<include name="common/*.java" />
<include name="platforms/${target}/*.java" />
</patternset>
<!-- Launch4J Exe Creator -->
<taskdef name="launch4j"
classname="net.sf.launch4j.ant.Launch4jTask"
classpath="${LAUNCH4J}/launch4j.jar
:${LAUNCH4J}/lib/xstream.jar" />
<target name="init">
<!-- Create the build directory structure used by compile -->
<mkdir dir="${dist}"/>
<delete dir="${classes}" />
<mkdir dir="${classes}"/>
</target>
<target name="compile" depends="init">
<echo message="Compiling from ${src}"/>
<echo file="${src}/common/BuildSettings.java">
/* This file is autogenerated. Please do not edit manually */
public class BuildSettings
{
public final static String VERSION = "${VERSION}";
public final static boolean ACCURATE = ${ACCURATE};
}</echo>
<javac srcdir="${src}" destdir="${classes}" source="1.3" target="1.1">
<bootclasspath path="${classpath};${LIBS}" />
<patternset refid="sourcePattern" />
</javac>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Create JAR file -->
<echo message="Creating JAR: ${baseName}.jar"/>
<jar jarfile="${dist}/${baseName}.jar" manifest="${basedir}/platforms/${target}/MANIFEST.MF">
<fileset dir="${classes}" />
<fileset dir="${res}" >
<!-- Exclude thumbs.db system files -->
<exclude name="**/*.db"/>
</fileset>
</jar>
<!-- Create Applet HTML -->
<echo message="Creating HTML: ${baseName}.html"/>
<copy file="${basedir}/platforms/${target}/applet.html" todir="${dist}"/>
<move file="${dist}/applet.html" tofile="${dist}/${baseName}.html"/>
<replace file="${dist}/${baseName}.html" token="@FILENAME@" value="${baseName}.jar"/>
</target>
<target name="dist_obfuscate" depends="dist" if="doObfuscate">
<taskdef resource="proguard/ant/task.properties"
classpath="${PROGUARD}" />
<proguard>
-libraryjars "${java.home}/lib/rt.jar"
-injars "${dist}/${baseName}.jar"
-outjars "${dist}/${baseName}_proguard.jar"
-keepclasseswithmembers public class * {
public static void main(java.lang.String[]);
}
-keep public class JavaGearApplet
</proguard>
<!-- Overwrite original unobfuscated jar -->
<move file="${dist}/${baseName}_proguard.jar" tofile="${dist}/${baseName}.jar"/>
</target>
<!-- Create Windows executable Wrapper -->
<target name="dist_launch4j" depends="dist_obfuscate"
description="Create Windows executable for JavaGear">
<launch4j>
<config headerType="gui"
outfile="${dist}/javagear.exe"
dontWrapJar="true"
jarPath="${baseName}.jar"
icon="platforms/${target}/favicon.ico">
<classPath mainClass="JavaGear">
<cp>%USER_LIBS%/*.jar</cp>
</classPath>
<jre minVersion="1.1.0"/>
</config>
</launch4j>
</target>
<target name="run">
<!-- Compile RomTool -->
<javac srcdir="${romtool}" destdir="${romtool}" source="1.3" target="1.1">
<bootclasspath path="${classpath}" />
</javac>
<!-- Add ROM to package -->
<java classname="RomTool"
failonerror="true"
fork="true"
classpath="${romtool}"
dir="${romtool}">
<!-- Catridge to compile -->
<arg value="${basedir}/rom/${ROM}" />
<!-- JAD of package -->
<arg value="${dist}/${baseName}.jar" />
</java>
<!-- Run JAR file -->
<java jar="${dist}/${baseName}.jar" fork="true" failonerror="true">
<!-- True: Emulate MIDP build, False: J2SE build with menus -->
<arg value="-midp" />
<arg value="true" />
<!-- emulated screen width -->
<arg value="-width" />
<arg value="${WINDOW_WIDTH}" />
<!-- emulated screen height -->
<arg value="-height" />
<arg value="${WINDOW_HEIGHT}" />
</java>
</target>
</project>