-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustom_rules.xml
More file actions
154 lines (138 loc) · 7.84 KB
/
custom_rules.xml
File metadata and controls
154 lines (138 loc) · 7.84 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
149
150
151
152
153
154
<?xml version="1.0" encoding="UTF-8"?>
<project name="custom_rules">
<property name="apk-version" value="unversioned"/>
<property name="apk-market" value="unmarketed"/>
<property name="apk-gaid" value="UA-27755065-4"/>
<property name="apk-bdid" value="4fe8c1edb0"/>
<property name="release.apk.dir" value="/home/android/builds/release" />
<property name="debug.apk.dir" value="/home/android/builds/debug" />
<property name="out.release.file" location="${release.apk.dir}/${ant.project.name}-release-${apk-version}-${apk-market}.apk" />
<property name="out.debug.file" location="${debug.apk.dir}/${ant.project.name}-debug-${apk-version}.apk" />
<!-- ******************************************************* -->
<!-- **************** Debug specific targets *************** -->
<!-- ******************************************************* -->
<target name="-set-debug-files" depends="-set-mode-check">
<property name="out.packaged.file" location="${out.absolute.dir}/${ant.project.name}-debug-unaligned.apk" />
<property name="out.final.file" location="${out.debug.file}" />
<property name="build.is.mode.set" value="true" />
</target>
<!-- Compiles this project's .java files into .class files. -->
<target name="-compile" depends="-build-setup, -pre-build, -code-gen, -pre-compile">
<do-only-if-manifest-hasCode elseText="hasCode = false. Skipping...">
<!-- merge the project's own classpath and the tested project's classpath -->
<path id="project.javac.classpath">
<path refid="project.all.jars.path" />
<path refid="tested.project.classpath" />
<fileset dir="libs" includes="obfuscated/*.jar"/>
</path>
<javac encoding="${java.encoding}"
source="${java.source}" target="${java.target}"
debug="true" extdirs="" includeantruntime="false"
destdir="${out.classes.absolute.dir}"
bootclasspathref="project.target.class.path"
verbose="${verbose}"
classpathref="project.javac.classpath"
fork="${need.javac.fork}">
<src path="${source.absolute.dir}" />
<src path="${gen.absolute.dir}" />
<compilerarg line="${java.compilerargs}" />
</javac>
<!-- if the project is instrumented, intrument the classes -->
<if condition="${build.is.instrumented}">
<then>
<echo level="info">Instrumenting classes from ${out.absolute.dir}/classes...</echo>
<!-- build the filter to remove R, Manifest, BuildConfig -->
<getemmafilter
appPackage="${project.app.package}"
libraryPackagesRefId="project.library.packages"
filterOut="emma.default.filter"/>
<!-- define where the .em file is going. This may have been
setup already if this is a library -->
<property name="emma.coverage.absolute.file" location="${out.absolute.dir}/coverage.em" />
<!-- It only instruments class files, not any external libs -->
<emma enabled="true">
<instr verbosity="${verbosity}"
mode="overwrite"
instrpath="${out.absolute.dir}/classes"
outdir="${out.absolute.dir}/classes"
metadatafile="${emma.coverage.absolute.file}">
<filter excludes="${emma.default.filter}" />
<filter value="${emma.filter}" />
</instr>
</emma>
</then>
</if>
<!-- if the project is a library then we generate a jar file -->
<if condition="${project.is.library}">
<then>
<echo level="info">Creating library output jar file...</echo>
<property name="out.library.jar.file" location="${out.absolute.dir}/classes.jar" />
<if>
<condition>
<length string="${android.package.excludes}" trim="true" when="greater" length="0" />
</condition>
<then>
<echo level="info">Custom jar packaging exclusion: ${android.package.excludes}</echo>
</then>
</if>
<propertybyreplace name="project.app.package.path" input="${project.app.package}" replace="." with="/" />
<jar destfile="${out.library.jar.file}">
<fileset dir="${out.classes.absolute.dir}"
includes="**/*.class"
excludes="${project.app.package.path}/R.class ${project.app.package.path}/R$*.class ${project.app.package.path}/BuildConfig.class"/>
<fileset dir="${source.absolute.dir}" excludes="**/*.java ${android.package.excludes}" />
</jar>
</then>
</if>
</do-only-if-manifest-hasCode>
</target>
<!-- Converts this project's .class files into .dex files -->
<target name="-dex" depends="-compile, -post-compile, -obfuscate">
<do-only-if-manifest-hasCode elseText="hasCode = false. Skipping...">
<!-- only convert to dalvik bytecode is *not* a library -->
<do-only-if-not-library elseText="Library project: do not convert bytecode..." >
<!-- special case for instrumented builds: need to use no-locals and need
to pass in the emma jar. -->
<if condition="${build.is.instrumented}">
<then>
<dex-helper nolocals="true">
<external-libs>
<fileset file="${emma.dir}/emma_device.jar" />
</external-libs>
</dex-helper>
</then>
<else>
<dex-helper>
<external-libs>
<fileset dir="libs" includes="obfuscated/*.jar"/>
</external-libs>
</dex-helper>
</else>
</if>
</do-only-if-not-library>
</do-only-if-manifest-hasCode>
</target>
<target name="-release-sign" if="has.keystore" >
<!-- only create apk if *not* a library project -->
<do-only-if-not-library elseText="Library project: do not create apk..." >
<sequential>
<property name="out.unaligned.file" location="${out.absolute.dir}/${ant.project.name}-release-unaligned.apk" />
<!-- Signs the APK -->
<echo level="info">Signing final apk...</echo>
<signapk
input="${out.packaged.file}"
output="${out.unaligned.file}"
keystore="${key.store}"
storepass="${key.store.password}"
alias="${key.alias}"
keypass="${key.alias.password}"/>
<!-- Zip aligns the APK -->
<zipalign-helper
in.package="${out.unaligned.file}"
out.package="${out.release.file}" />
<echo level="info">Release Package: ${out.release.file}</echo>
</sequential>
</do-only-if-not-library>
<record-build-info />
</target>
</project>