-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbuild.xml
243 lines (202 loc) · 8.84 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
241
242
243
<?xml version = "1.0" encoding = "utf-8"?>
<project name = "Protege 4 OWLViz project" default = "install" basedir = ".">
<!--
To run this build file set the environment variable
PROTEGE_HOME to point to a protege distribution and type ant
install or jar.
-->
<property environment="env"/>
<property name = "protege.home" location="${env.PROTEGE_HOME}"/>
<property file = "${protege.home}/build.properties"/>
<property file="local.properties"/>
<property file="etc/version.properties"/>
<!--
This setting defines the name of the plugin.
This may be the only setting that the developer needs to
change.
-->
<property name = "plugin" value = "org.coode.owlviz"/>
<!--
these properties probably don't need changing
-->
<property name = "src" location = "./src/main/java"/>
<property name = "build" location = "./build"/>
<property name = "bundle.dir" location = "${build}"/>
<property name = "classes" location = "${build}/classes"/>
<property name = "lib" location = "./lib"/>
<property name = "genlib" location = "${build}/lib"/>
<property name = "manifest" location = "${build}/manifest.mf"/>
<property name = "protege.common" location="${protege.home}/bundles"/>
<property name = "protege.plugins" location="${protege.home}/plugins"/>
<target name = "init">
<tstamp>
<format property="build.time" pattern="yyyy_MM_dd_hhmm"/>
</tstamp>
<mkdir dir = "${build}"/>
<mkdir dir = "${classes}"/>
<mkdir dir = "${genlib}"/>
<property name="bundle.version"
value="${major.version}.${minor.version}.${micro.version}.${build.time}"/>
</target>
<!-- ============================================================= -->
<!-- Configuring the Compile Classpath -->
<!-- ============================================================= -->
<target name="checkProtegeLibsAndReport" depends="checkProtegeLibs"
unless="libs.found">
<echo message="Missing protege libraries. You need to set "/>
<echo message="the PROTEGE_HOME environment variable to a"/>
<echo message="protege installation directory where the"/>
<echo message="appropriate plugins have been installed."/>
<echo message="Alternatively set the jar libs in local.properties (protege.lib=...)"/>
<echo message="Use the -v option to ant to see what jars are missing."/>
<fail message = "missing protege libraries"/>
</target>
<!--
The following target only needs to be modified if the user
needs to change the classpath. It is preconfigured to use
the common protege 4 jars, the lib directory and the
libraries that have been uncovered in buildlibs.
-->
<target name = "checkProtegeLibs" depends="init">
<echo message="**********************************************************"/>
<echo message="Using Protege Home = ${protege.home}"/>
<echo message="Using Java Version = ${ant.java.version}" />
<echo message="**********************************************************"/>
<condition property="libs.found">
<and>
<available file="${protege.osgi}" type="file"/>
<available file="${equinox.common}" type = "file"/>
<available file="${equinox.registry}" type = "file"/>
<available file="${owl.editor.jar}" type = "file"/>
<available file="${owl.lib}" type="file"/>
</and>
</condition>
<path id = "project.classpath">
<pathelement location="${protege.osgi}"/>
<pathelement location="${protege.lib}"/>
<pathelement location="${equinox.common}"/>
<pathelement location="${equinox.registry}"/>
<pathelement location="${owl.editor.jar}"/>
<pathelement location="${owl.lib}"/>
<fileset dir="${genlib}"/>
</path>
</target>
<!--
The following target only needs to be modified if the
developer needs to obtain some jar files that are contained in
the Protege bundles. The contents of these jar files are
found when Protege 4 runs but may be needed in order to
compile the plugin.
-->
<target name = "buildlibs" depends="checkProtegeLibsAndReport">
<unjar dest="${build}"
src="${common.lib}">
<patternset>
<include name = "**/log4j.jar"/>
<include name = "**/looks.jar"/>
</patternset>
</unjar>
</target>
<!--
Here is the copy.resources target. It may need modification
to copy the right resources into the classes directory. By
default it already copies non-java files found in the source
directory, the libraries needed by the project and the
viewconfig and the plugin.xml. This will be sufficient in
many cases.
-->
<target name="copy.resources" depends="build.manifest">
<copy todir="${classes}">
<fileset dir="src/main/resources">
<include name="**/*"/>
<exclude name="**/*.java"/>
<exclude name="**/MANIFEST.MF"/>
<exclude name="**/manifest.mf"/>
</fileset>
</copy>
<copy todir = "${classes}" file = "plugin.xml"/>
<!-- the manifest doesn't belong here but this is good for IDE's -->
<mkdir dir="${classes}/META-INF"/>
<copy todir="${classes}/META-INF" file = "${manifest}"/>
</target>
<!--
It is less likely that the developer will want to make changes
below this line
-->
<!-- ============================================================= -->
<target name="add.source" depends="init">
<zip destfile="${classes}/${plugin}src.zip">
<fileset dir="${src}"/>
</zip>
</target>
<target name = "compile" depends = "buildlibs, checkProtegeLibsAndReport">
<javac srcdir = "${src}"
destdir = "${classes}"
debug="on"
includeAntRuntime="false">
<classpath refid = "project.classpath"/>
</javac>
</target>
<target name="build.manifest">
<copy tofile="${manifest}"
file="META-INF/MANIFEST.MF" overwrite="true"/>
<manifest file="${manifest}"
mode = "update">
<attribute name="Built-By" value = "${user.name}"/>
<attribute name="Bundle-Version" value="${bundle.version}"/>
</manifest>
</target>
<target name = "create.update.properties">
<property name="update.properties.file"
location="${build}/owlviz-update.properties"/>
<echo file="${update.properties.file}" append="false">
id=${plugin}
version=${bundle.version}
download=http://smi-protege.stanford.edu/protege4/plugins/4.1/${plugin}.jar
name=OWLViz Plugin
readme=http://smi-protege.stanford.edu/protege4/plugins/4.1/owlviz-readme.txt
license=http://www.gnu.org/licenses/lgpl.html
author=Matthew Horridge for the CO-ODE project
</echo>
</target>
<target name = "jar" depends = "compile, copy.resources, create.update.properties">
<jar jarfile = "${build}/${plugin}.jar"
basedir = "${classes}"
manifest = "${build}/manifest.mf"/>
</target>
<target name = "install" depends = "jar">
<!-- flush cache -->
<delete dir = "${protege.home}/configuration/org.eclipse.core.runtime"/>
<delete dir = "${protege.home}/configuration/org.eclipse.osgi"/>
<copy file="${build}/${plugin}.jar"
todir = "${protege.plugins}"
overwrite = "true"/>
</target>
<target name="junit"/>
<target name = "clean">
<delete dir = "${build}"/>
</target>
<target name = "usage">
<echo message = "To run this script set the PROTEGE_HOME environment"/>
<echo message = "variable and use one of the following targets"/>
<echo message = "jar - builds the jar (bundle) file for this project"/>
<echo message = "install - installs the bundle into the Protege distribution"/>
<echo message = "copy.resources - copyies resources into the classes directory"/>
<echo message = " this can be useful for ide developers - see the wiki"/>
</target>
<!--
Standard properties that should not require changing
-->
<property name="equinox.common"
location="${protege.common}/org.eclipse.equinox.common.jar"/>
<property name="equinox.registry"
location="${protege.common}/org.eclipse.equinox.registry.jar"/>
<property name="protege.lib"
location="${protege.common}/org.protege.editor.core.application.jar"/>
<property name="common.lib"
location="${protege.common}/org.protege.common.jar"/>
<property name="owl.lib"
location="${protege.plugins}/org.semanticweb.owl.owlapi.jar"/>
<property name="owl.editor.jar"
location="${protege.plugins}/org.protege.editor.owl.jar"/>
</project>