-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
232 lines (208 loc) · 11.8 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
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
223
224
225
226
227
228
229
230
231
232
<project name="yank" default="jar">
<property file="build.properties" />
<property name="src.dir" value="${basedir}/src" />
<property name="resources.dir" value="${basedir}/resources" />
<property name="test.dir" value="${basedir}/test" />
<property name="target.dir" value="${basedir}/target" />
<property name="classes.dir" value="${target.dir}/classes" />
<property name="lib.dir" value="${basedir}/lib" />
<property name="javadoc.dir" value="${target.dir}/javadoc" />
<property name="sample.dir" value="${basedir}/sample" />
<property name="javac.source" value="1.5" />
<property name="javac.target" value="1.5" />
<property name="javac.deprecation" value="on" />
<property name="javac.debug" value="on" />
<property name="yank.version" value="2.0.3" />
<property name="sonatype.dir" value="${user.home}/.yank-${yank.version}-sonatype" />
<property name="ant_.version" value="1.10.15" />
<property name="poi.version" value="4.1.0" />
<property name="json.version" value="20190722" />
<property name="supercsv.version" value="2.4.0" />
<property name="jarjar.version" value="1.3" />
<property name="ant-url" value="https://repo1.maven.org/maven2/org/apache/ant/ant/${ant_.version}/ant-${ant_.version}.jar" />
<property name="poi-url" value="https://repo1.maven.org/maven2/org/apache/poi/poi/${poi.version}/poi-${poi.version}.jar" />
<property name="json-url" value="https://repo1.maven.org/maven2/org/json/json/${json.version}/json-${json.version}.jar" />
<property name="supercsv-url" value="https://repo1.maven.org/maven2/net/sf/supercsv/super-csv/${supercsv.version}/super-csv-${supercsv.version}.jar" />
<property name="jarjar-url" value="https://repo1.maven.org/maven2/com/googlecode/jarjar/jarjar/${jarjar.version}/jarjar-${jarjar.version}.jar" />
<target name="check">
<available file="${dest}/${name}-${version}.jar" property="jar-exists" />
</target>
<target name="_pull" depends="check" unless="jar-exists">
<get src="${url}" dest="${dest}/${name}-${version}.jar" verbose="true" ignoreerrors="true" />
</target>
<macrodef name="pull">
<attribute name="url" />
<attribute name="dest" />
<attribute name="name" />
<attribute name="version" />
<sequential>
<antcall target="_pull">
<param name="url" value="@{url}" />
<param name="dest" value="@{dest}" />
<param name="name" value="@{name}" />
<param name="version" value="@{version}" />
</antcall>
</sequential>
</macrodef>
<target name="pullall">
<pull url="${ant-url}" dest="${lib.dir}" name="ant" version="${ant_.version}" />
<pull url="${poi-url}" dest="${lib.dir}" name="poi" version="${poi.version}" />
<pull url="${json-url}" dest="${lib.dir}" name="json" version="${json.version}" />
<pull url="${supercsv-url}" dest="${lib.dir}" name="super-csv" version="${supercsv.version}" />
<pull url="${jarjar-url}" dest="${lib.dir}" name="jarjar" version="${jarjar.version}" />
</target>
<target name="clean" description="removes all generated collateral">
<delete dir="${target.dir}" />
<delete includeEmptyDirs="true">
<fileset dir="${sample.dir}" includes="*.jar"/>
</delete>
<delete file="${sample.dir}/yank_build.xml"/>
</target>
<target name="-init" description="prepares repository for a build">
<mkdir dir="${lib.dir}" />
<mkdir dir="${target.dir}" />
</target>
<path id="yank.classpath">
<pathelement location="${lib.dir}/ant-${ant_.version}.jar" />
<pathelement location="${lib.dir}/poi-${poi.version}.jar" />
<pathelement location="${lib.dir}/json-${json.version}.jar" />
<pathelement location="${lib.dir}/super-csv-${supercsv.version}.jar" />
<pathelement location="${lib.dir}/jarjar-${jarjar.version}.jar" />
</path>
<target name="compile" depends="-init, pullall, resources" description="compiles java files">
<javac srcdir="${src.dir}" destdir="${classes.dir}" source="${javac.source}" target="${javac.target}" deprecation="${javac.deprecation}" debug="${javac.debug}" includeantruntime="false">
<classpath refid="yank.classpath" />
</javac>
<javac srcdir="${test.dir}" destdir="${classes.dir}" source="${javac.source}" target="${javac.target}" deprecation="${javac.deprecation}" debug="${javac.debug}" includeantruntime="false">
<classpath refid="yank.classpath" />
</javac>
</target>
<target name="resources" description="copies files to classes">
<copy todir="${classes.dir}">
<fileset dir="${src.dir}">
<include name="**/*.xml"/>
</fileset>
<fileset dir="${resources.dir}">
<include name="knownlicenses/*"/>
</fileset>
</copy>
</target>
<target name="jar" depends="compile" description="produces the yank jar file">
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpathref="yank.classpath"/>
<jarjar destfile="${target.dir}/yank-${yank.version}.jar">
<fileset dir="${classes.dir}">
<include name="**/*.class" />
<include name="**/*.xml" />
<include name="knownlicenses/*" />
<exclude name="**/test/*.*" />
</fileset>
<zipfileset src="${lib.dir}/poi-${poi.version}.jar" />
<zipfileset src="${lib.dir}/json-${json.version}.jar" />
<zipfileset src="${lib.dir}/super-csv-${supercsv.version}.jar" />
<rule pattern="org.apache.poi.**" result="com.mebigfatguy.org.apache.poi.@1" />
<rule pattern="org.json.**" result="com.mebigfatguy.org.json.@1" />
<rule pattern="org.supercsv.**" result="com.mebigfatguy.org.supercsv.@1" />
<keep pattern="com.mebigfatguy.yank.**"/>
<keep pattern="org.supercsv.io.**"/>
<manifest>
<attribute name="yank-version" value="${yank.version}" />
<attribute name="Main-Class" value="com.mebigfatguy.yank.YankTask" />
<attribute name="Bundle-ManifestVersion" value="2" />
<attribute name="Bundle-Name" value="yank task" />
<attribute name="Bundle-SymbolicName" value="yank; singleton:=true" />
<attribute name="Bundle-Version" value="${yank.version}" />
<attribute name="Bundle-ClassPath" value="." />
<attribute name="Bundle-Vendor" value="Yank Project" />
<attribute name="Bundle-ActivationPolicy" value="lazy" />
</manifest>
</jarjar>
</target>
<target name="srczip" description="builds the source distribution zip file">
<zip destfile="${target.dir}/yank-${yank.version}-sources.jar" basedir="${src.dir}">
<fileset dir="${src.dir}">
<include name="**/*.java" />
<include name="**/*.xml" />
</fileset>
<fileset dir="${basedir}">
<include name="pom.xml" />
<include name="build.xml" />
<include name=".classpath" />
<include name=".project" />
<include name="sample/yank.xls" />
</fileset>
</zip>
</target>
<target name="javadoc" depends="-init" description="build the javadoc for the project">
<javadoc packagenames="com.mebigfatguy.*" sourcepath="${src.dir}" classpathref="yank.classpath" destdir="${javadoc.dir}" windowtitle="yank api">
<doctitle><![CDATA[<h1>yank javadoc</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright © 2013-2018 MeBigFatGuy.com. All Rights Reserved.</i>]]></bottom>
</javadoc>
</target>
<target name="test" depends="jar" description="test yank">
<taskdef name="yank" classname="com.mebigfatguy.yank.YankTask" classpath="${lib.dir}/ant-${ant_.version}.jar;${basedir}/target/yank-${yank.version}.jar"/>
<echo message=""/>
<echo message="===== Testing yank.xls =========="/>
<echo message=""/>
<yank yankFile="${sample.dir}/yank.xls" destination="${sample.dir}" stripVersions="true" reportMissingDependencies="true"
source="true" separateClassifierTypes="true" generateLicenses="true" threadPoolSize="30">
<generatePath pathXmlFile="${sample.dir}/yank_build.xml" classpathName="yank.xls.path" />
<generateVersions propertyFileName="${sample.dir}/yank.xls.properties"/>
<server url="https://repo1.maven.org/maven2"/>
<server url="http://repository.codehaus.org"/>
</yank>
<echo message=""/>
<echo message="===== Testing yank.ods =========="/>
<echo message=""/>
<yank yankFile="${sample.dir}/yank.ods" destination="${sample.dir}" stripVersions="true" reportMissingDependencies="true"
source="true" separateClassifierTypes="true" generateLicenses="true" threadPoolSize="30">
<generatePath pathXmlFile="${sample.dir}/yank_build.xml" classpathName="yank.ods.path" />
<generateVersions propertyFileName="${sample.dir}/yank.ods.properties"/>
<server url="https://repo1.maven.org/maven2"/>
<server url="http://repository.codehaus.org"/>
</yank>
<echo message=""/>
<echo message="===== Testing yank.xlsx =========="/>
<echo message=""/>
<yank yankFile="${sample.dir}/yank.xlsx" destination="${sample.dir}" stripVersions="true" reportMissingDependencies="true"
source="true" separateClassifierTypes="true" generateLicenses="true" threadPoolSize="30">
<generatePath pathXmlFile="${sample.dir}/yank_build.xml" classpathName="yank.xlsx.path" />
<generateVersions propertyFileName="${sample.dir}/yank.xlsx.properties"/>
<server url="https://repo1.maven.org/maven2"/>
<server url="http://repository.codehaus.org"/>
</yank>
</target>
<target name="release" depends="jar, srczip, javadoc" description="prepares everything for a release" />
<target name="sonatype" depends="release" description="prepare an artifact bundle for sonatype">
<mkdir dir="${sonatype.dir}"/>
<copy todir="${sonatype.dir}" file="${target.dir}/yank-${yank.version}.jar"/>
<copy tofile="${sonatype.dir}/yank-${yank.version}-sources.jar" file="${target.dir}/yank-${yank.version}-sources.jar"/>
<jar destfile="${sonatype.dir}/yank-${yank.version}-javadoc.jar" basedir="${target.dir}" includes="javadoc/**"/>
<copy tofile="${sonatype.dir}/yank-${yank.version}.pom" file="${basedir}/pom.xml"/>
<exec executable="gpg">
<arg value="-abi" />
<arg value="${sonatype.dir}/yank-${yank.version}.jar" />
</exec>
<exec executable="gpg">
<arg value="-abi" />
<arg value="${sonatype.dir}/yank-${yank.version}.pom" />
</exec>
<exec executable="gpg">
<arg value="-abi" />
<arg value="${sonatype.dir}/yank-${yank.version}-sources.jar" />
</exec>
<exec executable="gpg">
<arg value="-abi" />
<arg value="${sonatype.dir}/yank-${yank.version}-javadoc.jar" />
</exec>
<jar destfile="${sonatype.dir}/bundle.jar" basedir="${sonatype.dir}" includes="yank*">
</jar>
<echo message="" />
<echo message="" />
<echo message="====================================================================================================================================" />
<echo message="sonatype update bundle produced at ${sonatype.dir}/bundle.jar" />
<echo message="upload this jar at https://oss.sonatype.org" />
<echo message="" />
<echo message="see link for details-> https://central.sonatype.org/pages/ossrh-guide.html" />
<echo message="====================================================================================================================================" />
</target>
</project>