Commit 1b8dd718 authored by Thomas Anderson's avatar Thomas Anderson Committed by Commit Bot

Revert "Android: Replace desugar with d8 and r8 for debug"

This reverts commit 8a5a16af.

Reason for revert: Suspected cause of breakage on android-rel:
https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/android-rel/6359

Original change's description:
> Android: Replace desugar with d8 and r8 for debug
> 
> For release builds, desugar.jar still runs first, before d8 or r8, so
> nothing is changing for them as by the time d8 or r8 runs, the code has
> already been desugared.
> 
> When r8 is enabled, it can desugar all targets that enable proguard, and
> d8 can desugar all targets that do not enable proguard.
> 
> This can only be turned on once r8 replaces proguard since proguard does
> not understand java 8 code that has not been desugared already.
> 
> Bug: 906803, 913679, 916733
> Change-Id: I3fcc5a20b38e7fdc78cdeed1533583675d58346b
> Reviewed-on: https://chromium-review.googlesource.com/c/1384945
> Reviewed-by: Sam Maier <smaier@chromium.org>
> Commit-Queue: Peter Wen <wnwen@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#619434}

TBR=wnwen@chromium.org,smaier@chromium.org

Change-Id: I5591321bd6369f4fb9de3f1519b2c823775c048b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 906803, 913679, 916733
Reviewed-on: https://chromium-review.googlesource.com/c/1393425Reviewed-by: default avatarThomas Anderson <thomasanderson@chromium.org>
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619447}
parent 598e056c
...@@ -37,10 +37,6 @@ def _ParseArgs(args): ...@@ -37,10 +37,6 @@ def _ParseArgs(args):
parser = optparse.OptionParser() parser = optparse.OptionParser()
build_utils.AddDepfileOption(parser) build_utils.AddDepfileOption(parser)
parser.add_option('--classpath', help='Classpaths necessary for desugaring.')
parser.add_option(
'--sdk-jars',
help='Path(s) to android sdk jar, necessary for desugaring.')
parser.add_option('--output-directory', parser.add_option('--output-directory',
default=os.getcwd(), default=os.getcwd(),
help='Path to the output build directory.') help='Path to the output build directory.')
...@@ -322,13 +318,7 @@ def main(args): ...@@ -322,13 +318,7 @@ def main(args):
if options.multi_dex: if options.multi_dex:
input_paths.append(options.main_dex_list_path) input_paths.append(options.main_dex_list_path)
dex_cmd = ['java', '-jar', options.d8_jar_path] dex_cmd = ['java', '-jar', options.d8_jar_path, '--no-desugaring']
options.sdk_jars = build_utils.ParseGnList(options.sdk_jars)
options.classpath = build_utils.ParseGnList(options.classpath)
for path in options.classpath:
dex_cmd += ['--classpath', path]
for path in options.sdk_jars:
dex_cmd += ['--lib', path]
if options.multi_dex: if options.multi_dex:
dex_cmd += ['--main-dex-list', options.main_dex_list_path] dex_cmd += ['--main-dex-list', options.main_dex_list_path]
if options.release: if options.release:
......
...@@ -121,6 +121,7 @@ def _CreateR8Command(options, map_output_path, output_dir): ...@@ -121,6 +121,7 @@ def _CreateR8Command(options, map_output_path, output_dir):
# TODO: R8 needs -applymapping equivalent. # TODO: R8 needs -applymapping equivalent.
cmd = [ cmd = [
'java', '-jar', options.r8_path, 'java', '-jar', options.r8_path,
'--no-desugaring',
'--no-data-resources', '--no-data-resources',
'--output', output_dir, '--output', output_dir,
'--pg-map-output', map_output_path, '--pg-map-output', map_output_path,
......
...@@ -1243,23 +1243,18 @@ if (enable_java_templates) { ...@@ -1243,23 +1243,18 @@ if (enable_java_templates) {
]) ])
script = "//build/android/gyp/dex.py" script = "//build/android/gyp/dex.py"
depfile = "$target_gen_dir/$target_name.d" depfile = "$target_gen_dir/$target_name.d"
inputs = [ inputs = []
invoker.build_config,
]
outputs = [ outputs = [
invoker.output, invoker.output,
] ]
_rebased_output = rebase_path(invoker.output, root_build_dir) _rebased_output = rebase_path(invoker.output, root_build_dir)
_rebased_build_config =
rebase_path(invoker.build_config, root_build_dir)
args = [ args = [
"--depfile", "--depfile",
rebase_path(depfile, root_build_dir), rebase_path(depfile, root_build_dir),
"--dex-path", "--dex-path",
_rebased_output, _rebased_output,
"--classpath=@FileArg($_rebased_build_config:deps_info:javac_full_interface_classpath)",
"--sdk-jars=@FileArg($_rebased_build_config:android:sdk_jars)",
] ]
if (_proguard_enabled) { if (_proguard_enabled) {
...@@ -1430,7 +1425,7 @@ if (enable_java_templates) { ...@@ -1430,7 +1425,7 @@ if (enable_java_templates) {
# Turned off because of existing code which fails the assertion # Turned off because of existing code which fails the assertion
_enable_thread_annotations = false _enable_thread_annotations = false
_desugar = defined(invoker.desugar) && invoker.desugar _desugar = defined(invoker.supports_android) && invoker.supports_android
_emma_instrument = invoker.emma_instrument _emma_instrument = invoker.emma_instrument
_enable_bytecode_rewriter = _enable_bytecode_rewriter =
_enable_assert || _enable_custom_resources || _enable_thread_annotations _enable_assert || _enable_custom_resources || _enable_thread_annotations
...@@ -3362,9 +3357,6 @@ if (enable_java_templates) { ...@@ -3362,9 +3357,6 @@ if (enable_java_templates) {
_accumulated_public_deps += [ ":$_copy_system_library_target_name" ] _accumulated_public_deps += [ ":$_copy_system_library_target_name" ]
} else { } else {
_process_prebuilt_target_name = "${target_name}__process_prebuilt" _process_prebuilt_target_name = "${target_name}__process_prebuilt"
# Skip desugaring for debug builds using r8 due to binary size issue.
_desugar = _supports_android && !(is_java_debug && experimental_use_r8)
process_java_prebuilt(_process_prebuilt_target_name) { process_java_prebuilt(_process_prebuilt_target_name) {
forward_variables_from(invoker, forward_variables_from(invoker,
[ [
...@@ -3374,7 +3366,7 @@ if (enable_java_templates) { ...@@ -3374,7 +3366,7 @@ if (enable_java_templates) {
"jar_included_patterns", "jar_included_patterns",
]) ])
is_prebuilt = _is_prebuilt is_prebuilt = _is_prebuilt
desugar = _desugar supports_android = _supports_android
enable_build_hooks = _enable_build_hooks enable_build_hooks = _enable_build_hooks
enable_build_hooks_android = _enable_build_hooks_android enable_build_hooks_android = _enable_build_hooks_android
build_config = _build_config build_config = _build_config
...@@ -3397,9 +3389,7 @@ if (enable_java_templates) { ...@@ -3397,9 +3389,7 @@ if (enable_java_templates) {
dex("${target_name}__dex") { dex("${target_name}__dex") {
input_jars = [ _final_jar_path ] input_jars = [ _final_jar_path ]
output = _dex_path output = _dex_path
build_config = _build_config
deps = [ deps = [
":$_build_config_target_name",
":$_process_prebuilt_target_name", ":$_process_prebuilt_target_name",
] ]
} }
......
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