-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
146 lines (126 loc) · 5.18 KB
/
Copy pathbuild.xml
File metadata and controls
146 lines (126 loc) · 5.18 KB
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
<?xml version="1.0" encoding="ISO-8859-1" ?>
<project name="ogam-builder" default="dist-all" basedir=".">
<description>
Contains target for :
* dist : Build and make a jar for the deployer project.
The resulted jars and required libs are bundled into a zip file
located into the "dist" foler. This zip file can be extracted and used
as it to launch the application form the jar.
* dist-all : Build and make a jar for the deployer project and all
"projects" that can be used with the depoyer. Each "projects" have to
be located into the "src/projects" dir and will live in a root package
who has the name of the project. To add a project, update the
"dist-projects" target while copying and pasting the "distproject"
task.
</description>
<target name="dist-projects" depends="dist">
<!-- Copy, paste this task and change the "project" attribute -->
<!--<distproject project="demo" />-->
</target>
<target name="compile" depends="init">
<mkdir dir=".build/main/classes"/>
<javac srcdir="src/main/java" destdir=".build/main/classes"
includeantruntime="false" debug="on" optimize="on" >
<compilerarg value="-Xlint"/>
<classpath>
<fileset dir="lib/main" includes="**/*.jar" />
</classpath>
</javac>
</target>
<target name="dist" depends="compile">
<mkdir dir=".build/main/jar/lib" />
<copy todir=".build/main/jar/lib">
<fileset dir="lib/main" includes="*.jar" />
</copy>
<path id="classpath">
<fileset dir=".build/main/jar/lib" includes="*.jar" />
</path>
<manifestclasspath property="jar.classpath" jarfile=".build/main/jar/ogam-builder.jar">
<classpath refid="classpath" />
</manifestclasspath>
<tempfile property="manifest" destdir=".build/main/jar" suffix=".tmp" prefix="MANIFEST_"/>
<manifest file="${manifest}">
<attribute name="Main-Class" value="be.gervaisb.ogam.deployer.Launcher"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Class-Path" value="${jar.classpath}" />
</manifest>
<jar destfile=".build/main/jar/ogam-builder.jar"
basedir=".build/main/classes"
manifest="${manifest}">
<fileset dir="src/main/resources" />
</jar>
<zip destfile="dist/ogam-builder_standalone.zip"
basedir=".build/main/jar" />
<delete file="${manifest}" />
</target>
<target name="dist-all" depends="dist, dist-projects">
<mkdir dir=".build/all/lib" />
<copy todir=".build/all/lib">
<fileset dir="lib/main" includes="*.jar" />
<fileset dir="lib/projects" includes="*/*.jar" />
</copy>
<mkdir dir=".build/all/projects" />
<copy todir=".build/all/projects">
<fileset dir=".build/projects/jar" includes="*.jar" />
</copy>
<mkdir dir=".build/all" />
<path id="classpath.all">
<fileset dir=".build/all/projects" includes="**/*.jar" />
<fileset dir=".build/all/lib" includes="**/*.jar" />
</path>
<manifestclasspath property="jar.classpath.all" jarfile=".build/all/ogam-builder.jar">
<classpath refid="classpath.all" />
</manifestclasspath>
<tempfile property="manifest.all" destdir=".build/all" suffix=".tmp" prefix="MANIFEST_"/>
<manifest file="${manifest.all}">
<attribute name="Main-Class" value="be.gervaisb.ogam.deployer.Launcher"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Class-Path" value="${jar.classpath.all}" />
</manifest>
<jar destfile=".build/all/ogam-builder.jar"
basedir=".build/main/classes"
manifest="${manifest.all}">
<fileset dir="src/main/resources" />
<fileset dir="src/main/java" includes="**/*.png" />
<fileset dir="src/main/java" includes="**/*.png" />
</jar>
<delete file="${manifest.all}" />
<zip destfile="dist/ogam-builder_all.zip"
basedir=".build/all" excludes="${manifest.all}">
</zip>
</target>
<target name="clean" >
<delete dir=".build" includeemptydirs="no" failonerror="no" />
</target>
<target name="init" depends="clean">
<mkdir dir=".build" />
<mkdir dir="dist" />
</target>
<!-- = = = = = = = = = = = = = = = = =
macrodef: distproject
= = = = = = = = = = = = = = = = = -->
<macrodef name="distproject">
<attribute name="project" />
<sequential>
<!-- First, we compile the project classes -->
<mkdir dir=".build/projects/@{project}/classes"/>
<mkdir dir="lib/projects/@{project}" />
<javac srcdir="src/projects" destdir=".build/projects/@{project}/classes"
includeantruntime="false" debug="on" optimize="on" >
<compilerarg value="-Xlint"/>
<classpath>
<fileset dir="lib/main" includes="**/*.jar" />
<fileset file=".build/main/jar/ogam-builder.jar" />
<fileset dir="lib/projects/@{project}" includes="**/*.jar" />
</classpath>
<include name="@{project}/**/*"/>
</javac>
<!-- Next, we make a jar for this project -->
<mkdir dir=".build/projects/jar" />
<jar destfile=".build/projects/jar/@{project}.jar"
basedir=".build/projects/@{project}/classes" >
<fileset dir="src/projects" excludes="**/*.java" />
</jar>
</sequential>
</macrodef>
</project>