0

Android: Remove build logic for enable_jdk_library_desugaring

With Android M support dropped, we no longer require this feature.

Bug: 1366413
Change-Id: I40c05cdfaa9e55481f268589ec71f05400e5f179
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4076267
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Mohamed Heikal <mheikal@chromium.org>
Commit-Queue: Ben Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1079847}
This commit is contained in:
Andrew Grieve
2022-12-06 17:45:22 +00:00
committed by Chromium LUCI CQ
parent 6965b83a5e
commit a297b4db5e
34 changed files with 3 additions and 1223 deletions

22
DEPS

@ -2410,28 +2410,6 @@ deps = {
'dep_type': 'cipd',
},
'src/third_party/android_deps/libs/com_android_tools_desugar_jdk_libs': {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/com_android_tools_desugar_jdk_libs',
'version': 'version:2@1.1.5.cr1',
},
],
'condition': 'checkout_android',
'dep_type': 'cipd',
},
'src/third_party/android_deps/libs/com_android_tools_desugar_jdk_libs_configuration': {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/com_android_tools_desugar_jdk_libs_configuration',
'version': 'version:2@1.1.5.cr1',
},
],
'condition': 'checkout_android',
'dep_type': 'cipd',
},
'src/third_party/android_deps/libs/com_android_tools_layoutlib_layoutlib_api': {
'packages': [
{

@ -1522,7 +1522,6 @@ _GENERIC_PYDEPS_FILES = [
'build/android/gyp/create_test_apk_wrapper_script.pydeps',
'build/android/gyp/create_ui_locale_resources.pydeps',
'build/android/gyp/dex.pydeps',
'build/android/gyp/dex_jdk_libs.pydeps',
'build/android/gyp/dist_aar.pydeps',
'build/android/gyp/filter_zip.pydeps',
'build/android/gyp/flatc_java.pydeps',

@ -16,13 +16,6 @@ if (enable_java_templates) {
create_cache = true
}
if (enable_jdk_library_desugaring) {
dex_jdk_libs("all_jdk_libs") {
output = "$target_out_dir/$target_name.l8.dex"
min_sdk_version = default_min_sdk_version
}
}
generate_build_config_srcjar("build_config_gen") {
use_final_fields = false
}

@ -55,9 +55,6 @@ def _ParseArgs(args):
default='apk', help='Specify output format.')
parser.add_argument('--dex-file',
help='Path to the classes.dex to use')
parser.add_argument(
'--jdk-libs-dex-file',
help='Path to classes.dex created by dex_jdk_libs.py')
parser.add_argument('--uncompress-dex', action='store_true',
help='Store .dex files uncompressed in the APK')
parser.add_argument('--native-libs',
@ -446,13 +443,6 @@ def main(args):
dex_zip.read(dex),
compress=not options.uncompress_dex)
if options.jdk_libs_dex_file:
with open(options.jdk_libs_dex_file, 'rb') as dex_file_obj:
add_to_zip(
apk_dex_dir + 'classes{}.dex'.format(max_dex_number + 1),
dex_file_obj.read(),
compress=not options.uncompress_dex)
# 4. Native libraries.
logging.debug('Adding lib/')
_AddFiles(out_apk, libs_to_add)

@ -105,8 +105,6 @@ def _ParseArgs(args):
'--bootclasspath',
action='append',
help='GN-list of bootclasspath. Needed for --desugar')
parser.add_argument(
'--desugar-jdk-libs-json', help='Path to desugar_jdk_libs.json.')
parser.add_argument('--show-desugar-default-interface-warnings',
action='store_true',
help='Enable desugaring warnings.')
@ -509,9 +507,6 @@ def main(args):
input_paths += options.bootclasspath
if options.desugar_jdk_libs_json:
dex_cmd += ['--desugared-lib', options.desugar_jdk_libs_json]
input_paths += [options.desugar_jdk_libs_json]
if options.assertion_handler:
dex_cmd += ['--force-assertions-handler:' + options.assertion_handler]
if options.force_enable_assertions:

@ -1,93 +0,0 @@
#!/usr/bin/env python3
#
# Copyright 2020 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import os
import shutil
import subprocess
import sys
import zipfile
from util import build_utils
def _ParseArgs(args):
args = build_utils.ExpandFileArgs(args)
parser = argparse.ArgumentParser()
parser.add_argument('--output', required=True, help='Dex output path.')
parser.add_argument('--r8-path', required=True, help='Path to R8 jar.')
parser.add_argument(
'--desugar-jdk-libs-json', help='Path to desugar_jdk_libs.json.')
parser.add_argument(
'--desugar-jdk-libs-jar', help='Path to desugar_jdk_libs.jar.')
parser.add_argument('--desugar-jdk-libs-configuration-jar',
help='Path to desugar_jdk_libs_configuration.jar.')
parser.add_argument('--min-api', help='minSdkVersion', required=True)
parser.add_argument('--warnings-as-errors',
action='store_true',
help='Treat all warnings as errors.')
options = parser.parse_args(args)
return options
def DexJdkLibJar(r8_path,
min_api,
desugar_jdk_libs_json,
desugar_jdk_libs_jar,
desugar_jdk_libs_configuration_jar,
output,
warnings_as_errors,
config_paths=None):
# TODO(agrieve): Spews a lot of stderr about missing classes.
with build_utils.TempDir() as tmp_dir:
cmd = build_utils.JavaCmd(warnings_as_errors) + [
'-cp',
r8_path,
'com.android.tools.r8.L8',
'--min-api',
min_api,
'--lib',
build_utils.JAVA_HOME,
'--desugared-lib',
desugar_jdk_libs_json,
]
# If no desugaring is required, no keep rules are generated, and the keep
# file will not be created.
if config_paths is not None:
for path in config_paths:
cmd += ['--pg-conf', path]
cmd += [
'--output', tmp_dir, desugar_jdk_libs_jar,
desugar_jdk_libs_configuration_jar
]
build_utils.CheckOutput(cmd,
print_stdout=False,
fail_on_output=warnings_as_errors)
if os.path.exists(os.path.join(tmp_dir, 'classes2.dex')):
raise Exception('Achievement unlocked: desugar_jdk_libs is multidex!')
# classes.dex might not exists if the "desugar_jdk_libs_jar" is not used
# at all.
if os.path.exists(os.path.join(tmp_dir, 'classes.dex')):
shutil.move(os.path.join(tmp_dir, 'classes.dex'), output)
return True
return False
def main(args):
options = _ParseArgs(args)
DexJdkLibJar(options.r8_path, options.min_api, options.desugar_jdk_libs_json,
options.desugar_jdk_libs_jar,
options.desugar_jdk_libs_configuration_jar, options.output,
options.warnings_as_errors)
if __name__ == '__main__':
main(sys.argv[1:])

@ -1,6 +0,0 @@
# Generated by running:
# build/print_python_deps.py --root build/android/gyp --output build/android/gyp/dex_jdk_libs.pydeps build/android/gyp/dex_jdk_libs.py
../../gn_helpers.py
dex_jdk_libs.py
util/__init__.py
util/build_utils.py

@ -14,7 +14,6 @@ import sys
import zipfile
import dex
import dex_jdk_libs
from util import build_utils
from util import diff_utils
@ -34,16 +33,10 @@ def _ParseOptions():
parser.add_argument('--r8-path',
required=True,
help='Path to the R8.jar to use.')
parser.add_argument(
'--desugar-jdk-libs-json', help='Path to desugar_jdk_libs.json.')
parser.add_argument('--input-paths',
action='append',
required=True,
help='GN-list of .jar files to optimize.')
parser.add_argument('--desugar-jdk-libs-jar',
help='Path to desugar_jdk_libs.jar.')
parser.add_argument('--desugar-jdk-libs-configuration-jar',
help='Path to desugar_jdk_libs_configuration.jar.')
parser.add_argument('--output-path', help='Path to the generated .jar file.')
parser.add_argument(
'--proguard-configs',
@ -193,18 +186,12 @@ class _SplitContext:
self.staging_dir = os.path.join(work_dir, name)
os.mkdir(self.staging_dir)
def CreateOutput(self, has_imported_lib=False, keep_rule_output=None):
def CreateOutput(self):
found_files = build_utils.FindInDirectory(self.staging_dir)
if not found_files:
raise Exception('Missing dex outputs in {}'.format(self.staging_dir))
if self.final_output_path.endswith('.dex'):
if has_imported_lib:
raise Exception(
'Trying to create a single .dex file, but a dependency requires '
'JDK Library Desugaring (which necessitates a second file).'
'Refer to %s to see what desugaring was required' %
keep_rule_output)
if len(found_files) != 1:
raise Exception('Expected exactly 1 dex file output, found: {}'.format(
'\t'.join(found_files)))
@ -336,14 +323,6 @@ def _OptimizeWithR8(options,
if not options.warnings_as_errors:
cmd += ['--map-diagnostics', 'error', 'warning']
if options.desugar_jdk_libs_json:
cmd += [
'--desugared-lib',
options.desugar_jdk_libs_json,
'--desugared-lib-pg-conf-output',
options.desugared_library_keep_rule_output,
]
if options.min_api:
cmd += ['--min-api', options.min_api]
@ -393,39 +372,8 @@ def _OptimizeWithR8(options,
'https://chromium.googlesource.com/chromium/src/+/HEAD/build/'
'android/docs/java_optimization.md#Debugging-common-failures') from e
base_has_imported_lib = False
if options.desugar_jdk_libs_json:
logging.debug('Running L8')
existing_files = build_utils.FindInDirectory(base_context.staging_dir)
jdk_dex_output = os.path.join(base_context.staging_dir,
'classes%d.dex' % (len(existing_files) + 1))
# Use -applymapping to avoid name collisions.
l8_dynamic_config_path = os.path.join(tmp_dir, 'l8_dynamic_config.flags')
with open(l8_dynamic_config_path, 'w') as f:
f.write("-applymapping '{}'\n".format(tmp_mapping_path))
# Pass the dynamic config so that obfuscation options are picked up.
l8_config_paths = [dynamic_config_path, l8_dynamic_config_path]
if os.path.exists(options.desugared_library_keep_rule_output):
l8_config_paths.append(options.desugared_library_keep_rule_output)
base_has_imported_lib = dex_jdk_libs.DexJdkLibJar(
options.r8_path, options.min_api, options.desugar_jdk_libs_json,
options.desugar_jdk_libs_jar,
options.desugar_jdk_libs_configuration_jar, jdk_dex_output,
options.warnings_as_errors, l8_config_paths)
if int(options.min_api) >= 24 and base_has_imported_lib:
with open(jdk_dex_output, 'rb') as f:
dexfile = dex_parser.DexFile(bytearray(f.read()))
for m in dexfile.IterMethodSignatureParts():
print('{}#{}'.format(m[0], m[2]))
assert False, (
'Desugared JDK libs are disabled on Monochrome and newer - see '
'crbug.com/1159984 for details, and see above list for desugared '
'classes and methods.')
logging.debug('Collecting ouputs')
base_context.CreateOutput(base_has_imported_lib,
options.desugared_library_keep_rule_output)
base_context.CreateOutput()
for split_context in split_contexts_by_name.values():
if split_context is not base_context:
split_context.CreateOutput()

@ -6,7 +6,6 @@
../pylib/dex/__init__.py
../pylib/dex/dex_parser.py
dex.py
dex_jdk_libs.py
proguard.py
util/__init__.py
util/build_utils.py

@ -286,10 +286,6 @@ if (is_android || is_chromeos) {
# Enables JNI multiplexing to reduce JNI native methods overhead.
enable_jni_multiplexing = false
# Enables Java library desugaring.
# This will cause an extra classes.dex file to appear in every apk.
enable_jdk_library_desugaring = true
# Enables trace event injection on Android views with bytecode rewriting.
# This adds an additional step on android_app_bundle_module targets that
# adds trace events to some methods in android.view.View subclasses.

@ -98,9 +98,6 @@ _r8_path = "//third_party/r8/lib/r8.jar"
# and unnecessarily slows down all bots.
_d8_path = "//third_party/r8/d8/lib/r8.jar"
_custom_d8_path = "//third_party/r8/custom_d8.jar"
_desugar_jdk_libs_json = "//third_party/r8/desugar_jdk_libs.json"
_desugar_jdk_libs_jar = "//third_party/android_deps/libs/com_android_tools_desugar_jdk_libs/desugar_jdk_libs-1.1.5.jar"
_desugar_jdk_libs_configuration_jar = "//third_party/android_deps/libs/com_android_tools_desugar_jdk_libs_configuration/desugar_jdk_libs_configuration-1.1.5.jar"
_robolectric_jar_path =
"//third_party/robolectric/lib/android-all-12-robolectric-7732740.jar"
_default_lint_jar_path = "//third_party/android_build_tools/lint/lint.jar"
@ -1165,12 +1162,6 @@ if (enable_java_templates) {
_mapping_path = "${invoker.output_path}.mapping"
}
_enable_jdk_library_desugaring = enable_jdk_library_desugaring
if (defined(invoker.supports_jdk_library_desugaring) &&
!invoker.supports_jdk_library_desugaring) {
_enable_jdk_library_desugaring = false
}
_rebased_build_config = rebase_path(invoker.build_config, root_build_dir)
_args = [
"--mapping-output",
@ -1254,31 +1245,6 @@ if (enable_java_templates) {
_args += [ "--disable-checks" ]
}
if (_enable_jdk_library_desugaring) {
_args += [
"--desugar-jdk-libs-json",
rebase_path(_desugar_jdk_libs_json, root_build_dir),
]
_inputs += [ _desugar_jdk_libs_json ]
_args += [
"--desugar-jdk-libs-jar",
rebase_path(_desugar_jdk_libs_jar, root_build_dir),
"--desugar-jdk-libs-configuration-jar",
rebase_path(_desugar_jdk_libs_configuration_jar, root_build_dir),
]
_inputs += [
_desugar_jdk_libs_jar,
_desugar_jdk_libs_configuration_jar,
]
_desugared_library_keep_rule_output_path =
"$target_gen_dir/$target_name.desugared_library_keep_rules.flags"
_args += [
"--desugared-library-keep-rule-output",
rebase_path(_desugared_library_keep_rule_output_path, root_build_dir),
]
}
_ignore_desugar_missing_deps =
defined(invoker.ignore_desugar_missing_deps) &&
invoker.ignore_desugar_missing_deps
@ -1510,7 +1476,6 @@ if (enable_java_templates) {
"proguard_enable_obfuscation",
"proguard_mapping_path",
"proguard_sourcefile_suffix",
"supports_jdk_library_desugaring",
"top_target_name",
])
inputs = []
@ -1677,14 +1642,6 @@ if (enable_java_templates) {
if (_enable_desugar) {
args += [ "--desugar" ]
# Passing the flag for dex merging causes invalid dex files to be created.
if (enable_jdk_library_desugaring && !_is_dex_merging) {
inputs += [ _desugar_jdk_libs_json ]
args += [
"--desugar-jdk-libs-json",
rebase_path(_desugar_jdk_libs_json, root_build_dir),
]
}
_ignore_desugar_missing_deps =
defined(invoker.ignore_desugar_missing_deps) &&
invoker.ignore_desugar_missing_deps
@ -1745,38 +1702,6 @@ if (enable_java_templates) {
}
}
# Variables
# output: Path to output ".l8.dex".
# min_sdk_version: The minimum Android SDK version this target supports.
template("dex_jdk_libs") {
action_with_pydeps(target_name) {
script = "//build/android/gyp/dex_jdk_libs.py"
inputs = [
_r8_path,
_desugar_jdk_libs_json,
_desugar_jdk_libs_jar,
_desugar_jdk_libs_configuration_jar,
]
outputs = [ invoker.output ]
args = [
"--r8-path",
rebase_path(_r8_path, root_build_dir),
"--desugar-jdk-libs-json",
rebase_path(_desugar_jdk_libs_json, root_build_dir),
"--desugar-jdk-libs-jar",
rebase_path(_desugar_jdk_libs_jar, root_build_dir),
"--desugar-jdk-libs-configuration-jar",
rebase_path(_desugar_jdk_libs_configuration_jar, root_build_dir),
"--output",
rebase_path(invoker.output, root_build_dir),
"--min-api=${invoker.min_sdk_version}",
]
if (treat_warnings_as_errors) {
args += [ "--warnings-as-errors" ]
}
}
}
template("jacoco_instr") {
action_with_pydeps(target_name) {
forward_variables_from(invoker,
@ -2683,7 +2608,6 @@ if (enable_java_templates) {
# and assets is consistent with the given expectation file.
# expected_libs_and_assets_base: Treat expected_libs_and_assets as a diff
# with this file as the base.
# jdk_libs_dex: Path to classes.dex for desugar_jdk_libs.
# packaged_resources_path: Path to .ap_ to use.
# output_apk_path: Output path for the generated .apk.
# min_sdk_version: The minimum Android SDK version this target supports.
@ -2792,13 +2716,6 @@ if (enable_java_templates) {
rebase_path(invoker.dex_path, root_build_dir),
]
}
if (defined(invoker.jdk_libs_dex)) {
_inputs += [ invoker.jdk_libs_dex ]
_args += [
"--jdk-libs-dex-file",
rebase_path(invoker.jdk_libs_dex, root_build_dir),
]
}
if ((defined(invoker.loadable_modules) && invoker.loadable_modules != []) ||
defined(invoker.native_libs_filearg) ||
_native_lib_placeholders != []) {
@ -4155,8 +4072,6 @@ template("create_android_app_bundle_module") {
_rebased_build_config = rebase_path(invoker.build_config, root_build_dir)
_rebased_native_libraries_config =
rebase_path(invoker.native_libraries_config, root_build_dir)
_proguard_enabled =
defined(invoker.proguard_enabled) && invoker.proguard_enabled
forward_variables_from(invoker, TESTONLY_AND_VISIBILITY)
_deps = invoker.deps
@ -4220,20 +4135,6 @@ template("create_android_app_bundle_module") {
_args += [ "--dex-file=@FileArg($_rebased_build_config:final_dex:path)" ]
}
# The library is imported via proguard when proguard is enabled.
if (!_proguard_enabled && enable_jdk_library_desugaring &&
invoker.module_name == "base") {
_all_jdk_libs = "//build/android:all_jdk_libs"
_deps += [ _all_jdk_libs ]
_jdk_libs_dex =
get_label_info(_all_jdk_libs, "target_out_dir") + "/all_jdk_libs.l8.dex"
_inputs += [ _jdk_libs_dex ]
_args += [
"--jdk-libs-dex-file",
rebase_path(_jdk_libs_dex, root_build_dir),
]
}
if (treat_warnings_as_errors) {
_args += [ "--warnings-as-errors" ]
}

@ -1908,9 +1908,6 @@ if (enable_java_templates && is_android) {
# per-target dex steps are emitted here since this is using jar files
# rather than dex files.
ignore_desugar_missing_deps = true
# When trying to build a stand-alone .dex, don't add in jdk_libs_dex.
supports_jdk_library_desugaring = false
} else {
_rebased_build_config = rebase_path(_build_config, root_build_dir)
input_dex_filearg =
@ -3260,14 +3257,6 @@ if (enable_java_templates && is_android) {
# may include .so files extracted by __unpack_aar targets.
deps = _invoker_deps + [ ":$_build_config_target" ]
if ((!_proguard_enabled || _incremental_apk) &&
enable_jdk_library_desugaring && !_omit_dex) {
_all_jdk_libs = "//build/android:all_jdk_libs"
deps += [ _all_jdk_libs ]
jdk_libs_dex = get_label_info(_all_jdk_libs, "target_out_dir") +
"/all_jdk_libs.l8.dex"
}
if (_incremental_apk) {
_dex_target = "//build/android/incremental_install:apk_dex"
@ -5068,7 +5057,6 @@ if (enable_java_templates && is_android) {
"is_multi_abi",
"min_sdk_version",
"uncompress_dex",
"proguard_enabled",
])
module_name = _module.name
build_config = _module_build_config

@ -38,8 +38,6 @@
"libs/com_android_support_versionedparcelable",
"libs/com_android_support_viewpager",
"libs/com_android_tools_common",
"libs/com_android_tools_desugar_jdk_libs",
"libs/com_android_tools_desugar_jdk_libs_configuration",
"libs/com_android_tools_layoutlib_layoutlib_api",
"libs/com_android_tools_sdk_common",
"libs/com_github_ben_manes_caffeine_caffeine",

@ -110,12 +110,6 @@ dependencies {
compile 'javax.annotation:jsr250-api:1.0'
compile 'javax.inject:javax.inject:1'
// Used by R8 to desugar library functions.
// See instructions in //third_party/r8/README.chromium for how to
// update desugar_jdk_libs.json (needed when changing this version).
compile 'com.android.tools:desugar_jdk_libs:1.1.5'
compile 'com.android.tools:desugar_jdk_libs_configuration:1.1.5'
compile 'io.grpc:grpc-binder:1.49.0'
compile 'io.grpc:grpc-protobuf-lite:1.49.0'
compile 'io.grpc:grpc-stub:1.49.0'

@ -1,16 +0,0 @@
# Copyright 2021 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
create {
source {
script { name: "fetch.py" }
}
}
upload {
pkg_prefix: "chromium/third_party/android_deps/libs"
universal: true
}

@ -1,78 +0,0 @@
#!/usr/bin/env python3
# Copyright 2021 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This is generated, do not edit. Update BuildConfigGenerator.groovy and
# 3ppFetch.template instead.
import argparse
import json
import os
import re
import urllib.request
_REPO_URL = 'https://dl.google.com/dl/android/maven2'
_GROUP_NAME = 'com/android/tools'
_MODULE_NAME = 'desugar_jdk_libs'
_FILE_EXT = 'jar'
_OVERRIDE_LATEST = None
_PATCH_VERSION = 'cr1'
def do_latest():
if _OVERRIDE_LATEST is not None:
print(_OVERRIDE_LATEST + f'.{_PATCH_VERSION}')
return
maven_metadata_url = '{}/{}/{}/maven-metadata.xml'.format(
_REPO_URL, _GROUP_NAME, _MODULE_NAME)
metadata = urllib.request.urlopen(maven_metadata_url).read().decode(
'utf-8')
# Do not parse xml with the python included parser since it is susceptible
# to maliciously crafted xmls. Only use regular expression parsing to be
# safe. RE should be enough to handle what we need to extract.
match = re.search('<latest>([^<]+)</latest>', metadata)
if match:
latest = match.group(1)
else:
# if no latest info was found just hope the versions are sorted and the
# last one is the latest (as is commonly the case).
latest = re.findall('<version>([^<]+)</version>', metadata)[-1]
print(latest + f'.{_PATCH_VERSION}')
def get_download_url(version):
# Remove the patch version when getting the download url
version_no_patch, patch = version.rsplit('.', 1)
if patch.startswith('cr'):
version = version_no_patch
file_url = '{0}/{1}/{2}/{3}/{2}-{3}.{4}'.format(_REPO_URL, _GROUP_NAME,
_MODULE_NAME, version,
_FILE_EXT)
file_name = file_url.rsplit('/', 1)[-1]
partial_manifest = {
'url': [file_url],
'name': [file_name],
'ext': '.' + _FILE_EXT,
}
print(json.dumps(partial_manifest))
def main():
ap = argparse.ArgumentParser()
sub = ap.add_subparsers()
latest = sub.add_parser('latest')
latest.set_defaults(func=lambda _opts: do_latest())
download = sub.add_parser('get_url')
download.set_defaults(
func=lambda _opts: get_download_url(os.environ['_3PP_VERSION']))
opts = ap.parse_args()
opts.func(opts)
if __name__ == '__main__':
main()

@ -1,347 +0,0 @@
The GNU General Public License (GPL)
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your freedom to share
and change it. By contrast, the GNU General Public License is intended to
guarantee your freedom to share and change free software--to make sure the
software is free for all its users. This General Public License applies to
most of the Free Software Foundation's software and to any other program whose
authors commit to using it. (Some other Free Software Foundation software is
covered by the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not price. Our
General Public Licenses are designed to make sure that you have the freedom to
distribute copies of free software (and charge for this service if you wish),
that you receive source code or can get it if you want it, that you can change
the software or use pieces of it in new free programs; and that you know you
can do these things.
To protect your rights, we need to make restrictions that forbid anyone to deny
you these rights or to ask you to surrender the rights. These restrictions
translate to certain responsibilities for you if you distribute copies of the
software, or if you modify it.
For example, if you distribute copies of such a program, whether gratis or for
a fee, you must give the recipients all the rights that you have. You must
make sure that they, too, receive or can get the source code. And you must
show them these terms so they know their rights.
We protect your rights with two steps: (1) copyright the software, and (2)
offer you this license which gives you legal permission to copy, distribute
and/or modify the software.
Also, for each author's protection and ours, we want to make certain that
everyone understands that there is no warranty for this free software. If the
software is modified by someone else and passed on, we want its recipients to
know that what they have is not the original, so that any problems introduced
by others will not reflect on the original authors' reputations.
Finally, any free program is threatened constantly by software patents. We
wish to avoid the danger that redistributors of a free program will
individually obtain patent licenses, in effect making the program proprietary.
To prevent this, we have made it clear that any patent must be licensed for
everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and modification
follow.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains a notice
placed by the copyright holder saying it may be distributed under the terms of
this General Public License. The "Program", below, refers to any such program
or work, and a "work based on the Program" means either the Program or any
derivative work under copyright law: that is to say, a work containing the
Program or a portion of it, either verbatim or with modifications and/or
translated into another language. (Hereinafter, translation is included
without limitation in the term "modification".) Each licensee is addressed as
"you".
Activities other than copying, distribution and modification are not covered by
this License; they are outside its scope. The act of running the Program is
not restricted, and the output from the Program is covered only if its contents
constitute a work based on the Program (independent of having been made by
running the Program). Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's source code as
you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and
disclaimer of warranty; keep intact all the notices that refer to this License
and to the absence of any warranty; and give any other recipients of the
Program a copy of this License along with the Program.
You may charge a fee for the physical act of transferring a copy, and you may
at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion of it, thus
forming a work based on the Program, and copy and distribute such modifications
or work under the terms of Section 1 above, provided that you also meet all of
these conditions:
a) You must cause the modified files to carry prominent notices stating
that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in whole or
in part contains or is derived from the Program or any part thereof, to be
licensed as a whole at no charge to all third parties under the terms of
this License.
c) If the modified program normally reads commands interactively when run,
you must cause it, when started running for such interactive use in the
most ordinary way, to print or display an announcement including an
appropriate copyright notice and a notice that there is no warranty (or
else, saying that you provide a warranty) and that users may redistribute
the program under these conditions, and telling the user how to view a copy
of this License. (Exception: if the Program itself is interactive but does
not normally print such an announcement, your work based on the Program is
not required to print an announcement.)
These requirements apply to the modified work as a whole. If identifiable
sections of that work are not derived from the Program, and can be reasonably
considered independent and separate works in themselves, then this License, and
its terms, do not apply to those sections when you distribute them as separate
works. But when you distribute the same sections as part of a whole which is a
work based on the Program, the distribution of the whole must be on the terms
of this License, whose permissions for other licensees extend to the entire
whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest your
rights to work written entirely by you; rather, the intent is to exercise the
right to control the distribution of derivative or collective works based on
the Program.
In addition, mere aggregation of another work not based on the Program with the
Program (or with a work based on the Program) on a volume of a storage or
distribution medium does not bring the other work under the scope of this
License.
3. You may copy and distribute the Program (or a work based on it, under
Section 2) in object code or executable form under the terms of Sections 1 and
2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable source
code, which must be distributed under the terms of Sections 1 and 2 above
on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three years, to
give any third party, for a charge no more than your cost of physically
performing source distribution, a complete machine-readable copy of the
corresponding source code, to be distributed under the terms of Sections 1
and 2 above on a medium customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer to
distribute corresponding source code. (This alternative is allowed only
for noncommercial distribution and only if you received the program in
object code or executable form with such an offer, in accord with
Subsection b above.)
The source code for a work means the preferred form of the work for making
modifications to it. For an executable work, complete source code means all
the source code for all modules it contains, plus any associated interface
definition files, plus the scripts used to control compilation and installation
of the executable. However, as a special exception, the source code
distributed need not include anything that is normally distributed (in either
source or binary form) with the major components (compiler, kernel, and so on)
of the operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the source
code from the same place counts as distribution of the source code, even though
third parties are not compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program except as
expressly provided under this License. Any attempt otherwise to copy, modify,
sublicense or distribute the Program is void, and will automatically terminate
your rights under this License. However, parties who have received copies, or
rights, from you under this License will not have their licenses terminated so
long as such parties remain in full compliance.
5. You are not required to accept this License, since you have not signed it.
However, nothing else grants you permission to modify or distribute the Program
or its derivative works. These actions are prohibited by law if you do not
accept this License. Therefore, by modifying or distributing the Program (or
any work based on the Program), you indicate your acceptance of this License to
do so, and all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the Program),
the recipient automatically receives a license from the original licensor to
copy, distribute or modify the Program subject to these terms and conditions.
You may not impose any further restrictions on the recipients' exercise of the
rights granted herein. You are not responsible for enforcing compliance by
third parties to this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues), conditions
are imposed on you (whether by court order, agreement or otherwise) that
contradict the conditions of this License, they do not excuse you from the
conditions of this License. If you cannot distribute so as to satisfy
simultaneously your obligations under this License and any other pertinent
obligations, then as a consequence you may not distribute the Program at all.
For example, if a patent license would not permit royalty-free redistribution
of the Program by all those who receive copies directly or indirectly through
you, then the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply and
the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents or
other property right claims or to contest validity of any such claims; this
section has the sole purpose of protecting the integrity of the free software
distribution system, which is implemented by public license practices. Many
people have made generous contributions to the wide range of software
distributed through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing to
distribute software through any other system and a licensee cannot impose that
choice.
This section is intended to make thoroughly clear what is believed to be a
consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in certain
countries either by patents or by copyrighted interfaces, the original
copyright holder who places the Program under this License may add an explicit
geographical distribution limitation excluding those countries, so that
distribution is permitted only in or among countries not thus excluded. In
such case, this License incorporates the limitation as if written in the body
of this License.
9. The Free Software Foundation may publish revised and/or new versions of the
General Public License from time to time. Such new versions will be similar in
spirit to the present version, but may differ in detail to address new problems
or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any later
version", you have the option of following the terms and conditions either of
that version or of any later version published by the Free Software Foundation.
If the Program does not specify a version number of this License, you may
choose any version ever published by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free programs
whose distribution conditions are different, write to the author to ask for
permission. For software which is copyrighted by the Free Software Foundation,
write to the Free Software Foundation; we sometimes make exceptions for this.
Our decision will be guided by the two goals of preserving the free status of
all derivatives of our free software and of promoting the sharing and reuse of
software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible
use to the public, the best way to achieve this is to make it free software
which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach
them to the start of each source file to most effectively convey the exclusion
of warranty; and each file should have at least the "copyright" line and a
pointer to where the full notice is found.
One line to give the program's name and a brief idea of what it does.
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this when it
starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author Gnomovision comes
with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free
software, and you are welcome to redistribute it under certain conditions;
type 'show c' for details.
The hypothetical commands 'show w' and 'show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may be
called something other than 'show w' and 'show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your school,
if any, to sign a "copyright disclaimer" for the program, if necessary. Here
is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
'Gnomovision' (which makes passes at compilers) written by James Hacker.
signature of Ty Coon, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General Public
License instead of this License.
"CLASSPATH" EXCEPTION TO THE GPL
Certain source files distributed by Oracle America and/or its affiliates are
subject to the following clarification and special exception to the GPL, but
only where Oracle has expressly included in the particular source file's header
the words "Oracle designates this particular file as subject to the "Classpath"
exception as provided by Oracle in the LICENSE file that accompanied this code."
Linking this library statically or dynamically with other modules is making
a combined work based on this library. Thus, the terms and conditions of
the GNU General Public License cover the whole combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent modules,
and to copy and distribute the resulting executable under terms of your
choice, provided that you also meet, for each linked independent module,
the terms and conditions of the license of that module. An independent
module is a module which is not derived from or based on this library. If
you modify this library, you may extend this exception to your version of
the library, but you are not obligated to do so. If you do not wish to do
so, delete this exception statement from your version.

@ -1 +0,0 @@
file://third_party/android_deps/OWNERS

@ -1,14 +0,0 @@
Name: Small subset of OpenJDK libraries
Short Name: desugar_jdk_libs
URL: https://github.com/google/desugar_jdk_libs
Version: 1.1.5
License: GPL v2 with the classpath exception
License File: LICENSE
CPEPrefix: unknown
Security Critical: yes
Description:
This project contains a small subset of OpenJDK libraries simplified for use on older runtimes. This is not an official Google product.
Local Modifications:
No modifications.

@ -1,10 +0,0 @@
# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# To create CIPD package run the following command.
# cipd create --pkg-def cipd.yaml -tag version:2@1.1.5.cr1
package: chromium/third_party/android_deps/libs/com_android_tools_desugar_jdk_libs
description: "Small subset of OpenJDK libraries"
data:
- file: desugar_jdk_libs-1.1.5.jar

@ -1,16 +0,0 @@
# Copyright 2021 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
create {
source {
script { name: "fetch.py" }
}
}
upload {
pkg_prefix: "chromium/third_party/android_deps/libs"
universal: true
}

@ -1,78 +0,0 @@
#!/usr/bin/env python3
# Copyright 2021 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This is generated, do not edit. Update BuildConfigGenerator.groovy and
# 3ppFetch.template instead.
import argparse
import json
import os
import re
import urllib.request
_REPO_URL = 'https://dl.google.com/dl/android/maven2'
_GROUP_NAME = 'com/android/tools'
_MODULE_NAME = 'desugar_jdk_libs_configuration'
_FILE_EXT = 'jar'
_OVERRIDE_LATEST = None
_PATCH_VERSION = 'cr1'
def do_latest():
if _OVERRIDE_LATEST is not None:
print(_OVERRIDE_LATEST + f'.{_PATCH_VERSION}')
return
maven_metadata_url = '{}/{}/{}/maven-metadata.xml'.format(
_REPO_URL, _GROUP_NAME, _MODULE_NAME)
metadata = urllib.request.urlopen(maven_metadata_url).read().decode(
'utf-8')
# Do not parse xml with the python included parser since it is susceptible
# to maliciously crafted xmls. Only use regular expression parsing to be
# safe. RE should be enough to handle what we need to extract.
match = re.search('<latest>([^<]+)</latest>', metadata)
if match:
latest = match.group(1)
else:
# if no latest info was found just hope the versions are sorted and the
# last one is the latest (as is commonly the case).
latest = re.findall('<version>([^<]+)</version>', metadata)[-1]
print(latest + f'.{_PATCH_VERSION}')
def get_download_url(version):
# Remove the patch version when getting the download url
version_no_patch, patch = version.rsplit('.', 1)
if patch.startswith('cr'):
version = version_no_patch
file_url = '{0}/{1}/{2}/{3}/{2}-{3}.{4}'.format(_REPO_URL, _GROUP_NAME,
_MODULE_NAME, version,
_FILE_EXT)
file_name = file_url.rsplit('/', 1)[-1]
partial_manifest = {
'url': [file_url],
'name': [file_name],
'ext': '.' + _FILE_EXT,
}
print(json.dumps(partial_manifest))
def main():
ap = argparse.ArgumentParser()
sub = ap.add_subparsers()
latest = sub.add_parser('latest')
latest.set_defaults(func=lambda _opts: do_latest())
download = sub.add_parser('get_url')
download.set_defaults(
func=lambda _opts: get_download_url(os.environ['_3PP_VERSION']))
opts = ap.parse_args()
opts.func(opts)
if __name__ == '__main__':
main()

@ -1,27 +0,0 @@
Copyright (c) 2016, the R8 project authors.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

@ -1 +0,0 @@
file://third_party/android_deps/OWNERS

@ -1,14 +0,0 @@
Name: D8 configuration to desugar desugar_jdk_libs
Short Name: desugar_jdk_libs_configuration
URL: http://r8.googlesource.com/r8
Version: 1.1.5
License: BSD 3-Clause
License File: LICENSE
CPEPrefix: unknown
Security Critical: yes
Description:
D8 configuration to desugar desugar_jdk_libs.
Local Modifications:
No modifications.

@ -1,10 +0,0 @@
# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# To create CIPD package run the following command.
# cipd create --pkg-def cipd.yaml -tag version:2@1.1.5.cr1
package: chromium/third_party/android_deps/libs/com_android_tools_desugar_jdk_libs_configuration
description: "D8 configuration to desugar desugar_jdk_libs"
data:
- file: desugar_jdk_libs_configuration-1.1.5.jar

@ -20,12 +20,6 @@ Directory overview:
* 3pp
* Contains code for 3pp-linux-amd64-packager to package and upload new
versions of r8.
* desugar_jdk_libs.json
* Configuration for Java library desugaring.
* Taken from
//third_party/android_deps/libs/com_android_tools_desugar_jdk_libs_configuration/
inside the jar file, in META-INF/desugar/d8/desugar.json. License is also
BSD 3-Clause (the r8 version).
* print_version.sh
* Print the R8 commit for the current version.sh.
@ -33,18 +27,6 @@ Local Modifications:
* Refer to commit descriptions within "3pp/patches" directory.
* Added "playground" directory for quick "how does this optimize" tests.
* Added "dump_inputs.py" and "print_version.sh" scripts.
* desugar_jdk_libs.json:
* Removed references to ConcurrentHashMap to avoid bloat
* Removed references to TimeZone#getTimeZone to avoid desugaring of
an overload that does not require desugaring
* Removed references to synchronizedMap and synchronizedSortedMap because the
desugared version accesses the "dark greylisted"
SynchronizedCollection.mutex field, which caused modal dialogs to appear on
Android P instrumentation tests. https://crbug.com/1256614
* Removed references to ThreadLocalRandom to avoid streams APIs being pulled
in unnecessarily. https://crbug.com/1280841
* Removed references to java.time and associated classes.
https://crbug.com/1301349
* Added "java/src/org/chromium/build/CustomD8.java", custom_d8.jar, and BUILD.gn.
* Used in "build/android/gyp/dex.py" to enable desugar dependencies.
@ -95,19 +77,6 @@ cp r8.jar $CHROMIUM_SRC/third_party/r8/lib/r8.jar
cd $CHROMIUM_SRC
java -cp third_party/r8/lib/r8.jar com.android.tools.r8.BackportedMethodList --min-api 16 > third_party/r8/backported_methods.txt
* Update instructions for desugar_jdk_libs.json:
unzip -p third_party/android_deps/libs/com_android_tools_desugar_jdk_libs_configuration/*.jar META-INF/desugar/d8/desugar.json > third_party/r8/desugar_jdk_libs.json
* Remove all mentions of:
* ConcurrentHashMap
* TimeZone#getTimeZone
* Collections#synchronizedMap
* Collections#synchronizedSortedMap
* ThreadLocalRandom
* Don't forget to remove trailing commas where applicable.
* Update //build/config/android/internal_rules.gni to point at the new .jar files:
* desugar_jdk_libs-1.1.1.jar
* desugar_jdk_libs_configuration-1.1.1.jar
How to file bugs against R8:
* Copy & paste the failing ninja command (starts with proguard.py), and add --dump-inputs.
* This also works for dex.py, it produces d8inputs.zip

@ -1,215 +0,0 @@
{
"configuration_format_version": 3,
"group_id" : "com.tools.android",
"artifact_id" : "desugar_jdk_libs",
"version": "1.1.5",
"required_compilation_api_level": 26,
"synthesized_library_classes_package_prefix": "j$.",
"support_all_callbacks_from_library": true,
"common_flags": [
{
"api_level_below_or_equal": 25,
"wrapper_conversion": [
]
},
{
"api_level_below_or_equal": 23,
"wrapper_conversion": [
"java.util.PrimitiveIterator$OfDouble",
"java.util.PrimitiveIterator$OfInt",
"java.util.PrimitiveIterator$OfLong",
"java.util.Spliterator",
"java.util.Spliterator$OfDouble",
"java.util.Spliterator$OfInt",
"java.util.Spliterator$OfLong",
"java.util.Spliterator$OfPrimitive",
"java.util.function.BiConsumer",
"java.util.function.BiFunction",
"java.util.function.BiPredicate",
"java.util.function.BinaryOperator",
"java.util.function.Consumer",
"java.util.function.DoubleBinaryOperator",
"java.util.function.DoubleConsumer",
"java.util.function.DoubleFunction",
"java.util.function.DoublePredicate",
"java.util.function.DoubleToIntFunction",
"java.util.function.DoubleToLongFunction",
"java.util.function.DoubleUnaryOperator",
"java.util.function.Function",
"java.util.function.IntBinaryOperator",
"java.util.function.IntConsumer",
"java.util.function.IntFunction",
"java.util.function.IntPredicate",
"java.util.function.IntToDoubleFunction",
"java.util.function.IntToLongFunction",
"java.util.function.IntUnaryOperator",
"java.util.function.LongBinaryOperator",
"java.util.function.LongConsumer",
"java.util.function.LongFunction",
"java.util.function.LongPredicate",
"java.util.function.LongToDoubleFunction",
"java.util.function.LongToIntFunction",
"java.util.function.LongUnaryOperator",
"java.util.function.ObjDoubleConsumer",
"java.util.function.ObjIntConsumer",
"java.util.function.ObjLongConsumer",
"java.util.function.Predicate",
"java.util.function.Supplier",
"java.util.function.ToDoubleFunction",
"java.util.function.ToIntFunction",
"java.util.function.ToLongFunction",
"java.util.function.UnaryOperator",
"java.util.stream.BaseStream",
"java.util.stream.Collector",
"java.util.stream.DoubleStream",
"java.util.stream.IntStream",
"java.util.stream.LongStream",
"java.util.stream.Stream"
]
}
],
"library_flags": [
{
"api_level_below_or_equal": 25,
"rewrite_prefix": {
"java.util.Desugar": "j$.util.Desugar"
},
"retarget_lib_member": {
},
"custom_conversion": {
}
},
{
"api_level_below_or_equal": 23,
"rewrite_prefix": {
"j$.util.Optional": "java.util.Optional",
"j$.util.LongSummaryStatistics": "java.util.LongSummaryStatistics",
"j$.util.IntSummaryStatistics": "java.util.IntSummaryStatistics",
"j$.util.DoubleSummaryStatistics": "java.util.DoubleSummaryStatistics",
"java.util.stream.": "j$.util.stream.",
"java.util.function.": "j$.util.function.",
"java.util.Comparators": "j$.util.Comparators",
"java.util.DoubleSummaryStatistics": "j$.util.DoubleSummaryStatistics",
"java.util.IntSummaryStatistics": "j$.util.IntSummaryStatistics",
"java.util.LongSummaryStatistics": "j$.util.LongSummaryStatistics",
"java.util.Objects": "j$.util.Objects",
"java.util.Optional": "j$.util.Optional",
"java.util.PrimitiveIterator": "j$.util.PrimitiveIterator",
"java.util.SortedSet$1": "j$.util.SortedSet$1",
"java.util.Spliterator": "j$.util.Spliterator",
"java.util.StringJoiner": "j$.util.StringJoiner",
"java.util.Tripwire": "j$.util.Tripwire",
"java.util.concurrent.DesugarUnsafe": "j$.util.concurrent.DesugarUnsafe",
"java.util.concurrent.atomic.DesugarAtomic": "j$.util.concurrent.atomic.DesugarAtomic"
},
"retarget_lib_member": {
"java.util.Arrays#stream": "java.util.DesugarArrays",
"java.util.Arrays#spliterator": "java.util.DesugarArrays",
"java.util.LinkedHashSet#spliterator": "java.util.DesugarLinkedHashSet"
},
"dont_rewrite": [
"java.util.Iterator#remove"
],
"emulate_interface": {
"java.lang.Iterable": "j$.lang.Iterable",
"java.util.Map$Entry": "j$.util.Map$Entry",
"java.util.Collection": "j$.util.Collection",
"java.util.Map": "j$.util.Map",
"java.util.Iterator": "j$.util.Iterator",
"java.util.Comparator": "j$.util.Comparator",
"java.util.List": "j$.util.List",
"java.util.SortedSet": "j$.util.SortedSet",
"java.util.Set": "j$.util.Set",
"java.util.concurrent.ConcurrentMap": "j$.util.concurrent.ConcurrentMap"
},
"custom_conversion": {
"java.util.Optional": "java.util.OptionalConversions",
"java.util.OptionalDouble": "java.util.OptionalConversions",
"java.util.OptionalInt": "java.util.OptionalConversions",
"java.util.OptionalLong": "java.util.OptionalConversions",
"java.util.LongSummaryStatistics": "java.util.LongSummaryStatisticsConversions",
"java.util.IntSummaryStatistics": "java.util.IntSummaryStatisticsConversions",
"java.util.DoubleSummaryStatistics": "java.util.DoubleSummaryStatisticsConversions"
}
}
],
"program_flags": [
{
"api_level_below_or_equal": 25,
"rewrite_prefix": {
"java.util.Desugar": "j$.util.Desugar"
},
"retarget_lib_member": {
},
"custom_conversion": {
}
},
{
"api_level_below_or_equal": 23,
"rewrite_prefix": {
"java.util.stream.": "j$.util.stream.",
"java.util.function.": "j$.util.function.",
"java.util.DoubleSummaryStatistics": "j$.util.DoubleSummaryStatistics",
"java.util.IntSummaryStatistics": "j$.util.IntSummaryStatistics",
"java.util.LongSummaryStatistics": "j$.util.LongSummaryStatistics",
"java.util.Optional": "j$.util.Optional",
"java.util.PrimitiveIterator": "j$.util.PrimitiveIterator",
"java.util.Spliterator": "j$.util.Spliterator",
"java.util.StringJoiner": "j$.util.StringJoiner",
"java.util.concurrent.atomic.DesugarAtomic": "j$.util.concurrent.atomic.DesugarAtomic"
},
"retarget_lib_member": {
"java.util.Arrays#stream": "java.util.DesugarArrays",
"java.util.Arrays#spliterator": "java.util.DesugarArrays",
"java.util.LinkedHashSet#spliterator": "java.util.DesugarLinkedHashSet",
"java.util.concurrent.atomic.AtomicInteger#getAndUpdate": "java.util.concurrent.atomic.DesugarAtomicInteger",
"java.util.concurrent.atomic.AtomicInteger#updateAndGet": "java.util.concurrent.atomic.DesugarAtomicInteger",
"java.util.concurrent.atomic.AtomicInteger#getAndAccumulate": "java.util.concurrent.atomic.DesugarAtomicInteger",
"java.util.concurrent.atomic.AtomicInteger#accumulateAndGet": "java.util.concurrent.atomic.DesugarAtomicInteger",
"java.util.concurrent.atomic.AtomicLong#getAndUpdate": "java.util.concurrent.atomic.DesugarAtomicLong",
"java.util.concurrent.atomic.AtomicLong#updateAndGet": "java.util.concurrent.atomic.DesugarAtomicLong",
"java.util.concurrent.atomic.AtomicLong#getAndAccumulate": "java.util.concurrent.atomic.DesugarAtomicLong",
"java.util.concurrent.atomic.AtomicLong#accumulateAndGet": "java.util.concurrent.atomic.DesugarAtomicLong",
"java.util.concurrent.atomic.AtomicReference#getAndUpdate": "java.util.concurrent.atomic.DesugarAtomicReference",
"java.util.concurrent.atomic.AtomicReference#updateAndGet": "java.util.concurrent.atomic.DesugarAtomicReference",
"java.util.concurrent.atomic.AtomicReference#getAndAccumulate": "java.util.concurrent.atomic.DesugarAtomicReference",
"java.util.concurrent.atomic.AtomicReference#accumulateAndGet": "java.util.concurrent.atomic.DesugarAtomicReference"
},
"dont_rewrite": [
"java.util.Iterator#remove"
],
"emulate_interface": {
"java.lang.Iterable": "j$.lang.Iterable",
"java.util.Map$Entry": "j$.util.Map$Entry",
"java.util.Collection": "j$.util.Collection",
"java.util.Map": "j$.util.Map",
"java.util.Iterator": "j$.util.Iterator",
"java.util.Comparator": "j$.util.Comparator",
"java.util.List": "j$.util.List",
"java.util.SortedSet": "j$.util.SortedSet",
"java.util.Set": "j$.util.Set",
"java.util.concurrent.ConcurrentMap": "j$.util.concurrent.ConcurrentMap"
},
"custom_conversion": {
"java.util.Optional": "java.util.OptionalConversions",
"java.util.OptionalDouble": "java.util.OptionalConversions",
"java.util.OptionalInt": "java.util.OptionalConversions",
"java.util.OptionalLong": "java.util.OptionalConversions",
"java.util.LongSummaryStatistics": "java.util.LongSummaryStatisticsConversions",
"java.util.IntSummaryStatistics": "java.util.IntSummaryStatisticsConversions",
"java.util.DoubleSummaryStatistics": "java.util.DoubleSummaryStatisticsConversions"
}
}
],
"shrinker_config": [
"-keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); public static final !synthetic <fields>; }",
"-keeppackagenames j$.**",
"-keepclassmembers class j$.util.IntSummaryStatistics { long count; long sum; int min; int max; }",
"-keepclassmembers class j$.util.LongSummaryStatistics { long count; long sum; long min; long max; }",
"-keepclassmembers class j$.util.DoubleSummaryStatistics { long count; double sum; double min; double max; }",
"-keepattributes Signature",
"-keepattributes EnclosingMethod",
"-keepattributes InnerClasses",
"-dontwarn sun.misc.Unsafe"
]
}

@ -3,4 +3,3 @@
*.jar
*.txt
*.mapping
desugar_jdk_libs.pgcfg

@ -21,9 +21,6 @@ function get_path() {
ANDROID_JAR=$(get_path ../../android_sdk/public/platforms/*/android.jar)
DEXDUMP=$(get_path ../../android_sdk/public/build-tools/*/dexdump)
DESUGAR_JDK_LIBS_JSON=$(get_path ../desugar_jdk_libs.json)
DESUGAR_JDK_LIBS_JAR=$(get_path ../../android_deps/libs/com_android_tools_desugar_jdk_libs/desugar_jdk_libs-*.jar)
DESUGAR_JDK_LIBS_CONFIGURATION_JAR=$(get_path ../../android_deps/libs/com_android_tools_desugar_jdk_libs_configuration/desugar_jdk_libs_configuration-*.jar)
R8_PATH=$(get_path ../lib/r8.jar)
JAVA_HOME=../../jdk/current
JAVA_BIN=../../jdk/current/bin
@ -41,8 +38,6 @@ $JAVA_BIN/java -cp $R8_PATH $DUMP_INPUTS com.android.tools.r8.R8 \
--min-api $MIN_API \
--lib "$JAVA_HOME" \
--lib "$ANDROID_JAR" \
--desugared-lib "$DESUGAR_JDK_LIBS_JSON" \
--desugared-lib-pg-conf-output desugar_jdk_libs.pgcfg \
--no-minification \
--pg-conf playground.pgcfg \
--pg-map-output Playground.mapping \
@ -51,18 +46,6 @@ $JAVA_BIN/java -cp $R8_PATH $DUMP_INPUTS com.android.tools.r8.R8 \
*.class
$DEXDUMP -d classes.dex > dexdump.txt
rm -f desugar_jdk_libs.dex*
if [[ -n $(cat desugar_jdk_libs.pgcfg) ]]; then
echo "Running L8"
$JAVA_BIN/java -cp $R8_PATH com.android.tools.r8.L8 \
--min-api $MIN_API \
--lib "$JAVA_HOME" \
--desugared-lib "$DESUGAR_JDK_LIBS_JSON" \
--pg-conf desugar_jdk_libs.pgcfg \
--output desugar_jdk_libs.dex.jar \
"$DESUGAR_JDK_LIBS_JAR" "$DESUGAR_JDK_LIBS_CONFIGURATION_JAR"
unzip -p desugar_jdk_libs.dex.jar classes.dex > desugar_jdk_libs.dex
fi
du -b *.dex
echo 'Outputs are: Playground.mapping, classes.dex, dexdump.txt'

@ -4008,8 +4008,7 @@
'clang_use_default_sample_profile=false '
'media_use_ffmpeg = false'
'use_thin_lto=false ' # https://crbug.com/1136963
'enable_resource_allowlist_generation=false '
'enable_jdk_library_desugaring=false'),
'enable_resource_allowlist_generation=false '),
},
# Keep in sync with //infra/build/recipes/recipe_modules/chromium_android/chromium_config.py

@ -69,7 +69,6 @@
"debuggable_apks": false,
"default_min_sdk_version": 19,
"disable_file_support": true,
"enable_jdk_library_desugaring": false,
"enable_reporting": true,
"enable_resource_allowlist_generation": false,
"enable_websockets": false,

@ -245,7 +245,6 @@
"debuggable_apks": false,
"default_min_sdk_version": 19,
"disable_file_support": true,
"enable_jdk_library_desugaring": false,
"enable_reporting": true,
"enable_resource_allowlist_generation": false,
"enable_websockets": false,
@ -275,7 +274,6 @@
"debuggable_apks": false,
"default_min_sdk_version": 19,
"disable_file_support": true,
"enable_jdk_library_desugaring": false,
"enable_reporting": true,
"enable_resource_allowlist_generation": false,
"enable_websockets": false,
@ -304,7 +302,6 @@
"debuggable_apks": false,
"default_min_sdk_version": 19,
"disable_file_support": true,
"enable_jdk_library_desugaring": false,
"enable_reporting": true,
"enable_resource_allowlist_generation": false,
"enable_websockets": false,
@ -332,7 +329,6 @@
"debuggable_apks": false,
"default_min_sdk_version": 19,
"disable_file_support": true,
"enable_jdk_library_desugaring": false,
"enable_reporting": true,
"enable_resource_allowlist_generation": false,
"enable_websockets": false,
@ -363,7 +359,6 @@
"debuggable_apks": false,
"default_min_sdk_version": 19,
"disable_file_support": true,
"enable_jdk_library_desugaring": false,
"enable_reporting": true,
"enable_resource_allowlist_generation": false,
"enable_websockets": false,
@ -394,7 +389,6 @@
"debuggable_apks": false,
"default_min_sdk_version": 19,
"disable_file_support": true,
"enable_jdk_library_desugaring": false,
"enable_reporting": true,
"enable_resource_allowlist_generation": false,
"enable_websockets": false,
@ -423,7 +417,6 @@
"debuggable_apks": false,
"default_min_sdk_version": 19,
"disable_file_support": true,
"enable_jdk_library_desugaring": false,
"enable_reporting": true,
"enable_resource_allowlist_generation": false,
"enable_websockets": false,
@ -451,7 +444,6 @@
"debuggable_apks": false,
"default_min_sdk_version": 19,
"disable_file_support": true,
"enable_jdk_library_desugaring": false,
"enable_reporting": true,
"enable_resource_allowlist_generation": false,
"enable_websockets": false,

@ -187,7 +187,6 @@
"debuggable_apks": false,
"default_min_sdk_version": 19,
"disable_file_support": true,
"enable_jdk_library_desugaring": false,
"enable_reporting": true,
"enable_resource_allowlist_generation": false,
"enable_websockets": false,
@ -215,7 +214,6 @@
"debuggable_apks": false,
"default_min_sdk_version": 19,
"disable_file_support": true,
"enable_jdk_library_desugaring": false,
"enable_reporting": true,
"enable_resource_allowlist_generation": false,
"enable_websockets": false,
@ -243,7 +241,6 @@
"debuggable_apks": false,
"default_min_sdk_version": 19,
"disable_file_support": true,
"enable_jdk_library_desugaring": false,
"enable_reporting": true,
"enable_resource_allowlist_generation": false,
"enable_websockets": false,
@ -274,7 +271,6 @@
"debuggable_apks": false,
"default_min_sdk_version": 19,
"disable_file_support": true,
"enable_jdk_library_desugaring": false,
"enable_reporting": true,
"enable_resource_allowlist_generation": false,
"enable_websockets": false,
@ -306,7 +302,6 @@
"debuggable_apks": false,
"default_min_sdk_version": 19,
"disable_file_support": true,
"enable_jdk_library_desugaring": false,
"enable_reporting": true,
"enable_resource_allowlist_generation": false,
"enable_websockets": false,
@ -336,7 +331,6 @@
"debuggable_apks": false,
"default_min_sdk_version": 19,
"disable_file_support": true,
"enable_jdk_library_desugaring": false,
"enable_reporting": true,
"enable_resource_allowlist_generation": false,
"enable_websockets": false,
@ -365,7 +359,6 @@
"debuggable_apks": false,
"default_min_sdk_version": 19,
"disable_file_support": true,
"enable_jdk_library_desugaring": false,
"enable_reporting": true,
"enable_resource_allowlist_generation": false,
"enable_websockets": false,
@ -392,7 +385,6 @@
"debuggable_apks": false,
"default_min_sdk_version": 19,
"disable_file_support": true,
"enable_jdk_library_desugaring": false,
"enable_reporting": true,
"enable_resource_allowlist_generation": false,
"enable_websockets": false,
@ -419,7 +411,6 @@
"debuggable_apks": false,
"default_min_sdk_version": 19,
"disable_file_support": true,
"enable_jdk_library_desugaring": false,
"enable_reporting": true,
"enable_resource_allowlist_generation": false,
"enable_websockets": false,
@ -446,7 +437,6 @@
"debuggable_apks": false,
"default_min_sdk_version": 19,
"disable_file_support": true,
"enable_jdk_library_desugaring": false,
"enable_reporting": true,
"enable_resource_allowlist_generation": false,
"enable_websockets": false,
@ -473,7 +463,6 @@
"debuggable_apks": false,
"default_min_sdk_version": 19,
"disable_file_support": true,
"enable_jdk_library_desugaring": false,
"enable_reporting": true,
"enable_resource_allowlist_generation": false,
"enable_websockets": false,
@ -501,7 +490,6 @@
"debuggable_apks": false,
"default_min_sdk_version": 19,
"disable_file_support": true,
"enable_jdk_library_desugaring": false,
"enable_reporting": true,
"enable_resource_allowlist_generation": false,
"enable_websockets": false,
@ -531,7 +519,6 @@
"debuggable_apks": false,
"default_min_sdk_version": 19,
"disable_file_support": true,
"enable_jdk_library_desugaring": false,
"enable_reporting": true,
"enable_resource_allowlist_generation": false,
"enable_websockets": false,
@ -1035,7 +1022,6 @@
"debuggable_apks": false,
"default_min_sdk_version": 19,
"disable_file_support": true,
"enable_jdk_library_desugaring": false,
"enable_reporting": true,
"enable_resource_allowlist_generation": false,
"enable_websockets": false,