-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-extension.xml
111 lines (93 loc) · 4.15 KB
/
build-extension.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
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="build" name="windows-services-ext">
<property name="extension.jar" value="thingworx-sc-extension.jar"/>
<property name="target" value="1.7"/>
<property name="source" value="1.7"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="common" value="WindowsServicesFunctions"/>
<property name="ui" value="ui"/>
<property name="lib" value="lib"/>
<property name="entities" value="Entities"/>
<property name="src.dir" value="${basedir}/src"/>
<property name="build.dir" value="${basedir}/bin"/>
<property name="config.dir" value="${basedir}/configfiles"/>
<property name="ui.dir" value="${basedir}/${ui}"/>
<property name="lib.dir" value="${basedir}/${lib}"/>
<property name="zip.dir" value="${basedir}/build/distributions"/>
<property name="entity.dir" value="${basedir}/Entities"/>
<!-- ExtensionPackage directory structure props -->
<property name="package.lib.basedir" value="${lib}"/>
<property name="package.ui.basedir" value="${ui}"/>
<property name="package.common.lib.dir" value="${package.lib.basedir}/${common}"/>
<property name="package.common.ui.dir" value="${package.ui.basedir}/${common}"/>
<!-- Extension file info -->
<property name="zip.file.name" value="${ant.project.name}.zip"/>
<tstamp>
<format pattern="yyyy-MM-dd HH:mm:ss" property="NOW"/>
</tstamp>
<!-- define the classpath so it picks up the ThingWorx SDK jar relative to this basedir -->
<path id="jar.classpath">
<pathelement location="${build.dir}"/>
<fileset dir="${basedir}\twx-lib" includes="*.jar"/>
<fileset dir="${basedir}\lib" includes="*.jar"/>
</path>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target depends="clean" name="init">
<mkdir dir="${build.dir}"/>
<copy includeemptydirs="false" todir="${build.dir}">
<fileset dir="${src.dir}">
<exclude name="**/*.launch"/>
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target depends="init" name="build-source">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="${build.dir}" includeantruntime="false" source="${source}" target="${target}">
<src path="${src.dir}"/>
<classpath refid="jar.classpath"/>
</javac>
</target>
<target depends="build-source" name="check-bin">
<fileset dir="${build.dir}" id="binfileset"/>
<condition property="bindir.empty">
<length length="0">
<fileset refid="binfileset"/>
</length>
</condition>
</target>
<target depends="check-bin" name="build-jars" unless="bindir.empty">
<echo message="building ${extension.jar} to ${build.dir}..."/>
<jar destfile="${build.dir}/${extension.jar}">
<!-- generate MANIFEST inline -->
<manifest>
<attribute name="Built-By" value="${extension.package.vendor}"/>
<attribute name="Build-Date" value="${NOW}"/>
<section name="${extension.package.name}">
<attribute name="Package-Title" value="${extension.package.title}"/>
<attribute name="Package-Version" value="${extension.package.version}"/>
<attribute name="Package-Vendor" value="${extension.package.vendor}"/>
</section>
</manifest>
<fileset dir="${build.dir}"/>
</jar>
</target>
<target depends="build-jars" name="package-extension">
<zip destfile="${zip.dir}/${zip.file.name}">
<mappedresources>
<fileset dir="${build.dir}" includes="${extension.jar}"/>
<globmapper from="*" to="${package.common.lib.dir}/*"/>
</mappedresources>
<mappedresources>
<fileset dir="${basedir}\lib" includes="*.jar"/>
<globmapper from="*" to="${package.common.lib.dir}/*"/>
</mappedresources>
<zipfileset dir="${config.dir}" includes="metadata.xml"/>
</zip>
</target>
<target depends="package-extension" name="build">
<echo message="Building ${ant.project.name} extension package..."/>
</target>
</project>