Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3023)

Unified Diff: build/android/ant/apk-obfuscate.xml

Issue 12880007: Translate some ant to python (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ant_split
Patch Set: Rebase Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/android/dex.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/ant/apk-obfuscate.xml
diff --git a/build/android/ant/apk-compile.xml b/build/android/ant/apk-obfuscate.xml
similarity index 60%
copy from build/android/ant/apk-compile.xml
copy to build/android/ant/apk-obfuscate.xml
index 10ffd374a0df21a2dd38a043223d42567916a760..bdc8a793f1c3de4bd27474dc66a8365c94ae2378 100644
--- a/build/android/ant/apk-compile.xml
+++ b/build/android/ant/apk-obfuscate.xml
@@ -15,26 +15,19 @@
limitations under the License.
-->
-<project default="-dex">
+<project default="-obfuscate">
<property name="verbose" value="false" />
<property name="out.dir" location="${OUT_DIR}" />
<!-- Output directories -->
<property name="out.dir" value="bin" />
<property name="out.absolute.dir" location="${out.dir}" />
<property name="out.classes.absolute.dir" location="${out.dir}/classes" />
- <property name="out.dexed.absolute.dir" location="${out.dir}/dexedLibs" />
<property name="out.manifest.abs.file" location="${out.dir}/AndroidManifest.xml" />
<!-- tools location -->
<property name="sdk.dir" location="${ANDROID_SDK_ROOT}"/>
<property name="target" value="android-${ANDROID_SDK_VERSION}"/>
<property name="android.tools.dir" location="${sdk.dir}/tools" />
- <property name="android.platform.tools.dir" location="${sdk.dir}/platform-tools" />
-
- <property name="project.target.android.jar" location="${ANDROID_SDK_JAR}" />
- <path id="project.target.class.path">
- <pathelement location="${project.target.android.jar}" />
- </path>
<!-- jar file from where the tasks are loaded -->
@@ -45,96 +38,15 @@
<!-- Custom tasks -->
<taskdef resource="anttasks.properties" classpathref="android.antlibs" />
-
- <path id="javac.srcdirs.additional">
- <filelist files="${ADDITIONAL_SRC_DIRS}"/>
- <filelist files="${GENERATED_SRC_DIRS}"/>
- </path>
-
<!-- Classpath for javac -->
<path id="javac.custom.classpath">
<filelist files="${INPUT_JARS_PATHS}"/>
</path>
- <!--
- TODO(cjhopman): This is wrong for proguard builds. In that case, it should be just the
- obfuscated jar.
- -->
- <path id="out.dex.jar.input.ref">
- <path refid="javac.custom.classpath"/>
- </path>
-
- <!-- compilation options -->
- <property name="java.encoding" value="UTF-8" />
- <property name="java.target" value="1.5" />
- <property name="java.source" value="1.5" />
- <property name="java.compilerargs" value="" />
-
- <property name="source.dir" value="${SOURCE_DIR}" />
- <property name="source.absolute.dir" location="${source.dir}" />
- <property name="gen.absolute.dir" value="${out.dir}/gen"/>
-
- <property name="dx" location="${android.platform.tools.dir}/dx" />
-
- <property name="need.javac.fork" value="false" />
<condition property="project.is.testapp" value="true" else="false">
<equals arg1="${IS_TEST_APK}" arg2="1" />
</condition>
- <!--
- Override the -compile target.
- This target requires 'javac.custom.classpath' to be set to reference
- of classpath to be used for javac. Also accepts custom path for
- sources: 'javac.custom.sourcepath'.
- -->
- <!-- Compiles this project's .java files into .class files. -->
- <target name="-compile">
-
- <mkdir dir="${out.classes.absolute.dir}" />
- <mkdir dir="${out.dexed.absolute.dir}" />
- <delete>
- <fileset dir="${out.classes.absolute.dir}" includes="**/*.class"/>
- </delete>
-
- <javac
- bootclasspathref="project.target.class.path"
- classpathref="javac.custom.classpath"
- debug="true"
- destdir="${out.classes.absolute.dir}"
- encoding="${java.encoding}"
- extdirs=""
- fork="${need.javac.fork}"
- includeantruntime="false"
- source="${java.source}"
- target="${java.target}"
- verbose="${verbose}">
- <src path="${source.absolute.dir}"/>
- <src path="${gen.absolute.dir}"/>
- <src>
- <path refid="javac.srcdirs.additional"/>
- </src>
- <compilerarg value="-Xlint:unchecked"/>
- <compilerarg line="${java.compilerargs}"/>
- </javac>
-
- <if condition="${project.is.testapp}">
- <then>
- <!-- get the project manifest package -->
- <xpath input="${out.manifest.abs.file}"
- expression="/manifest/@package" output="project.app.package" />
- <property name="create.test.jar.file"
- location="${CREATE_TEST_JAR_PATH}" />
- <script language="javascript" src="${create.test.jar.file}"/>
- </then>
- </if>
-
- <!-- Package all the compiled .class files into a .jar. -->
- <jar
- jarfile="${JAR_PATH}"
- basedir="${out.classes.absolute.dir}"
- />
- </target>
-
<property name="proguard.enabled" value="${PROGUARD_ENABLED}" />
<property name="proguard.config" value="${PROGUARD_FLAGS}" />
@@ -147,15 +59,23 @@
Override obfuscate target to pass javac.custom.classpath to Proguard. SDK tools do not provide
any way to pass custom class paths to Proguard.
-->
- <target name="-obfuscate" depends="-compile">
+ <target name="-obfuscate">
+ <if condition="${project.is.testapp}">
+ <then>
+ <!-- get the project manifest package -->
+ <xpath input="${out.manifest.abs.file}"
+ expression="/manifest/@package" output="project.app.package" />
+ <property name="create.test.jar.file"
+ location="${CREATE_TEST_JAR_PATH}" />
+ <script language="javascript" src="${create.test.jar.file}"/>
+ </then>
+ </if>
<if condition="${proguard.enabled}">
<then>
- <path id="out.dex.jar.input.ref" />
<property name="obfuscate.absolute.dir" location="${out.absolute.dir}/proguard"/>
<property name="preobfuscate.jar.file" value="${obfuscate.absolute.dir}/original.jar"/>
- <property name="obfuscated.jar.file" value="${obfuscate.absolute.dir}/obfuscated.jar"/>
- <!-- input for dex will be proguard's output -->
- <property name="out.dex.input.absolute.dir" value="${obfuscated.jar.file}"/>
+ <property name="obfuscated.jar.file" value="${OBFUSCATED_JAR_PATH}"/>
+ <property name="obfuscated.jar.abs.file" location="${obfuscated.jar.file}"/>
<!-- Add Proguard Tasks -->
<property name="proguard.jar" location="${android.tools.dir}/proguard/lib/proguard.jar"/>
@@ -205,14 +125,14 @@
<mkdir dir="${obfuscate.absolute.dir}"/>
<delete file="${preobfuscate.jar.file}"/>
- <delete file="${obfuscated.jar.file}"/>
+ <delete file="${obfuscated.jar.abs.file}"/>
<jar basedir="${out.classes.absolute.dir}"
destfile="${preobfuscate.jar.file}"/>
<proguard>
-include "${proguard.configcmd}"
-include "${out.absolute.dir}/proguard.txt"
-injars ${project.all.classes.value}
- -outjars "${obfuscated.jar.file}"
+ -outjars "${obfuscated.jar.abs.file}"
-libraryjars ${project.target.classpath.value}
-dump "${obfuscate.absolute.dir}/dump.txt"
-printseeds "${obfuscate.absolute.dir}/seeds.txt"
@@ -221,27 +141,6 @@
</proguard>
</then>
</if>
- </target>
-
- <property name="dex.file.name" value="classes.dex" />
- <property name="intermediate.dex.file" location="${out.absolute.dir}/${dex.file.name}" />
-
- <!-- Converts this project's .class files into .dex files -->
- <target name="-dex" depends="-obfuscate">
- <!-- sets the primary input for dex. If a pre-dex task sets it to
- something else this has no effect -->
- <property name="out.dex.input.absolute.dir" value="${out.classes.absolute.dir}" />
- <property name="dex.force.jumbo" value="false" />
-
- <dex executable="${dx}"
- output="${intermediate.dex.file}"
- dexedlibs="${out.dexed.absolute.dir}"
- nolocals="false"
- forceJumbo="${dex.force.jumbo}"
- verbose="${verbose}">
- <path path="${out.dex.input.absolute.dir}"/>
- <path refid="out.dex.jar.input.ref" />
- </dex>
- <touch file="${STAMP}" />
+ <touch file="${STAMP}" />
</target>
</project>
« no previous file with comments | « no previous file | build/android/dex.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698