forked from protegeproject/owl-diff-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
251 lines (216 loc) · 9.59 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
244
245
246
247
248
249
250
251
<?xml version = "1.0" encoding = "utf-8"?>
<project name = "Protege OWL diff library"
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="version.properties"/>
<property name="major.version" value="1"/>
<property name="minor.version" value="0"/>
<property name="micro.version" value="0"/>
<property name = "plugin" value = "org.protege.owl.diff"/>
<!--
these properties probably don't need changing
-->
<property name = "src" location = "./src/main/java"/>
<property name = "build" 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"/>
<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"/>
<target name = "init">
<tstamp>
<format property="build.time" pattern="yyyy_MM_dd_hhmm"/>
</tstamp>
<property name="bundle.version"
value="${major.version}.${minor.version}.${micro.version}.${build.time}"/>
<mkdir dir = "${build}"/>
<mkdir dir = "${classes}"/>
<mkdir dir = "${classes}/lib"/>
<mkdir dir = "${genlib}"/>
</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>
<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>
<target name = "buildlibs" depends="checkProtegeLibsAndReport">
<unjar dest="${build}"
src="${common.lib}">
<patternset>
<include name = "**/log4j.jar"/>
<include name = "**/looks.jar"/>
</patternset>
</unjar>
</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="copy.resources" depends="build.manifest">
<copy todir="${classes}">
<fileset dir="${src}">
<include name="**/*"/>
<exclude name="**/*.java"/>
<exclude name="**/MANIFEST.MF"/>
<exclude name="**/manifest.mf"/>
</fileset>
</copy>
<copy todir="${classes}">
<fileset dir="src/main/resources"/>
</copy>
<copy todir="${classes}">
<fileset dir="." includes="*.xml">
<exclude name="build.xml"/>
</fileset>
</copy>
<!-- 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>
<target name = "create.update.properties" depends="init">
<property name="update.properties.file"
location="${build}/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=Protege OWL Diff Library
readme=http://smi-protege.stanford.edu/protege4/plugins/4.1/difflibrary-readme.html
license=http://www.gnu.org/licenses/lgpl.html
author=The Protege Development Team
</echo>
</target>
<target name = "compile" depends = "buildlibs, checkProtegeLibsAndReport">
<javac srcdir = "${src}"
destdir = "${classes}"
debug="on"
includeAntRuntime="false">
<classpath refid = "project.classpath"/>
</javac>
</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>
<!-- =================================================================== -->
<!-- RUN -->
<!-- =================================================================== -->
<target name = "run" depends="init">
<java fork = "true" dir = "${protege.home}"
classname = "org.protege.osgi.framework.Launcher">
<jvmarg value = "-Dlog4j.configuration=file:log4j.xml"/>
<jvmarg value = "-Xmx1500M"/>
<classpath>
<pathelement path="${protege.osgi}"/>
<pathelement path="${protege.launcher}"/>
</classpath>
</java>
</target>
<!-- =================================================================== -->
<!-- DEBUG -->
<!-- =================================================================== -->
<target name = "debug" depends="init">
<java fork = "true" dir = "${protege.home}"
classname = "org.protege.osgi.framework.Launcher">
<jvmarg value = "-Dlog4j.configuration=file:log4j.xml"/>
<jvmarg value = "-agentlib:jdwp=transport=dt_socket,address=8500,server=y,suspend=y"/>
<jvmarg value = "-Xmx1500M"/>
<classpath>
<pathelement path="${protege.osgi}"/>
<pathelement path="${protege.launcher}"/>
</classpath>
</java>
</target>
<target name = "openAndCompare" depends="compile">
<java fork = "true"
classname = "org.protege.owl.diff.OpenAndCompare">
<jvmarg value = "-Dlog4j.configuration=file:log4j.xml"/>
<jvmarg value = "-Xmx3400M"/>
<classpath refid="project.classpath"/>
<classpath>
<pathelement path="${classes}"/>
</classpath>
</java>
</target>
<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"/>
<echo message = "run - runs Protege (requires that Protege has been installed)"/>
<echo message = "debug - starts Protege with the debugger using port 8500"/>
</target>
</project>