-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
104 lines (92 loc) · 4.81 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
<?xml version="1.0"?>
<project name="libjoe" basedir="." default="clean-dist">
<property environment="env"/>
<property file="build.properties" />
<property name="classes.root.dir" value="${build.dir}/classes" />
<property name="jars.dir" value="${build.dir}/jars" />
<property name="dist.dir" value="dist" />
<property name="java5home" value="${env.JAVA_HOME}" />
<property name="javasrc" value="${java5home}/src" />
<property name="fulljavadoc" value="true" />
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="lib/jarjar-1.0.jar" />
<target name="clean-dist" depends="clean-build-all,dist-zip-file,javadoc" description="Cleans the build area, builds everything and puts the jars in the distribution directory" />
<target name="clean-build-all" depends="clean-all,build-all" description="Cleans the build area and builds everything from scratch" />
<target name="build-all" depends="compile-all,jar-bootstrapper" description="Builds jars for all components" />
<target name="clean-all" description="Cleans the build area">
<delete dir="${build.dir}" />
</target>
<target name="compile-all" description="Compiles the source for all components">
<mkdir dir="${classes.root.dir}" />
<compile-and-jar component="${src.base.dir}" />
<compile-and-jar component="${src.collect.dir}" />
<compile-and-jar component="${src.bootstrapper.dir}" />
</target>
<macrodef name="compile-and-jar">
<attribute name="component" />
<sequential>
<property name="@{component}.jar.name" value="${jars.dir}/libjoe-@{component}-${version}.jar" />
<mkdir dir="${classes.root.dir}/@{component}" />
<javac srcdir="${src.root.dir}/@{component}" destdir="${classes.root.dir}/@{component}" debug="on">
<compilerarg value="-Xlint:all" />
<classpath>
<fileset dir=".">
<include name="lib/**/*.jar" />
<include name="${jars.dir}/*.jar" />
</fileset>
</classpath>
</javac>
<copy todir="${classes.root.dir}/@{component}">
<fileset dir="${src.root.dir}/@{component}" excludes="**/*.java" />
</copy>
<jar destfile="${jars.dir}/libjoe-@{component}-${version}.jar" basedir="${classes.root.dir}/@{component}" />
<jar destfile="${jars.dir}/libjoe-@{component}-${version}.src.jar" basedir="${src.root.dir}/@{component}" />
</sequential>
</macrodef>
<target name="jar-bootstrapper" depends="compile-all" description="Builds the bootstrapper jars: one standalone incorporating its jarjar'd dependencies and one with only the libjoe code.">
<jarjar destfile="${jars.dir}/libjoe-bootstrapper-standalone-${version}.jar" basedir="${classes.root.dir}/${src.bootstrapper.dir}">
<zipfileset src="${bootstrapper.jar.name}" />
<zipfileset src="${base.jar.name}" />
<zipfileset src="lib/guava-r07.jar" />
<rule pattern="com.google.**" result="joe.util.bootstrap.dependencies.@0" />
</jarjar>
</target>
<target name="zip-jars">
<zip destfile="${jars.dir}/libjoe-${version}.zip">
<fileset dir="${jars.dir}" />
</zip>
</target>
<target name="dist-zip-file" depends="zip-jars">
<mkdir dir="${dist.dir}" />
<copy todir="${dist.dir}" file="${jars.dir}/libjoe-${version}.zip" overwrite="yes" />
</target>
<target name="javadoc">
<delete includeemptydirs="true">
<fileset dir="${dist.dir}/javadoc" defaultexcludes="on" includes="**/*" />
</delete>
<mkdir dir="${dist.dir}/javadoc" />
<!-- javadoc ant script adapted from guava build.xml -->
<javadoc packagenames="joe.*,com.google.common.collect.*" destdir="${dist.dir}/javadoc" encoding="UTF-8" docencoding="UTF-8" charset="UTF-8" additionalparam="-XDignore.symbol.file" author="true" protected="true" use="${fulljavadoc}" windowtitle="libjoe - Java data structures and utilities - ${version}">
<sourcepath>
<pathelement location="${src.root.dir}/${src.base.dir}" />
<pathelement location="${src.root.dir}/${src.collect.dir}" />
<pathelement location="${src.root.dir}/${src.bootstrapper.dir}" />
<pathelement location="${javasrc}" />
</sourcepath>
<!-- workaround for http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6442982 -->
<classpath>
<fileset dir=".">
<include name="lib/**/*.jar" />
<include name="${jars.dir}/*.jar" />
</fileset>
</classpath>
<link href="http://guava-libraries.googlecode.com/svn/tags/release09/javadoc" />
<link href="http://jsr-305.googlecode.com/svn/trunk/javadoc" />
<link href="http://download.oracle.com/javase/6/docs/api" />
</javadoc>
<!-- remove dumb comments inserted by javadoc so that we only see svn diffs
when things actually change. -->
<replaceregexp match="^.*(META NAME=.date|generated by javadoc ).*$\n" replace="" flags="gmi">
<fileset dir="${dist.dir}/javadoc" includes="**/*.html" />
</replaceregexp>
</target>
</project>