From 586de95cbd4ac0375eba539d295edcb5bb2819c6 Mon Sep 17 00:00:00 2001 From: ahumesky Date: Tue, 16 Mar 2021 10:21:24 -0700 Subject: [PATCH] Update Android remote tools to ensure Bazel uses the latest Android tooling that has been updated to support AndroidX databinding generation. Updates Android remote tooling version to 0.21.0. Also updates list of desugar flags for new desugarer version included in the tools, and in particular remove usages of "--retarget_core_library_member", which the updated desugar tool no longer needs. PiperOrigin-RevId: 363212429 --- WORKSPACE | 20 +++++------ .../android/android_remote_tools.WORKSPACE | 4 +-- tools/android/BUILD.tools | 11 +++--- tools/android/desugar.sh | 36 +++---------------- .../runtime_deps/upload_android_tools.sh | 2 +- 5 files changed, 23 insertions(+), 50 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 5a6d52c15412e7..f93273d8131a24 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -129,16 +129,16 @@ distdir_tar( name = "additional_distfiles", # Keep in sync with the archives fetched as part of building bazel. archives = [ - "android_tools_pkg-0.19.0rc3.tar.gz", + "android_tools_pkg-0.21.0.tar.gz", ], dirname = "derived/distdir", dist_deps = {dep: attrs for dep, attrs in DIST_DEPS.items() if "additional_distfiles" in attrs["used_in"]}, sha256 = { - "android_tools_pkg-0.19.0rc3.tar.gz": "ea5c0589a01e2a9f43c20e5c145d3530e3b3bdbe7322789bc5da38d0ca49b837", + "android_tools_pkg-0.21.0.tar.gz": "a4a17c811de5ca0df81b93ccc34e4b8494da9176bda4c85512083c2172494190", }, urls = { - "android_tools_pkg-0.19.0rc3.tar.gz": [ - "https://mirror.bazel.build/bazel_android_tools/android_tools_pkg-0.19.0rc3.tar.gz", + "android_tools_pkg-0.21.0.tar.gz": [ + "https://mirror.bazel.build/bazel_android_tools/android_tools_pkg-0.21.0.tar.gz", ], }, ) @@ -392,7 +392,7 @@ distdir_tar( "zulu11.37.17-ca-jdk11.0.6-macosx_x64.tar.gz", "zulu11.45.27-ca-jdk11.0.10-macosx_aarch64.tar.gz", "zulu11.37.17-ca-jdk11.0.6-win_x64.zip", - "android_tools_pkg-0.19.0rc3.tar.gz", + "android_tools_pkg-0.21.0.tar.gz", ], dirname = "test_WORKSPACE/distdir", dist_deps = {dep: attrs for dep, attrs in DIST_DEPS.items() if "test_WORKSPACE_files" in attrs["used_in"]}, @@ -402,7 +402,7 @@ distdir_tar( "zulu11.37.17-ca-jdk11.0.6-macosx_x64.tar.gz": "e1fe56769f32e2aaac95e0a8f86b5a323da5af3a3b4bba73f3086391a6cc056f", "zulu11.45.27-ca-jdk11.0.10-macosx_aarch64.tar.gz": "3dcc636e64ae58b922269c2dc9f20f6f967bee90e3f6847d643c4a566f1e8d8a", "zulu11.37.17-ca-jdk11.0.6-win_x64.zip": "a9695617b8374bfa171f166951214965b1d1d08f43218db9a2a780b71c665c18", - "android_tools_pkg-0.19.0rc3.tar.gz": "ea5c0589a01e2a9f43c20e5c145d3530e3b3bdbe7322789bc5da38d0ca49b837", + "android_tools_pkg-0.21.0.tar.gz": "a4a17c811de5ca0df81b93ccc34e4b8494da9176bda4c85512083c2172494190", }, urls = { "zulu11.37.17-ca-jdk11.0.6-linux_x64.tar.gz": ["https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-linux_x64.tar.gz"], @@ -410,8 +410,8 @@ distdir_tar( "zulu11.37.17-ca-jdk11.0.6-macosx_x64.tar.gz": ["https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-macosx_x64.tar.gz"], "zulu11.45.27-ca-jdk11.0.10-macosx_aarch64.tar.gz": ["https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.45.27-ca-jdk11.0.10-macosx_aarch64.tar.gz"], "zulu11.37.17-ca-jdk11.0.6-win_x64.zip": ["https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-win_x64.zip"], - "android_tools_pkg-0.19.0rc3.tar.gz": [ - "https://mirror.bazel.build/bazel_android_tools/android_tools_pkg-0.19.0rc3.tar.gz", + "android_tools_pkg-0.21.0.tar.gz": [ + "https://mirror.bazel.build/bazel_android_tools/android_tools_pkg-0.21.0.tar.gz", ], }, ) @@ -474,8 +474,8 @@ http_archive( name = "android_tools_for_testing", patch_cmds = EXPORT_WORKSPACE_IN_BUILD_FILE, patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_FILE_WIN, - sha256 = "ea5c0589a01e2a9f43c20e5c145d3530e3b3bdbe7322789bc5da38d0ca49b837", # DO_NOT_REMOVE_THIS_ANDROID_TOOLS_UPDATE_MARKER - url = "https://mirror.bazel.build/bazel_android_tools/android_tools_pkg-0.19.0rc3.tar.gz", + sha256 = "a4a17c811de5ca0df81b93ccc34e4b8494da9176bda4c85512083c2172494190", # DO_NOT_REMOVE_THIS_ANDROID_TOOLS_UPDATE_MARKER + url = "https://mirror.bazel.build/bazel_android_tools/android_tools_pkg-0.21.0.tar.gz", ) # Used in src/main/java/com/google/devtools/build/lib/bazel/rules/coverage.WORKSPACE. diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android_remote_tools.WORKSPACE b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android_remote_tools.WORKSPACE index 7d843315a7656c..d6eff4c14ee73f 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android_remote_tools.WORKSPACE +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android_remote_tools.WORKSPACE @@ -3,6 +3,6 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # This must be kept in sync with the top-level WORKSPACE file. http_archive( name = "android_tools", - sha256 = "ea5c0589a01e2a9f43c20e5c145d3530e3b3bdbe7322789bc5da38d0ca49b837", - url = "https://mirror.bazel.build/bazel_android_tools/android_tools_pkg-0.19.0rc3.tar.gz", + sha256 = "a4a17c811de5ca0df81b93ccc34e4b8494da9176bda4c85512083c2172494190", + url = "https://mirror.bazel.build/bazel_android_tools/android_tools_pkg-0.21.0.tar.gz", ) diff --git a/tools/android/BUILD.tools b/tools/android/BUILD.tools index 85c9718f9df43c..1b1a2b64274f87 100644 --- a/tools/android/BUILD.tools +++ b/tools/android/BUILD.tools @@ -208,14 +208,15 @@ genrule( --noemit_dependency_metadata_as_needed \ --nodesugar_try_with_resources_if_needed \ --desugar_supported_core_libs \ + --rewrite_core_library_prefix java/time/ \ --rewrite_core_library_prefix java/lang/Double8 \ --rewrite_core_library_prefix java/lang/Integer8 \ --rewrite_core_library_prefix java/lang/Long8 \ --rewrite_core_library_prefix java/lang/Math8 \ - --rewrite_core_library_prefix java/time/ \ + --rewrite_core_library_prefix java/io/Desugar \ + --rewrite_core_library_prefix java/io/UncheckedIOException \ --rewrite_core_library_prefix java/util/stream/ \ --rewrite_core_library_prefix java/util/function/ \ - --rewrite_core_library_prefix java/util/Comparators \ --rewrite_core_library_prefix java/util/Desugar \ --rewrite_core_library_prefix java/util/DoubleSummaryStatistics \ --rewrite_core_library_prefix java/util/IntSummaryStatistics \ @@ -223,15 +224,13 @@ genrule( --rewrite_core_library_prefix java/util/Objects \ --rewrite_core_library_prefix java/util/Optional \ --rewrite_core_library_prefix java/util/PrimitiveIterator \ - --rewrite_core_library_prefix java/util/SortedSet\\$$1 \ --rewrite_core_library_prefix java/util/Spliterator \ --rewrite_core_library_prefix java/util/StringJoiner \ - --rewrite_core_library_prefix java/util/Tripwire \ + --rewrite_core_library_prefix javadesugar/testing/ \ --rewrite_core_library_prefix java/util/concurrent/ConcurrentHashMap \ - --rewrite_core_library_prefix java/util/concurrent/DesugarUnsafe \ --rewrite_core_library_prefix java/util/concurrent/ThreadLocalRandom \ --rewrite_core_library_prefix java/util/concurrent/atomic/DesugarAtomic \ - --retarget_core_library_member "java/util/LinkedHashSet#spliterator->java/util/DesugarLinkedHashSet" \ + --auto_desugar_shadowed_api_use \ --emulate_core_library_interface java/util/Collection \ --emulate_core_library_interface java/util/Map \ --emulate_core_library_interface java/util/Map\\$$Entry \ diff --git a/tools/android/desugar.sh b/tools/android/desugar.sh index a4dd368167f9a6..74eee3d1173224 100644 --- a/tools/android/desugar.sh +++ b/tools/android/desugar.sh @@ -59,6 +59,8 @@ readonly DESUGAR_JAVA8_LIBS_CONFIG=(--rewrite_core_library_prefix java/time/ \ --rewrite_core_library_prefix java/lang/Integer8 \ --rewrite_core_library_prefix java/lang/Long8 \ --rewrite_core_library_prefix java/lang/Math8 \ + --rewrite_core_library_prefix java/io/Desugar \ + --rewrite_core_library_prefix java/io/UncheckedIOException \ --rewrite_core_library_prefix java/util/stream/ \ --rewrite_core_library_prefix java/util/function/ \ --rewrite_core_library_prefix java/util/Desugar \ @@ -70,45 +72,17 @@ readonly DESUGAR_JAVA8_LIBS_CONFIG=(--rewrite_core_library_prefix java/time/ \ --rewrite_core_library_prefix java/util/PrimitiveIterator \ --rewrite_core_library_prefix java/util/Spliterator \ --rewrite_core_library_prefix java/util/StringJoiner \ + --rewrite_core_library_prefix javadesugar/testing/ \ --rewrite_core_library_prefix java/util/concurrent/ConcurrentHashMap \ --rewrite_core_library_prefix java/util/concurrent/ThreadLocalRandom \ --rewrite_core_library_prefix java/util/concurrent/atomic/DesugarAtomic \ - --retarget_core_library_member "java/lang/Double#max->java/lang/Double8" \ - --retarget_core_library_member "java/lang/Double#min->java/lang/Double8" \ - --retarget_core_library_member "java/lang/Double#sum->java/lang/Double8" \ - --retarget_core_library_member "java/lang/Integer#max->java/lang/Integer8" \ - --retarget_core_library_member "java/lang/Integer#min->java/lang/Integer8" \ - --retarget_core_library_member "java/lang/Integer#sum->java/lang/Integer8" \ - --retarget_core_library_member "java/lang/Long#max->java/lang/Long8" \ - --retarget_core_library_member "java/lang/Long#min->java/lang/Long8" \ - --retarget_core_library_member "java/lang/Long#sum->java/lang/Long8" \ - --retarget_core_library_member "java/lang/Math#toIntExact->java/lang/Math8" \ - --retarget_core_library_member "java/util/Arrays#stream->java/util/DesugarArrays" \ - --retarget_core_library_member "java/util/Arrays#spliterator->java/util/DesugarArrays" \ - --retarget_core_library_member "java/util/Calendar#toInstant->java/util/DesugarCalendar" \ - --retarget_core_library_member "java/util/Date#from->java/util/DesugarDate" \ - --retarget_core_library_member "java/util/Date#toInstant->java/util/DesugarDate" \ - --retarget_core_library_member "java/util/GregorianCalendar#from->java/util/DesugarGregorianCalendar" \ - --retarget_core_library_member "java/util/GregorianCalendar#toZonedDateTime->java/util/DesugarGregorianCalendar" \ - --retarget_core_library_member "java/util/LinkedHashSet#spliterator->java/util/DesugarLinkedHashSet" \ - --retarget_core_library_member "java/util/concurrent/atomic/AtomicInteger#getAndUpdate->java/util/concurrent/atomic/DesugarAtomicInteger" \ - --retarget_core_library_member "java/util/concurrent/atomic/AtomicInteger#updateAndGet->java/util/concurrent/atomic/DesugarAtomicInteger" \ - --retarget_core_library_member "java/util/concurrent/atomic/AtomicInteger#getAndAccumulate->java/util/concurrent/atomic/DesugarAtomicInteger" \ - --retarget_core_library_member "java/util/concurrent/atomic/AtomicInteger#accumulateAndGet->java/util/concurrent/atomic/DesugarAtomicInteger" \ - --retarget_core_library_member "java/util/concurrent/atomic/AtomicLong#getAndUpdate->java/util/concurrent/atomic/DesugarAtomicLong" \ - --retarget_core_library_member "java/util/concurrent/atomic/AtomicLong#updateAndGet->java/util/concurrent/atomic/DesugarAtomicLong" \ - --retarget_core_library_member "java/util/concurrent/atomic/AtomicLong#getAndAccumulate->java/util/concurrent/atomic/DesugarAtomicLong" \ - --retarget_core_library_member "java/util/concurrent/atomic/AtomicLong#accumulateAndGet->java/util/concurrent/atomic/DesugarAtomicLong" \ - --retarget_core_library_member "java/util/concurrent/atomic/AtomicReference#getAndUpdate->java/util/concurrent/atomic/DesugarAtomicReference" \ - --retarget_core_library_member "java/util/concurrent/atomic/AtomicReference#updateAndGet->java/util/concurrent/atomic/DesugarAtomicReference" \ - --retarget_core_library_member "java/util/concurrent/atomic/AtomicReference#getAndAccumulate->java/util/concurrent/atomic/DesugarAtomicReference" \ - --retarget_core_library_member "java/util/concurrent/atomic/AtomicReference#accumulateAndGet->java/util/concurrent/atomic/DesugarAtomicReference" \ + --auto_desugar_shadowed_api_use \ --emulate_core_library_interface java/util/Collection \ --emulate_core_library_interface java/util/Map \ --emulate_core_library_interface java/util/Map\$Entry \ --emulate_core_library_interface java/util/Iterator \ --emulate_core_library_interface java/util/Comparator \ - --dont_rewrite_core_library_invocation "java/util/Iterator#remove") + --dont_rewrite_core_library_invocation "java/util/Iterator#remove" ) # Check for params file. Desugar doesn't accept a mix of params files and flags # directly on the command line, so we need to build a new params file that adds diff --git a/tools/android/runtime_deps/upload_android_tools.sh b/tools/android/runtime_deps/upload_android_tools.sh index 74e04cc1af5306..f6d1027127af61 100755 --- a/tools/android/runtime_deps/upload_android_tools.sh +++ b/tools/android/runtime_deps/upload_android_tools.sh @@ -31,7 +31,7 @@ set -euo pipefail # The version of android_tools.tar.gz -VERSION="0.19.0rc3" +VERSION="0.21.0" VERSIONED_FILENAME="android_tools_pkg-$VERSION.tar.gz" # Create a temp directory to hold the versioned tarball, and clean it up when the script exits.