Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 1 | # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | # This file is a helper to java_apk.gypi. It should be used to create an |
| 6 | # action that runs ApkBuilder via ANT. |
| 7 | # |
| 8 | # Required variables: |
| 9 | # apk_name - File name (minus path & extension) of the output apk. |
| 10 | # apk_path - Path to output apk. |
| 11 | # package_input_paths - Late-evaluated list of resource zips. |
| 12 | # native_libs_dir - Path to lib/ directory to use. Set to an empty directory |
| 13 | # if no native libs are needed. |
| 14 | # Optional variables: |
| 15 | # has_code - Whether to include classes.dex in the apk. |
| 16 | # dex_path - Path to classes.dex. Used only when has_code=1. |
| 17 | # extra_inputs - List of extra action inputs. |
| 18 | { |
| 19 | 'variables': { |
| 20 | 'variables': { |
| 21 | 'has_code%': 1, |
| 22 | }, |
| 23 | 'conditions': [ |
| 24 | ['has_code == 0', { |
| 25 | 'has_code_str': 'false', |
| 26 | }, { |
| 27 | 'has_code_str': 'true', |
| 28 | }], |
| 29 | ], |
| 30 | 'has_code%': '<(has_code)', |
| 31 | 'extra_inputs%': [], |
| 32 | # Write the inputs list to a file, so that its mtime is updated when |
| 33 | # the list of inputs changes. |
| 34 | 'inputs_list_file': '>|(apk_package.<(_target_name).<(apk_name).gypcmd >@(package_input_paths))', |
| 35 | 'resource_packaged_apk_name': '<(apk_name)-resources.ap_', |
| 36 | 'resource_packaged_apk_path': '<(intermediate_dir)/<(resource_packaged_apk_name)', |
| 37 | }, |
| 38 | 'action_name': 'apkbuilder_<(apk_name)', |
| 39 | 'message': 'Packaging <(apk_name)', |
| 40 | 'inputs': [ |
| 41 | '<(DEPTH)/build/android/ant/apk-package.xml', |
| 42 | '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| 43 | '<(DEPTH)/build/android/gyp/ant.py', |
| 44 | '<(resource_packaged_apk_path)', |
| 45 | '<@(extra_inputs)', |
| 46 | '>@(package_input_paths)', |
| 47 | '>(inputs_list_file)', |
| 48 | ], |
| 49 | 'outputs': [ |
| 50 | '<(apk_path)', |
| 51 | ], |
| 52 | 'conditions': [ |
| 53 | ['has_code == 1', { |
| 54 | 'inputs': ['<(dex_path)'], |
| 55 | 'action': [ |
| 56 | '-DDEX_FILE_PATH=<(dex_path)', |
| 57 | ] |
| 58 | }], |
| 59 | ['enable_multidex == 1', { |
| 60 | 'action': [ |
| 61 | '-DMULTIDEX_ENABLED=1', |
| 62 | ] |
| 63 | }] |
| 64 | ], |
| 65 | 'action': [ |
| 66 | 'python', '<(DEPTH)/build/android/gyp/ant.py', |
| 67 | '--', |
| 68 | '-quiet', |
| 69 | '-DHAS_CODE=<(has_code_str)', |
| 70 | '-DANDROID_SDK_ROOT=<(android_sdk_root)', |
| 71 | '-DANDROID_SDK_TOOLS=<(android_sdk_tools)', |
| 72 | '-DRESOURCE_PACKAGED_APK_NAME=<(resource_packaged_apk_name)', |
| 73 | '-DNATIVE_LIBS_DIR=<(native_libs_dir)', |
| 74 | '-DAPK_NAME=<(apk_name)', |
| 75 | '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)', |
| 76 | '-DOUT_DIR=<(intermediate_dir)', |
| 77 | '-DUNSIGNED_APK_PATH=<(apk_path)', |
| 78 | '-DEMMA_INSTRUMENT=<(emma_instrument)', |
| 79 | '-DEMMA_DEVICE_JAR=<(emma_device_jar)', |
| 80 | '-Dbasedir=.', |
| 81 | '-buildfile', |
| 82 | '<(DEPTH)/build/android/ant/apk-package.xml', |
| 83 | ] |
| 84 | } |