forked from unl-pal/argv-transformer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
134 lines (118 loc) · 4.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
<?xml version="1.0" ?>
<project name="argv-transformer" default="package">
<!-- Debug Properties -->
<property name="debug.enabled" value="on" />
<property name="debug.level" value="lines,vars,source" />
<!-- Paths -->
<path id="project.class.path">
<fileset dir="lib">
<include name="**/*.jar" />
</fileset>
<dirset dir="build/classes">
<include name="**" />
</dirset>
</path>
<path id="src.paths">
<pathelement location="src/java" />
</path>
<property name="src.paths" refid="src.paths" />
<!-- Ensure Target Directories -->
<target name="-init">
<mkdir dir="build/classes" />
<mkdir dir="build/depcache" />
<mkdir dir="dist" />
</target>
<!-- Dependency Check -->
<target name="-check-deps">
<depend srcdir="${src.paths}" destdir="build/classes" cache="build/depcache" closure="yes" />
</target>
<!-- Compile -->
<target name="compile" depends="-init,-check-deps" description="Compile the project">
<javac includeantruntime="true"
srcdir="${src.paths}"
destdir="build/classes"
debug="${debug.enabled}"
debuglevel="${debug.level}">
<classpath refid="project.class.path" />
</javac>
</target>
<!-- Clean -->
<target name="clean.build" description="Clean compiled files">
<delete>
<fileset dir="build/classes">
<patternset>
<include name="**" />
</patternset>
</fileset>
</delete>
</target>
<!-- Packaging -->
<target name="git.revision" description="Store git revision in ${repository.version}">
<exec executable="git" outputproperty="git.revision" failifexecutionfails="false" errorproperty="">
<arg value="log" />
<arg value="-1" />
<arg value="--pretty=format:%H" />
</exec>
<condition property="repository.version" value="${git.revision}" else="unknown">
<and>
<isset property="git.revision"/>
<length string="${git.revision}" trim="yes" length="0" when="greater" />
</and>
</condition>
</target>
<target name="git.branch" description="Store git branch in ${repository.branch}">
<exec executable="git" outputproperty="git.branch" failifexecutionfails="false" errorproperty="">
<arg value="branch" />
<arg value="--show-current" />
</exec>
<condition property="repository.branch" value="${git.branch}" else="unknown">
<and>
<isset property="git.branch"/>
<length string="${git.branch}" trim="yes" length="0" when="greater" />
</and>
</condition>
</target>
<target name="package" depends="compile,git.branch,git.revision" description="Package utilities">
<tstamp>
<format property="time.stamp" pattern="yyyy-MM-dd'T'HH:mm:ss.SSSZ"/>
</tstamp>
<jar destfile="dist/transformer.jar">
<manifest>
<section name="transformer">
<attribute name="Transformer-Branch" value="${repository.branch}" />
<attribute name="Transformer-Commit" value="${repository.version}" />
<attribute name="Transformer-CompiledDate" value="${time.stamp}" />
</section>
</manifest>
<fileset dir="build/classes">
<patternset>
<include name="*/" />
</patternset>
</fileset>
</jar>
</target>
<target name="clean.dist" description="Clean all JAR files.">
<delete dir="dist" />
</target>
<!-- Project Cleanup -->
<target name="clean"
depends="clean.dist,clean.build"
description="Clean all generated/compiled files."
/>
<!-- Tool Running -->
<target name="run.filter" depends="compile" description="Run the project filterer">
<java classname="filter.Main" fork="true">
<classpath refid="project.class.path" />
</java>
</target>
<target name="run.transform" depends="compile" description="Run the code transformer">
<java classname="transform.Main" fork="true">
<classpath refid="project.class.path" />
</java>
</target>
<target name="run" depends="compile" description="Run the full workflow">
<java classname="full.Driver" fork="true">
<classpath refid="project.class.path" />
</java>
</target>
</project>