This repository was archived by the owner on May 26, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-helper.xml
More file actions
148 lines (114 loc) · 4.37 KB
/
Copy pathbuild-helper.xml
File metadata and controls
148 lines (114 loc) · 4.37 KB
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
<!--
+==========================================================================
| Common Code
+==========================================================================
-->
<project name="polydes-common" basedir="." xmlns:if="ant:if" xmlns:unless="ant:unless">
<!-- Set the following properties in build-helper.properties
swjar=path/to/sw.jar
buildpath=path/to/stencylworks/extensions
-->
<include file="tools/ant-helper.xml"/>
<dirname property="common.base" file="${ant.file.polydes-common}"/>
<if>
<not>
<available file="${common.base}/build-helper.properties" />
</not>
<then>
<fail message="No build-helper.properties file found." />
</then>
</if>
<property file="${common.base}/build-helper.properties"/>
<property name="common.src" value="${common.base}/src" />
<property name="common.pkg" value="com/polydes/common" />
<var name="this.src" value="./src" />
<var name="this.build" value="./build" />
<var name="this.lib" value="./libs" />
<var name="this.res" value="./res" />
<var name="this.pkg" value="${pkg}" />
<set-var-if-unset name="version" value="1.0.0" />
<propertyregex property="extensionID"
input="${pkg}"
regexp="/"
replace="."
global="true" />
<var name="jarname" value="${extensionID}" />
<!--
srcpath and clspath are first set when this script is included.
They can then be set by the caller with <var name=".." value=".." />.
They will be ignored the second time they're evaluated (when <antcall> is used).
-->
<set-var-if-unset name="srcpath" value="${this.src}" />
<set-var-if-unset name="clspath" value="${swjar}" />
<set-var-if-unset name="usinglibs" value="false" />
<set-var-if-unset name="name" value="My Extension" />
<set-var-if-unset name="description" value="Description" />
<set-var-if-unset name="author" value="Author" />
<set-var-if-unset name="website" value="https://github.com/polydes" />
<set-var-if-unset name="internalVersion" value="1" />
<set-var-if-unset name="type" value="normal" />
<set-var-if-unset name="repository" value="http://www.polydes.com/repo" />
<path id="compile.libs">
<fileset dir="${this.lib}" includes="*.jar" />
</path>
<!-- Compilation -->
<target name="compile" >
<delete dir="${this.build}" />
<mkdir dir="${this.build}" />
<echo message="Compiling sources -> ${srcpath}" />
<echo message="Using classpath -> ${clspath}" />
<javac source="1.8" target="1.8" srcdir="${srcpath}" destdir="${this.build}" debug="on" fork="true">
<classpath>
<pathelement path="${clspath}" />
<path refid="compile.libs" if:true="${usinglibs}" />
</classpath>
</javac>
</target>
<!-- Copying resources -->
<target name="copy-resources">
<if>
<available file="${this.res}"/>
<then>
<copy toDir="${this.build}/res/${this.pkg}">
<fileset dir="${this.res}" />
</copy>
</then>
</if>
<if>
<available file="icon.png"/>
<then>
<copy toFile="${this.build}/${this.pkg}/res/icon.png" file="icon.png" />
</then>
</if>
</target>
<!-- Jar files -->
<target name="makejar">
<if>
<matches string="${dependsOn}" pattern="(^|[, ])stencyl-" />
<then>
<var name="depends" value="${dependsOn}" />
</then>
<else>
<var name="depends" value="stencyl-3.5.0" />
<var name="depends" value="${depends},${dependsOn}" if:set="dependsOn" />
</else>
</if>
<jar destfile="${buildpath}/${jarname}.jar" basedir="${this.build}">
<manifest>
<attribute name="Extension-ID" value="${extensionID}" />
<attribute name="Extension-Main-Class" value="${main}" />
<attribute name="Extension-Version" value="${version}" />
<attribute name="Extension-Icon" value="${pkg}/res/icon.png" />
<attribute name="Extension-Dependencies" value="${depends}" />
<attribute name="Extension-Type" value="${type}" />
<attribute name="Extension-Name" value="${name}" />
<attribute name="Extension-Description" value="${description}" />
<attribute name="Extension-Author" value="${author}" />
<attribute name="Extension-Website" value="${website}" />
<attribute name="Extension-Repository" value="${repository}" />
<attribute name="Extension-Internal-Version" value="${internalVersion}" />
</manifest>
<zipgroupfileset dir="${this.lib}/" includes="*.jar" if:true="${usinglibs}" />
</jar>
</target>
</project>