Commit 2e296d82 authored by Andrew Grieve's avatar Andrew Grieve Committed by Commit Bot

Reland "Android: Link against apk_under_test resources for test apks"

This reverts commit 6fe841a9.

Reason for reland: Fixed the build error. Built all locally.

Test apks are allowed to reference resources that live in the apk_under_test.
We've previous supported such references via R.java constants, but this
CL also adds the ability for resources in the test apk to directly
reference resources in the apk_under_test (e.g. via xml @references).

The need for this has come with the latest version of the support
library.

To accomplish this:
1. Adds a "-I UnderTest.ap_" flag when compiling test apks resources
2. Sets the test apk's arsc package name to match the apk_under_test's
   package name.
3. Uses --emit-ids / --stable-ids to avoid collisions between the
   test apk and the apk_under_test.
4. Updates incremental install manifest logic to do the same trick.

Some other small tweaks to related resource code:
* Removes incremental AndroidManifest.xml as an explicit build output
* Moves most uses of "aapt dump" to "aapt2 dump"
* Removes --check-resources-pkg-id in favor of always enabling it
* Removes --optimize-resources in favor of having it implicitly set by
  --optimized-resources-path

Bug: 896775
Change-Id: I37aa5b969023ccdaad45e7617f811d1781564c29
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1567926Reviewed-by: default avatarTibor Goldschwendt <tiborg@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#651093}
parent a4ab7717
This diff is collapsed.
......@@ -36,6 +36,9 @@ def _ParseArgs(args):
"""
parser, input_opts, output_opts = resource_utils.ResourceArgsParser()
input_opts.add_argument(
'--aapt-path', required=True, help='Path to the Android aapt tool')
input_opts.add_argument('--resource-dirs',
default='[]',
help='A list of input directories containing resources '
......
......@@ -8,6 +8,7 @@ import contextlib
import os
import re
import shutil
import subprocess
import sys
import tempfile
from xml.etree import ElementTree
......@@ -24,6 +25,8 @@ from jinja2 import Template # pylint: disable=F0401
EMPTY_ANDROID_MANIFEST_PATH = os.path.join(
_SOURCE_ROOT, 'build', 'android', 'AndroidManifest.xml')
ANDROID_NAMESPACE = 'http://schemas.android.com/apk/res/android'
TOOLS_NAMESPACE = 'http://schemas.android.com/tools'
# A variation of these maps also exists in:
# //base/android/java/src/org/chromium/base/LocaleUtils.java
......@@ -44,6 +47,9 @@ _ANDROID_TO_CHROMIUM_LANGUAGE_MAP = {
}
_xml_namespace_initialized = False
def ToAndroidLocaleName(chromium_locale):
"""Convert an Chromium locale name into a corresponding Android one."""
# First handle the special cases, these are needed to deal with Android
......@@ -511,8 +517,38 @@ public final class R {
def ExtractPackageFromManifest(manifest_path):
"""Extract package name from Android manifest file."""
doc = ElementTree.parse(manifest_path)
return doc.getroot().get('package')
return ParseAndroidManifest(manifest_path)[1].get('package')
def ExtractBinaryManifestValues(aapt2_path, apk_path):
"""Returns (version_code, version_name, package_name) for the given apk."""
output = subprocess.check_output([
aapt2_path, 'dump', 'xmltree', apk_path, '--file', 'AndroidManifest.xml'
])
version_code = re.search(r'versionCode.*?=(\d*)', output).group(1)
version_name = re.search(r'versionName.*?="(.*?)"', output).group(1)
package_name = re.search(r'package.*?="(.*?)"', output).group(1)
return version_code, version_name, package_name
def ExtractArscPackage(aapt2_path, apk_path):
"""Returns (package_name, package_id) of resources.arsc from apk_path."""
proc = subprocess.Popen([aapt2_path, 'dump', 'resources', apk_path],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
for line in proc.stdout:
# Package name=org.chromium.webview_shell id=7f
if line.startswith('Package'):
proc.kill()
parts = line.split()
package_name = parts[1].split('=')[1]
package_id = parts[2][3:]
return package_name, int(package_id, 16)
# aapt2 currently crashes when dumping webview resources, but not until after
# it prints the "Package" line (b/130553900).
sys.stderr.write(proc.stderr.read())
raise Exception('Failed to find arsc package name')
def ExtractDeps(dep_zips, deps_dir):
......@@ -603,13 +639,6 @@ def ResourceArgsParser():
help='Paths to arsc resource files used to link '
'against. Can be specified multiple times.')
input_opts.add_argument('--aapt-path', required=True,
help='Path to the Android aapt tool')
input_opts.add_argument('--aapt2-path',
help='Path to the Android aapt2 tool. If in different'
' directory from --aapt-path.')
input_opts.add_argument('--dependencies-res-zips', required=True,
help='Resources zip archives from dependents. Required to '
'resolve @type/foo references into dependent '
......@@ -630,15 +659,6 @@ def ResourceArgsParser():
'list of resources to be included in the R.java file in the format '
'generated by aapt.')
input_opts.add_argument(
'--package-name',
help='Package name that will be used to determine package ID.')
input_opts.add_argument(
'--package-name-to-id-mapping',
help='List containing mapping from package name to package IDs that will '
'be assigned.')
return (parser, input_opts, output_opts)
......@@ -671,9 +691,6 @@ def HandleCommonOptions(options):
else:
options.extra_r_text_files = []
if not options.aapt2_path:
options.aapt2_path = options.aapt_path + '2'
def ParseAndroidResourceStringsFromXml(xml_data):
"""Parse and Android xml resource file and extract strings from it.
......@@ -782,3 +799,36 @@ def FilterAndroidResourceStringsXml(xml_file_path, string_predicate):
new_xml_data = GenerateAndroidResourceStringsXml(strings_map, namespaces)
with open(xml_file_path, 'wb') as f:
f.write(new_xml_data)
def _RegisterElementTreeNamespaces():
global _xml_namespace_initialized
if not _xml_namespace_initialized:
_xml_namespace_initialized = True
ElementTree.register_namespace('android', ANDROID_NAMESPACE)
ElementTree.register_namespace('tools', TOOLS_NAMESPACE)
def ParseAndroidManifest(path):
"""Parses an AndroidManifest.xml using ElementTree.
Registers required namespaces & creates application node if missing.
Returns tuple of:
doc: Root xml document.
manifest_node: the <manifest> node.
app_node: the <application> node.
"""
_RegisterElementTreeNamespaces()
doc = ElementTree.parse(path)
# ElementTree.find does not work if the required tag is the root.
if doc.getroot().tag == 'manifest':
manifest_node = doc.getroot()
else:
manifest_node = doc.find('manifest')
app_node = doc.find('application')
if app_node is None:
app_node = ElementTree.SubElement(manifest_node, 'application')
return doc, manifest_node, app_node
......@@ -1075,9 +1075,9 @@ def main(argv):
if options.type == 'android_apk' and options.tested_apk_config:
tested_apk_deps = Deps([options.tested_apk_config])
tested_apk_name = tested_apk_deps.Direct()[0]['name']
tested_apk_config = tested_apk_deps.Direct()[0]
tested_apk_resources_deps = tested_apk_deps.All('android_resources')
gradle['apk_under_test'] = tested_apk_name
gradle['apk_under_test'] = tested_apk_config['name']
all_resources_deps = [
d for d in all_resources_deps if not d in tested_apk_resources_deps]
......@@ -1274,6 +1274,9 @@ def main(argv):
config['resources']['dependency_zips'] = dependency_zips
config['resources']['extra_package_names'] = extra_package_names
config['resources']['extra_r_text_files'] = extra_r_text_files
if options.type == 'android_apk' and options.tested_apk_config:
config['resources']['arsc_package_name'] = (
tested_apk_config['package_name'])
if is_apk_or_module_target:
deps_dex_files = [c['dex_path'] for c in all_library_deps]
......@@ -1466,8 +1469,6 @@ def main(argv):
# apk-under-test still has all of its code in its classes.dex, none of it is
# used at runtime because the copy of it within the test apk takes precidence.
if options.type == 'android_apk' and options.tested_apk_config:
tested_apk_config = GetDepConfig(options.tested_apk_config)
if tested_apk_config['proguard_enabled']:
assert options.proguard_enabled, ('proguard must be enabled for '
'instrumentation apks if it\'s enabled for the tested apk.')
......
......@@ -11,8 +11,6 @@ the application class changed to IncrementalApplication.
import argparse
import os
import re
import shutil
import subprocess
import sys
import tempfile
......@@ -21,9 +19,7 @@ from xml.etree import ElementTree
sys.path.append(os.path.join(os.path.dirname(__file__), os.path.pardir, 'gyp'))
from util import build_utils
_ANDROID_NAMESPACE = 'http://schemas.android.com/apk/res/android'
ElementTree.register_namespace('android', _ANDROID_NAMESPACE)
from util import resource_utils
_INCREMENTAL_APP_NAME = 'org.chromium.incrementalinstall.BootstrapApplication'
_META_DATA_APP_NAME = 'incremental-install-real-app'
......@@ -40,32 +36,28 @@ _INCREMENTAL_INSTRUMENTATION_CLASSES = [
def _AddNamespace(name):
"""Adds the android namespace prefix to the given identifier."""
return '{%s}%s' % (_ANDROID_NAMESPACE, name)
return '{%s}%s' % (resource_utils.ANDROID_NAMESPACE, name)
def _ParseArgs(args):
parser = argparse.ArgumentParser()
parser.add_argument('--src-manifest',
help='The main manifest of the app',
required=True)
parser.add_argument('--out-manifest',
help='The output manifest',
required=True)
parser.add_argument(
'--src-manifest', required=True, help='The main manifest of the app')
parser.add_argument('--disable-isolated-processes',
help='Changes all android:isolatedProcess to false. '
'This is required on Android M+',
action='store_true')
parser.add_argument('--out-apk', help='Path to output .ap_ file')
parser.add_argument('--in-apk', help='Path to non-incremental .ap_ file')
parser.add_argument('--aapt-path', help='Path to the Android aapt tool')
parser.add_argument('--android-sdk-jars', help='Path to the Android SDK jar.')
parser.add_argument(
'--out-apk', required=True, help='Path to output .ap_ file')
parser.add_argument(
'--in-apk', required=True, help='Path to non-incremental .ap_ file')
parser.add_argument(
'--aapt2-path', required=True, help='Path to the Android aapt tool')
parser.add_argument(
'--android-sdk-jars', help='GN List of resource apks to include.')
ret = parser.parse_args(build_utils.ExpandFileArgs(args))
if ret.out_apk and not (ret.in_apk and ret.aapt_path
and ret.android_sdk_jars):
parser.error(
'--out-apk requires --in-apk, --aapt-path, and --android-sdk-jars.')
ret.android_sdk_jars = build_utils.ParseGnList(ret.android_sdk_jars)
return ret
......@@ -75,33 +67,20 @@ def _CreateMetaData(parent, name, value):
meta_data_node.set(_AddNamespace('value'), value)
def _ProcessManifest(main_manifest, disable_isolated_processes):
"""Returns a transformed AndroidManifest.xml for use with _incremental apks.
Args:
main_manifest: Manifest contents to transform.
disable_isolated_processes: Whether to set all isolatedProcess attributes to
false
Returns:
The transformed AndroidManifest.xml.
"""
if disable_isolated_processes:
main_manifest = main_manifest.replace('isolatedProcess="true"',
'isolatedProcess="false"')
# Disable check for page-aligned native libraries.
main_manifest = main_manifest.replace('extractNativeLibs="false"',
'extractNativeLibs="true"')
def _ProcessManifest(path, arsc_package_name, disable_isolated_processes):
doc, manifest_node, app_node = resource_utils.ParseAndroidManifest(path)
doc = ElementTree.fromstring(main_manifest)
app_node = doc.find('application')
if app_node is None:
app_node = ElementTree.SubElement(doc, 'application')
# Ensure the manifest package matches that of the apk's arsc package
# So that resource references resolve correctly. The actual manifest
# package name is set via --rename-manifest-package.
manifest_node.set('package', arsc_package_name)
# Pylint for some reason things app_node is an int.
# pylint: disable=no-member
real_app_class = app_node.get(_AddNamespace('name'),
_DEFAULT_APPLICATION_CLASS)
app_node.set(_AddNamespace('name'), _INCREMENTAL_APP_NAME)
# pylint: enable=no-member
_CreateMetaData(app_node, _META_DATA_APP_NAME, real_app_class)
# Seems to be a bug in ElementTree, as doc.find() doesn't work here.
......@@ -115,45 +94,46 @@ def _ProcessManifest(main_manifest, disable_isolated_processes):
_CreateMetaData(app_node, _META_DATA_INSTRUMENTATION_NAMES[i],
real_instrumentation_class)
return ElementTree.tostring(doc, encoding='UTF-8')
def _ExtractVersionFromApk(aapt_path, apk_path):
output = subprocess.check_output([aapt_path, 'dump', 'badging', apk_path])
version_code = re.search(r"versionCode='(.*?)'", output).group(1)
version_name = re.search(r"versionName='(.*?)'", output).group(1)
return version_code, version_name,
ret = ElementTree.tostring(doc.getroot(), encoding='UTF-8')
# Disable check for page-aligned native libraries.
ret = ret.replace('extractNativeLibs="false"', 'extractNativeLibs="true"')
if disable_isolated_processes:
ret = ret.replace('isolatedProcess="true"', 'isolatedProcess="false"')
return ret
def main(raw_args):
options = _ParseArgs(raw_args)
with open(options.src_manifest) as f:
main_manifest_data = f.read()
new_manifest_data = _ProcessManifest(main_manifest_data,
arsc_package, _ = resource_utils.ExtractArscPackage(options.aapt2_path,
options.in_apk)
# Extract version from the compiled manifest since it might have been set
# via aapt, and not exist in the manifest's text form.
version_code, version_name, manifest_package = (
resource_utils.ExtractBinaryManifestValues(options.aapt2_path,
options.in_apk))
new_manifest_data = _ProcessManifest(options.src_manifest, arsc_package,
options.disable_isolated_processes)
with open(options.out_manifest, 'w') as f:
f.write(new_manifest_data)
if options.out_apk:
version_code, version_name = _ExtractVersionFromApk(
options.aapt_path, options.in_apk)
with tempfile.NamedTemporaryFile() as f:
cmd = [options.aapt_path, 'package', '-f', '-F', f.name,
'-M', options.out_manifest,
'-I', options.in_apk, '--replace-version',
'--version-code', version_code, '--version-name', version_name,
'--debug-mode']
for j in options.android_sdk_jars:
cmd += ['-I', j]
subprocess.check_call(cmd)
with zipfile.ZipFile(f.name, 'a') as z:
path_transform = lambda p: None if p == 'AndroidManifest.xml' else p
build_utils.MergeZips(
z, [options.in_apk], path_transform=path_transform)
shutil.copyfile(f.name, options.out_apk)
return 0
with tempfile.NamedTemporaryFile() as tmp_manifest, \
tempfile.NamedTemporaryFile() as tmp_apk:
tmp_manifest.write(new_manifest_data)
tmp_manifest.flush()
cmd = [
options.aapt2_path, 'link', '-o', tmp_apk.name, '--manifest',
tmp_manifest.name, '-I', options.in_apk, '--replace-version',
'--version-code', version_code, '--version-name', version_name,
'--rename-manifest-package', manifest_package, '--debug-mode'
]
for j in options.android_sdk_jars:
cmd += ['-I', j]
subprocess.check_call(cmd)
with zipfile.ZipFile(options.out_apk, 'w') as z:
path_transform = lambda p: None if p != 'AndroidManifest.xml' else p
build_utils.MergeZips(z, [tmp_apk.name], path_transform=path_transform)
path_transform = lambda p: None if p == 'AndroidManifest.xml' else p
build_utils.MergeZips(z, [options.in_apk], path_transform=path_transform)
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))
main(sys.argv[1:])
# Generated by running:
# build/print_python_deps.py --root build/android/incremental_install --output build/android/incremental_install/generate_android_manifest.pydeps build/android/incremental_install/generate_android_manifest.py
../../../third_party/jinja2/__init__.py
../../../third_party/jinja2/_compat.py
../../../third_party/jinja2/bccache.py
../../../third_party/jinja2/compiler.py
../../../third_party/jinja2/defaults.py
../../../third_party/jinja2/environment.py
../../../third_party/jinja2/exceptions.py
../../../third_party/jinja2/filters.py
../../../third_party/jinja2/idtracking.py
../../../third_party/jinja2/lexer.py
../../../third_party/jinja2/loaders.py
../../../third_party/jinja2/nodes.py
../../../third_party/jinja2/optimizer.py
../../../third_party/jinja2/parser.py
../../../third_party/jinja2/runtime.py
../../../third_party/jinja2/tests.py
../../../third_party/jinja2/utils.py
../../../third_party/jinja2/visitor.py
../../../third_party/markupsafe/__init__.py
../../../third_party/markupsafe/_compat.py
../../../third_party/markupsafe/_native.py
../../gn_helpers.py
../gyp/util/__init__.py
../gyp/util/build_utils.py
../gyp/util/md5_check.py
../gyp/util/resource_utils.py
generate_android_manifest.py
......@@ -207,7 +207,7 @@ def _NormalizeResourcesArsc(apk_path, num_arsc_files, num_translations,
print('Skipping resources.arsc normalization (output directory required)')
return 0
ap_name = os.path.basename(apk_path).replace('.apk', '.intermediate.ap_')
ap_path = os.path.join(out_dir, 'gen/arsc/apks', ap_name)
ap_path = os.path.join(out_dir, 'arsc/apks', ap_name)
if not os.path.exists(ap_path):
raise Exception('Missing expected file: %s, try rebuilding.' % ap_path)
apk_path = ap_path
......
......@@ -144,9 +144,6 @@ template("write_build_config") {
if (defined(invoker.android_manifest_dep)) {
deps += [ invoker.android_manifest_dep ]
}
if (defined(invoker.base_module_build_config_target)) {
deps += [ invoker.base_module_build_config_target ]
}
script = "//build/android/gyp/write_build_config.py"
depfile = "$target_gen_dir/$target_name.d"
......@@ -481,11 +478,16 @@ template("write_build_config") {
invoker.main_class,
]
}
if (defined(invoker.base_module_build_config)) {
_rebased_base_module_build_config =
rebase_path(invoker.base_module_build_config, root_build_dir)
args +=
[ "--base-module-build-config=$_rebased_base_module_build_config" ]
if (defined(invoker.base_module_target)) {
_target_label =
get_label_info(invoker.base_module_target, "label_no_toolchain")
_dep_gen_dir = get_label_info(_target_label, "target_gen_dir")
_dep_name = get_label_info(_target_label, "name")
deps += [ "$_target_label$build_config_target_suffix" ]
args += [
"--base-module-build-config",
rebase_path("$_dep_gen_dir/$_dep_name.build_config", root_build_dir),
]
}
if (current_toolchain != default_toolchain) {
# This has to be a built-time error rather than a GN assert because many
......@@ -877,7 +879,6 @@ template("stack_script") {
if (enable_java_templates) {
android_sdk_jar = "$android_sdk/android.jar"
android_default_aapt_path = "$android_sdk_build_tools/aapt"
android_default_aapt2_path = "$android_sdk_build_tools/aapt2"
template("android_lint") {
action_with_pydeps(target_name) {
......@@ -2086,6 +2087,15 @@ if (enable_java_templates) {
# used to determine which package ID to assign if package_name variable
# was passed in.
#
# package_id: (optional)
# Use a custom package ID in resource IDs (same purpose as
# package_name_to_id_mapping)
#
# arsc_package_name: (optional)
# Use this package name in the arsc file rather than the package name
# found in the AndroidManifest.xml. Does not affect the package name
# used in AndroidManifest.xml.
#
# Output variables:
# output: Path to a zip file containing the compiled resources.
#
......@@ -2161,8 +2171,6 @@ if (enable_java_templates) {
"--depfile",
rebase_path(depfile, root_build_dir),
"--include-resources=@FileArg($_rebased_build_config:android:sdk_jars)",
"--aapt-path",
rebase_path(_android_aapt_path, root_build_dir),
"--aapt2-path",
rebase_path(_android_aapt2_path, root_build_dir),
"--dependencies-res-zips=@FileArg($_rebased_build_config:resources:dependency_zips)",
......@@ -2176,12 +2184,6 @@ if (enable_java_templates) {
rebase_path(invoker.android_manifest, root_build_dir),
]
if (defined(invoker.package_name_to_id_mapping)) {
args += [
"--package-name-to-id-mapping=${invoker.package_name_to_id_mapping}",
]
}
if (defined(invoker.no_xml_namespaces) && invoker.no_xml_namespaces) {
args += [ "--no-xml-namespaces" ]
}
......@@ -2212,8 +2214,13 @@ if (enable_java_templates) {
]
}
if (defined(invoker.optimize_resources) && invoker.optimize_resources) {
args += [ "--optimize-resources" ]
if (defined(invoker.optimized_resources_path)) {
args += [
"--optimized-resources-path",
rebase_path(invoker.optimized_resources_path, root_build_dir),
]
outputs += [ invoker.optimized_resources_path ]
if (defined(invoker.resources_config_path)) {
inputs += [ invoker.resources_config_path ]
args += [
......@@ -2221,14 +2228,6 @@ if (enable_java_templates) {
rebase_path(invoker.resources_config_path, root_build_dir),
]
}
if (defined(invoker.unoptimized_resources_path)) {
args += [
"--unoptimized-resources-path",
rebase_path(invoker.unoptimized_resources_path, root_build_dir),
]
outputs += [ invoker.unoptimized_resources_path ]
}
}
# Useful to have android:debuggable in the manifest even for Release
......@@ -2270,21 +2269,26 @@ if (enable_java_templates) {
# generated resources table is correct. It should be 0x02 for runtime
# shared libraries, and 0x7f otherwise.
_expected_resources_pkg_id = "0x7f"
if (defined(invoker.shared_resources) && invoker.shared_resources) {
args += [ "--shared-resources" ]
_expected_resources_pkg_id = "0x02"
} else if (defined(invoker.app_as_shared_lib) &&
invoker.app_as_shared_lib) {
}
if (defined(invoker.app_as_shared_lib) && invoker.app_as_shared_lib) {
args += [ "--app-as-shared-lib" ]
}
# NOTE: It is not possible to check the resources package ID of
# proto-compiled APKs at the moment.
if (!_proto_format) {
args += [ "--check-resources-pkg-id=$_expected_resources_pkg_id" ]
} else {
assert(_expected_resources_pkg_id != "") # Mark as used.
if (defined(invoker.package_id)) {
args += [ "--package-id=${invoker.package_id}" ]
}
if (defined(invoker.package_name)) {
args += [
"--package-name=${invoker.package_name}",
"--package-name-to-id-mapping=${invoker.package_name_to_id_mapping}",
]
}
if (defined(invoker.arsc_package_name)) {
args += [
"--arsc-package-name",
invoker.arsc_package_name,
]
}
if (defined(invoker.shared_resources_whitelist)) {
......@@ -2351,10 +2355,6 @@ if (enable_java_templates) {
args += invoker.args
}
if (defined(invoker.package_name)) {
args += [ "--package-name=${invoker.package_name}" ]
}
if (defined(invoker.emit_ids_out_path)) {
outputs += [ invoker.emit_ids_out_path ]
_rebased_emit_ids_path =
......@@ -2678,7 +2678,6 @@ if (enable_java_templates) {
"assets_build_config",
"native_lib_placeholders",
"native_libs_filearg",
"packaged_resources_path",
"secondary_native_lib_placeholders",
"secondary_abi_native_libs_filearg",
"secondary_abi_loadable_modules",
......@@ -2689,6 +2688,12 @@ if (enable_java_templates) {
if (!defined(uncompress_shared_libraries)) {
uncompress_shared_libraries = _load_library_from_apk
}
if (defined(invoker.optimized_resources_path)) {
packaged_resources_path = invoker.optimized_resources_path
not_needed(invoker, [ "packaged_resources_path" ])
} else {
packaged_resources_path = invoker.packaged_resources_path
}
deps = _deps
native_libs = _native_libs + _native_libs_even_when_incremental
keystore_path = _keystore_path
......@@ -2717,16 +2722,6 @@ if (enable_java_templates) {
_incremental_compiled_resources_path = "${_base_path}_incremental.ap_"
_incremental_compile_resources_target_name =
"${target_name}_incremental__compile_resources"
_incremental_android_manifest =
get_label_info(_incremental_compile_resources_target_name,
"target_gen_dir") + "/AndroidManifest.xml"
if (defined(invoker.unoptimized_resources_path)) {
_incremental_packaged_resources_path =
invoker.unoptimized_resources_path
} else {
_incremental_packaged_resources_path = invoker.packaged_resources_path
}
_rebased_build_config =
rebase_path(invoker.assets_build_config, root_build_dir)
......@@ -2738,26 +2733,21 @@ if (enable_java_templates) {
inputs = [
_android_manifest,
invoker.assets_build_config,
_incremental_packaged_resources_path,
invoker.packaged_resources_path,
]
outputs = [
# Output the non-compiled manifest for easy debugging (as opposed to
# generating to a temp file).
_incremental_android_manifest,
_incremental_compiled_resources_path,
]
args = [
"--src-manifest",
rebase_path(_android_manifest, root_build_dir),
"--out-manifest",
rebase_path(_incremental_android_manifest, root_build_dir),
"--in-apk",
rebase_path(_incremental_packaged_resources_path, root_build_dir),
rebase_path(invoker.packaged_resources_path, root_build_dir),
"--out-apk",
rebase_path(_incremental_compiled_resources_path, root_build_dir),
"--aapt-path",
rebase_path(android_default_aapt_path, root_build_dir),
"--aapt2-path",
rebase_path(android_sdk_tools_bundle_aapt2, root_build_dir),
"--android-sdk-jars=@FileArg($_rebased_build_config:android:sdk_jars)",
]
if (disable_incremental_isolated_processes) {
......@@ -3371,8 +3361,7 @@ if (enable_java_templates) {
if (type == "android_app_bundle_module") {
forward_variables_from(invoker,
[
"base_module_build_config",
"base_module_build_config_target",
"base_module_target",
"module_rtxt_path",
"proto_resources_path",
])
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment