blob: a83c02dc77fa97e9cb12b2a2e23baaa581b01ae2 [file] [log] [blame]
Ben Murdoch097c5b22016-05-18 11:27:45 +01001# 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# android_manifest_path - Path to AndroidManifest.xml.
11# app_manifest_version_name - set the apps 'human readable' version number.
12# app_manifest_version_code - set the apps version number.
13# Optional variables:
14# asset_location - The directory where assets are located (if any).
15# create_density_splits - Whether to create density-based apk splits. Splits
16# are supported only for minSdkVersion >= 21.
17# language_splits - List of languages to create apk splits for.
18# resource_zips - List of paths to resource zip files.
19# shared_resources - Make a resource package that can be loaded by a different
20# application at runtime to access the package's resources.
21# app_as_shared_library - Make a resource package that can be loaded as shared
22# library.
23# extensions_to_not_compress - E.g.: 'pak,dat,bin'
24# extra_inputs - List of extra action inputs.
25{
26 'variables': {
27 'asset_location%': '',
28 'create_density_splits%': 0,
29 'resource_zips%': [],
30 'shared_resources%': 0,
31 'app_as_shared_library%': 0,
32 'extensions_to_not_compress%': '',
33 'extra_inputs%': [],
34 'resource_packaged_apk_name': '<(apk_name)-resources.ap_',
35 'resource_packaged_apk_path': '<(intermediate_dir)/<(resource_packaged_apk_name)',
36 },
37 'action_name': 'package_resources_<(apk_name)',
38 'message': 'packaging resources for <(apk_name)',
39 'inputs': [
40 # TODO: This isn't always rerun correctly, http://crbug.com/351928
41 '<(DEPTH)/build/android/gyp/util/build_utils.py',
42 '<(DEPTH)/build/android/gyp/package_resources.py',
43 '<(android_manifest_path)',
44 '<@(extra_inputs)',
45 ],
46 'outputs': [
47 '<(resource_packaged_apk_path)',
48 ],
49 'action': [
50 'python', '<(DEPTH)/build/android/gyp/package_resources.py',
51 '--android-sdk-jar', '<(android_sdk_jar)',
52 '--aapt-path', '<(android_aapt_path)',
53 '--configuration-name', '<(CONFIGURATION_NAME)',
54 '--android-manifest', '<(android_manifest_path)',
55 '--version-code', '<(app_manifest_version_code)',
56 '--version-name', '<(app_manifest_version_name)',
57 '--no-compress', '<(extensions_to_not_compress)',
58 '--apk-path', '<(resource_packaged_apk_path)',
59 ],
60 'conditions': [
61 ['shared_resources == 1', {
62 'action': [
63 '--shared-resources',
64 ],
65 }],
66 ['app_as_shared_library == 1', {
67 'action': [
68 '--app-as-shared-lib',
69 ],
70 }],
71 ['asset_location != ""', {
72 'action': [
73 '--asset-dir', '<(asset_location)',
74 ],
75 }],
76 ['create_density_splits == 1', {
77 'action': [
78 '--create-density-splits',
79 ],
80 'outputs': [
81 '<(resource_packaged_apk_path)_hdpi',
82 '<(resource_packaged_apk_path)_xhdpi',
83 '<(resource_packaged_apk_path)_xxhdpi',
84 '<(resource_packaged_apk_path)_xxxhdpi',
85 '<(resource_packaged_apk_path)_tvdpi',
86 ],
87 }],
88 ['language_splits != []', {
89 'action': [
90 '--language-splits=<(language_splits)',
91 ],
92 'outputs': [
93 "<!@(python <(DEPTH)/build/apply_locales.py '<(resource_packaged_apk_path)_ZZLOCALE' <(language_splits))",
94 ],
95 }],
96 ['resource_zips != []', {
97 'action': [
98 '--resource-zips', '>(resource_zips)',
99 ],
100 'inputs': [
101 '>@(resource_zips)',
102 ],
103 }],
104 ],
105}