-
Notifications
You must be signed in to change notification settings - Fork 2
/
plugin-common.xml
164 lines (148 loc) · 5.16 KB
/
plugin-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
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
<?xml version="1.0"?>
<project name="Plugins-common-future" basedir=".">
<!--
Plugins that use this build file have to define
the embed.jars path (even if it's just empty)
The embed.jars will be unjarred and included in the plugin jar.
-->
<property name="debug.mode" value="true"/>
<!-- location where bundle and its dependencies will be installed -->
<property name="bundle.dest" value="dist"/>
<!-- the name of the executable wrapper jar uses the project name of the calling build file -->
<property name="exe.jar" value="pathvisio-with-${ant.project.name}.jar"/>
<!-- perpare-common should not be overriden -> override prepare instead -->
<target name="prepare-common">
<mkdir dir="build/classes"/>
<!-- copies plugin.props file so it is included in jar-->
<copy toDir="build/classes">
<fileset dir=".">
<include name="*.props"/>
</fileset>
</copy>
<mkdir dir="${bundle.dest}"/>
<mkdir dir="resources"/> <!-- defensive, to prevent file not found error later on -->
<fail message="Can't find ${pathvisio.dir}/modules/org.pathvisio.core.jar, please specify the path to pathvisio with -Dpathvisio.dir=....">
<condition>
<not><available file="${pathvisio.dir}/modules/org.pathvisio.core.jar"/></not>
</condition>
</fail>
<condition property="test.dir.exists"><available file="test"/></condition>
</target>
<target name="prepare-jar-name">
<!-- the name of the plug-in jar uses the project name of the calling build file -->
<property name="jar.name" value="${bundle.dest}/${ant.project.name}.jar"/>
</target>
<!-- designed to be overridden -->
<target name="prepare">
</target>
<target name="clean">
<delete dir="build"/>
<delete file="${jar.name}"/>
</target>
<target name="compile" depends="prepare,prepare-common,prepare-jar-name">
<echo>Compiling: ${jar.name}</echo>
<javac srcdir="src"
includes="**"
destdir="build/classes"
debug="${debug.mode}"
source="1.5">
<classpath>
<path refid="project.class.path"/>
<path refid="embed.jars"/>
</classpath>
</javac>
</target>
<target name="jar" depends="compile">
<echo>Creating JAR: ${jar.name}</echo>
<manifestclasspath property="manifest.cp" jarfile="${jar.name}">
<classpath>
<fileset dir="${bundle.dest}">
<include name="*.jar"/>
<exclude name="${ant.project.name}.jar"/>
</fileset>
</classpath>
</manifestclasspath>
<unjar dest="build/classes">
<path refid="embed.jars"/>
</unjar>
<jar jarfile="${jar.name}" manifest="META-INF/MANIFEST.MF">
<fileset dir="build/classes">
<include name="**/*"/>
</fileset>
<fileset dir="resources">
<include name="**/*"/>
</fileset>
<manifest>
<attribute name="Class-Path" value="${manifest.cp}"/>
</manifest>
</jar>
</target>
<target name="install" depends="jar">
<copy toDir="${bundle.dest}" flatten="true">
<path refid="project.class.path"/>
</copy>
</target>
<target name="dist-clean" depends="clean">
<delete file="${jar.name}"/>
<delete file="${exe.jar}"/>
<delete dir="${bundle.dest}"/>
</target>
<target name="test" if="test.dir.exists">
<javac srcdir="test" debug="${debug.mode}"
includes="**"
destdir="build"
source="1.5">
<classpath>
<path refid="test.class.path"/>
<path refid="project.class.path"/>
<path refid="embed.jars"/>
</classpath>
</javac>
<junit printsummary="on" haltonfailure="true" fork="true" dir=".">
<formatter type="brief" usefile="false"/>
<classpath>
<pathelement path="build"/>
<path refid="test.class.path"/>
<path refid="project.class.path"/>
<path refid="embed.jars"/>
</classpath>
<batchtest>
<fileset dir="test">
<include name="**/*Test*.java"/>
</fileset>
</batchtest>
</junit>
</target>
<!-- create an executable bundle that includes pathvisio bundles and launcher -->
<target name="exe" depends="jar">
<mkdir dir="build/exe"/>
<copy toDir="build/exe" flatten="true">
<path refid="exe.bundle"/>
</copy>
<!-- copies plugin jar to build/exe -->
<copy file="${jar.name}" toDir="build/exe"/>
<unjar src="${pathvisio.dir}/modules/org.pathvisio.launcher.jar" dest="build/exe"/>
<unjar src="${pathvisio.dir}/lib/felix.jar" dest="build/exe"/>
<jar file="${exe.jar}" basedir="build/exe">
<manifest>
<attribute name="Main-Class" value="org.pathvisio.launcher.PathVisioMain"/>
</manifest>
</jar>
</target>
<target name="webstart" depends="exe">
<fail message="You must specify a keystore password for opening visioKeyStore: ant -Dkeystore.password=***** [ant target]">
<condition>
<not> <isset property="keystore.password"/> </not>
</condition>
</fail>
<delete dir="build/webstart"/>
<mkdir dir="build/webstart"/>
<copy todir="build/webstart" file="pathvisio-with-${ant.project.name}.jar"/>
<copy todir="build/webstart" file="${ant.project.name}.jnlp"/>
<replace file="build/webstart/${ant.project.name}.jnlp" token="#BASEURL#" value="${webstart.base.url}"/>
<signjar alias="PV" lazy = "true"
storepass="${keystore.password}" keystore="${pathvisio.dir}/lib/visioKeyStore">
<fileset dir="build/webstart" includes="**/*.jar"/>
</signjar>
</target>
</project>