-
Notifications
You must be signed in to change notification settings - Fork 1
/
common.xml
129 lines (109 loc) · 4.84 KB
/
common.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
<?xml version="1.0"?>
<project name="common">
<property file="build.properties"/>
<!-- can be overridden at the command line with -Dversion=
or in IDEA, in the ant properties dialog -->
<property name="version" value="2.0"/>
<property name="api.version" value="1.2"/>
<target name="compile" description="Compile Java source.">
<mkdir dir="${build.dir}/classes"/>
<javac srcdir="${src.dir}"
debug="on"
destdir="${build.dir}/classes"
source="1.5" target="1.5">
<classpath refid="compile.classpath"/>
</javac>
<copy toDir="${build.dir}/classes">
<fileset dir="${src.dir}" excludes="**/*.java"/>
</copy>
</target>
<target name="manifest" description="Generate OSGi manifest." depends="compile">
<dirname property="common.basedir" file="${ant.file.common}"/>
<taskdef resource="aQute/bnd/ant/taskdef.properties"
classpath="${common.basedir}/lib/build/bnd-0.0.305.jar"/>
<fail unless="module" message="Missing 'module' property (use the primary package name in this jar)"/>
<property name="Bundle-Name" value="${ant.project.name}"/>
<property name="Bundle-SymbolicName" value="${module}"/>
<property name="Bundle-Version" value="${replace;${version};^[^0-9];${api.version}.$0}"/>
<property name="Bundle-Description" value="Guice is a lightweight dependency injection framework for Java 5 and above"/>
<property name="Bundle-DocURL" value="http://code.google.com/p/google-guice/"/>
<property name="Bundle-Copyright" value="Copyright (C) 2006 Google Inc."/>
<property name="Bundle-License" value="http://www.apache.org/licenses/LICENSE-2.0"/>
<property name="Bundle-Vendor" value="Google Inc."/>
<property name="exclude.imports" value=""/>
<property name="api.range" value=""[${api.version},${version;+;${api.version}})""/>
<property name="guice.imports" value="com.google.inject.*;version=${api.range}"/>
<property name="Import-Package" value="${exclude.imports},${guice.imports},*;resolution:=optional"/>
<!--
TODO Lets expose internal so that we don't have to use Fragments in GuiceyFruit
<property name="Export-Package" value="!${module}.internal.*,${module}.*;version=${api.version}"/>
-->
<property name="Export-Package" value="${module}.*;version=${api.version}"/>
<property name="-removeheaders" value="Bnd-LastModified,Ignore-Package,Include-Resource,Private-Package,Tool"/>
<bndwrap jars="${build.dir}/classes" output="${build.dir}"/>
<unjar src="${build.dir}/classes.bar" dest="${build.dir}">
<patternset>
<include name="META-INF/MANIFEST.MF"/>
</patternset>
</unjar>
</target>
<target name="test.compile"
depends="compile"
description="Compile test source.">
<mkdir dir="${build.dir}/test"/>
<javac srcdir="${test.dir}"
debug="on"
destdir="${build.dir}/test"
source="1.5" target="1.5">
<classpath path="${build.dir}/classes"/>
<classpath refid="compile.classpath"/>
</javac>
<copy toDir="${build.dir}/test">
<fileset dir="${test.dir}" excludes="**/*.java"/>
</copy>
</target>
<target name="test"
depends="test.compile"
description="Execute JUnit tests.">
<java fork="true"
classname="junit.textui.TestRunner"
failonerror="true"
taskname="junit">
<classpath>
<pathelement location="${build.dir}/test"/>
<pathelement location="${build.dir}/classes"/>
<path refid="compile.classpath"/>
</classpath>
<arg value="${test.class}"/>
</java>
</target>
<target name="clean"
description="Remove generated files.">
<delete dir="${build.dir}"/>
</target>
<target name="source.jar"
description="Create a .jar file with sources">
<mkdir dir="${build.dir}"/>
<zip destfile="${build.dir}/${ant.project.name}-${version}-src.jar">
<fileset dir="src"/>
</zip>
</target>
<target name="distjars"
depends="source.jar, jar"
description="Build jar files"/>
<target name="jar.withdeps" depends="compile"
description="Build jar with dependencies embedded.">
<mkdir dir="${build.dir}/dist"/>
<dirname property="common.basedir" file="${ant.file.common}"/>
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask"
classpath="${common.basedir}/lib/build/jarjar-1.0rc8.jar"/>
<jarjar jarfile="${build.dir}/${ant.project.name}-with-deps.jar">
<fileset dir="${build.dir}/classes"/>
<zipfileset src="${common.basedir}/lib/build/cglib-2.2.1-snapshot.jar"/>
<zipfileset src="${common.basedir}/lib/build/asm-3.1.jar"/>
<rule pattern="net.sf.cglib.**" result="com.google.inject.internal.cglib.@1"/>
<rule pattern="org.objectweb.asm.**" result="com.google.inject.internal.asm.@1"/>
<keep pattern="com.google.inject.**"/>
</jarjar>
</target>
</project>