forked from ArneBab/SCGIPublisher
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
147 lines (131 loc) · 5.52 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
<?xml version="1.0"?>
<!-- ant build file for SCGIPublisher -->
<project name="SCGIPublisher" default="dist" basedir=".">
<!-- user overrides (properties are immutable, so set overrides first) -->
<property file="build.properties"/>
<property name="freenet-cvs-snapshot.location" location="../fred/build/libs/freenet.jar"/>
<property name="freenet-ext.location" location="../fred/lib/freenet-ext.jar"/>
<property name="svn.revision" value="@custom@"/>
<property name="source-version" value="1.8"/>
<property name="target-version" value="1.8"/>
<property name="build" location="build/"/>
<property name="build-test" location="build-test/"/>
<property name="dist" location="dist/"/>
<property name="src" location="src/"/>
<property name="junit.location" value="/usr/share/java/junit.jar"/>
<property name="version.src" value="de/saces/fnplugins/SCGIPublisher/Version.java" />
<property name="version.build" value="de/saces/fnplugins/SCGIPublisher/Version.class" />
<available file="src/plugins/SCGIPublisher/Version.java" property="version.present"/>
<available file="${junit.location}" property="junit.present"/>
<exec executable="git"
failifexecutionfails="false"
errorProperty="git.errror"
outputproperty="git.describe"
resultproperty="git.result">
<arg value="describe" />
<arg value="--always" />
<arg value="--abbrev=4" />
</exec>
<condition property="git.revision" value="${git.describe}" else="@unknown@">
<and>
<equals arg1="${git.result}" arg2="0" />
<isset property="git.describe" />
</and>
</condition>
<target name="mkdir">
<mkdir dir="${build}"/>
<mkdir dir="${build-test}"/>
<mkdir dir="${dist}"/>
<echo message="Using ${freenet-cvs-snapshot.location} as freenet-cvs-snapshot.jar"/>
<echo message="Using ${freenet-ext.location} as freenet-ext.jar"/>
</target>
<!-- ================================================== -->
<target name="compile" depends="mkdir" >
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<!-- Create the Version file with patched revision number in ${build} -->
<copy file="${src}/${version.src}" tofile="${build}/${version.src}" overwrite="true" />
<delete file="${build}/${version.build}" quiet="true" />
<replace file="${build}/${version.src}">
<replacefilter token="@custom@" value="${git.revision}"/>
</replace>
<echo message="Updated build version to ${git.revision} in ${build}/${version.src}"/>
<!-- Force compile of Version.java in case compile of ${src} didn't trigger it -->
<javac srcdir="${build}" destdir="${build}" debug="on" optimize="on" source="${source-version}" target="${target-version}">
<classpath>
<pathelement location="${freenet-ext.location}"/>
<pathelement location="${freenet-cvs-snapshot.location}"/>
</classpath>
<include name="${version.src}"/>
</javac>
<!-- FIXME: remove the debug and replace with optimize -->
<javac srcdir="${src}" destdir="${build}" debug="on" optimize="on" source="${source-version}" target="${target-version}">
<classpath>
<pathelement location="${freenet-ext.location}"/>
<pathelement location="${freenet-cvs-snapshot.location}"/>
</classpath>
<include name="**/*.java"/>
<exclude name="**/*Test.java"/>
<exclude name="${version.src}"/>
</javac>
</target>
<!-- ================================================== -->
<target name="unit-build" depends="compile" if="junit.present" unless="skip_tests">
<javac srcdir="src/" destdir="${build-test}" debug="on" optimize="on" source="1.5">
<classpath>
<pathelement path="${build}"/>
<pathelement location="${freenet-ext.location}"/>
<pathelement location="${freenet-cvs-snapshot.location}"/>
<pathelement location="${junit.location}"/>
</classpath>
<compilerarg value="-Xlint"/>
<include name="**/*Test.java"/>
</javac>
</target>
<target name="junit" depends="unit-build" if="junit.present" unless="skip_tests">
<junit printsummary="yes" fork="yes" haltonfailure="yes">
<classpath>
<pathelement path="${build}"/>
<pathelement path="${build-test}"/>
<pathelement location="${freenet-ext.location}"/>
<pathelement location="${freenet-cvs-snapshot.location}"/>
<pathelement location="${junit.location}"/>
</classpath>
<formatter type="plain" usefile="false"/>
<batchtest fork="yes">
<fileset dir="${build-test}">
<include name="**/*Test.class"/>
</fileset>
</batchtest>
<sysproperty key="benchmark" value="${benchmark}" />
<sysproperty key="extensiveTesting" value="${extensiveTesting}" />
</junit>
</target>
<!-- ================================================== -->
<target name="dist" depends="compile,junit"
description="generate the distribution" >
<jar jarfile="${dist}/SCGIPublisher.jar" duplicate="fail">
<manifest>
<attribute name="Plugin-Main-Class" value="de.saces.fnplugins.SCGIPublisher.SCGIPublisher"/>
</manifest>
<fileset dir="src/" casesensitive="no">
<include name="*.md"/>
</fileset>
<fileset dir="${build}/"/>
<fileset dir="." includes="SCGIPublisher.ini" />
</jar>
<zip destfile="${dist}/SCGIPublisher-src.zip" filesonly="true" compress="true">
<zipfileset dir="."
prefix = ""
excludes=".*"
includes="src/**/* build.xml README.md"/>
</zip>
</target>
<!-- ================================================== -->
<target name="clean" description="Delete class files and docs dir.">
<delete dir="${build}"/>
<delete dir="${build-test}"/>
<delete dir="${dist}"/>
</target>
</project>