-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-extension.xml
116 lines (97 loc) · 4.67 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
112
113
114
115
116
<?xml version="1.0" encoding="UTF-8"?>
<project name="CircularSliderWidget" basedir="." default="build">
<property name="extension.jar" value="circularsliderwidget.jar" />
<property name="target" value="1.8" />
<property name="source" value="1.8" />
<property name="debuglevel" value="source,lines,vars" />
<property name="common" value="common" />
<property name="ui" value="ui" />
<property name="lib" value="lib" />
<property name="entities" value="Entities" />
<property name="localization" value="Localization" />
<property name="src.dir" value="${basedir}/src" />
<property name="build.dir" value="${user.home}/builds/${ant.project.name}/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="${user.home}/builds/${ant.project.name}/build/distributions" />
<property name="entity.dir" value="${basedir}/Entities" />
<property name="localization.dir" value="${basedir}/${localization}" />
<property file="extension.properties" />
<!-- 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 property="NOW" pattern="yyyy-MM-dd HH:mm:ss" />
</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="${lib.dir}" includes="*.jar" erroronmissingdir="false" />
</path>
<target name="clean">
<delete dir="${build.dir}" />
<delete dir="${zip.dir}" />
</target>
<target name="init" depends="clean">
<mkdir dir="${build.dir}" />
<copy includeemptydirs="false" todir="${build.dir}">
<fileset dir="${src.dir}">
<exclude name="**/*.launch" />
<exclude name="**/*.java" />
</fileset>
</copy>
</target>
<target name="build-source" depends="init">
<echo message="${ant.project.name}: ${ant.file}" />
<javac debug="true" debuglevel="${debuglevel}" destdir="${build.dir}" source="${source}" target="${target}" includeantruntime="false">
<src path="${src.dir}" />
<classpath refid="jar.classpath" />
</javac>
</target>
<target name="check-bin" depends="build-source">
<fileset dir="${build.dir}" id="binfileset" />
<condition property="bindir.empty">
<length length="0">
<fileset refid="binfileset" />
</length>
</condition>
</target>
<target name="build-jars" depends="check-bin" 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="Eclipse Plugin for ThingWorx Extension Development ${twx_eclipse_plugin_version}" />
<attribute name="Build-Date" value="${NOW}" />
<section name="${ant.project.name}">
<attribute name="Package-Title" value="${ant.project.name}" />
<attribute name="Package-Version" value="${package_version}" />
<attribute name="Package-Vendor" value="${project_vendor}" />
</section>
</manifest>
<fileset dir="${build.dir}" />
</jar>
</target>
<target name="package-extension" depends="build-jars">
<zip destfile="${zip.dir}/${zip.file.name}">
<mappedresources>
<fileset dir="${build.dir}" includes="${extension.jar}" />
<globmapper from="*" to="${package.common.lib.dir}/*" />
</mappedresources>
<zipfileset dir="${config.dir}" includes="metadata.xml" />
<zipfileset dir="${basedir}" includes="${entities}/**/*.xml" />
<zipfileset dir="${basedir}" includes="${localization}/**/*.json" />
<zipfileset dir="${basedir}" includes="${ui}/**/*.*" />
<zipfileset dir="${lib.dir}" includes="**/*.jar" prefix="${package.common.lib.dir}/"/>
</zip>
</target>
<target name="build" depends="package-extension">
<echo message="Building ${ant.project.name} extension package..."/>
</target>
</project>