From 4a7bf608b2003b1be7bb94e312180f75b229334c Mon Sep 17 00:00:00 2001 From: Jingwen Chen Date: Wed, 21 Sep 2022 06:36:37 +0000 Subject: [PATCH] Add a soong_zip alias to prebuilts and allowlist all blocked rdeps. This is an improvement over directly referencing the prebuilt because bp2build can now emit BUILD files that contain a dep to //build/soong/zip/cmd:soong_zip even though we're not converting the soong_zip module. It helps to make progress despite not having go rules support to convert/build soong_zip. This unblocks many modules, like genrules and gensrcs that use soong_zip in tools. soong_zip doesn't change often, so it's not risky to depend on the prebuilt instead of source version. Bug: 194644518 Bug: 248222296 Test: bp2build CI Change-Id: Idef0c27ec0fb43a9097d750ec72fba00644c9f2a --- android/allowlists/allowlists.go | 41 ++++++++++++++++++++++---------- zip/cmd/BUILD.bazel | 20 ++++++++++++++++ 2 files changed, 48 insertions(+), 13 deletions(-) create mode 100644 zip/cmd/BUILD.bazel diff --git a/android/allowlists/allowlists.go b/android/allowlists/allowlists.go index c2af38e68..e993ca792 100644 --- a/android/allowlists/allowlists.go +++ b/android/allowlists/allowlists.go @@ -147,6 +147,7 @@ var ( "external/mdnsresponder": Bp2BuildDefaultTrueRecursively, "external/minijail": Bp2BuildDefaultTrueRecursively, "external/openscreen": Bp2BuildDefaultTrueRecursively, + "external/objenesis": Bp2BuildDefaultTrueRecursively, "external/pcre": Bp2BuildDefaultTrueRecursively, "external/protobuf": Bp2BuildDefaultTrueRecursively, "external/python/six": Bp2BuildDefaultTrueRecursively, @@ -312,7 +313,7 @@ var ( // build/make/tools/signapk BUILD file is generated, so build/make/tools is not recursive. "build/make/tools":/* recursive = */ false, "build/pesto":/* recursive = */ true, - "build/soong/ui/metrics/bp2build_progress_metrics_proto":/* recursive = */ true, + "build/soong":/* recursive = */ true, // external/bazelbuild-rules_android/... is needed by mixed builds, otherwise mixed builds analysis fails // e.g. ERROR: Analysis of target '@soong_injection//mixed_builds:buildroot' failed @@ -323,6 +324,10 @@ var ( "external/guava":/* recursive = */ true, "external/jsr305":/* recursive = */ true, "external/protobuf":/* recursive = */ false, + + // this BUILD file is globbed by //external/icu/icu4c/source:icu4c_test_data's "data/**/*". + "external/icu/icu4c/source/data/unidata/norm2":/* recursive = */ false, + "frameworks/base/tools/codegen":/* recursive = */ true, "frameworks/ex/common":/* recursive = */ true, @@ -565,6 +570,13 @@ var ( "sysprop_library", } + // Add the names of modules that bp2build should never convert, if it is + // in the package allowlist. An error will be thrown if a module must + // not be here and in the alwaysConvert lists. + // + // For prebuilt modules (e.g. android_library_import), remember to add + // the "prebuilt_" prefix to the name, so that it's differentiable from + // the source versions within Soong's module graph. Bp2buildModuleDoNotConvertList = []string{ // cc bugs "libactivitymanager_aidl", // TODO(b/207426160): Unsupported use of aidl sources (via Dactivity_manager_procstate_aidl) in a cc_library @@ -602,6 +614,9 @@ var ( "prebuilt_car-ui-androidx-core-common", // TODO(b/224773339), genrule dependency creates an .aar, not a .jar "prebuilt_platform-robolectric-4.4-prebuilt", // aosp/1999250, needs .aar support in Jars "prebuilt_platform-robolectric-4.5.1-prebuilt", // aosp/1999250, needs .aar support in Jars + // ERROR: The dependencies for the following 1 jar(s) are not complete. + // 1.bazel-out/android_target-fastbuild/bin/prebuilts/tools/common/m2/_aar/robolectric-monitor-1.0.2-alpha1/classes_and_libs_merged.jar + "prebuilt_robolectric-monitor-1.0.2-alpha1", // path property for filegroups "conscrypt", // TODO(b/210751803), we don't handle path property for filegroups @@ -614,18 +629,14 @@ var ( "auto_value_plugin_resources", // TODO(b/210751803), we don't handle path property for filegroups // go deps: - "aapt2-protos", // depends on soong_zip, a go binary - "analyze_bcpf", // depends on bpmodify a blueprint_go_binary. - "apex-protos", // depends on soong_zip, a go binary - "generated_android_icu4j_src_files", "generated_android_icu4j_test_files", "icu4c_test_data", // depends on unconverted modules: soong_zip + "analyze_bcpf", // depends on bpmodify a blueprint_go_binary. "host_bionic_linker_asm", // depends on extract_linker, a go binary. "host_bionic_linker_script", // depends on extract_linker, a go binary. - "libc_musl_sysroot_bionic_arch_headers", // depends on soong_zip - "libc_musl_sysroot_bionic_headers", // 218405924, depends on soong_zip and generates duplicate srcs - "libc_musl_sysroot_libc++_headers", "libc_musl_sysroot_libc++abi_headers", // depends on soong_zip, zip2zip - "libc_musl_sysroot_zlib_headers", // depends on soong_zip and zip2zip - "robolectric-sqlite4java-native", // depends on soong_zip, a go binary - "robolectric_tzdata", // depends on soong_zip, a go binary + "libc_musl_sysroot_libc++_headers", "libc_musl_sysroot_libc++abi_headers", // depends on zip2zip + "libc_musl_sysroot_zlib_headers", // depends on zip2zip + + // in cmd attribute of genrule rule //system/timezone/output_data:robolectric_tzdata: label '//system/timezone/output_data:iana/tzdata' in $(location) expression is not a declared prerequisite of this rule + "robolectric_tzdata", // rust support "libtombstoned_client_rust_bridge_code", "libtombstoned_client_wrapper", // rust conversions are not supported @@ -641,8 +652,8 @@ var ( "com.android.runtime", // depends on unconverted modules: bionic-linker-config, linkerconfig "currysrc", // depends on unconverted modules: currysrc_org.eclipse, guavalib, jopt-simple-4.9 "dex2oat-script", // depends on unconverted modules: dex2oat - "generated_android_icu4j_resources", // depends on unconverted modules: android_icu4j_srcgen_binary, soong_zip - "generated_android_icu4j_test_resources", // depends on unconverted modules: android_icu4j_srcgen_binary, soong_zip + "generated_android_icu4j_resources", // depends on unconverted modules: android_icu4j_srcgen_binary + "generated_android_icu4j_test_resources", // depends on unconverted modules: android_icu4j_srcgen_binary "host-libprotobuf-java-nano", // b/220869005, depends on libprotobuf-java-nano "jacoco-stubs", // b/245767077, depends on droidstubs "libapexutil", // depends on unconverted modules: apex-info-list-tinyxml @@ -680,6 +691,10 @@ var ( // aidl files not created "overlayable_policy_aidl_interface", + //prebuilts/tools/common/m2 + // depends on //external/okio:okio-lib, which uses kotlin + "wire-runtime", + // cc_test related. // Failing host cc_tests "memunreachable_unit_test", diff --git a/zip/cmd/BUILD.bazel b/zip/cmd/BUILD.bazel new file mode 100644 index 000000000..e04a1e10d --- /dev/null +++ b/zip/cmd/BUILD.bazel @@ -0,0 +1,20 @@ +# Copyright (C) 2022 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# TODO(b/194644518): Switch to the source version when Bazel can build go +# binaries. +alias( + name = "soong_zip", + actual = "//prebuilts/build-tools:linux-x86/bin/soong_zip", +)