This repository has been archived by the owner on Nov 16, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathbuild.xml
182 lines (155 loc) · 6.69 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
<?xml version="1.0" encoding="iso-8859-1"?>
<project name="CSSEmbed" default="build.all.jars" basedir=".">
<target name="clean" depends="-load.properties">
<delete dir="${build.dir}" quiet="true"/>
</target>
<target name="-load.properties">
<property file="ant.properties"/>
</target>
<target name="-init" depends="-load.properties">
<mkdir dir="${build.dir}"/>
</target>
<!-- get a timestamp -->
<tstamp>
<format property="RIGHT_NOW"
pattern="d-MMMM-yyyy hh:mm:ss"
locale="en,US"/>
</tstamp>
<tstamp>
<format property="SIMPLE_DATE"
pattern="MMMM d, yyyy"
locale="en,US"/>
</tstamp>
<target name="changelog.update" depends="-load.properties">
<exec executable="git" failonerror="true" outputproperty="git.tag">
<arg line="tag"/>
</exec>
<script language="javascript"><![CDATA[
//get the most recent tag to get the diff
var tags = CSSEmbed.getProperty("git.tag").replace("\r", "").split("\n"),
lastTag = tags[tags.length-1];
CSSEmbed.setProperty("git.log.range", lastTag + "..HEAD");
]]></script>
<!-- git log -pretty=format:'* %s (%an)' v0.4.0..v0.5.0-->
<exec executable="git" failonerror="true" outputproperty="git.changelog">
<arg line="log --pretty=format:'* %s (%an)' ${git.log.range}"/>
</exec>
<concat destfile="CHANGELOG.tmp" fixlastline="true">
<header trimleading="yes">${SIMPLE_DATE} - v${cssembed.version}
${git.changelog}
</header>
<fileset dir="." includes="CHANGELOG" />
</concat>
<delete file="CHANGELOG"/>
<move file="CHANGELOG.tmp" tofile="CHANGELOG"/>
</target>
<target name="build.classes" depends="-init">
<mkdir dir="${build.dir}/classes"/>
<javac srcdir="${src.dir}"
destdir="${build.dir}/classes"
includes="**/*.java"
deprecation="off"
debug="on"
source="${class.version}"
target="${class.version}">
<classpath>
<pathelement location="${lib.dir}/${ant.jar}"/>
<pathelement location="${lib.dir}/${jargs.jar}"/>
<pathelement location="${lib.dir}/${datauri.jar}"/>
</classpath>
</javac>
</target>
<target name="build.tests" depends="-init">
<mkdir dir="${build.dir}/testclasses"/>
<javac srcdir="${tests.dir}"
destdir="${build.dir}/testclasses"
includes="**/*.java"
deprecation="off"
debug="on"
source="${class.version}"
target="${class.version}">
<classpath>
<pathelement location="${lib.dir}/${ant.jar}"/>
<pathelement location="${lib.dir}/${jargs.jar}"/>
<pathelement location="${lib.dir}/${junit.jar}"/>
<pathelement location="${build.dir}/classes"/>
</classpath>
</javac>
<copy todir="${build.dir}/testclasses/net/nczonline/web/cssembed">
<fileset dir="${tests.dir}" includes="*.png"/>
<fileset dir="${tests.dir}" includes="*.css"/>
</copy>
</target>
<target name="build.cssembed.jar" depends="build.classes">
<make-jar name="${cssembed.name}" jar="${cssembed.jar}" main="${cssembed.main}">
<jar-files>
<fileset dir="${build.dir}/classes" includes="**/*.class"/>
</jar-files>
</make-jar>
</target>
<target name="build.datauri.jar" depends="build.classes">
<make-jar name="${datauri.name}" jar="${datauri.jar}" main="${datauri.main}">
<jar-files>
<fileset dir="${build.dir}/classes" includes="**/datauri/*.class"/>
</jar-files>
</make-jar>
</target>
<!-- build all jars -->
<target name="build.all.jars" depends="clean,build.cssembed.jar,build.datauri.jar"></target>
<target name="build.dist.package" depends="build.cssembed.jar,build.datauri.jar">
<mkdir dir="${build.dir}/${dist.package.name}"/>
<mkdir dir="${build.dir}/${dist.package.name}/build"/>
<copy file="${build.dir}/${jar.name}" todir="${build.dir}/${dist.package.name}/build"/>
<copy todir="${build.dir}/${dist.package.name}">
<fileset dir=".">
<include name="ant.properties"/>
<include name="build.xml"/>
<include name="doc/**/*"/>
<include name="lib/**/*"/>
<include name="src/**/*"/>
<exclude name="**/.git"/>
</fileset>
</copy>
<zip destfile="${build.dir}/${dist.package.name}.zip"
basedir="${build.dir}"
includes="${dist.package.name}/**/*"/>
</target>
<target name="test.classes" depends="build.classes,build.tests">
<junit printsummary="yes" fork="yes" errorproperty="junit.failure" failureproperty="junit.failure" showoutput="true">
<jvmarg value="-Duser.dir=${res.dir}"/>
<!-- classpath must include all jar dependencies and classes -->
<classpath>
<pathelement location="${build.dir}/classes"/>
<pathelement location="${build.dir}/testclasses"/>
<pathelement location="${lib.dir}/${datauri.jar}"/>
<pathelement location="${lib.dir}/${junit.jar}"/>
</classpath>
<!-- formatter to use for output -->
<formatter type="plain" usefile="false"/>
<!-- fully qualified classname of testsuite -->
<batchtest>
<fileset dir="${build.dir}/testclasses">
<include name="**/*Test.class" />
</fileset>
</batchtest>
</junit>
</target>
<macrodef name="make-jar">
<attribute name="jar"/>
<attribute name="main"/>
<attribute name="name"/>
<element name="jar-files"/>
<sequential>
<mkdir dir="${build.dir}/@{name}-jar"/>
<unjar src="${lib.dir}/${jargs.jar}" dest="${build.dir}/@{name}-jar"/>
<copy todir="${build.dir}/@{name}-jar">
<jar-files/>
</copy>
<jar destfile="${build.dir}/@{jar}" basedir="${build.dir}/@{name}-jar">
<manifest>
<attribute name="Main-Class" value="@{main}"/>
</manifest>
</jar>
</sequential>
</macrodef>
</project>