Skip to content

Commit

Permalink
Make aapt and aidl paths flexible.
Browse files Browse the repository at this point in the history
Android-M sdk moved these build-tools to a different directory
and so we need to be able to set them in GYP_DEFINES for M sdk builds.

BUG=None

Review URL: https://codereview.chromium.org/1162943008

Cr-Commit-Position: refs/heads/master@{#332959}
  • Loading branch information
aurimas authored and Commit bot committed Jun 4, 2015
1 parent 21740f6 commit 2a145da
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 17 deletions.
8 changes: 4 additions & 4 deletions build/android/gyp/package_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ def ParseArgs():
parser = optparse.OptionParser()
build_utils.AddDepfileOption(parser)
parser.add_option('--android-sdk', help='path to the Android SDK folder')
parser.add_option('--android-sdk-tools',
help='path to the Android SDK build tools folder')
parser.add_option('--aapt-path',
help='path to the Android aapt tool')

parser.add_option('--configuration-name',
help='Gyp\'s configuration name (Debug or Release).')
Expand Down Expand Up @@ -105,7 +105,7 @@ def ParseArgs():
parser.error('No positional arguments should be given.')

# Check that required options have been provided.
required_options = ('android_sdk', 'android_sdk_tools', 'configuration_name',
required_options = ('android_sdk', 'aapt_path', 'configuration_name',
'android_manifest', 'version_code', 'version_name',
'apk_path')

Expand Down Expand Up @@ -187,7 +187,7 @@ def CheckDensityMissedConfigs(apk_path):
def main():
options = ParseArgs()
android_jar = os.path.join(options.android_sdk, 'android.jar')
aapt = os.path.join(options.android_sdk_tools, 'aapt')
aapt = options.aapt_path

with build_utils.TempDir() as temp_dir:
package_command = [aapt,
Expand Down
8 changes: 4 additions & 4 deletions build/android/gyp/process_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def ParseArgs(args):
build_utils.AddDepfileOption(parser)

parser.add_option('--android-sdk', help='path to the Android SDK folder')
parser.add_option('--android-sdk-tools',
help='path to the Android SDK build tools folder')
parser.add_option('--aapt-path',
help='path to the Android aapt tool')
parser.add_option('--non-constant-id', action='store_true')

parser.add_option('--android-manifest', help='AndroidManifest.xml path')
Expand Down Expand Up @@ -102,7 +102,7 @@ def ParseArgs(args):
# Check that required options have been provided.
required_options = (
'android_sdk',
'android_sdk_tools',
'aapt_path',
'android_manifest',
'dependencies_res_zips',
'resource_dirs',
Expand Down Expand Up @@ -303,7 +303,7 @@ def main():

options = ParseArgs(args)
android_jar = os.path.join(options.android_sdk, 'android.jar')
aapt = os.path.join(options.android_sdk_tools, 'aapt')
aapt = options.aapt_path

input_files = []

Expand Down
2 changes: 1 addition & 1 deletion build/android/package_resources_action.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
'action': [
'python', '<(DEPTH)/build/android/gyp/package_resources.py',
'--android-sdk', '<(android_sdk)',
'--android-sdk-tools', '<(android_sdk_tools)',
'--aapt-path', '<(android_aapt_path)',
'--configuration-name', '<(CONFIGURATION_NAME)',
'--android-manifest', '<(android_manifest_path)',
'--version-code', '<(app_manifest_version_code)',
Expand Down
3 changes: 2 additions & 1 deletion build/common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -1692,7 +1692,7 @@
'host_os%': '<(host_os)',

'android_sdk%': '<(android_sdk_root)/platforms/android-<(android_sdk_version)',
# Android SDK build tools (e.g. dx, aapt, aidl)
# Android SDK build tools (e.g. dx, aidl)
'android_sdk_tools%': '<(android_sdk_root)/build-tools/<(android_sdk_build_tools_version)',

# Android API level 16 is JB (Android 4.1) which is the minimum
Expand Down Expand Up @@ -1761,6 +1761,7 @@
'android_ndk_include': '<(android_ndk_sysroot)/usr/include',
'android_ndk_lib': '<(android_ndk_sysroot)/<(android_ndk_lib_dir)',
'android_sdk_tools%': '<(android_sdk_tools)',
'android_aapt_path%': '<(android_sdk_tools)/aapt',
'android_sdk%': '<(android_sdk)',
'android_sdk_jar%': '<(android_sdk)/android.jar',

Expand Down
9 changes: 5 additions & 4 deletions build/config/android/internal_rules.gni
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ rebased_android_sdk_build_tools =

android_sdk_jar = "$android_sdk/android.jar"
rebased_android_sdk_jar = rebase_path(android_sdk_jar, root_build_dir)
android_aapt_path = "$rebased_android_sdk_build_tools/aapt"

template("android_lint") {
set_sources_assignment_filter([])
Expand Down Expand Up @@ -635,8 +636,8 @@ template("create_apk") {
rebase_path(depfile, root_build_dir),
"--android-sdk",
rebased_android_sdk,
"--android-sdk-tools",
rebased_android_sdk_build_tools,
"--aapt-path",
android_aapt_path,
"--configuration-name=$_configuration_name",
"--android-manifest",
rebase_path(_android_manifest, root_build_dir),
Expand Down Expand Up @@ -1264,8 +1265,8 @@ template("process_resources") {
rebase_path(depfile, root_build_dir),
"--android-sdk",
rebase_path(android_sdk, root_build_dir),
"--android-sdk-tools",
rebase_path(android_sdk_build_tools, root_build_dir),
"--aapt-path",
android_aapt_path,
"--android-manifest",
rebase_path(android_manifest, root_build_dir),
"--resource-dirs=$rebase_resource_dirs",
Expand Down
2 changes: 1 addition & 1 deletion build/java.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
'action': [
'python', '<(DEPTH)/build/android/gyp/process_resources.py',
'--android-sdk', '<(android_sdk)',
'--android-sdk-tools', '<(android_sdk_tools)',
'--aapt-path', '<(android_aapt_path)',
'--non-constant-id',

'--android-manifest', '<(android_manifest)',
Expand Down
3 changes: 2 additions & 1 deletion build/java_aidl.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

{
'variables': {
'aidl_path%': '<(android_sdk_tools)/aidl',
'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/aidl',
'aidl_import_include%': '',
'additional_aidl_arguments': [],
Expand Down Expand Up @@ -66,7 +67,7 @@
'<(intermediate_dir)/<(RULE_INPUT_ROOT).java',
],
'action': [
'<(android_sdk_tools)/aidl',
'<(aidl_path)',
'-p<(android_sdk)/framework.aidl',
'-p<(aidl_interface_file)',
'<@(additional_aidl_arguments)',
Expand Down
2 changes: 1 addition & 1 deletion build/java_apk.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@
'action': [
'python', '<(DEPTH)/build/android/gyp/process_resources.py',
'--android-sdk', '<(android_sdk)',
'--android-sdk-tools', '<(android_sdk_tools)',
'--aapt-path', '<(android_aapt_path)',

'--android-manifest', '<(android_manifest_path)',
'--dependencies-res-zips', '>(dependencies_res_zip_paths)',
Expand Down

0 comments on commit 2a145da

Please sign in to comment.