forked from lintool/twitter-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
222 lines (191 loc) · 9.72 KB
/
build.xml
File metadata and controls
222 lines (191 loc) · 9.72 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
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<project name="twitter-tools" default="scripts"
xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:artifact="antlib:org.apache.maven.artifact.ant" basedir=".">
<description>Twitter tools for researchers</description>
<property name="lib.dir" value="lib" />
<property name="build.dir" value="build"/>
<property name="src.dir" value="src"/>
<property name="dist.dir" value="dist"/>
<property name="test.dir" location="test" />
<property name="javadoc.dir" location="docs/api/" />
<property name="version" value="1.1.1"/>
<!-- paths used for compilation and run -->
<path id="lib.path.id">
<fileset dir="${lib.dir}" />
</path>
<path id="run.path.id">
<path refid="lib.path.id" />
<fileset dir="${dist.dir}" />
</path>
<property name="ivy.install.version" value="2.2.0"/>
<property name="ivy.jar.dir" value="${basedir}/ivy"/>
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar"/>
<property name="ivy.settings.file" value="${basedir}/ivy/ivysettings.xml" />
<property name="ivy.dep.file" value="${basedir}/ivy/ivy.xml" />
<property name="maven.ant.task.version" value="2.1.2"/>
<property name="maven.jar.dir" value="${basedir}/${lib.dir}"/>
<property name="maven.jar.file" value="${maven.jar.dir}/maven.jar"/>
<!-- define Maven coordinates, repository url and artifacts name etc -->
<property name="groupId" value="cc.twittertools" />
<property name="artifactId" value="twitter-tools" />
<property name="version" value="${version}" />
<property name="maven-repository-url" value="https://oss.sonatype.org/service/local/staging/deploy/maven2" />
<property name="maven-repository-id" value="sonatype-nexus-staging" />
<property name="maven-jar" value="${dist.dir}/${artifactId}-${version}.jar" />
<property name="maven-javadoc-jar" value="${dist.dir}/${artifactId}-${version}-javadoc.jar" />
<property name="maven-sources-jar" value="${dist.dir}/${artifactId}-${version}-sources.jar" />
<target name="init">
<tstamp />
<condition property="platform" value="unix"><os family="unix" /></condition>
<condition property="platform" value="unix"><os family="mac" /></condition>
<condition property="platform" value="windows"><os family="windows" /></condition>
<mkdir dir="${build.dir}" />
<mkdir dir="${lib.dir}" />
<mkdir dir="${dist.dir}" />
</target>
<!-- download Ivy from web site so that it can be used even without any special installation -->
<target name="download-ivy" unless="skip.download">
<echo message="installing ivy..."/>
<get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<!-- try to load ivy here from local ivy dir, in case the user has not already dropped
it into ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may be empty) and
ivy is in at least one of ant's lib dir or the local lib dir. -->
<target name="install-ivy" depends="download-ivy" description="--> install ivy">
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<target name="resolve" depends="install-ivy" description="--> retreive dependencies with ivy">
<ivy:retrieve/>
</target>
<target name="report" depends="resolve" description="--> generates a report of dependencies">
<ivy:report todir="${build.dir}"/>
</target>
<!-- download maven from web site so that it can be used even without any special installation -->
<target name="download-maven" depends="init" unless="skip.download">
<mkdir dir="${maven.jar.dir}"/>
<echo message="installing maven ant tasks..."/>
<get src="http://repo1.maven.org/maven2/org/apache/maven/maven-ant-tasks/${maven.ant.task.version}/maven-ant-tasks-${maven.ant.task.version}.jar"
dest="${maven.jar.file}" usetimestamp="true"/>
</target>
<target name="install-maven" depends="download-maven" description="--> install ivy">
<path id="maven.lib.path">
<fileset dir="${maven.jar.dir}" includes="*.jar"/>
</path>
<taskdef uri="antlib:org.apache.maven.artifact.ant" classpathref="maven.lib.path"/>
</target>
<target name="compile" depends="init,resolve" description="compile the source ">
<javac classpathref="lib.path.id" srcdir="${src.dir}/main/java" destdir="${build.dir}" optimize="on" debug="on">
<compilerarg value="-Xlint:unchecked" />
</javac>
<javac classpathref="lib.path.id" srcdir="${src.dir}/test/java" destdir="${build.dir}" optimize="on" debug="on">
<compilerarg value="-Xlint:unchecked" />
</javac>
<copy todir="${build.dir}">
<fileset dir="${src.dir}/main/java" excludes="**/*.java" />
<fileset dir="${src.dir}/test/java" excludes="**/*.java" />
</copy>
</target>
<target name="jar" depends="compile" description="generate the distribution">
<jar jarfile="${dist.dir}/twitter-tools-${version}.jar" basedir="${build.dir}" />
</target>
<target name="dist" depends="jar,javadoc" description="generate the distribution">
<jar jarfile="${dist.dir}/twitter-tools-${version}-sources.jar" basedir="${src.dir}" />
<jar jarfile="${dist.dir}/twitter-tools-${version}-javadoc.jar" basedir="${javadoc.dir}" />
</target>
<target name="clean" description="clean up">
<delete dir="${test.dir}" />
<delete dir="${build.dir}" />
<delete dir="${lib.dir}" />
<delete dir="${dist.dir}" />
<delete dir="${javadoc.dir}" />
</target>
<target name="test" depends="jar" description="Execute Unit Tests">
<mkdir dir="${test.dir}" />
<junit printsummary="yes" fork="yes" maxmemory="1024m">
<sysproperty key="java.library.path" path="${lib.dir}" />
<sysproperty key="org.xml.sax.driver" value="org.apache.xerces.parsers.SAXParser" />
<classpath refid="run.path.id" />
<formatter type="xml" />
<batchtest todir="${test.dir}">
<fileset dir="${build.dir}">
<include name="**/*Test.class" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${test.dir}">
<fileset dir="${test.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="noframes" styledir="etc/" todir="${test.dir}" />
</junitreport>
</target>
<target name="javadoc">
<javadoc destdir="${javadoc.dir}" access="public" use="true" notree="false" nonavbar="false" noindex="false" splitindex="no" author="true" version="true" nodeprecatedlist="false" nodeprecated="false" classpathref="lib.path.id">
<fileset dir="src/main/java">
<include name="**/*.java" />
</fileset>
<link href="http://java.sun.com/javase/6/docs/api/" />
</javadoc>
<copy todir="${javadoc.dir}">
<fileset dir="${src.dir}/main/java">
</fileset>
</copy>
</target>
<target name="scripts" depends="jar">
<pathconvert property="run.path.id" refid="run.path.id" targetos="${platform}" />
<pathconvert property="lib.path.id" refid="lib.path.id" targetos="${platform}" />
<property name="suffix" value="sh" />
<property name="param_prefix" value="$" />
<property name="cp_sep" value=":" />
<property name="java_command" value="java -Xmx4g -classpath "${run.path.id}"" />
<property name="script_prefix" value="#!/bin/sh${line.separator}" />
<echo file="./etc/run.${suffix}" message="${script_prefix}" />
<echo file="./etc/run.${suffix}" message="${java_command} " append="true" />
<echo file="./etc/run.${suffix}" message="${param_prefix}1 ${param_prefix}2 ${param_prefix}3 ${param_prefix}4 ${param_prefix}5 ${param_prefix}6 ${param_prefix}7 ${param_prefix}8 ${param_prefix}9${line.separator}" append="true" />
<chmod dir="./etc/" perm="ugo+rx" includes="**/*.sh"/>
</target>
<target name="gen-pom" depends="install-ivy">
<ivy:makepom ivyfile="ivy/ivy.xml" pomfile="twittertools.pom" />
</target>
<target name="publish-local" depends="jar" description="publish jar/source to maven repo mounted at ~/.m2/repository">
<ivy:publish resolver="local-m2-publish" forcedeliver="true" overwrite="true" publishivy="false">
<artifacts pattern="${dist.dir}/[artifact]-[revision].[ext]"/>
<artifacts pattern="pom.xml"/>
</ivy:publish>
</target>
<target name="deploy" depends="dist,install-maven" description="deploy to Nexus">
<!-- sign and deploy the main artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.1:sign-and-deploy-file" />
<arg value="-Durl=${maven-repository-url}" />
<arg value="-DrepositoryId=${maven-repository-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${maven-jar}" />
<arg value="-Pgpg" />
</artifact:mvn>
<!-- sign and deploy the sources artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.1:sign-and-deploy-file" />
<arg value="-Durl=${maven-repository-url}" />
<arg value="-DrepositoryId=${maven-repository-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${maven-sources-jar}" />
<arg value="-Dclassifier=sources" />
<arg value="-Pgpg" />
</artifact:mvn>
<!-- sign and deploy the javadoc artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.1:sign-and-deploy-file" />
<arg value="-Durl=${maven-repository-url}" />
<arg value="-DrepositoryId=${maven-repository-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${maven-javadoc-jar}" />
<arg value="-Dclassifier=javadoc" />
<arg value="-Pgpg" />
</artifact:mvn>
</target>
</project>