-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
executable file
·166 lines (153 loc) · 5.6 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="ReverbApi" default="copy" basedir=".">
<property name="build.properties" value="build.properties"/>
<property file="${build.properties}"/>
<property name="local.properties" value="local.properties"/>
<property file="${local.properties}"/>
<property name="src" value="src"/>
<property name="bin" value="bin"/>
<property name="lib" value="lib"/>
<property name="build" value="build"/>
<property name="jar" value="reverb.jar"/>
<property name="build.jar" location="${build}/${jar}"/>
<property name="jar.depends" value="reverb-dependencies.jar"/>
<property name="build.jar.depends" location="${build}/${jar.depends}"/>
<property name="tools" location="tools"/>
<property name="github" location="${tools}/github"/>
<property name="docs" value="docs"/>
<fileset id="github-anttasks.jars" dir="${github}/lib">
<include name="**/*.jar"/>
</fileset>
<path id="github-anttasks.classpath">
<fileset refid="github-anttasks.jars"/>
<pathelement location="."/>
<fileset dir="${github}">
<include name="**/*.jar"/>
</fileset>
</path>
<taskdef name="github.createrelease" classname="com.github.api.CreateRelease" classpathref="github-anttasks.classpath" loaderref="github-anttasks.classpath.loader" />
<taskdef name="github.uploadasset" classname="com.github.api.UploadAsset" classpathref="github-anttasks.classpath" loaderref="github-anttasks.classpath.loader" />
<taskdef name="github.fullrelease" classname="com.github.api.FullRelease" classpathref="github-anttasks.classpath" loaderref="github-anttasks.classpath.loader" />
<condition property="is.mac">
<os family="mac"/>
</condition>
<condition property="not.mac">
<not><isset property="is.mac"/></not>
</condition>
<condition property="is.windows">
<os family="windows"/>
</condition>
<condition property="is.unix">
<and>
<os family="unix"/>
<isset property="not.mac"/>
</and>
</condition>
<condition property="is.other">
<and>
<not><isset property="is.mac"/></not>
<not><isset property="is.unix"/></not>
<not><isset property="is.windows"/></not>
</and>
</condition>
<condition property="copy.props">
<not>
<available file="${local.properties}"/>
</not>
</condition>
<target name="copy.properties" if="copy.props">
<copy file="local.example.properties" tofile="${local.properties}" />
</target>
<target name="prepare" depends="copy.properties" description="Create build dirs">
<mkdir dir="${bin}"/>
<mkdir dir="${build}"/>
<mkdir dir="${docs}"/>
</target>
<path id="class.path">
<fileset dir="build">
<include name="**/reverb.jar"/>
</fileset>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="version.input" depends="prepare">
<input
message="Please input a new version. Current version ${build.version}"
addproperty="new.version"
/>
<propertyfile file="${build.properties}">
<entry key="build.version" value="${new.version}"/>
</propertyfile>
</target>
<target name="version.default" depends="prepare">
<property name="new.version" value="${build.version}"/>
</target>
<target name="version" depends="version.input" description="Prompt user to enter new version">
<!-- At the moment version requires nothing else -->
</target>
<target name="jar" depends="version.default">
<buildnumber file="${build.properties}"/>
<javac srcdir="${src}" destdir="${bin}" source="1.6" target="1.5" includes="**/*.java" includeantruntime="false" classpathref="class.path"/>
<!--<exportjar dir="build"/>-->
<jar jarfile="${build.jar}" basedir="${bin}" manifest="MANIFEST.MF"/>
<zip destfile="${build.jar.depends}">
<zipgroupfileset dir="${build}" includes="reverb.jar"/>
<zipgroupfileset dir="${lib}" includes="*.jar"/>
</zip>
</target>
<target name="copy" depends="jar">
<propertyset id="copy.dirs">
<propertyref prefix="dir"/>
</propertyset>
<pathconvert refid="copy.dirs" pathsep="," property="copy.dirs" preserveduplicates="true">
<mapper type="regexp" from="^(.*)$" to="\1"/>
</pathconvert>
<script language="javascript"><![CDATA[
//https://ant.apache.org/manual/Tasks/script.html
//importPackage(java.io);
importClass(java.io.File);
function echo(message) {
var echotask = project.createTask('echo');
echotask.setMessage(message); echotask.perform();
}
echo('Entering JavaScript...');
var copy = project.createTask('copy');
copy.setFile(new File(project.getProperty('build.jar')));
var props = project.getProperty('copy.dirs').split(",");
for (var i=0; i<props.length; i++) {
copy.setTodir(new File(props[i]));
copy.perform();
}
]]>
</script>
</target>
<target name="test" depends="jar">
<java classname="com.reverb.api.ReverbApi" fork="true" maxmemory="128m" classpathref="class.path">
<arg value="${reverb.token}"/>
</java>
</target>
<target name="release" depends="version,jar">
<echo message="${new.version}"/>
<echo message="TODO: Auto deploy release to github, reverb.jar, reverb-dependencies.jar, JSON-java.jar"/>
<github.fullrelease
repouser="${github.repouser}"
repo="${github.repo}"
tokenuser="${github.tokenuser}"
token="${github.token}"
tag="${new.version}"
body="Reverb.com API Java library version ${new.version}">
<fileset dir="${build}" casesensitive="yes">
<include name="${jar}"/>
<include name="${jar.depends}"/>
</fileset>
</github.fullrelease>
</target>
<target name="list">
<propertyset id="copy.dirs">
<propertyref prefix="dir"/>
</propertyset>
<pathconvert refid="copy.dirs" pathsep="," property="copy.dirs"/>
<echo message="${copy.dirs}" />
</target>
</project>