summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcjhopman@chromium.org <cjhopman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-26 17:35:21 +0000
committercjhopman@chromium.org <cjhopman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-26 17:35:21 +0000
commitbd6ab3db3f2ac6f387eb1515e1db6ac9d3d9d0fe (patch)
treeaf797fbe1c9072edf7dcb3588542bb449d57a276
parent060847ecad23482812eee34ea38b86a2e0d4500a (diff)
downloadchromium_src-bd6ab3db3f2ac6f387eb1515e1db6ac9d3d9d0fe.zip
chromium_src-bd6ab3db3f2ac6f387eb1515e1db6ac9d3d9d0fe.tar.gz
chromium_src-bd6ab3db3f2ac6f387eb1515e1db6ac9d3d9d0fe.tar.bz2
Split apk-build.xml into 3 steps
In preparation for rewriting these actions in python, split apk-build.xml into smaller ant scripts. This should not change the functionality and mostly is just splitting the file and identifying the properties and defines required for each of the new files. Some of the configuration is moved out of ant and into gyp (i.e. the android_manifest_path is now gyp-configurable). Also, the ant scripts now use the correct basedir! That is, these ant scripts actually understand relative paths. To go along with this, resource_dir is the relative path to the resource directory (rather than a path relative to java_in_dir). BUG=158821 TBR=torne@chromium.org, brettw@chromium.org NOTRY=true Review URL: https://chromiumcodereview.appspot.com/12963009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190712 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--android_webview/android_webview_tests.gypi4
-rw-r--r--build/android/ant/apk-build.xml605
-rw-r--r--build/android/ant/apk-codegen.xml112
-rw-r--r--build/android/ant/apk-compile.xml247
-rw-r--r--build/android/ant/apk-package.xml201
-rw-r--r--build/android/ant/chromium-apk.xml28
-rw-r--r--build/android/ant/create-test-jar.js3
-rw-r--r--build/android/empty_proguard.flags1
-rw-r--r--build/java_apk.gypi184
-rw-r--r--chrome/chrome_android.gypi2
-rw-r--r--chrome/chrome_tests.gypi4
-rw-r--r--content/content_shell.gypi2
-rw-r--r--content/content_tests.gypi8
13 files changed, 701 insertions, 700 deletions
diff --git a/android_webview/android_webview_tests.gypi b/android_webview/android_webview_tests.gypi
index 1a9be7f..09ebb89 100644
--- a/android_webview/android_webview_tests.gypi
+++ b/android_webview/android_webview_tests.gypi
@@ -13,9 +13,9 @@
],
'variables': {
'apk_name': 'AndroidWebView',
- 'java_in_dir': '../android_webview/test/shell',
+ 'java_in_dir': 'test/shell',
'native_libs_paths': ['<(SHARED_LIB_DIR)/libwebviewchromium.so'],
- 'resource_dir': 'res',
+ 'resource_dir': 'test/shell/res',
'additional_input_paths': [
'<(PRODUCT_DIR)/android_webview_apk/assets/webviewchromium.pak',
'<(PRODUCT_DIR)/android_webview_apk/assets/asset_file.html',
diff --git a/build/android/ant/apk-build.xml b/build/android/ant/apk-build.xml
deleted file mode 100644
index d123279..0000000
--- a/build/android/ant/apk-build.xml
+++ /dev/null
@@ -1,605 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (C) 2005-2008 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<project name="android_rules" default="debug">
-
- <property-location name="out.dir" location="${OUT_DIR}" check-exists="false" />
-
- <path id="javac.srcdirs.additional">
- <filelist files="${ADDITIONAL_SRC_DIRS}"/>
- <filelist files="${GENERATED_SRC_DIRS}"/>
- </path>
-
- <!--
- Include additional resource folders in the apk, e.g. content/.../res. We
- list the res folders in project.library.res.folder.path and the
- corresponding java packages in project.library.packages, which must be
- semicolon-delimited while ADDITIONAL_RES_PACKAGES is space-delimited, hence
- the javascript task.
- -->
- <path id="project.library.res.folder.path">
- <filelist files="${ADDITIONAL_RES_DIRS}"/>
- </path>
- <path id="project.library.bin.r.file.path">
- <filelist files="${ADDITIONAL_R_TEXT_FILES}"/>
- </path>
- <path id="project.library.manifest.file.path">
- <filelist files="${LIBRARY_MANIFEST_PATHS}"/>
- </path>
- <script language="javascript">
- var before = project.getProperty("ADDITIONAL_RES_PACKAGES");
- project.setProperty("project.library.packages", before.replaceAll(" ", ";"));
- </script>
-
- <property-value name="target.abi" value="${APP_ABI}"/>
-
- <!--
- We use the PROGUARD_ENABLED flag for enabling proguard. By default proguard is enabled for
- Release builds if proguard.config is set. Setting proguard.config even to an empty string will
- enable proguard. Set this property only when we have explicitly enabled proguard.
- -->
- <condition property="proguard.config" value="${PROGUARD_FLAGS}">
- <istrue value="${PROGUARD_ENABLED}"/>
- </condition>
-
- <!-- Set the output directory for the final apk to the ${apks.dir}. -->
- <property-location name="out.final.file"
- location="${apks.dir}/${ant.project.name}.apk"
- check-exists="false"/>
-
- <!-- 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>
-
- <path id="native.libs.gdbserver">
- <fileset file="${android.gdbserver}"/>
- </path>
-
- <!-- Disables automatic signing. -->
- <property name="build.is.signing.debug" value="false"/>
-
- <!-- SDK tools assume that out.packaged.file is signed and name it "...-unaligned" -->
- <property name="out.packaged.file"
- value="${apks.dir}/${ant.project.name}-unsigned.apk" />
- <property name="out.unaligned.file"
- value="${apks.dir}/${ant.project.name}-unaligned.apk" />
-
- <!-- fileset exclude patterns (space separated) to prevent
- files inside src/ from being packaged. -->
- <property name="android.package.excludes" value="" />
-
- <!-- set some properties used for filtering/override. If those weren't defined
- before, then this will create them with empty values, which are then ignored
- by the custom tasks receiving them. -->
- <property-value name="version.code" value="${APP_MANIFEST_VERSION_CODE}"/>
- <property-value name="version.name" value="${APP_MANIFEST_VERSION_NAME}"/>
-
- <property name="aapt.resource.filter" value="" />
- <!-- 'aapt.ignore.assets' is the list of file patterns to ignore under /res and /assets.
- Default is "!.svn:!.git:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~"
-
- Overall patterns syntax is:
- [!][<dir>|<file>][*suffix-match|prefix-match*|full-match]:more:patterns...
-
- - The first character flag ! avoids printing a warning.
- - Pattern can have the flag "<dir>" to match only directories
- or "<file>" to match only files. Default is to match both.
- - Match is not case-sensitive.
- -->
- <property name="aapt.ignore.assets" value="" />
-
- <!-- 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="" />
-
- <!-- manifest merger default value if it's not set.-->
- <condition property="manifestmerger.enabled"
- value="false"
- else="true">
- <equals arg1="${LIBRARY_MANIFEST_PATHS}" arg2=""/>
- </condition>
-
- <!-- Verbosity -->
- <property name="verbose" value="false" />
-
- <!-- ******************************************************* -->
- <!-- ********************* Custom Tasks ******************** -->
- <!-- ******************************************************* -->
-
- <!-- jar file from where the tasks are loaded -->
- <path id="android.antlibs">
- <pathelement path="${sdk.dir}/tools/lib/anttasks.jar" />
- </path>
-
- <!-- Custom tasks -->
- <taskdef resource="anttasks.properties" classpathref="android.antlibs" />
-
- <!-- ******************************************************* -->
- <!-- ******************* Other Properties ****************** -->
- <!-- ******************************************************* -->
- <!-- overriding these properties may break the build
- unless the whole file is updated -->
-
- <target name="-set-release-mode">
- <!-- record the current build target -->
- <property name="build.target" value="release" />
-
- <!-- release mode is only valid if the manifest does not explicitly
- set debuggable to true. default is false. -->
- <xpath input="${manifest.abs.file}" expression="/manifest/application/@android:debuggable"
- output="build.is.packaging.debug" default="false"/>
-
- <if condition="${build.is.packaging.debug}">
- <then>
- <echo>*************************************************</echo>
- <echo>**** Android Manifest has debuggable=true ****</echo>
- <echo>**** Doing DEBUG packaging with RELEASE keys ****</echo>
- <echo>*************************************************</echo>
- </then>
- <else>
- <!-- property only set in release mode.
- Useful for if/unless attributes in target node
- when using Ant before 1.8 -->
- <property name="build.is.mode.release" value="true"/>
- </else>
- </if>
-
- <echo level="info">proguard.config is ${proguard.config}</echo>
- <condition property="proguard.enabled" value="true" else="false">
- <and>
- <isset property="build.is.mode.release" />
- <isset property="proguard.config" />
- </and>
- </condition>
- <if condition="${proguard.enabled}">
- <then>
- <echo level="info">Proguard.config is enabled</echo>
- <!-- Secondary dx input (jar files) is empty since all the
- jar files will be in the obfuscated jar -->
- <path id="out.dex.jar.input.ref" />
- </then>
- </if>
- </target>
-
- <target name="-set-debug-mode">
- <!-- record the current build target -->
- <property name="build.target" value="debug" />
-
- <!-- whether the build is a debug build. always set. -->
- <property name="build.is.packaging.debug" value="true" />
-
- <!-- proguard is never enabled in debug mode -->
- <property name="proguard.enabled" value="false"/>
- </target>
-
-
- <!-- Input directories -->
- <property name="source.dir" value="src" />
- <property name="source.absolute.dir" location="${source.dir}" />
- <property-value name="gen.absolute.dir" value="${out.dir}/gen"/>
- <property name="resource.absolute.dir" value="${RESOURCE_DIR}"/>
- <property name="asset.dir" value="assets" />
- <condition property="asset.absolute.dir"
- value="${out.dir}/assets"
- else="${ASSET_DIR}">
- <equals arg1="${ASSET_DIR}" arg2=""/>
- </condition>
-
- <property-location name="native.libs.absolute.dir" location="${out.dir}/libs"
- check-exists="false"/>
-
- <property name="manifest.file" value="AndroidManifest.xml" />
- <property name="manifest.abs.file" location="${manifest.file}" />
-
- <!-- 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.res.absolute.dir" location="${out.dir}/res" />
- <property name="out.aidl.absolute.dir" location="${out.dir}/aidl" />
- <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="android.tools.dir" location="${sdk.dir}/tools" />
- <property name="android.platform.tools.dir" location="${sdk.dir}/platform-tools" />
- <property name="exe" value="" />
- <property name="bat" value="" />
- <property name="zipalign" location="${android.tools.dir}/zipalign${exe}" />
- <property name="aidl" location="${android.platform.tools.dir}/aidl${exe}" />
- <property name="aapt" location="${android.platform.tools.dir}/aapt${exe}" />
- <property name="dx" location="${android.platform.tools.dir}/dx${bat}" />
-
- <!-- Intermediate files -->
- <property name="dex.file.name" value="classes.dex" />
- <property name="intermediate.dex.file" location="${out.absolute.dir}/${dex.file.name}" />
- <property name="resource.package.file.name" value="${ant.project.name}.ap_" />
-
- <!-- Build property file -->
- <property name="out.build.prop.file" location="${out.absolute.dir}/build.prop" />
-
- <!--
- For debug builds, the Android SDK tools create a key in ~/.android and sign the build with it.
- This has caused all kinds of issues. Instead, the debug build should be signed with a key in
- build/android/ant. The SDK tools do not provide any support for overriding that behavior and so
- instead one must use the hack below.
- -->
- <property name="key.store" value="${CHROMIUM_SRC}/build/android/ant/chromium-debug.keystore"/>
- <property name="key.store.password" value="chromium"/>
- <property name="key.alias" value="chromiumdebugkey"/>
- <property name="key.alias.password" value="chromium"/>
-
- <!-- properties for packaging -->
- <property name="build.packaging.nocrunch" value="true" />
-
- <property name="need.javac.fork" value="false" />
-
- <!-- ******************************************************* -->
- <!-- ******************** Build Targets ******************** -->
- <!-- ******************************************************* -->
-
- <!-- generic setup -->
- <target name="-setup">
- <checkenv />
- <echo level="info">Project Name: ${ant.project.name}</echo>
- <gettype projectTypeOut="project.type" />
-
- <!-- sets a few boolean based on project.type
- to make the if task easier -->
- <condition property="project.is.testapp" value="true" else="false">
- <equals arg1="${project.type}" arg2="test-app" />
- </condition>
-
- <!-- get the project manifest package -->
- <xpath input="${manifest.abs.file}"
- expression="/manifest/@package" output="project.app.package" />
-
- <!-- read the previous build mode -->
- <property file="${out.build.prop.file}" />
-
- <echo level="info">Resolving Build Target for ${ant.project.name}...</echo>
- <!-- load project properties, resolve Android target, library dependencies
- and set some properties with the results.
- All property names are passed as parameters ending in -Out -->
- <gettarget
- androidJarFileOut="project.target.android.jar"
- androidAidlFileOut="project.target.framework.aidl"
- bootClassPathOut="project.target.class.path"
- targetApiOut="project.target.apilevel"
- minSdkVersionOut="project.minSdkVersion" />
-
- <property name="manifest.hasCode" value="true" />
-
- <echo level="info">----------</echo>
- <echo level="info">Creating output directories if needed...</echo>
- <mkdir dir="${out.absolute.dir}" />
- <mkdir dir="${out.res.absolute.dir}" />
- <mkdir dir="${gen.absolute.dir}" />
- <mkdir dir="${out.classes.absolute.dir}" />
- <mkdir dir="${out.dexed.absolute.dir}" />
- </target>
-
- <!-- Code Generation: compile resources (aapt -> R.java), aidl -->
- <target name="-code-gen" depends="-setup">
- <!-- always merge manifest -->
- <mergemanifest
- appManifest="${manifest.abs.file}"
- outManifest="${out.manifest.abs.file}"
- enabled="${manifestmerger.enabled}">
- <library refid="project.library.manifest.file.path" />
- </mergemanifest>
-
- <echo level="info">----------</echo>
- <echo level="info">Handling Resources...</echo>
- <aapt executable="${aapt}"
- command="package"
- verbose="${verbose}"
- manifest="${out.manifest.abs.file}"
- androidjar="${project.target.android.jar}"
- rfolder="${gen.absolute.dir}"
- nonConstantId="${android.library}"
- libraryResFolderPathRefid="project.library.res.folder.path"
- libraryPackagesRefid="project.library.packages"
- libraryRFileRefid="project.library.bin.r.file.path"
- ignoreAssets="${aapt.ignore.assets}"
- binFolder="${out.absolute.dir}"
- proguardFile="${out.absolute.dir}/proguard.txt">
- <res path="${out.res.absolute.dir}" />
- <res path="${resource.absolute.dir}" />
- </aapt>
-
- </target>
-
- <!--
- 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" depends="-code-gen">
- <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 the project needs a test jar then generate a jar containing
- all compiled classes and referenced jars.
- project.is.testapp is set by Android's ant build system based on the
- target's manifest. It is true only for instrumentation apks.
- -->
- <if condition="${project.is.testapp}">
- <then>
- <property-location name="create.test.jar.file"
- location="${CHROMIUM_SRC}/build/android/ant/create-test-jar.js"/>
- <script language="javascript" src="${create.test.jar.file}"/>
- </then>
- </if>
- <!--
- Copy gdbserver to main libs directory if building a non-instrumentation debug apk.
- -->
- <if>
- <condition>
- <and>
- <equals arg1="${build.target}" arg2="debug"/>
- <isfalse value="${project.is.testapp}"/>
- </and>
- </condition>
- <then>
- <copy todir="${out.dir}/libs/${target.abi}">
- <path refid="native.libs.gdbserver"/>
- </copy>
- </then>
- </if>
-
- <!-- Package all the compiled .class files into a .jar. -->
- <jar
- jarfile="${lib.java.dir}/${JAR_NAME}"
- basedir="${out.classes.absolute.dir}"
- />
- </target>
-
-
- <!-- Obfuscate target
- This is only active in release builds when proguard.config is defined
- in default.properties.
-
- -->
- <!--
- 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">
- <if condition="${proguard.enabled}">
- <then>
- <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}"/>
-
- <!-- Add Proguard Tasks -->
- <property name="proguard.jar" location="${android.tools.dir}/proguard/lib/proguard.jar"/>
- <taskdef name="proguard" classname="proguard.ant.ProGuardTask" classpath="${proguard.jar}"/>
-
- <!-- Set the android classpath Path object into a single property. It'll be
- all the jar files separated by a platform path-separator.
- Each path must be quoted if it contains spaces.
- -->
- <pathconvert property="project.target.classpath.value" refid="project.target.class.path">
- <firstmatchmapper>
- <regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/>
- <identitymapper/>
- </firstmatchmapper>
- </pathconvert>
-
- <!-- Build a path object with all the jar files that must be obfuscated.
- This include the project compiled source code and any 3rd party jar
- files. -->
- <path id="project.all.classes.path">
- <pathelement location="${preobfuscate.jar.file}"/>
- <!-- Pass javac.custom.classpath for apks. -->
- <path refid="javac.custom.classpath"/>
- </path>
- <!-- Set the project jar files Path object into a single property. It'll be
- all the jar files separated by a platform path-separator.
- Each path must be quoted if it contains spaces.
- -->
- <pathconvert property="project.all.classes.value" refid="project.all.classes.path">
- <firstmatchmapper>
- <regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/>
- <identitymapper/>
- </firstmatchmapper>
- </pathconvert>
-
- <!-- Turn the path property ${proguard.config} from an A:B:C property
- into a series of includes: -include A -include B -include C
- suitable for processing by the ProGuard task. Note - this does
- not include the leading '-include "' or the closing '"'; those
- are added under the <proguard> call below.
- -->
- <path id="proguard.configpath">
- <pathelement path="${proguard.config}"/>
- </path>
- <pathconvert pathsep='" -include "' property="proguard.configcmd"
- refid="proguard.configpath"/>
-
- <mkdir dir="${obfuscate.absolute.dir}"/>
- <delete file="${preobfuscate.jar.file}"/>
- <delete file="${obfuscated.jar.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}"
- -libraryjars ${project.target.classpath.value}
- -dump "${obfuscate.absolute.dir}/dump.txt"
- -printseeds "${obfuscate.absolute.dir}/seeds.txt"
- -printusage "${obfuscate.absolute.dir}/usage.txt"
- -printmapping "${obfuscate.absolute.dir}/mapping.txt"
- </proguard>
- </then>
- </if>
- </target>
-
- <!-- Converts this project's .class files into .dex files -->
- <target name="-dex" depends="-obfuscate">
- <sequential>
- <!-- 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>
- </sequential>
- </target>
-
- <!-- Puts the project's resources into the output package file
- This actually can create multiple resource package in case
- Some custom apk with specific configuration have been
- declared in default.properties.
- -->
- <target name="-package-resources" depends="-setup">
- <!-- Updates the pre-processed PNG cache -->
- <exec executable="${aapt}" taskName="crunch">
- <arg value="crunch" />
- <arg value="-v" />
- <arg value="-S" />
- <arg path="${resource.absolute.dir}" />
- <arg value="-C" />
- <arg path="${out.res.absolute.dir}" />
- </exec>
- <aapt executable="${aapt}"
- command="package"
- versioncode="${version.code}"
- versionname="${version.name}"
- debug="${build.is.packaging.debug}"
- manifest="${out.manifest.abs.file}"
- assets="${asset.absolute.dir}"
- androidjar="${project.target.android.jar}"
- apkfolder="${out.absolute.dir}"
- nocrunch="${build.packaging.nocrunch}"
- resourcefilename="${resource.package.file.name}"
- resourcefilter="${aapt.resource.filter}"
- libraryResFolderPathRefid="project.library.res.folder.path"
- libraryPackagesRefid="project.library.packages"
- libraryRFileRefid="project.library.bin.r.file.path"
- previousBuildType=""
- buildType="${build.target}"
- ignoreAssets="${aapt.ignore.assets}">
- <res path="${out.res.absolute.dir}" />
- <res path="${resource.absolute.dir}" />
- <!-- <nocompress /> forces no compression on any files in assets or res/raw -->
- <!-- <nocompress extension="xml" /> forces no compression on specific file extensions in assets and res/raw -->
- </aapt>
- </target>
-
- <!-- Packages the application. -->
- <target name="-package" depends="-dex, -package-resources">
- <apkbuilder
- outfolder="${out.absolute.dir}"
- resourcefile="${resource.package.file.name}"
- apkfilepath="${out.packaged.file}"
- debugpackaging="${build.is.packaging.debug}"
- debugsigning="${build.is.signing.debug}"
- verbose="${verbose}"
- hascode="${manifest.hasCode}"
- previousBuildType="/"
- buildType="${build.is.packaging.debug}/${build.is.signing.debug}">
- <dex path="${intermediate.dex.file}"/>
- <sourcefolder path="${source.absolute.dir}"/>
- <nativefolder path="${native.libs.absolute.dir}" />
- </apkbuilder>
- </target>
-
- <!-- Signs and zipaligns the apk. -->
- <target name="-do-sign" depends="-package">
- <sequential>
- <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}"/>
-
- <zipalign
- executable="${zipalign}"
- input="${out.unaligned.file}"
- output="${out.final.file}"
- verbose="${verbose}" />
- <echo level="info">Release Package: ${out.final.file}</echo>
- </sequential>
- </target>
-
- <!-- Builds debug output package -->
- <target name="debug"
- depends="-set-debug-mode, -do-sign"
- description="Builds the application and signs it with a debug key.">
- </target>
-
- <!-- This runs -package-release first and then runs
- only if release-sign is true (set in -release-check,
- called by -release-no-sign)-->
- <target name="release"
- depends="-set-release-mode, -do-sign"
- description="Builds the application in release mode.">
- </target>
-
-</project>
diff --git a/build/android/ant/apk-codegen.xml b/build/android/ant/apk-codegen.xml
new file mode 100644
index 0000000..64ade7a
--- /dev/null
+++ b/build/android/ant/apk-codegen.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2005-2008 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<project default="-code-gen">
+ <property name="verbose" value="false" />
+
+ <property name="out.dir" location="${OUT_DIR}" />
+ <property name="out.absolute.dir" location="${out.dir}" />
+ <property name="out.res.absolute.dir" location="${out.dir}/res" />
+ <property name="out.manifest.abs.file" location="${out.dir}/AndroidManifest.xml" />
+ <property name="gen.absolute.dir" value="${out.dir}/gen"/>
+
+ <!-- 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="aapt" location="${android.platform.tools.dir}/aapt" />
+ <property name="project.target.android.jar" location="${ANDROID_SDK_JAR}" />
+
+ <!-- jar file from where the tasks are loaded -->
+ <path id="android.antlibs">
+ <pathelement path="${sdk.dir}/tools/lib/anttasks.jar" />
+ </path>
+
+ <!-- Custom tasks -->
+ <taskdef resource="anttasks.properties" classpathref="android.antlibs" />
+
+ <!--
+ Include additional resource folders in the apk, e.g. content/.../res. We
+ list the res folders in project.library.res.folder.path and the
+ corresponding java packages in project.library.packages, which must be
+ semicolon-delimited while ADDITIONAL_RES_PACKAGES is space-delimited, hence
+ the javascript task.
+ -->
+ <path id="project.library.res.folder.path">
+ <filelist files="${ADDITIONAL_RES_DIRS}"/>
+ </path>
+ <path id="project.library.bin.r.file.path">
+ <filelist files="${ADDITIONAL_R_TEXT_FILES}"/>
+ </path>
+ <script language="javascript">
+ var before = project.getProperty("ADDITIONAL_RES_PACKAGES");
+ project.setProperty("project.library.packages", before.replaceAll(" ", ";"));
+ </script>
+
+ <path id="project.library.manifest.file.path">
+ <filelist files="${LIBRARY_MANIFEST_PATHS}"/>
+ </path>
+
+ <!-- manifest merger default value -->
+ <property name="manifestmerger.enabled" value="false" />
+
+ <property name="resource.absolute.dir" value="${RESOURCE_DIR}"/>
+
+ <property name="manifest.file" value="${ANDROID_MANIFEST}" />
+ <property name="manifest.abs.file" location="${manifest.file}" />
+
+ <!-- Intermediate files -->
+ <property name="resource.package.file.name" value="${APK_NAME}.ap_" />
+
+ <property name="aapt.ignore.assets" value="" />
+
+ <target name="-mergemanifest">
+ <mergemanifest
+ appManifest="${manifest.abs.file}"
+ outManifest="${out.manifest.abs.file}"
+ enabled="${manifestmerger.enabled}">
+ <library refid="project.library.manifest.file.path" />
+ </mergemanifest>
+ </target>
+
+ <!-- Code Generation: compile resources (aapt -> R.java), aidl -->
+ <target name="-code-gen" depends="-mergemanifest">
+ <mkdir dir="${out.absolute.dir}" />
+ <mkdir dir="${out.res.absolute.dir}" />
+ <mkdir dir="${gen.absolute.dir}" />
+
+ <aapt executable="${aapt}"
+ command="package"
+ verbose="${verbose}"
+ manifest="${out.manifest.abs.file}"
+ androidjar="${project.target.android.jar}"
+ rfolder="${gen.absolute.dir}"
+ nonConstantId="false"
+ libraryResFolderPathRefid="project.library.res.folder.path"
+ libraryPackagesRefid="project.library.packages"
+ libraryRFileRefid="project.library.bin.r.file.path"
+ ignoreAssets="${aapt.ignore.assets}"
+ binFolder="${out.absolute.dir}"
+ proguardFile="${out.absolute.dir}/proguard.txt">
+ <res path="${out.res.absolute.dir}" />
+ <res path="${resource.absolute.dir}" />
+ </aapt>
+
+ <touch file="${STAMP}" />
+ </target>
+</project>
diff --git a/build/android/ant/apk-compile.xml b/build/android/ant/apk-compile.xml
new file mode 100644
index 0000000..10ffd37
--- /dev/null
+++ b/build/android/ant/apk-compile.xml
@@ -0,0 +1,247 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2005-2008 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<project default="-dex">
+ <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 -->
+ <path id="android.antlibs">
+ <pathelement path="${sdk.dir}/tools/lib/anttasks.jar" />
+ </path>
+
+ <!-- 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}" />
+
+ <!-- Obfuscate target
+ This is only active in release builds when proguard.config is defined
+ in default.properties.
+
+ -->
+ <!--
+ 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">
+ <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}"/>
+
+ <!-- Add Proguard Tasks -->
+ <property name="proguard.jar" location="${android.tools.dir}/proguard/lib/proguard.jar"/>
+ <taskdef name="proguard" classname="proguard.ant.ProGuardTask" classpath="${proguard.jar}"/>
+
+ <!-- Set the android classpath Path object into a single property. It'll be
+ all the jar files separated by a platform path-separator.
+ Each path must be quoted if it contains spaces.
+ -->
+ <pathconvert property="project.target.classpath.value" refid="project.target.class.path">
+ <firstmatchmapper>
+ <regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/>
+ <identitymapper/>
+ </firstmatchmapper>
+ </pathconvert>
+
+ <!-- Build a path object with all the jar files that must be obfuscated.
+ This include the project compiled source code and any 3rd party jar
+ files. -->
+ <path id="project.all.classes.path">
+ <pathelement location="${preobfuscate.jar.file}"/>
+ <!-- Pass javac.custom.classpath for apks. -->
+ <path refid="javac.custom.classpath"/>
+ </path>
+ <!-- Set the project jar files Path object into a single property. It'll be
+ all the jar files separated by a platform path-separator.
+ Each path must be quoted if it contains spaces.
+ -->
+ <pathconvert property="project.all.classes.value" refid="project.all.classes.path">
+ <firstmatchmapper>
+ <regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/>
+ <identitymapper/>
+ </firstmatchmapper>
+ </pathconvert>
+
+ <!-- Turn the path property ${proguard.config} from an A:B:C property
+ into a series of includes: -include A -include B -include C
+ suitable for processing by the ProGuard task. Note - this does
+ not include the leading '-include "' or the closing '"'; those
+ are added under the <proguard> call below.
+ -->
+ <path id="proguard.configpath">
+ <pathelement path="${proguard.config}"/>
+ </path>
+ <pathconvert pathsep='" -include "' property="proguard.configcmd"
+ refid="proguard.configpath"/>
+
+ <mkdir dir="${obfuscate.absolute.dir}"/>
+ <delete file="${preobfuscate.jar.file}"/>
+ <delete file="${obfuscated.jar.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}"
+ -libraryjars ${project.target.classpath.value}
+ -dump "${obfuscate.absolute.dir}/dump.txt"
+ -printseeds "${obfuscate.absolute.dir}/seeds.txt"
+ -printusage "${obfuscate.absolute.dir}/usage.txt"
+ -printmapping "${obfuscate.absolute.dir}/mapping.txt"
+ </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}" />
+ </target>
+</project>
diff --git a/build/android/ant/apk-package.xml b/build/android/ant/apk-package.xml
new file mode 100644
index 0000000..ca51878
--- /dev/null
+++ b/build/android/ant/apk-package.xml
@@ -0,0 +1,201 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2005-2008 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<project default="-do-sign">
+ <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.res.absolute.dir" location="${out.dir}/res" />
+ <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="project.target.android.jar" location="${ANDROID_SDK_JAR}" />
+ <property name="android.tools.dir" location="${sdk.dir}/tools" />
+ <property name="android.platform.tools.dir" location="${sdk.dir}/platform-tools" />
+
+ <!-- jar file from where the tasks are loaded -->
+ <path id="android.antlibs">
+ <pathelement path="${sdk.dir}/tools/lib/anttasks.jar" />
+ </path>
+
+ <!-- Custom tasks -->
+ <taskdef resource="anttasks.properties" classpathref="android.antlibs" />
+
+ <condition property="build.target" value="release" else="debug">
+ <equals arg1="${CONFIGURATION_NAME}" arg2="Release" />
+ </condition>
+ <condition property="build.is.packaging.debug" value="true" else="false">
+ <equals arg1="build.target" arg2="debug" />
+ </condition>
+
+
+ <!-- Set the output directory for the final apk to the ${apks.dir}. -->
+ <property name="out.final.file" location="${APKS_DIR}/${APK_NAME}.apk" />
+
+ <!-- Disables automatic signing. -->
+ <property name="build.is.signing.debug" value="false"/>
+
+ <!-- SDK tools assume that out.packaged.file is signed and name it "...-unaligned" -->
+ <property name="out.packaged.file" value="${out.dir}/${APK_NAME}-unsigned.apk" />
+ <property name="out.unaligned.file" value="${out.dir}/${APK_NAME}-unaligned.apk" />
+
+ <property name="resource.dir" value="${RESOURCE_DIR}"/>
+ <property name="resource.absolute.dir" location="${resource.dir}"/>
+
+ <property name="asset.dir" value="${ASSET_DIR}" />
+ <property name="asset.absolute.dir" location="${asset.dir}" />
+
+ <property name="native.libs.absolute.dir" location="${out.dir}/libs" />
+
+ <property name="aapt" location="${android.platform.tools.dir}/aapt" />
+
+ <target name="-crunch">
+ <!-- Updates the pre-processed PNG cache -->
+ <exec executable="${aapt}" taskName="crunch">
+ <arg value="crunch" />
+ <arg value="-v" />
+ <arg value="-S" />
+ <arg path="${resource.absolute.dir}" />
+ <arg value="-C" />
+ <arg path="${out.res.absolute.dir}" />
+ </exec>
+ </target>
+
+ <property name="version.code" value="${APP_MANIFEST_VERSION_CODE}"/>
+ <property name="version.name" value="${APP_MANIFEST_VERSION_NAME}"/>
+
+ <property name="aapt.resource.filter" value="" />
+ <!-- 'aapt.ignore.assets' is the list of file patterns to ignore under /res and /assets.
+ Default is "!.svn:!.git:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~"
+
+ Overall patterns syntax is:
+ [!][<dir>|<file>][*suffix-match|prefix-match*|full-match]:more:patterns...
+
+ - The first character flag ! avoids printing a warning.
+ - Pattern can have the flag "<dir>" to match only directories
+ or "<file>" to match only files. Default is to match both.
+ - Match is not case-sensitive.
+ -->
+ <property name="aapt.ignore.assets" value="" />
+
+ <!--
+ Include additional resource folders in the apk, e.g. content/.../res. We
+ list the res folders in project.library.res.folder.path and the
+ corresponding java packages in project.library.packages, which must be
+ semicolon-delimited while ADDITIONAL_RES_PACKAGES is space-delimited, hence
+ the javascript task.
+ -->
+ <path id="project.library.res.folder.path">
+ <filelist files="${ADDITIONAL_RES_DIRS}"/>
+ </path>
+ <path id="project.library.bin.r.file.path">
+ <filelist files="${ADDITIONAL_R_TEXT_FILES}"/>
+ </path>
+ <script language="javascript">
+ var before = project.getProperty("ADDITIONAL_RES_PACKAGES");
+ project.setProperty("project.library.packages", before.replaceAll(" ", ";"));
+ </script>
+
+ <property name="build.packaging.nocrunch" value="true" />
+
+ <!-- Intermediate files -->
+ <property name="resource.package.file.name" value="${APK_NAME}.ap_" />
+
+ <target name="-package-resources" depends="-crunch">
+ <aapt
+ executable="${aapt}"
+ command="package"
+ versioncode="${version.code}"
+ versionname="${version.name}"
+ debug="${build.is.packaging.debug}"
+ manifest="${out.manifest.abs.file}"
+ assets="${asset.absolute.dir}"
+ androidjar="${project.target.android.jar}"
+ apkfolder="${out.absolute.dir}"
+ nocrunch="${build.packaging.nocrunch}"
+ resourcefilename="${resource.package.file.name}"
+ resourcefilter="${aapt.resource.filter}"
+ libraryResFolderPathRefid="project.library.res.folder.path"
+ libraryPackagesRefid="project.library.packages"
+ libraryRFileRefid="project.library.bin.r.file.path"
+ previousBuildType=""
+ buildType="${build.target}"
+ ignoreAssets="${aapt.ignore.assets}">
+ <res path="${out.res.absolute.dir}" />
+ <res path="${resource.absolute.dir}" />
+ <!-- <nocompress /> forces no compression on any files in assets or res/raw -->
+ <!-- <nocompress extension="xml" /> forces no compression on specific file extensions in assets and res/raw -->
+ </aapt>
+ </target>
+
+ <property name="dex.file.name" value="classes.dex" />
+ <property name="intermediate.dex.file" location="${out.absolute.dir}/${dex.file.name}" />
+ <property name="source.dir" value="${SOURCE_DIR}" />
+ <property name="source.absolute.dir" location="${source.dir}" />
+
+
+ <!-- Packages the application. -->
+ <target name="-package" depends="-package-resources">
+ <apkbuilder
+ outfolder="${out.absolute.dir}"
+ resourcefile="${resource.package.file.name}"
+ apkfilepath="${out.packaged.file}"
+ debugpackaging="${build.is.packaging.debug}"
+ debugsigning="${build.is.signing.debug}"
+ verbose="${verbose}"
+ hascode="true"
+ previousBuildType="/"
+ buildType="${build.is.packaging.debug}/${build.is.signing.debug}">
+ <dex path="${intermediate.dex.file}"/>
+ <sourcefolder path="${source.absolute.dir}"/>
+ <nativefolder path="${native.libs.absolute.dir}" />
+ </apkbuilder>
+ </target>
+
+
+
+ <property name="key.store" value="${KEYSTORE_PATH}"/>
+ <property name="key.store.password" value="chromium"/>
+ <property name="key.alias" value="chromiumdebugkey"/>
+ <property name="key.alias.password" value="chromium"/>
+ <property name="zipalign" location="${android.tools.dir}/zipalign" />
+
+ <!-- Signs and zipaligns the apk. -->
+ <target name="-do-sign" depends="-package">
+ <sequential>
+ <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}" />
+
+ <zipalign
+ executable="${zipalign}"
+ input="${out.unaligned.file}"
+ output="${out.final.file}"
+ verbose="${verbose}" />
+ <echo level="info">Release Package: ${out.final.file}</echo>
+ </sequential>
+ </target>
+</project>
diff --git a/build/android/ant/chromium-apk.xml b/build/android/ant/chromium-apk.xml
deleted file mode 100644
index 6c86f88..0000000
--- a/build/android/ant/chromium-apk.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
- Copyright (c) 2012 The Chromium Authors. All rights reserved.
- Use of this source code is governed by a BSD-style license that can be
- found in the LICENSE file.
--->
-<project default="error">
- <property name="ant.project.name" value="${APK_NAME}"/>
- <!--
- Gyp will pass CONFIGURATION_NAME as the target for ant to build. These targets will call the
- appropriate sdk tools target.
- -->
- <target name="Debug" depends="debug"/>
- <target name="Release" depends="release"/>
- <target name="error">
- <fail message="CONFIGURATION_NAME should be passed as a target to ant."/>
- </target>
-
- <description>
- Building ${ant.project.name}.apk
- </description>
- <import file="common.xml"/>
-
- <!-- TODO(cjhopman): Remove this property when all gyp files define the CHROMIUM_SRC property. -->
- <property name="CHROMIUM_SRC" value="${PRODUCT_DIR}/../.." />
-
- <import file="apk-build.xml"/>
-</project>
-
diff --git a/build/android/ant/create-test-jar.js b/build/android/ant/create-test-jar.js
index d9014a3..855b47e 100644
--- a/build/android/ant/create-test-jar.js
+++ b/build/android/ant/create-test-jar.js
@@ -25,8 +25,7 @@ var duplicate = Zip.Duplicate();
duplicate.setValue("preserve");
jarTask.setDuplicate(duplicate);
-var destFile = project.getProperty("ant.project.name") + ".jar";
-var destPath = File(project.getProperty("test.lib.java.dir") + "/" + destFile);
+var destPath = File(project.getProperty("TEST_JAR_PATH"));
jarTask.setDestFile(destPath);
// Include all the jars in the classpath.
diff --git a/build/android/empty_proguard.flags b/build/android/empty_proguard.flags
new file mode 100644
index 0000000..53484fe
--- /dev/null
+++ b/build/android/empty_proguard.flags
@@ -0,0 +1 @@
+# Used for apk targets that do not need proguard. See build/java_apk.gypi.
diff --git a/build/java_apk.gypi b/build/java_apk.gypi
index 0aea316..0316cf94 100644
--- a/build/java_apk.gypi
+++ b/build/java_apk.gypi
@@ -12,7 +12,7 @@
# 'variables': {
# 'apk_name': 'MyPackage',
# 'java_in_dir': 'path/to/package/root',
-# 'resource_dir': 'res',
+# 'resource_dir': 'path/to/package/root/res',
# },
# 'includes': ['path/to/this/gypi/file'],
# }
@@ -29,8 +29,7 @@
# each directory in additional_res_dirs.
# additional_src_dirs - Additional directories with .java files to be compiled
# and included in the output of this target.
-# asset_location - The directory where assets are located (default:
-# <(ant_build_out)/<(_target_name)/assets).
+# asset_location - The directory where assets are located.
# generated_src_dirs - Same as additional_src_dirs except used for .java files
# that are generated at build time. This should be set automatically by a
# target's dependencies. The .java files in these directories are not
@@ -52,7 +51,6 @@
{
'variables': {
- 'asset_location%': '',
'additional_input_paths': [],
'input_jars_paths': [],
'additional_src_dirs': [],
@@ -60,17 +58,23 @@
'app_manifest_version_name%': '<(android_app_version_name)',
'app_manifest_version_code%': '<(android_app_version_code)',
'proguard_enabled%': 'false',
- 'proguard_flags%': '',
+ 'proguard_flags_path%': '<(DEPTH)/build/android/empty_proguard.flags',
'native_libs_paths': [],
'jar_name%': 'chromium_apk_<(_target_name).jar',
- 'resource_dir%':'',
+ 'resource_dir%':'<(DEPTH)/build/android/ant/empty/res',
'R_package%':'',
'additional_res_dirs': [],
'additional_res_packages': [],
'is_test_apk%': 0,
'java_strings_grd%': '',
- 'res_grit_files': [],
- 'library_manifest_paths%' : [],
+ 'library_manifest_paths' : [],
+ 'resource_input_paths': [],
+ 'intermediate_dir': '<(PRODUCT_DIR)/<(_target_name)',
+ 'asset_location%': '<(intermediate_dir)/assets',
+ 'codegen_stamp': '<(intermediate_dir)/codegen.stamp',
+ 'compile_stamp': '<(intermediate_dir)/compile.stamp',
+ 'android_manifest': '<(java_in_dir)/AndroidManifest.xml',
+ 'codegen_input_paths': [],
},
'sources': [
'<@(native_libs_paths)'
@@ -88,7 +92,7 @@
'rule_name': 'copy_and_strip_native_libraries',
'extension': 'so',
'variables': {
- 'apk_libraries_dir': '<(PRODUCT_DIR)/<(_target_name)/libs/<(android_app_abi)',
+ 'apk_libraries_dir': '<(intermediate_dir)/libs/<(android_app_abi)',
'stripped_library_path': '<(apk_libraries_dir)/<(RULE_INPUT_ROOT).so',
},
'inputs': [
@@ -107,6 +111,11 @@
},
],
'conditions': [
+ ['resource_dir!=""', {
+ 'variables': {
+ 'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ]
+ },
+ }],
['R_package != ""', {
'variables': {
# We generate R.java in package R_package (in addition to the package
@@ -122,7 +131,9 @@
'additional_res_dirs': ['<(res_grit_dir)'],
# grit_grd_file is used by grit_action.gypi, included below.
'grit_grd_file': '<(java_in_dir)/strings/<(java_strings_grd)',
- 'res_grit_files': ['<!@pymod_do_main(grit_info <@(grit_defines) --outputs "<(res_grit_dir)" <(grit_grd_file))'],
+ 'resource_input_paths': [
+ '<!@pymod_do_main(grit_info <@(grit_defines) --outputs "<(res_grit_dir)" <(grit_grd_file))'
+ ],
},
'actions': [
{
@@ -140,81 +151,144 @@
],
'actions': [
{
- 'action_name': 'ant_<(_target_name)',
- 'message': 'Building <(_target_name).',
+ 'action_name': 'ant_codegen_<(_target_name)',
+ 'message': 'Generating R.java for <(_target_name)',
+ 'conditions': [
+ ['is_test_apk == 1', {
+ 'variables': {
+ 'additional_res_dirs=': [],
+ 'additional_res_packages=': [],
+ }
+ }],
+ ],
+ 'inputs': [
+ '<(DEPTH)/build/android/ant/apk-codegen.xml',
+ '<(android_manifest)',
+ '>@(library_manifest_paths)'
+ '>@(codegen_input_paths)',
+ '>@(additional_input_paths)',
+ ],
+ 'outputs': [
+ '<(codegen_stamp)',
+ ],
+ 'action': [
+ 'ant', '-quiet',
+ '-DADDITIONAL_RES_DIRS=>(additional_res_dirs)',
+ '-DADDITIONAL_RES_PACKAGES=>(additional_res_packages)',
+ '-DADDITIONAL_R_TEXT_FILES=>(additional_R_text_files)',
+ '-DANDROID_MANIFEST=<(android_manifest)',
+ '-DANDROID_SDK_JAR=<(android_sdk_jar)',
+ '-DANDROID_SDK_ROOT=<(android_sdk_root)',
+ '-DANDROID_SDK_VERSION=<(android_sdk_version)',
+ '-DLIBRARY_MANIFEST_PATHS=>(library_manifest_paths)',
+ '-DOUT_DIR=<(intermediate_dir)',
+ '-DRESOURCE_DIR=<(resource_dir)',
+
+ '-DSTAMP=<(codegen_stamp)',
+ '-Dbasedir=.',
+ '-buildfile',
+ '<(DEPTH)/build/android/ant/apk-codegen.xml',
+
+ # Add list of inputs to the command line, so if inputs change
+ # (e.g. if a Java file is removed), the command will be re-run.
+ # TODO(newt): remove this once crbug.com/177552 is fixed in ninja.
+ '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)',
+ ],
+ },
+ {
+ 'action_name': 'ant_compile_<(_target_name)',
+ 'message': 'Compiling java for <(_target_name)',
'inputs': [
- '<(java_in_dir)/AndroidManifest.xml',
- '<(DEPTH)/build/android/ant/chromium-apk.xml',
- '<(DEPTH)/build/android/ant/common.xml',
- '<(DEPTH)/build/android/ant/apk-build.xml',
+ '<(DEPTH)/build/android/ant/apk-compile.xml',
+ '<(DEPTH)/build/android/ant/create-test-jar.js',
# If there is a separate find for additional_src_dirs, it will find the
# wrong .java files when additional_src_dirs is empty.
'>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")',
'>@(input_jars_paths)',
+ '<(codegen_stamp)',
+ '<(proguard_flags_path)',
+ ],
+ 'outputs': [
+ '<(compile_stamp)',
+ ],
+ 'action': [
+ 'ant', '-quiet',
+ '-DADDITIONAL_SRC_DIRS=>(additional_src_dirs)',
+ '-DANDROID_SDK_JAR=<(android_sdk_jar)',
+ '-DANDROID_SDK_ROOT=<(android_sdk_root)',
+ '-DANDROID_SDK_VERSION=<(android_sdk_version)',
+ '-DAPK_NAME=<(apk_name)',
+ '-DCREATE_TEST_JAR_PATH=<(DEPTH)/build/android/ant/create-test-jar.js',
+ '-DGENERATED_SRC_DIRS=>(generated_src_dirs)',
+ '-DINPUT_JARS_PATHS=>(input_jars_paths)',
+ '-DIS_TEST_APK=<(is_test_apk)',
+ '-DJAR_PATH=<(PRODUCT_DIR)/lib.java/<(jar_name)',
+ '-DOUT_DIR=<(intermediate_dir)',
+ '-DPROGUARD_ENABLED=<(proguard_enabled)',
+ '-DPROGUARD_FLAGS=<(proguard_flags_path)',
+ '-DSOURCE_DIR=<(java_in_dir)/src',
+ '-DTEST_JAR_PATH=<(PRODUCT_DIR)/test.lib.java/<(apk_name).jar',
+
+ '-DSTAMP=<(compile_stamp)',
+ '-Dbasedir=.',
+ '-buildfile',
+ '<(DEPTH)/build/android/ant/apk-compile.xml',
+
+ # Add list of inputs to the command line, so if inputs change
+ # (e.g. if a Java file is removed), the command will be re-run.
+ # TODO(newt): remove this once crbug.com/177552 is fixed in ninja.
+ '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)',
+ ],
+ },
+ {
+ 'action_name': 'ant_package_<(_target_name)',
+ 'message': 'Packaging <(_target_name).',
+ 'inputs': [
+ '<(DEPTH)/build/android/ant/apk-package.xml',
+ #TODO(cjhopman): this should be the stripped library paths.
'>@(native_libs_paths)',
- '>@(additional_input_paths)',
- '>@(library_manifest_paths)',
- '<@(res_grit_files)',
+ '<(codegen_stamp)',
+ '<(compile_stamp)',
],
'conditions': [
- ['resource_dir!=""', {
- 'inputs': ['<!@(find <(java_in_dir)/<(resource_dir) -name "*")']
- }],
['is_test_apk == 1', {
'variables': {
'additional_res_dirs=': [],
'additional_res_packages=': [],
}
}],
- ['proguard_enabled == "true" and proguard_flags != ""', {
- 'inputs': ['<(java_in_dir)/<(proguard_flags)']
- }],
],
'outputs': [
'<(PRODUCT_DIR)/apks/<(apk_name).apk',
],
'action': [
'ant', '-quiet',
- '-DAPP_ABI=<(android_app_abi)',
- '-DANDROID_GDBSERVER=<(android_gdbserver)',
- '-DANDROID_SDK=<(android_sdk)',
+ '-DADDITIONAL_RES_DIRS=>(additional_res_dirs)',
+ '-DADDITIONAL_RES_PACKAGES=>(additional_res_packages)',
+ '-DADDITIONAL_R_TEXT_FILES=>(additional_R_text_files)',
+ '-DANDROID_SDK_JAR=<(android_sdk_jar)',
'-DANDROID_SDK_ROOT=<(android_sdk_root)',
- '-DANDROID_SDK_TOOLS=<(android_sdk_tools)',
'-DANDROID_SDK_VERSION=<(android_sdk_version)',
- '-DANDROID_TOOLCHAIN=<(android_toolchain)',
- '-DCHROMIUM_SRC=<(ant_build_out)/../..',
- '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)',
- '-DPRODUCT_DIR=<(ant_build_out)',
-
+ '-DAPKS_DIR=<(PRODUCT_DIR)/apks',
'-DAPK_NAME=<(apk_name)',
+ '-DAPP_MANIFEST_VERSION_CODE=<(app_manifest_version_code)',
+ '-DAPP_MANIFEST_VERSION_NAME=<(app_manifest_version_name)',
'-DASSET_DIR=<(asset_location)',
- '-DADDITIONAL_SRC_DIRS=>(additional_src_dirs)',
- '-DGENERATED_SRC_DIRS=>(generated_src_dirs)',
- '-DINPUT_JARS_PATHS=>(input_jars_paths)',
- '-DJAR_NAME=<(jar_name)',
- '-DOUT_DIR=<(ant_build_out)/<(_target_name)',
+ '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)',
+ '-DKEYSTORE_PATH=<(DEPTH)/build/android/ant/chromium-debug.keystore',
+ '-DOUT_DIR=<(intermediate_dir)',
'-DRESOURCE_DIR=<(resource_dir)',
- '-DADDITIONAL_R_TEXT_FILES=>(additional_R_text_files)',
- '-DADDITIONAL_RES_DIRS=>(additional_res_dirs)',
- '-DADDITIONAL_RES_PACKAGES=>(additional_res_packages)',
- '-DAPP_MANIFEST_VERSION_NAME=<(app_manifest_version_name)',
- '-DAPP_MANIFEST_VERSION_CODE=<(app_manifest_version_code)',
- '-DPROGUARD_FLAGS=>(proguard_flags)',
- '-DPROGUARD_ENABLED=>(proguard_enabled)',
- '-DLIBRARY_MANIFEST_PATHS=>(library_manifest_paths)',
+ '-DSOURCE_DIR=<(java_in_dir)/src',
+
+ '-Dbasedir=.',
+ '-buildfile',
+ '<(DEPTH)/build/android/ant/apk-package.xml',
# Add list of inputs to the command line, so if inputs change
# (e.g. if a Java file is removed), the command will be re-run.
# TODO(newt): remove this once crbug.com/177552 is fixed in ninja.
- '-DTHIS_IS_IGNORED=>(_inputs)',
-
- '-Dbasedir=<(java_in_dir)',
- '-buildfile',
- '<(DEPTH)/build/android/ant/chromium-apk.xml',
+ '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)',
- # Specify CONFIGURATION_NAME as the target for ant to build. The
- # buildfile will then build the appropriate SDK tools target.
- '<(CONFIGURATION_NAME)',
]
},
],
diff --git a/chrome/chrome_android.gypi b/chrome/chrome_android.gypi
index 245b321..1af9aec 100644
--- a/chrome/chrome_android.gypi
+++ b/chrome/chrome_android.gypi
@@ -58,7 +58,7 @@
'apk_name': 'ChromiumTestShell',
'manifest_package_name': 'org.chromium.chrome.testshell',
'java_in_dir': 'android/testshell/java',
- 'resource_dir': '../res',
+ 'resource_dir': 'android/testshell/res',
'asset_location': '<(ant_build_out)/../assets/<(package_name)',
'native_libs_paths': [ '<(SHARED_LIB_DIR)/libchromiumtestshell.so', ],
'additional_input_paths': [
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index adeb249..ea64b77 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -3159,8 +3159,8 @@
],
'variables': {
'apk_name': 'ChromiumTestShellTest',
- 'java_in_dir': './android/testshell/javatests',
- 'resource_dir': '../res',
+ 'java_in_dir': 'android/testshell/javatests',
+ 'resource_dir': 'android/testshell/res',
'additional_src_dirs': ['android/javatests/src'],
'is_test_apk': 1,
},
diff --git a/content/content_shell.gypi b/content/content_shell.gypi
index 5713513..4c45e15 100644
--- a/content/content_shell.gypi
+++ b/content/content_shell.gypi
@@ -677,7 +677,7 @@
'apk_name': 'ContentShell',
'manifest_package_name': 'org.chromium.content_shell_apk',
'java_in_dir': 'shell/android/shell_apk',
- 'resource_dir': 'res',
+ 'resource_dir': 'shell/android/shell_apk/res',
'native_libs_paths': ['<(SHARED_LIB_DIR)/libcontent_shell_content_view.so'],
'additional_input_paths': ['<(PRODUCT_DIR)/content_shell/assets/content_shell.pak'],
'asset_location': '<(ant_build_out)/content_shell/assets',
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index 3980d66..ef37f56 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -1017,7 +1017,7 @@
'variables': {
'apk_name': 'content_browsertests',
'java_in_dir': 'shell/android/browsertests_apk',
- 'resource_dir': 'res',
+ 'resource_dir': 'shell/android/browsertests_apk/res',
'native_libs_paths': ['<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)content_browsertests<(SHARED_LIB_SUFFIX)'],
'additional_input_paths': ['<(PRODUCT_DIR)/content_shell/assets/content_shell.pak'],
'asset_location': '<(ant_build_out)/content_shell/assets',
@@ -1060,9 +1060,9 @@
],
'variables': {
'apk_name': 'ContentShellTest',
- 'java_in_dir': '../content/shell/android/javatests',
- 'additional_src_dirs': ['../content/public/android/javatests/',],
- 'resource_dir': '../shell_apk/res',
+ 'java_in_dir': 'shell/android/javatests',
+ 'resource_dir': 'shell/android/shell_apk/res',
+ 'additional_src_dirs': ['public/android/javatests/',],
'is_test_apk': 1,
},
'includes': [ '../build/java_apk.gypi' ],