forked from robig/stlab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
208 lines (191 loc) · 7.45 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
203
204
205
206
207
208
<?xml version="1.0" encoding="UTF-8"?>
<!-- ======================================================================
09.08.2010 15:52:55
StLab
Builds packages for StLab - the device control application for the VOX Tonelab ST
robegroe
====================================================================== -->
<project name="StLab" default="build">
<description>
Builds packages for StLab - the device control application for the VOX Tonelab ST
</description>
<!-- - - - - - - - - - - - - - - - - -
target: init
- - - - - - - - - - - - - - - - - -->
<target name="init">
<property file="build.properties"/>
<property name="build.dir" value="build"/>
<property name="src.dir" value="src" />
<property name="img.dir" value="img" />
<property name="lib.dir" value="lib" />
<property name="dist.dir" value="dist" />
<!-- Set version in applicationVersion src/net/robig/stlab/StLab.java
<property name="version" value="0.2"/> -->
<property name="environment" value="UAT"/>
<path id="classpath">
<fileset dir="lib">
<include name="*.jar" />
</fileset>
</path>
</target>
<target name="get.version" depends="init">
<exec outputproperty="version" executable="./scripts/get_version.sh" failonerror="no">
<arg value="${environment}"/>
</exec>
<echo message="version: ${version}"/>
<property name="pc.jarfile" value="stlab-${version}_pc.jar"/>
<property name="osx.jarfile" value="stlab-${version}_osx.jar"/>
<condition property="non.production" value="1">
<not>
<or>
<equals arg1="${environment}" arg2=""/>
<equals arg1="${environment}" arg2="production"/>
</or>
</not>
</condition>
<condition property="envstr" value="-${environment}" else="">
<not>
<or>
<equals arg1="${environment}" arg2=""/>
<equals arg1="${environment}" arg2="production"/>
</or>
</not>
</condition>
<property name="distribution.zipfile" value="stlab-${version}${envstr}.zip"/>
<echo message="distribution zipfile: ${distribution.zipfile}"/>
</target>
<target name="clean" depends="init">
<delete dir="${build.dir}"/>
<delete file="${jarfile}"/>
</target>
<!-- =================================
target: build
================================= -->
<target name="build" depends="init,get.version,clean" description="Builds StLab application">
<mkdir dir="${build.dir}"/>
<javac
target="1.5"
srcdir="${src.dir}"
destdir="${build.dir}"
classpathref="classpath"
excludes="org/jsresources/**"/>
</target>
<target name="dist" depends="build" description="Builds the Application and creates the jar package">
<delete dir="${dist.dir}" failonerror="false"/>
<mkdir dir="${dist.dir}"/>
<!-- images: -->
<mkdir dir="${build.dir}/${img.dir}"/>
<copy todir="${build.dir}/${img.dir}">
<fileset dir="${img.dir}">
<include name="*.png" />
</fileset>
</copy>
<!-- additional properties: -->
<copy todir="${build.dir}">
<fileset dir=".">
<include name="logging.properties"/>
</fileset>
</copy>
<!-- release notes: -->
<copy todir="${dist.dir}">
<fileset dir=".">
<include name="readme.txt"/>
</fileset>
</copy>
<!-- unzip general libs to package in application jar: -->
<unzip dest="${build.dir}" src="${lib.dir}/nanoxml-lite-2.2.3.jar"/>
<unzip dest="${build.dir}" src="${lib.dir}/flexjson-2.0.jar"/>
<!-- PC jar -->
<jar destfile="${dist.dir}/${pc.jarfile}">
<fileset dir="${build.dir}"/>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class" value="net.robig.stlab.StLab"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Architecture" value="PC"/>
<!-- the classpath is also the search path for the config: .. means outside the jar -->
<attribute name="Class-Path" value=". .. ${pc.jarfile}"/>
</manifest>
</jar>
<echo file="default-config.properties">environment=${environment}</echo>
<!-- OSX distibution -->
<mkdir dir="${dist.dir}/osx"/>
<!-- macos midi implementation jar -->
<unzip dest="${build.dir}" src="${lib.dir}/mmj.jar"/>
<!-- Create MacOS .app: -->
<copy todir="${dist.dir}/osx/StLab.app">
<fileset dir="target"/>
</copy>
<replace file="${dist.dir}/osx/StLab.app/Contents/Info.plist">
<replacefilter token="%VERSION%" value="${version}"/>
<replacefilter token="%JARFILE%" value="${osx.jarfile}"/>
</replace>
<chmod file="${dist.dir}/osx/StLab.app/Contents/MacOS/JavaApplicationStub" perm="555"/>
<!-- build macos jar: -->
<jar destfile="${dist.dir}/osx/StLab.app/Contents/Resources/Java/${osx.jarfile}">
<fileset dir="${build.dir}"/>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class" value="net.robig.stlab.StLab"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Architecture" value="OSX"/>
<!-- the classpath is also the search path for the config: .. means outside the jar -->
<attribute name="Class-Path" value=". .."/>
</manifest>
</jar>
<!-- provide images in zip file: -->
<zip destfile="${dist.dir}/osx/StLab.app/Contents/Resources/Java/img.zip">
<fileset dir="img">
<include name="*.png"/>
</fileset>
</zip>
<copy todir="${dist.dir}/osx/StLab.app/Contents/Resources/Java">
<fileset dir="." id="other">
<include name="logging.properties"/>
<include name="libmmj.jnilib"/>
</fileset>
</copy>
<chmod file="${dist.dir}/osx/StLab.app/start.sh" perm="555"/>
<copy file="default-config.properties" tofile="${dist.dir}/osx/StLab.app/config.properties"/>
<copy file="default-config.properties" tofile="${dist.dir}/config.properties"/>
<!-- zip all for distribution: -->
<antcall target="changelog"/>
<zip destfile="${dist.dir}/${distribution.zipfile}">
<fileset dir="${dist.dir}">
<exclude name="stlab-${version}.zip"/>
<exclude name="osx/StLab.app/start.sh"/>
<exclude name="osx/StLab.app/Contents/MacOS/JavaApplicationStub"/>
<include name="**"/>
</fileset>
<zipfileset dir="${dist.dir}" includes="osx/StLab.app/Contents/MacOS/JavaApplicationStub" filemode="555"/>
<zipfileset dir="target" prefix="osx/StLab.app" includes="start.sh" filemode="555"/>
</zip>
<antcall target="source.package"/>
</target>
<target name="gen.config">
</target>
<!-- make source distribution -->
<target name="source.package" description="make source distribution">
<mkdir dir="${dist.dir}"/>
<mkdir dir="${build.dir}/src"/>
<mkdir dir="${build.dir}/src/img"/>
<copy todir="${build.dir}/src/img">
<fileset dir="img" >
<include name="*.png"/>
</fileset>
</copy>
<zip destfile="${dist.dir}/stlab-src-${version}.zip">
<fileset dir=".">
<include name="src"/>
<include name="lib"/>
</fileset>
<fileset dir="${build.dir}/src/">
<include name="img"/>
</fileset>
</zip>
<delete dir="${build.dir}/src"/>
</target>
<target name="changelog">
<exec executable="./scripts/changelog.sh" failonerror="yes" output="${dist.dir}/changelog.txt" />
</target>
</project>