-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build_common.xml
204 lines (168 loc) · 6.55 KB
/
build_common.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
<?xml version="1.0" encoding="UTF-8"?>
<project default="bootstrap" name="common" >
<dirname property="common.basedir" file="${ant.file.common}" />
<property file="${common.basedir}/../../build_config/version.config" description="grp version properties" />
<property file="${common.basedir}/build_config/version.config" description="build version properties" />
<property file="${common.basedir}/build_config/build.config" description="build properties" />
<property file="${common.basedir}/build_config/global.config" description="global properties" />
<property name="version.grp" value="${version_grp_major}.${version_grp_minor}.${version_grp_build}" />
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<target name="bootstrap">
<mkdir dir="${user.home}/.ant/lib"/>
<get dest="${user.home}/.ant/lib/ant-contrib.jar" src="https://search.maven.org/remotecontent?filepath=ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar"/>
<get dest="${user.home}/.ant/lib/rhino.jar" src="https://repo1.maven.org/maven2/org/mozilla/rhino/1.7.14-RC1/rhino-1.7.14-RC1.jar"/>
<get dest="${user.home}/.ant/lib/bsf.jar" src="http://search.maven.org/remotecontent?filepath=bsf/bsf/2.4.0/bsf-2.4.0.jar"/>
<get dest="${user.home}/.ant/lib/commons-logging-api.jar" src="http://search.maven.org/remotecontent?filepath=commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar"/>
</target>
<!-- PLATFORM INFORMATION -->
<condition property="isWindows" else="false">
<os family="windows" />
</condition>
<condition property="isMacOS" else="false">
<os family="mac" />
</condition>
<condition property="air.sdk" value="${air.sdk.windows}" else="${air.sdk.macos}">
<istrue value="${isWindows}"/>
</condition>
<property name="AIR_SDK_HOME" value="${air.sdk}" />
<condition property="android.sdk" value="${android.sdk.windows}" else="${android.sdk.macos}">
<istrue value="${isWindows}"/>
</condition>
<condition property="android.gradle" value="gradlew.bat" else="./gradlew">
<istrue value="${isWindows}"/>
</condition>
<condition property="air.adt" value="${air.sdk}/bin/adt.bat" else="${air.sdk}/bin/adt">
<istrue value="${isWindows}"/>
</condition>
<condition property="air.asdoc" value="${air.sdk}/bin/asdoc.bat" else="${air.sdk}/bin/asdoc">
<istrue value="${isWindows}"/>
</condition>
<!-- SCRIPTS -->
<scriptdef language="javascript" name="lower">
<attribute name="name" />
<attribute name="value" />
<![CDATA[
project.setProperty( attributes.get( "name" ),
attributes.get( "value" ).toLowerCase() );
]]>
</scriptdef>
<scriptdef language="javascript" name="titlecase">
<attribute name="name" />
<attribute name="value" />
<![CDATA[
var value = String(attributes.get( "value" ));
var titlecase = value.charAt(0).toUpperCase() + value.substr(1);
project.setProperty( attributes.get( "name" ), titlecase );
]]>
</scriptdef>
<scriptdef language="javascript" name="cleanchars">
<attribute name="name" />
<attribute name="value" />
<![CDATA[
project.setProperty( attributes.get( "name" ),
attributes.get( "value" ).replaceAll( "\\.", "" ) );
]]>
</scriptdef>
<scriptdef language="javascript" name="wrapxmltag">
<attribute name="name" />
<attribute name="input" />
<attribute name="tag" />
<![CDATA[
var value = "";
var input = String(attributes.get( "input" ));
var tag = String(attributes.get( "tag" ));
if (input.length > 0)
{
value = "<"+tag+">"+input+"</"+tag+">";
}
project.setProperty( attributes.get( "name" ), value );
]]>
</scriptdef>
<scriptdef language="javascript" name="outputname">
<attribute name="name" />
<attribute name="prefix" />
<attribute name="grp" />
<attribute name="projectname" />
<![CDATA[
var outputName = "";
var prefix = String(attributes.get( "prefix" ));
if (prefix.length > 0)
outputName = prefix + ".";
var grp = String(attributes.get( "grp" ).toLowerCase());
var projectname = String(attributes.get( "projectname" ));
if (grp.length > 0)
{
outputName += grp + "." + projectname;
}
else
{
outputName += projectname;
}
project.setProperty( attributes.get("name"), outputName );
]]>
</scriptdef>
<scriptdef language="javascript" name="grppackagename">
<attribute name="name" />
<attribute name="prefix" />
<attribute name="grp" />
<attribute name="projectname" />
<![CDATA[
var packageName = "";
var prefix = String(attributes.get( "prefix" ));
if (prefix.length > 0)
packageName = prefix + ".";
var grp = String(attributes.get( "grp" ).toLowerCase());
var projectname = String(attributes.get( "projectname" ).toLowerCase());
if (grp.length > 0)
{
packageName += grp + "." + projectname;
}
else
{
packageName += projectname;
}
project.setProperty( attributes.get("name"), packageName );
]]>
</scriptdef>
<scriptdef language="javascript" name="packagepath">
<attribute name="name" />
<attribute name="value" />
<![CDATA[
project.setProperty( attributes.get( "name" ),
attributes.get( "value" ).replaceAll( "\\.", "/" ) );
]]>
</scriptdef>
<scriptdef language="javascript" name="packagetores">
<attribute name="name" />
<attribute name="value" />
<![CDATA[
project.setProperty( attributes.get( "name" ),
attributes.get( "value" ).replaceAll( "\\.", "-" ) );
]]>
</scriptdef>
<outputname name="output.name" prefix="${output.basename}" grp="${project.grp}" projectname="${project.name}" />
<grppackagename name="package.name" prefix="${package.basename}" grp="${project.grp}" projectname="${project.name}" />
<packagepath name="package.path" value="${package.name}" />
<loadproperties srcFile="${common.basedir}/${android.dir}/app/build.gradle">
<filterchain>
<linecontains>
<contains value="minSdkVersion"/>
</linecontains>
<replaceregex pattern="\sminSdkVersion\s([0-9]*)" replace="minSdkVersion=\1" />
</filterchain>
</loadproperties>
<property name="minSdkVersion" value="${android.minSdkVersion}" />
<var name="android.minSdkVersion" unset="true" />
<property name="android.minSdkVersion" value="${minSdkVersion}" />
<loadproperties srcFile="${common.basedir}/${android.dir}/app/build.gradle">
<filterchain>
<linecontains>
<contains value="targetSdkVersion"/>
</linecontains>
<replaceregex pattern="\stargetSdkVersion\s([0-9]*)" replace="targetSdkVersion=\1" />
</filterchain>
</loadproperties>
<property name="targetSdkVersion" value="${android.targetSdkVersion}" />
<var name="android.targetSdkVersion" unset="true" />
<property name="android.targetSdkVersion" value="${targetSdkVersion}" />
</project>