summaryrefslogtreecommitdiffstats
path: root/build/android/apkbuilder_action.gypi
blob: e073e9bdbec688cd0517c8b0732b1af961296e76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Copyright 2015 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.

# This file is a helper to java_apk.gypi. It should be used to create an
# action that runs ApkBuilder via ANT.
#
# Required variables:
#  apk_name - File name (minus path & extension) of the output apk.
#  apk_path - Path to output apk.
#  package_input_paths - Late-evaluated list of resource zips.
#  native_libs_dir - Path to lib/ directory to use. Set to an empty directory
#    if no native libs are needed.
# Optional variables:
#  has_code - Whether to include classes.dex in the apk.
#  dex_path - Path to classes.dex. Used only when has_code=1.
#  extra_inputs - List of extra action inputs.
{
  'variables': {
    'variables': {
      'has_code%': 1,
    },
    'conditions': [
      ['has_code == 0', {
        'has_code_str': 'false',
      }, {
        'has_code_str': 'true',
      }],
    ],
    'has_code%': '<(has_code)',
    'extra_inputs%': [],
    # Write the inputs list to a file, so that its mtime is updated when
    # the list of inputs changes.
    'inputs_list_file': '>|(apk_package.<(_target_name).<(apk_name).gypcmd >@(package_input_paths))',
    'resource_packaged_apk_name': '<(apk_name)-resources.ap_',
    'resource_packaged_apk_path': '<(intermediate_dir)/<(resource_packaged_apk_name)',
  },
  'action_name': 'apkbuilder_<(apk_name)',
  'message': 'Packaging <(apk_name)',
  'inputs': [
    '<(DEPTH)/build/android/ant/apk-package.xml',
    '<(DEPTH)/build/android/gyp/util/build_utils.py',
    '<(DEPTH)/build/android/gyp/ant.py',
    '<(resource_packaged_apk_path)',
    '<@(extra_inputs)',
    '>@(package_input_paths)',
    '>(inputs_list_file)',
  ],
  'outputs': [
    '<(apk_path)',
  ],
  'conditions': [
    ['has_code == 1', {
      'inputs': ['<(dex_path)'],
      'action': [
        '-DDEX_FILE_PATH=<(dex_path)',
      ]
    }],
    ['enable_multidex == 1', {
      'action': [
        '-DMULTIDEX_ENABLED=1',
      ]
    }]
  ],
  'action': [
    'python', '<(DEPTH)/build/android/gyp/ant.py',
    '--',
    '-quiet',
    '-DHAS_CODE=<(has_code_str)',
    '-DANDROID_SDK_ROOT=<(android_sdk_root)',
    '-DANDROID_SDK_TOOLS=<(android_sdk_tools)',
    '-DRESOURCE_PACKAGED_APK_NAME=<(resource_packaged_apk_name)',
    '-DNATIVE_LIBS_DIR=<(native_libs_dir)',
    '-DAPK_NAME=<(apk_name)',
    '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)',
    '-DOUT_DIR=<(intermediate_dir)',
    '-DUNSIGNED_APK_PATH=<(apk_path)',
    '-DEMMA_INSTRUMENT=<(emma_instrument)',
    '-DEMMA_DEVICE_JAR=<(emma_device_jar)',
    '-Dbasedir=.',
    '-buildfile',
    '<(DEPTH)/build/android/ant/apk-package.xml',
  ]
}