-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
executable file
·240 lines (214 loc) · 10.9 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
233
234
235
236
237
238
239
240
<!--
/*
* deadmethods - A unused methods detector
* Copyright 2011-2022 MeBigFatGuy.com
* Copyright 2011-2022 Dave Brosius
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and limitations
* under the License.
*/
-->
<project name="deadmethods" default="info">
<property file="build.properties"/>
<property file="version.properties" />
<property name="src.dir" value="${basedir}/src/main/java"/>
<property name="resources.dir" value="${basedir}/src/main/resources"/>
<property name="samples.dir" value="${basedir}/src/samples/java"/>
<property name="target.dir" value="${basedir}/target"/>
<property name="samples.target.dir" value="${basedir}/target/samples/classes"/>
<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="htdocs.dir" value="${basedir}/htdocs"/>
<property name="javac.source" value="1.8"/>
<property name="javac.target" value="1.8"/>
<property name="javac.deprecation" value="on"/>
<property name="javac.debug" value="on"/>
<property name="sonatype.dir" value="${user.home}/.deadmethods-${deadmethods.version}-sonatype" />
<path id="deadmethods.classpath">
<pathelement location="${lib.dir}/ant-${ant_.version}.jar"/>
<pathelement location="${lib.dir}/maven-plugin-annotations-${maven-plugin-annotations.version}.jar"/>
<pathelement location="${lib.dir}/maven-plugin-api-${maven-plugin-api.version}.jar"/>
<pathelement location="${lib.dir}/maven-core-${maven-core.version}.jar"/>
<pathelement location="${lib.dir}/maven-model-${maven-model.version}.jar"/>
<pathelement location="${lib.dir}/maven-settings-${maven-settings.version}.jar"/>
<pathelement location="${lib.dir}/asm-${asm.version}.jar"/>
<pathelement location="${lib.dir}/junit-${junit.version}.jar"/>
<pathelement location="${lib.dir}/jakarta.servlet-api-${jakarta.servlet-api.version}.jar"/>
</path>
<path id="deadmethods.test.classpath">
<pathelement location="${classes.dir}"/>
<pathelement location="${lib.dir}/ant-${ant_.version}.jar"/>
<pathelement location="${lib.dir}/asm-${asm.version}.jar"/>
<pathelement location="${lib.dir}/junit-${junit.version}.jar"/>
<pathelement location="${lib.dir}/jakarta.servlet-api-${jakarta.servlet-api.version}.jar"/>
<pathelement location="${lib.dir}/spring-beans-${spring-beans.version}.jar"/>
<pathelement location="${lib.dir}/spring-context-${spring-context.version}.jar"/>
<pathelement location="${lib.dir}/maven-plugin-api-${maven-plugin-api.version}.jar"/>
</path>
<path id="deadmethods.classes.classpath">
<pathelement location="${classes.dir}"/>
</path>
<target name="clean" description="removes all generated collateral">
<delete dir="${target.dir}"/>
</target>
<target name="yank" unless="no.yank" xmlns:yank="antlib:com.mebigfatguy.yank">
<mkdir dir="${lib.dir}" />
<yank:yank yankFile="${basedir}/yank.xls" destination="${lib.dir}" source="true" separateClassifierTypes="true">
<server url="https://repo1.maven.org/maven2" />
<generateVersions propertyFileName="${basedir}/version.properties" />
</yank:yank>
</target>
<target name="info">
<echo message="deadmethods - an ant task for finding unused methods; private, protected or public"/>
<echo message=""/>
<echo message=" this project uses yank (https://github.com/mebigfatguy/yank) for dependency management"/>
<echo message=" download yank.jar and place in ant/lib directory"/>
<echo message=" https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.mebigfatguy.yank%22"/>
<antcall target="build"/>
</target>
<target name="-init" depends="yank" description="prepares repository for a build">
<mkdir dir="${classes.dir}"/>
<mkdir dir="${samples.target.dir}"/>
<mkdir dir="${javadoc.dir}"/>
</target>
<target name="compile" depends="-init, 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="true">
<classpath refid="deadmethods.classpath"/>
</javac>
</target>
<target name="resources" description="copies files to classes">
<copy todir="${classes.dir}">
<fileset dir="${resources.dir}">
<include name="**/*.xml"/>
<include name="**/*.properties"/>
</fileset>
</copy>
</target>
<target name="compile_samples" depends="-init" description="compiles java files">
<javac srcdir="${samples.dir}"
destdir="${samples.target.dir}"
source="1.8"
target="1.8"
deprecation="${javac.deprecation}"
debug="${javac.debug}"
includeantruntime="false">
<classpath refid="deadmethods.test.classpath"/>
</javac>
</target>
<target name="jar" depends="compile" description="produces the deadmethods jar file">
<jar destfile="${target.dir}/deadmethods-${deadmethods.version}.jar">
<fileset dir="${classes.dir}">
<include name="**/*.class"/>
<include name="**/*.xml"/>
<include name="**/*.properties"/>
</fileset>
<manifest>
<attribute name="deadmethods-version" value="${deadmethods.version}"/>
<attribute name="Application-Name" value="DeadMethods" />
<attribute name="Permissions" value="all-permissions" />
<attribute name="Codebase" value="*" />
<attribute name="Bundle-ManifestVersion" value="2"/>
<attribute name="Bundle-Name" value="deadmethods ant task"/>
<attribute name="Bundle-SymbolicName" value="deadmethods; singleton:=true"/>
<attribute name="Bundle-Version" value="${deadmethods.version}"/>
<attribute name="Bundle-ClassPath" value="."/>
<attribute name="Bundle-Vendor" value="DeadMethods Project"/>
<attribute name="Bundle-ActivationPolicy" value="lazy"/>
<attribute name="Export-Package" value="com.mebigfatguy.deadmethods,com.mebigfatguy.deadmethods.ant,com.mebigfatguy.deadmethods.mvn" />
<attribute name="Import-Package" value="org.objectweb.asm,org.apache.tools.ant,org.apache.maven.execution,org.apache.maven.model,org.apache.maven.plugin,org.apache.maven.plugin.logging,org.apache.maven.plugins,org.apache.maven.project,org.apache.maven.settings" />
</manifest>
</jar>
</target>
<target name="srczip" description="builds the source distribution zip file">
<zip destfile="${target.dir}/deadmethods-${deadmethods.version}-sources.jar" basedir="${basedir}">
<fileset dir="${src.dir}">
<include name="**/*.java"/>
<include name="**/*.xml"/>
<include name="**/*.license"/>
<include name="lib/*.jar"/>
</fileset>
</zip>
</target>
<target name="javadoc" depends="-init" description="build the javadoc for the project">
<javadoc packagenames="com.mebigfatguy.*"
sourcepath="${src.dir}"
classpathref="deadmethods.classpath"
destdir="${javadoc.dir}"
windowtitle="deadmethods api">
<doctitle><![CDATA[<h1>deadmethods javadoc</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright © 2011-2018 MeBigFatGuy.com. All Rights Reserved.</i>]]></bottom>
</javadoc>
</target>
<target name="build" depends="clean, -init, compile, compile_samples, jar" description="builds the deadmethods jar">
</target>
<target name="release" depends="build, srczip, javadoc" description="prepares everything for a release"/>
<target name="test" depends="jar" description="run deadmethods on itself">
<taskdef name="deadmethods" classname="com.mebigfatguy.deadmethods.ant.FindDeadMethodsAntTask">
<classpath refid="deadmethods.test.classpath"/>
</taskdef>
<deadmethods>
<classpath refid="deadmethods.classes.classpath"/>
<auxClasspath refid="deadmethods.test.classpath"/>
<ignoredPackage pattern="test.ignored.*"/>
</deadmethods>
</target>
<target name="samples" depends="jar,compile_samples" description="run deadmethods on the samples">
<taskdef name="deadmethods" classname="com.mebigfatguy.deadmethods.ant.FindDeadMethodsAntTask">
<classpath refid="deadmethods.test.classpath"/>
</taskdef>
<deadmethods>
<classpath location="${samples.target.dir}" />
<auxClasspath refid="deadmethods.test.classpath"/>
<ignoredPackage pattern="test.ignored.*"/>
</deadmethods>
</target>
<target name="sonatype" depends="release" description="prepare an artifact bundle for sonatype">
<mkdir dir="${sonatype.dir}"/>
<copy todir="${sonatype.dir}" file="${target.dir}/deadmethods-${deadmethods.version}.jar"/>
<copy tofile="${sonatype.dir}/deadmethods-${deadmethods.version}-sources.jar" file="${target.dir}/deadmethods-${deadmethods.version}-sources.jar"/>
<jar destfile="${sonatype.dir}/deadmethods-${deadmethods.version}-javadoc.jar" basedir="${target.dir}" includes="javadoc/**"/>
<copy tofile="${sonatype.dir}/deadmethods-${deadmethods.version}.pom" file="${basedir}/pom.xml"/>
<exec executable="gpg">
<arg value="-abi" />
<arg value="${sonatype.dir}/deadmethods-${deadmethods.version}.jar" />
</exec>
<exec executable="gpg">
<arg value="-abi" />
<arg value="${sonatype.dir}/deadmethods-${deadmethods.version}.pom" />
</exec>
<exec executable="gpg">
<arg value="-abi" />
<arg value="${sonatype.dir}/deadmethods-${deadmethods.version}-sources.jar" />
</exec>
<exec executable="gpg">
<arg value="-abi" />
<arg value="${sonatype.dir}/deadmethods-${deadmethods.version}-javadoc.jar" />
</exec>
<jar destfile="${sonatype.dir}/bundle.jar" basedir="${sonatype.dir}" includes="deadmethods*">
</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>