summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorcjhopman@chromium.org <cjhopman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-10 23:10:17 +0000
committercjhopman@chromium.org <cjhopman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-10 23:10:17 +0000
commit1c080335c2c177d2d6c7469fa1fb4ed7c20831dd (patch)
tree34e0cf61c0677bfcea76e3711f50c522ae6bb80a /build
parentcb99579b5045a9d2699c4179aa6c6f06ca141710 (diff)
downloadchromium_src-1c080335c2c177d2d6c7469fa1fb4ed7c20831dd.zip
chromium_src-1c080335c2c177d2d6c7469fa1fb4ed7c20831dd.tar.gz
chromium_src-1c080335c2c177d2d6c7469fa1fb4ed7c20831dd.tar.bz2
[Android] Split Ant -package and -package-resources
Splits apk-package.xml into apk-package.xml and apk-package-resources.xml and adds a new gyp action for package-resources. This continues the simplification of gyp actions (i.e. each individual action should be simple). Also, allows more accurate specification of inputs for -package-resources vs -package (and allows -package-resources to be done in parallel with javac/dex/etc.). BUG=158821 Review URL: https://chromiumcodereview.appspot.com/13811027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193491 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build')
-rw-r--r--build/android/ant/apk-package-resources.xml133
-rw-r--r--build/android/ant/apk-package.xml97
-rw-r--r--build/java_apk.gypi60
3 files changed, 184 insertions, 106 deletions
diff --git a/build/android/ant/apk-package-resources.xml b/build/android/ant/apk-package-resources.xml
new file mode 100644
index 0000000..cbce1de
--- /dev/null
+++ b/build/android/ant/apk-package-resources.xml
@@ -0,0 +1,133 @@
+<?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="-package-resources">
+ <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" />
+
+ <!-- tools location -->
+ <property name="sdk.dir" location="${ANDROID_SDK_ROOT}"/>
+ <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>
+
+ <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="aapt" location="${android.platform.tools.dir}/aapt" />
+
+ <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="-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>
+
+ <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>
+
+ <touch file="${STAMP}" />
+ </target>
+</project>
diff --git a/build/android/ant/apk-package.xml b/build/android/ant/apk-package.xml
index 6540d99..b70b6c3 100644
--- a/build/android/ant/apk-package.xml
+++ b/build/android/ant/apk-package.xml
@@ -18,18 +18,9 @@
<project default="-package">
<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">
@@ -52,103 +43,19 @@
<!-- SDK tools assume that out.packaged.file is signed and name it "...-unaligned" -->
<property name="out.packaged.file" value="${UNSIGNED_APK_PATH}" />
- <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="${NATIVE_LIBS_DIR}" />
- <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">
+ <target name="-package">
<apkbuilder
outfolder="${out.absolute.dir}"
resourcefile="${resource.package.file.name}"
diff --git a/build/java_apk.gypi b/build/java_apk.gypi
index 9be37d9..036b22d 100644
--- a/build/java_apk.gypi
+++ b/build/java_apk.gypi
@@ -100,6 +100,7 @@
'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml',
'push_stamp': '<(intermediate_dir)/push.stamp',
'link_stamp': '<(intermediate_dir)/link.stamp',
+ 'package_resources_stamp': '<(intermediate_dir)/package_resources.stamp',
'codegen_input_paths': [],
'keystore_path': '<(DEPTH)/build/android/ant/chromium-debug.keystore',
'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk',
@@ -345,9 +346,10 @@
'<(DEPTH)/build/android/gyp/util/build_utils.py',
'<(DEPTH)/build/android/gyp/ant.py',
'<(android_manifest_path)',
- '>@(library_manifest_paths)'
- '>@(codegen_input_paths)',
'>@(additional_input_paths)',
+ '>@(codegen_input_paths)',
+ '>@(library_manifest_paths)',
+ '>@(resource_input_paths)',
],
'outputs': [
'<(codegen_stamp)',
@@ -523,16 +525,17 @@
]
},
{
- 'action_name': 'ant_package_<(_target_name)',
- 'message': 'Packaging <(_target_name).',
+ 'action_name': 'ant package resources',
+ 'message': 'Packaging resources for <(_target_name) APK.',
'inputs': [
- '<(DEPTH)/build/android/ant/apk-package.xml',
+ '<(DEPTH)/build/android/ant/apk-package-resources.xml',
'<(DEPTH)/build/android/gyp/util/build_utils.py',
'<(DEPTH)/build/android/gyp/ant.py',
- '<(dex_path)',
+ '<(android_manifest_path)',
'<(codegen_stamp)',
- '<(obfuscate_stamp)',
- '>@(package_input_paths)',
+
+ '>@(library_manifest_paths)',
+ '>@(additional_input_paths)',
],
'conditions': [
['is_test_apk == 1', {
@@ -543,7 +546,7 @@
}],
],
'outputs': [
- '<(unsigned_apk_path)',
+ '<(package_resources_stamp)',
],
'action': [
'python', '<(DEPTH)/build/android/gyp/ant.py',
@@ -553,15 +556,50 @@
'-DADDITIONAL_R_TEXT_FILES=>(additional_R_text_files)',
'-DANDROID_SDK_JAR=<(android_sdk_jar)',
'-DANDROID_SDK_ROOT=<(android_sdk_root)',
- '-DANDROID_SDK_VERSION=<(android_sdk_version)',
'-DAPK_NAME=<(apk_name)',
'-DAPP_MANIFEST_VERSION_CODE=<(app_manifest_version_code)',
'-DAPP_MANIFEST_VERSION_NAME=<(app_manifest_version_name)',
'-DASSET_DIR=<(asset_location)',
'-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)',
- '-DNATIVE_LIBS_DIR=<(apk_package_native_libs_dir)',
'-DOUT_DIR=<(intermediate_dir)',
'-DRESOURCE_DIR=<(resource_dir)',
+
+ '-DSTAMP=<(package_resources_stamp)',
+
+ '-Dbasedir=.',
+ '-buildfile',
+ '<(DEPTH)/build/android/ant/apk-package-resources.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',
+ '<(DEPTH)/build/android/gyp/util/build_utils.py',
+ '<(DEPTH)/build/android/gyp/ant.py',
+ '<(dex_path)',
+ '<(codegen_stamp)',
+ '<(obfuscate_stamp)',
+ '<(package_resources_stamp)',
+ '>@(package_input_paths)',
+ ],
+ 'outputs': [
+ '<(unsigned_apk_path)',
+ ],
+ 'action': [
+ 'python', '<(DEPTH)/build/android/gyp/ant.py',
+ '-quiet',
+ '-DANDROID_SDK_ROOT=<(android_sdk_root)',
+ '-DAPK_NAME=<(apk_name)',
+ '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)',
+ '-DNATIVE_LIBS_DIR=<(apk_package_native_libs_dir)',
+ '-DOUT_DIR=<(intermediate_dir)',
'-DSOURCE_DIR=<(source_dir)',
'-DUNSIGNED_APK_PATH=<(unsigned_apk_path)',