-
Notifications
You must be signed in to change notification settings - Fork 53
/
build.xml
220 lines (180 loc) · 10.2 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
209
210
211
212
213
214
215
216
217
218
219
220
<?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.) -->
<project name="jaer" default="default" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<target depends="jar" description="Build jar.jar for all jAER classes." name="default"/>
<description>Builds, tests, and runs the project jAER</description>
<import file="nbproject/build-impl.xml"/>
<target name="-do-clean" depends="init,clean-ivy">
<delete dir="${build.dir}"/>
</target>
<!--
https://blog.alejandrocelaya.com/2014/02/22/dependency-management-in-java-projects-with-ant-and-ivy/
https://ant.apache.org/ivy/
http://wiki.netbeans.org/FaqIvy
see ivy.xml
ivy download and configure adapated from https://gist.github.com/snipsnipsnip/3284453
-->
<property name="ivy.install.version" value="2.5.2" />
<property name="ivy.jar.dir" value="${basedir}/ivy" />
<property name="ivy.cache.dir" value="${basedir}/ivy" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<property name="ivy.lib" value="${basedir}/lib" />
<property name="ivy.settings.location" value="${basedir}/ivysettings.xml" />
<target name="-check-ivy">
<echo message="ivy.lib=${ivy.lib}" />
<available file="${ivy.jar.file}" property="ivy.skip.download"/>
<mkdir dir="${ivy.lib}"/>
</target>
<target name="-download-ivy" unless="ivy.skip.download" depends="-check-ivy">
<mkdir dir="${ivy.jar.dir}"/>
<echo message="installing ivy..."/>
<get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<target name="-load-ivy-tasks" depends="-download-ivy">
<path id="ivy.lib.path">
<pathelement location="${ivy.jar.file}"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<target name="download-deps" depends="-load-ivy-tasks"
description="Download dependent libraries.">
<!--<echo message="****** If you get dialog Artifactory Domain asking for user/pass hit Cancel button"/>-->
<ivy:resolve file="ivy.xml"/>
<!--note following pattern that must be used instead of ${ivy.lib} which does not work for unknown reason-->
<ivy:retrieve pattern="lib/[artifact]-[revision](-[classifier]).[ext]" sync="true"/>
<!--<echo message="Retrieve pattern=${ivy.retrieve.pattern}"/>-->
<!--<ivy:retrieve/>-->
<pathconvert property="ivy.classpath.computed" dirsep="/" pathsep=":">
<path>
<fileset dir="${ivy.lib}" includes="*.jar"/>
</path>
<map from="${basedir}${file.separator}" to=""/>
</pathconvert>
<echo message="ivy.classpath.computed = ${line.separator} ${ivy.classpath.computed}" />
<propertyfile file="${basedir}/nbproject/project.properties">
<entry operation="=" key="ivy.classpath" value="${ivy.classpath.computed}"/>
</propertyfile>
</target>
<target name="clean-deps" description="Clean downloaded libraries.">
<echo message="clean-deps: deleting ${ivy.lib}" />
<delete dir="${ivy.lib}" failonerror="false" />
</target>
<target name="clean-ivy-cache" description="Clear ivy/ folder of all libraries." depends="-load-ivy-tasks">
<!--<ivy:cleancache />-->
<echo message="Clearing ivy cache ${ivy.cache.dir} excluding ${ivy.jar.file}"/>
<delete dir="${ivy.cache.dir}" failonerror="false" />
</target>
<target name="clean-ivy" depends="clean-deps" description="Clean ivy.">
<!--<delete dir="${ivy.jar.dir}"/>-->
<!--<ivy:cleancache/>-->
<propertyfile file="${basedir}/nbproject/project.properties">
<entry operation="=" key="ivy.classpath" value=""/>
</propertyfile>
</target>
<!-- <target name="-use-ivy-junit" depends="download-deps" unless="netbeans.home">
<property name="libs.junit_4.classpath" value="${ivy.lib}/junit-4.10.jar"/>
</target>-->
<target name="-pre-compile" depends="download-deps"/>
<target name="-pre-compile-single" depends="download-deps"/>
<target name="-pre-init">
<tstamp/>
</target>
<!-- makes sure that the build version is written to the jar -->
<target name="-pre-jar" depends="jaer-setBuildVersion,jaer-copySplashImage" >
<echo message="build.xml project opened"/>
<echo> Having trouble building or running?
See the jAER user forum at https://groups.google.com/forum/#!forum/jaer-users
</echo>
</target>
<target name="checkos">
<condition property="isWindows" value="true">
<os family="windows" />
</condition>
</target>
<!-- copy splash image to src tree so that it gets into main jar-->
<target name="jaer-copySplashImage">
<copy file="images/SplashScreen.png" todir="build/classes"/>
</target>
<!-- The exe4j launcher target to build jAERViewer.exe with integrated java 6 splash screen.
http://www.ej-technologies.com/products/exe4j/overview.html
-->
<target name="jaer-exe4j">
<echo message="Building Windows .exe. launchers using exe4j (https://www.ej-technologies.com/download/exe4j/files). ${line.separator} Note that depending on 32- or 64-bit installed JDKs, ${line.separator} you may not be able to build one or the other of these launchers. ${line.separator} Don't worry about this."/>
<!-- <subant failonerror="false" target="jaer-exe4jx86">
<fileset dir="." includes="build.xml"/>
</subant>-->
<subant failonerror="false" target="jaer-exe4j9">
<fileset dir="." includes="build.xml"/>
</subant>
</target>
<!--
Your license key for exe4j 4.x is:
L-TOBI_DELBRUCK#50022033010001-1evjjgm42c2fj#2311
-->
<target name="jaer-exe4j9" depends="checkos" if="isWindows">
<echo message="Building exe4j jAERViewer.exe 64-bit Windows launcher for 64-bit Java Virtual Machines - embedding icon and setting SplashScreen in jAERViewer.exe. ${line.separator} Don't worry if this task fails for you unless you have changed the classpath. ${line.separator}jAERViewer.exe does not normally need to be rebuilt."/>
<property environment="env"/>
<property name="env.EXE4J_JAVA_HOME" value="${java.home}"/>
<echo message="java.home=${java.home} env.EXE4J_JAVA_HOME=${env.EXE4J_JAVA_HOME}" />
<taskdef name="exe4j" classname="com.exe4j.Exe4JTask" classpath="exe4j-launcher/exe4j9/bin/ant.jar" onerror="report"/>
<exe4j projectfile="jaer_win_jre_x64.exe4j" requirelicense="true"/>
</target>
<!-- <taskdef name="install4j"
classname="com.install4j.Install4JTask"
classpath="C:\Program Files\install4j10\bin\ant.jar"/>
<target name="media">
<install4j projectFile="jaer.install4j"/>
</target>-->
<!-- builds the windows executable .exe launcher files -->
<target name="-post-jar" depends="jaer-exe4j">
</target>
<!-- builds a runtime archive for end users who don't want to develop -->
<target name="jaer-runtime-archive" depends="jar">
<tstamp/>
<exec executable="git" outputproperty="git.tag">
<arg value="describe"/>
<arg value="--tags"/>
<arg value="--abbrev=0"/>
</exec>
<echo message="Git tag is ${git.tag}"/>
<echo message="Building jaer-runtime-${git.tag}.zip"/>
<!--<delete file="../jaer-runtime-\*.zip" failonerror="false"/>-->
<property name="runtimeZipFileName" value="../jaer-runtime-${git.tag}.zip"/>
<zip destfile="${runtimeZipFileName}" level="9"
comment="jAER runtime release - see https://jaerproject.org">
<zipfileset prefix="jAER-runtime"
dir="."
excludes="**/*.zip, ivy/**, **/*.private, **/*.hprof, **/*.log, **/*.ncb, installers/**, .git/**, exe4j*/**"
defaultexcludes="false"
/>
</zip>
</target>
<!-- builds a file with the output of svnversion that is used for the About dialogs -->
<!--TODO fix to get rev info from git-->
<target name="jaer-setBuildVersion" depends="init">
<tstamp/>
<echo message="Making build version file ${buildversion.outputfile} - you can ignore any error ${line.separator}generated here since it will only affect the Help/About... dialog." />
<delete file="${buildversion.outputfile}"/>
<echo message="Built ${TODAY} at ${TSTAMP} by ${user.name}${line.separator}" append="true" file="${buildversion.outputfile}" />
<echo message="os.name=${os.name}${line.separator}" append="true" file="${buildversion.outputfile}" />
<echo message="os.version=${os.version}${line.separator}" append="true" file="${buildversion.outputfile}" />
<echo message="java.version=${java.version}${line.separator}" append="true" file="${buildversion.outputfile}" />
<echo message="java.vendor=${java.vendor}${line.separator}" append="true" file="${buildversion.outputfile}" />
<echo message="":git describe" output: " append="true" file="${buildversion.outputfile}" />
<!-- run version command to get revision numnber -->
<exec executable="git" failifexecutionfails="false" spawn="false" dir="${basedir}" output="${buildversion.outputfile}" append="true" searchpath="true">
<arg line="describe --tags --abbrev=0"/>
</exec>
<echo message="${line.separator}" append="true" file="${buildversion.outputfile}" />
<concat>
<filelist dir="${basedir}" files="${buildversion.outputfile}"/>
</concat>
</target>
<target name="jaer-sign-jar" depends="jar">
<echo message="Self-signing jar"/>
<signjar jar="${dist.jar}" alias="jaer" keystore="keystore" storepass="jaerjaer"/>
</target>
</project>