-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.xml
220 lines (181 loc) · 8.8 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
<project name="pluginbuilder" default="custom.plugin.generate_sources" basedir=".">
<property name="debug" value="true" />
<property name="config.plugin.name" value="com.genericworkflownodes.knime.config" />
<property name="config.plugin.version.major" value="0" />
<property name="config.plugin.version.minor" value="8" />
<property name="config.plugin.version.patch" value="0" />
<!-- check if we are in a checkout -->
<available file=".git" type="dir" property="git.present"/>
<!-- get git last change date -->
<target name="git.timestamp" description="Get git last change date" if="git.present">
<exec executable="git" outputproperty="timestamp.out" resultproperty="timestamp.res" failifexecutionfails="false" errorproperty="timestamp.error">
<arg value="log"/>
<arg value="-n1"/>
<arg value="--simplify-by-decoration"/>
<arg value="--pretty=%ai"/>
<redirector>
<outputfilterchain>
<containsregex pattern="^([0-9]*)-([0-9]*)-([0-9]*)\s([0-9]*):([0-9]*):.*$" replace="\1\2\3\4\5"/>
</outputfilterchain>
</redirector>
</exec>
<echo message="timestamp.out: ${timestamp.out}" />
<echo message="timestamp.res: ${timestamp.res}" />
<property name="git.last.change.date" value="${timestamp.out}" />
</target>
<property name="nodegenerator.name" value="com.genericworkflownodes.knime.node_generator" />
<!-- DEFAULT: this works only if it was not set previously the build.properties -->
<property name="default.plugin.dir" value="com.genericworkflownodes.knime.node_generator/sample-openms" description="Directory containing the files from which you want to generate the KNIME plugin." />
<property name="config.plugin.version" value="${config.plugin.version.major}.${config.plugin.version.minor}.${config.plugin.version.patch}" />
<tstamp>
<format property="fulltime" pattern="yyyy-MM-dd'T'HH-mm-ss-SZ" />
<!-- about ISO8601 -->
</tstamp>
<property name="tmp" value="${java.io.tmpdir}/GKN-${fulltime}" />
<property name="config.plugin.src" value="com.genericworkflownodes.knime.config" />
<property name="config.plugin.build.dir" value="${tmp}/configPlugin" />
<property name="config.plugin.build.jar" value="build/${config.plugin.name}_${config.plugin.version}.jar" />
<property name="nodegenerator.src" value="com.genericworkflownodes.knime.node_generator" />
<property name="nodegenerator.build.dir" value="${tmp}/nodeGenerator" />
<property name="nodegenerator.build.jar" value="build/${nodegenerator.name}_${config.plugin.version}.jar" />
<property name="src" value="src" />
<property name="test" value="test" />
<!-- the classpath for the config plugin (lib/) -->
<path id="config.plugin.classpath">
<!-- include our own dependencies -->
<fileset dir="${config.plugin.src}/lib">
<include name="*.jar" />
</fileset>
<!-- include our own files -->
<pathelement location="${config.plugin.src}/${src}" />
</path>
<path id="nodegenerator.build.classpath">
<pathelement location="${config.plugin.build.jar}" />
<!-- include our own dependencies -->
<fileset dir="${nodegenerator.src}/lib">
<include name="*.jar" />
</fileset>
</path>
<path id="nodegenerator.exec.classpath">
<path refid="nodegenerator.build.classpath" />
<pathelement location="${nodegenerator.build.jar}" />
</path>
<!-- the classpath used to compile and generate the plugin sources -->
<path id="custom.plugin.build.classpath">
<pathelement location="${config.plugin.build.jar}" />
<path refid="config.plugin.classpath" />
</path>
<target name="clean">
<delete dir="${tmp}" />
</target>
<!-- plugin.dir checks -->
<target name="plugin.dir.condition">
<!-- Check if the user set a plugin.dir or if we need to use the default.plugin.dir -->
<condition property="plugin.dir.isset">
<isset property="plugin.dir" />
</condition>
<!-- if not set overwrite -->
<condition property="plugin.dir" value="${default.plugin.dir}">
<not>
<isset property="plugin.dir" />
</not>
</condition>
</target>
<target name="plugin.dir.check" depends="plugin.dir.condition" unless="plugin.dir.isset">
<echo message="Using default plugin.dir: ${plugin.dir}" />
<echo message="If you want to use a custom plugin dir, just add a plugin.dir property to the" />
<echo message="build.properties file." />
</target>
<!-- Load Plugin Information -->
<target name="load-custom-plugin-info" depends="plugin.dir.check" >
<property file="${plugin.dir}/plugin.properties" />
<property name="custom.plugin.name" value="${pluginPackage}" />
<property name="custom.plugin.version" value="${pluginVersion}" />
<property name="default.custom.plugin.generator.target" value="generated_plugin/${custom.plugin.name}_${custom.plugin.version}/" />
<condition property="custom.plugin.generator.target" value="${default.custom.plugin.generator.target}">
<not>
<isset property="custom.plugin.generator.target" />
</not>
</condition>
<property name="custom.plugin.build.src" value="${custom.plugin.generator.target}/${custom.plugin.name}" />
<property name="custom.plugin.build.dir" value="${tmp}/customPlugin" />
<property name="custom.plugin.build.jar" value="build/${custom.plugin.name}_${custom.plugin.version}.jar" />
</target>
<target name="prepare" depends="clean,load-custom-plugin-info">
<echo message="plugin.dir: ${plugin.dir}" />
<mkdir dir="${tmp}" />
<mkdir dir="build" />
</target>
<target name="config.plugin.build" depends="prepare">
<echo message="Debug: ${debug}" />
<mkdir dir="${config.plugin.build.dir}" />
<mkdir dir="${config.plugin.build.dir}/lib" />
<copy todir="${config.plugin.build.dir}/lib" failonerror="true" overwrite="true">
<fileset dir="${config.plugin.src}/lib/">
<include name="*.jar" />
</fileset>
</copy>
<mkdir dir="${config.plugin.build.dir}/META-INF" />
<copy todir="${config.plugin.build.dir}/META-INF" failonerror="true" overwrite="true">
<fileset dir="${config.plugin.src}/META-INF">
<include name="MANIFEST.MF" />
</fileset>
</copy>
<antcall target="config.plugin.classes.build" />
<zip destfile="${config.plugin.build.jar}" basedir="${config.plugin.build.dir}" />
</target>
<target name="config.plugin.classes.build">
<javac srcdir="${config.plugin.src}/${src}" destdir="${config.plugin.build.dir}" includeantruntime="false" debug="on" debuglevel="lines,vars,source">
<classpath refid="config.plugin.classpath" />
<compilerarg value="-Xlint:unchecked" />
<compilerarg value="-Xlint:deprecation" />
</javac>
<!-- copy factory-xmls and other stuff -->
<copy todir="${config.plugin.build.dir}" failonerror="true" overwrite="true">
<fileset dir="${config.plugin.src}/${src}">
<!--<exclude name="**/*.java"/>-->
<exclude name="**/package.htm*" />
</fileset>
</copy>
</target>
<target name="nodegenerator.build" depends="config.plugin.build">
<mkdir dir="${nodegenerator.build.dir}" />
<javac srcdir="${nodegenerator.src}/${src}" destdir="${nodegenerator.build.dir}" includeantruntime="false" debug="on" debuglevel="lines,vars,source">
<classpath refid="nodegenerator.build.classpath" />
<compilerarg value="-Xlint:unchecked" />
<compilerarg value="-Xlint:deprecation" />
</javac>
<!-- copy templates and assets into nodegenerator.jar
e.g.,
* assets/.classpath
* templates/BinaryResources.template
-->
<copy todir="${nodegenerator.build.dir}" failonerror="true" overwrite="true">
<fileset dir="${nodegenerator.src}/${src}">
<!--<exclude name="**/*.java"/>-->
<exclude name="**/package.htm*" />
</fileset>
</copy>
<zip destfile="${nodegenerator.build.jar}" basedir="${nodegenerator.build.dir}" />
</target>
<target name="custom.plugin.generate_sources" description="run node generator" depends="nodegenerator.build,git.timestamp">
<echo message="${toString:nodegenerator.exec.classpath}" />
<condition property="generate.extra.arguments" value="">
<not>
<isset property="generate.extra.arguments" />
</not>
</condition>
<java classname="com.genericworkflownodes.knime.nodegeneration.Main" failonerror="true" fork="true">
<!-- we use the detour via env.CLASSPATH here since WinXP machines otherwise couldn't -->
<!-- handle the to long classpath -->
<env key="CLASSPATH" path="${env.CLASSPATH}:${toString:nodegenerator.exec.classpath}" />
<arg value="-i" />
<arg value="${plugin.dir}" />
<arg value="-o" />
<arg value="${custom.plugin.generator.target}" />
<arg value="-d" />
<arg value="${timestamp.out}" />
<arg line="${generate.extra.arguments}" />
</java>
</target>
</project>