forked from simonjupp/protege-obo-plugins
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
218 lines (187 loc) · 7.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
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
<?xml version = "1.0" encoding = "utf-8"?>
<project name = "OBO view" default = "install" basedir = ".">
<property file="local.properties"/>
<property environment="env"/>
<property name="main.resources" location="./resources"/>
<property name="main.source" location="./src"/>
<property name="main.icons" location="./icons"/>
<!--
To run this build file set the environment variable
PROTEGE_HOME to point to a protege distribution and type ant
install or jar.
-->
<property name="protege.home" location="${env.PROTEGE_HOME}"/>
<!-- ============================================================= -->
<!--
This section may need to be customized by the developer for a
particular project
-->
<!--
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.protege.oboeditor"/>
<!--
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="${main.source}">
<include name="**/*"/>
<exclude name="**/*.java"/>
<exclude name="**/MANIFEST.MF"/>
<exclude name="**/manifest.mf"/>
</fileset>
<fileset dir="${main.resources}"/>
</copy>
<copy todir="${classes}/icons">
<fileset dir="${main.icons}"/>
</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>
<!--
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="init, checkProtegeLibsAndReport">
<unjar dest="${build}"
src="${common.lib}">
<patternset>
<include name = "**/log4j.jar"/>
</patternset>
</unjar>
</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">
<echo message="Using Protege Home = ${protege.home} to find protege jars"/>
<condition property="libs.found">
<and>
<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.lib}"/>
<pathelement location="${equinox.common}"/>
<pathelement location="${equinox.registry}"/>
<pathelement location="${owl.editor.jar}"/>
<pathelement location="${owl.lib}"/>
</path>
</target>
<!--
It is less likely that the developer will want to make changes
below this line
-->
<!-- ============================================================= -->
<property name = "build" location = "./build"/>
<property name = "classes" location = "${build}/classes"/>
<property name = "manifest" location = "${build}/manifest.mf"/>
<!--
This is the section that changes for different distributions.
It would only need small changes for knopflerfish or felix.
-->
<property name="osgi"
location="${protege.home}/org.eclipse.osgi.jar"/>
<property name="equinox.common"
location="${protege.home}/bundles/org.eclipse.equinox.common.jar"/>
<property name="equinox.registry"
location="${protege.home}/bundles/org.eclipse.equinox.registry.jar"/>
<property name="protege.lib"
location="${protege.home}/bundles/org.protege.editor.core.application.jar"/>
<property name="common.lib"
location="${protege.home}/bundles/org.protege.common.jar"/>
<property name="owl.lib"
location="${protege.home}/plugins/org.semanticweb.owl.owlapi.jar"/>
<property name="owl.editor.jar"
location="${protege.home}/plugins/org.protege.editor.owl.jar"/>
<!-- end of equinox specific settings -->
<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>
<target name = "init">
<mkdir dir="${main.icons}"/>
<mkdir dir="${main.resources}"/>
<tstamp>
<format property="build.time" pattern="MM/dd/yyyy hh:mm aa"/>
</tstamp>
<mkdir dir = "${build}"/>
<mkdir dir = "${classes}"/>
<mkdir dir = "${classes}/lib"/>
<mkdir dir = "${classes}/icons"/>
</target>
<target name="checkProtegeHome">
<condition property="protege.home.set">
<available file="${protege.home}/org.protege.editor.core.application.jar" type="file"/>
</condition>
</target>
<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 = "compile" depends = "buildlibs, checkProtegeLibsAndReport">
<javac srcdir="${main.source}"
excludes="org/coode/matrix/test/*,java"
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="Build-Date" value = "${build.time}"/>
</manifest>
</target>
<target name = "jar" depends = "compile, copy.resources">
<jar jarfile = "${build}/${plugin}.jar"
basedir = "${classes}"
manifest = "${build}/manifest.mf"/>
</target>
<target name = "install" depends = "jar">
<copy file="${build}/${plugin}.jar"
todir = "${protege.home}/plugins"
overwrite = "true"/>
</target>
<target name = "clean">
<delete dir = "${build}"/>
</target>
</project>