-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
260 lines (205 loc) · 6 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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
<?xml version="1.0" encoding="UTF-8"?>
<project default="all" name="ane.build">
<import file="build_common.xml" />
<property file="${common.basedir}/build_config/build.config" description="build properties" />
<macrodef name="iterate">
<attribute name="target" />
<attribute name="directory" />
<sequential>
<subant target="@{target}">
<fileset dir="@{directory}">
<include name="**/build_*.xml" />
</fileset>
</subant>
</sequential>
</macrodef>
<!--
//
//
// VERSIONING
//
//
-->
<target name="version">
<antcall target="version_write" />
</target>
<target name="version_increment" if="${version.autoincrement}">
<propertyfile file="./build_config/version.config">
<entry key="version_build" type="int" operation="+" value="1" />
</propertyfile>
</target>
<target name="version_write">
<echo file="build/VERSION.md" append="false">## Version Details
| Extension | Version | Android Lib | iOS Lib |
| --- | --- | --- | --- |
</echo>
<var name="version" value="${version_major}.${version_minor}.${version_build}" />
<echo file="${output.dir}/VERSION.md" append="true" message="| ${output.name} | ${version} | ${version.android} | ${version.ios} |${line.separator}" />
</target>
<!--
//
//
// BUILD PLATFORMS
//
//
-->
<target name="build_platforms">
<iterate target="build" directory="platform" />
</target>
<target name="clean_platforms">
<iterate target="clean" directory="platform" />
</target>
<!--
//
//
// PACKAGE EXTENSIONS
//
//
-->
<target name="build_extensions">
<iterate target="build" directory="extension" />
</target>
<target name="clean_extensions">
<iterate target="clean" directory="extension" />
</target>
<!--
//
//
// DOCUMENTATION
//
//
-->
<target name="docs">
<iterate target="docs" directory="platform" />
<!-- Ensure documentation is updated -->
<lower name="project.namelower" value="${project.name}" />
<var name="docs.dir" value="docs/site/docs/${project.namelower}" />
<var name="docs.asdocs_dir" value="docs/site/static/asdocs/${project.namelower}" />
<!-- Copy ASDocs -->
<copy todir="${docs.asdocs_dir}" overwrite="true">
<fileset dir="docs/asdocs" />
</copy>
<!-- Copy CHANGELOG -->
<copy tofile="${docs.dir}/changelog.md" overwrite="true" file="CHANGELOG.md" />
</target>
<target name="wikiToPages">
<mkdir dir="docs/pages" />
<echo file="docs/pages/.gitignore">
Gemfile
_site
</echo>
<delete defaultexcludes="false" includeemptydirs="true">
<fileset dir="docs/pages">
<include name="**/*" />
<exclude name=".gitignore" />
</fileset>
</delete>
<!-- Clone the site template -->
<exec executable="git">
<arg value="clone" />
<arg value="git@gitlab.com:airnativeextensions/github-pages-template.git" />
<arg value="_tmpclone" />
</exec>
<copy todir="docs/pages" overwrite="true">
<fileset dir="_tmpclone" />
<filterchain>
<tokenfilter>
<replacestring from="Template" to="${project.name}" />
</tokenfilter>
</filterchain>
</copy>
<delete dir="_tmpclone" failonerror="false" />
<!-- Copy the wiki files
- update links to md
- move Home to index
- copy images
- sidebar manipulation to html
-->
<copy todir="docs/pages" overwrite="true">
<fileset dir="docs/wiki" defaultexcludes="false">
<exclude name="**/_Sidebar.md" />
<exclude name="**/_Footer.md" />
<include name="**/*.md" />
</fileset>
<filterchain>
<tokenfilter>
<replacestring from="[[" to="![](" />
<replacestring from="]]" to=")" />
</tokenfilter>
</filterchain>
</copy>
<move file="docs/pages/Home.md" tofile="docs/pages/index.md" />
<copy todir="docs/pages" overwrite="true">
<fileset dir="docs/wiki" defaultexcludes="false">
<include name="**/images/**" />
</fileset>
</copy>
<copy file="docs/wiki/_Sidebar.md" tofile="docs/pages/_includes/Sidebar.html" overwrite="true">
<filterchain>
<tokenfilter>
<replacestring from="---" to="<br/><hr/>" />
<!--<replacestring from="|Home]]" to="|https://airnativeextensions.com/extension/com.distriqt.${project.name}]]"/>-->
<replaceregex flags="g" pattern="^(.[^\[\(\<]+)$" replace="<h4>\1</h4>" />
<replaceregex flags="g" pattern="\[\[(.+?)\|Home\]\]" replace="" />
<replaceregex flags="g" pattern="\[\[(.+?)\|(.+?)\]\]" replace="<a href='\2'>\1<\/a><br\/>" />
<replaceregex flags="g" pattern="\[(.+?)\]\((.+?)\)" replace="<a href='\2'>\1<\/a><br\/>" />
</tokenfilter>
</filterchain>
</copy>
<!-- Copy ASDocs -->
<copy todir="docs/pages/asdocs" overwrite="true">
<fileset dir="docs/asdocs" />
</copy>
</target>
<!--
//
//
// AIR PACKAGE
//
//
-->
<target name="airpackage">
<iterate target="deploy" directory="package" />
</target>
<target name="clean_airpackage">
<iterate target="clean" directory="package" />
</target>
<!--
//
//
// DEPLOYMENT
//
//
-->
<target name="deploy">
<lower name="project.namelower" value="${project.name}" />
<delete dir="${docs.external_site_source}/docs/${project.namelower}" />
<delete dir="${docs.external_site_source}/static/asdocs/${project.namelower}" />
<!-- Copy docs to site -->
<copy todir="${docs.external_site_source}" overwrite="true" failonerror="false">
<fileset dir="docs/site">
<include name="**/*" />
<exclude name="sidebars.js" />
</fileset>
</copy>
<copy tofile="${docs.external_site_source}/docs/${project.namelower}/changelog.md" overwrite="true" file="CHANGELOG.md">
<filterchain>
<tokenfilter>
<replacestring from="######" to="###" />
</tokenfilter>
</filterchain>
</copy>
</target>
<!--
//
//
// GLOBAL TARGETS
//
//
-->
<target name="all" depends="version, build_platforms, build_extensions" />
<target name="clean" depends="clean_platforms, clean_extensions, clean_airpackage" >
<delete dir="${common.basedir}/${output.dir}" />
</target>
<target name="release" depends="version, docs, deploy" />
</project>