Merge "Shard Javac" into main
diff --git a/android/allowlists/allowlists.go b/android/allowlists/allowlists.go
index 6306ae1..ff2d6d3 100644
--- a/android/allowlists/allowlists.go
+++ b/android/allowlists/allowlists.go
@@ -394,6 +394,7 @@
"system/apex/tools": Bp2BuildDefaultTrueRecursively,
"system/core/debuggerd": Bp2BuildDefaultTrueRecursively,
"system/core/diagnose_usb": Bp2BuildDefaultTrueRecursively,
+ "system/core/fs_mgr": Bp2BuildDefaultTrueRecursively,
"system/core/healthd": Bp2BuildDefaultTrue,
"system/core/healthd/testdata": Bp2BuildDefaultTrue,
"system/core/libasyncio": Bp2BuildDefaultTrue,
@@ -697,8 +698,6 @@
// fastboot
"fastboot",
"libfastboot",
- "liblp",
- "libstorage_literals_headers",
"PluginCoreLib",
"dagger2",
@@ -754,14 +753,6 @@
//system/chre
"chre_api",
- //system/core/fs_mgr/libdm
- "libdm",
-
- //system/core/fs_mgr/libfiemap
- "libfiemap_headers",
- "libfiemap_passthrough_srcs",
- "libfiemap_srcs",
-
//system/gsid
"libgsi",
"libgsi_headers",
@@ -778,18 +769,9 @@
//system/extras/libfscrypt
"libfscrypt",
- //system/core/fs_mgr
- "libfstab",
-
//bootable/recovery/fuse_sideload
"libfusesideload",
- //system/core/fs_mgr/libfs_avb
- "libfs_avb",
-
- //system/core/fs_mgr
- "libfs_mgr",
-
"libcodec2_aidl",
"libcodec2_hidl@1.0",
"libcodec2_hidl@1.1",
@@ -897,7 +879,6 @@
"binderRpcWireProtocolTest",
"binderUnitTest",
"cpu_features-bit_utils_test",
- "liblp_test",
"android.hardware.audio.common.test.utility_tests",
"HalAudioStreamWorkerTest",
"libjavacore-unit-tests",
@@ -1066,20 +1047,10 @@
"libfsverity_rs",
"libtombstoned_client_rust",
- "libhardware", //Depends on unconverted libapexsupport
-
// TODO(b/263326760): Failed already.
"minijail_compiler_unittest",
"minijail_parser_unittest",
- // Depends on unconverted libandroid, libgui
- "dvr_buffer_queue-test",
- "dvr_display-test",
- // Depends on unconverted libchrome
- "pdx_benchmarks",
- "buffer_hub_queue-test",
- "buffer_hub_queue_producer-test",
-
// cc bugs
// TODO(b/198619163) module has same name as source
@@ -1120,7 +1091,8 @@
"host-libprotobuf-java-full", // TODO(b/210751803), we don't handle path property for filegroups
"libprotobuf-internal-python-srcs", // TODO(b/210751803), we don't handle path property for filegroups
- // go deps:
+ // go deps.
+ // TODO: b/305091740 - Rely on bp2build_deps to remove these dependencies.
"analyze_bcpf", // depends on bpmodify a blueprint_go_binary.
"analyze_bcpf_test", // depends on bpmodify a blueprint_go_binary.
"host_bionic_linker_asm", // depends on extract_linker, a go binary.
@@ -1134,89 +1106,9 @@
"modules-utils-os",
"modules-utils-synchronous-result-receiver",
- // unconverted deps
- "CarHTMLViewer", // depends on unconverted modules android.car-stubs, car-ui-lib
- "adb", // depends on unconverted modules: AdbWinApi, libandroidfw, libopenscreen-discovery, libopenscreen-platform-impl, libusb, bin2c_fastdeployagent, AdbWinUsbApi
- "android_icu4j_srcgen", // depends on unconverted modules: currysrc
- "android_icu4j_srcgen_binary", // depends on unconverted modules: android_icu4j_srcgen, currysrc
- "apex_compression_test", // depends on unconverted modules: soong_zip, com.android.example.apex
- "apex_manifest_proto_java", // b/210751803, depends on libprotobuf-java-full
- "apexer_with_DCLA_preprocessing_test", // depends on unconverted modules: apexer_test_host_tools, com.android.example.apex
- "art-script", // depends on unconverted modules: dalvikvm, dex2oat
- "bin2c_fastdeployagent", // depends on unconverted modules: deployagent
- "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
- "generated_android_icu4j_test_resources", // depends on unconverted modules: android_icu4j_srcgen_binary
- "hidl_system_api_test",
- "hidl_test_java",
- "host-libprotobuf-java-nano", // b/220869005, depends on libprotobuf-java-nano
- "jacoco-stubs", // b/245767077, depends on droidstubs
- "libart", // depends on unconverted modules: apex-info-list-tinyxml, libtinyxml2, libnativeloader-headers, heapprofd_client_api, art_operator_srcs, libcpu_features, libodrstatslog, libelffile, art_cmdlineparser_headers, cpp-define-generator-definitions, libdexfile, libnativebridge, libnativeloader, libsigchain, libartbase, libprofile, cpp-define-generator-asm-support
- "libart-runtime", // depends on unconverted modules: apex-info-list-tinyxml, libtinyxml2, libnativeloader-headers, heapprofd_client_api, art_operator_srcs, libcpu_features, libodrstatslog, libelffile, art_cmdlineparser_headers, cpp-define-generator-definitions, libdexfile, libnativebridge, libnativeloader, libsigchain, libartbase, libprofile, cpp-define-generator-asm-support
- "libart-runtime-for-test", // depends on unconverted modules: apex-info-list-tinyxml, libtinyxml2, libnativeloader-headers, heapprofd_client_api, art_operator_srcs, libcpu_features, libodrstatslog, libelffile, art_cmdlineparser_headers, cpp-define-generator-definitions, libdexfile, libnativebridge, libnativeloader, libsigchain, libartbase, libprofile, cpp-define-generator-asm-support
- "libart-runtime-gtest", // depends on unconverted modules: libgtest_isolated, libart-compiler, libdexfile, libprofile, libartbase, libartbase-art-gtest
- "libart_headers", // depends on unconverted modules: art_libartbase_headers
- "libartbase-art-gtest", // depends on unconverted modules: libgtest_isolated, libart, libart-compiler, libdexfile, libprofile
- "libartbased-art-gtest", // depends on unconverted modules: libgtest_isolated, libartd, libartd-compiler, libdexfiled, libprofiled
- "libartd", // depends on unconverted modules: art_operator_srcs, libcpu_features, libodrstatslog, libelffiled, art_cmdlineparser_headers, cpp-define-generator-definitions, libdexfiled, libnativebridge, libnativeloader, libsigchain, libartbased, libprofiled, cpp-define-generator-asm-support, apex-info-list-tinyxml, libtinyxml2, libnativeloader-headers, heapprofd_client_api
- "libartd-runtime", // depends on unconverted modules: art_operator_srcs, libcpu_features, libodrstatslog, libelffiled, art_cmdlineparser_headers, cpp-define-generator-definitions, libdexfiled, libnativebridge, libnativeloader, libsigchain, libartbased, libprofiled, cpp-define-generator-asm-support, apex-info-list-tinyxml, libtinyxml2, libnativeloader-headers, heapprofd_client_api
- "libartd-runtime-gtest", // depends on unconverted modules: libgtest_isolated, libartd-compiler, libdexfiled, libprofiled, libartbased, libartbased-art-gtest
- "libdebuggerd", // depends on unconverted module: libdexfile
- "libdebuggerd_handler", // depends on unconverted module libdebuggerd_handler_core
- "libdebuggerd_handler_core", "libdebuggerd_handler_fallback", // depends on unconverted module libdebuggerd
- "libdexfiled", // depends on unconverted modules: dexfile_operator_srcs, libartbased, libartpalette
- "libgmock_main_ndk", // depends on unconverted modules: libgtest_ndk_c++
- "libgmock_ndk", // depends on unconverted modules: libgtest_ndk_c++
- "libnativehelper_lazy_mts_jni", "libnativehelper_mts_jni", // depends on unconverted modules: libnativetesthelper_jni, libgmock_ndk
- "libnativetesthelper_jni", // depends on unconverted modules: libgtest_ndk_c++
- "libphonenumber_test", // depends on android.test.mock
- "libstatslog", // depends on unconverted modules: libstatspull, statsd-aidl-ndk
- "libstatslog_art", // depends on unconverted modules: statslog_art.cpp, statslog_art.h
- "linker_reloc_bench_main", // depends on unconverted modules: liblinker_reloc_bench_*
- "malloc-rss-benchmark", // depends on unconverted modules: libmeminfo
- "modules-utils-expresslog", // depends on unconverted modules: framework-statsd
- "pbtombstone", "crash_dump", // depends on libdebuggerd, libunwindstack
- "releasetools_test", // depends on unconverted modules: com.android.apex.compressed.v1
- "robolectric-sqlite4java-0.282", // depends on unconverted modules: robolectric-sqlite4java-import, robolectric-sqlite4java-native
- "static_crasher", // depends on unconverted modules: libdebuggerd_handler
- "test_fips", // depends on unconverted modules: adb
- "timezone-host", // depends on unconverted modules: art.module.api.annotations
-
// aidl files not created
"overlayable_policy_aidl_interface",
- //prebuilts/tools/common/m2
- // depends on //external/okio:okio-lib, which uses kotlin
- "wire-runtime",
-
- // depends on adbd_system_api_recovery, which is a unconverted `phony` module type
- "minadbd",
-
- // depends on android.hardware.health-V2.0-java
- "android.hardware.health-translate-java",
-
- //system/libvintf
- // depends on apex-info-list-tinyxml, unconverted xsd_config Soong module type.
- "libassemblevintf",
- "assemble_vintf",
- "checkvintf",
-
- // depends on audio_policy_configuration_aidl_default, xsd_config module.
- "libaudioserviceexampleimpl",
- "android.hardware.audio.service-aidl.example",
-
- // depends on //system/tools/aidl/build:aidl_metadata_json, which is an aidl_interfaces_metadata custom Soong type.
- "aidl_metadata_in_cpp",
- "libaidlmetadata",
- "libaidlmetadata_test",
-
- // depends on //system/tools/hidl/build:hidl_metadata_json, which is an hidl_interfaces_metadata custom Soong type.
- "hidl_metadata_in_cpp",
- "libhidlmetadata",
- "hidl_metadata_test",
-
// cc_test related.
// b/274164834 "Could not open Configuration file test.cfg"
"svcenc", "svcdec",
@@ -1249,40 +1141,18 @@
// cc_test with unconverted deps, or are device-only (and not verified to pass yet)
"AMRWBEncTest",
- "AmrnbDecoderTest", // depends on unconverted modules: libaudioutils, libsndfile
- "AmrnbEncoderTest", // depends on unconverted modules: libaudioutils, libsndfile
- "AmrwbDecoderTest", // depends on unconverted modules: libsndfile, libaudioutils
- "AmrwbEncoderTest", // depends on unconverted modules: libaudioutils, libsndfile
- "Mp3DecoderTest", // depends on unconverted modules: libsndfile, libaudioutils
"avcdec",
"avcenc",
- "bionic-benchmarks-tests",
- "bionic-fortify-runtime-asan-test",
- "bionic-stress-tests",
- "bionic-unit-tests",
- "bionic-unit-tests-glibc",
- "bionic-unit-tests-static",
- "boringssl_crypto_test",
- "boringssl_ssl_test",
"boringssl_test_support", //b/244431896
"cfi_test_helper",
- "cfi_test_helper2",
"cintltst32",
"cintltst64",
"compare",
"cpuid",
- "debuggerd_test", // depends on unconverted modules: libdebuggerd
"elftls_dlopen_ie_error_helper",
- "exec_linker_helper",
- "fastdeploy_test", // depends on unconverted modules: AdbWinApi, libadb_host, libandroidfw, libfastdeploy_host, libopenscreen-discovery, libopenscreen-platform-impl, libusb
"fdtrack_test",
"google-benchmark-test",
- "googletest-param-test-test_ndk", // depends on unconverted modules: libgtest_ndk_c++
"gtest-typed-test_test",
- "gtest-typed-test_test_ndk", // depends on unconverted modules: libgtest_ndk_c++, libgtest_main_ndk_c++
- "gtest_ndk_tests", // depends on unconverted modules: libgtest_ndk_c++, libgtest_main_ndk_c++
- "gtest_ndk_tests_no_main", // depends on unconverted modules: libgtest_ndk_c++
- "gtest_prod_test_ndk", // depends on unconverted modules: libgtest_ndk_c++, libgtest_main_ndk_c++
"gtest_tests",
"gtest_tests_no_main",
"gwp_asan_unittest",
@@ -1290,7 +1160,6 @@
"hashcombine_test",
"hevcdec",
"hevcenc",
- "hwbinderThroughputTest", // depends on unconverted modules: android.hardware.tests.libhwbinder@1.0-impl.test, android.hardware.tests.libhwbinder@1.0
"i444tonv12_eg",
"icu4c_sample_break",
"intltest32",
@@ -1299,11 +1168,6 @@
"jemalloc5_integrationtests",
"jemalloc5_unittests",
"jemalloc5_stresstests", // run by run_jemalloc_tests.sh and will be deleted after V
- "ld_config_test_helper",
- "ld_preload_test_helper",
- "libBionicCtsGtestMain", // depends on unconverted modules: libgtest_isolated
- "libBionicLoaderTests", // depends on unconverted modules: libmeminfo
- "libapexutil_tests", // depends on unconverted modules: apex-info-list-tinyxml, libapexutil
"libcutils_sockets_test",
"libhwbinder_latency",
"liblog-host-test", // failing tests
@@ -1311,12 +1175,9 @@
"libminijail_unittest_gtest",
"libpackagelistparser_test",
"libprotobuf_vendor_suffix_test",
- "libstagefright_amrnbdec_test", // depends on unconverted modules: libsndfile, libaudioutils
"libstagefright_amrnbenc_test",
- "libstagefright_amrwbdec_test", // depends on unconverted modules: libsndfile, libaudioutils
+ "libstagefright_amrwbdec_test", // error: did not report any run
"libstagefright_m4vh263enc_test",
- "libstagefright_mp3dec_test", // depends on unconverted modules: libsndfile, libaudioutils
- "libstatssocket_test",
"libvndksupport-tests",
"libyuv_unittest",
"linker-unit-tests",
@@ -1325,22 +1186,17 @@
"malloc_hooks_system_tests",
"mat_test",
"mathtest",
- "memunreachable_binder_test", // depends on unconverted modules: libbinder
"memunreachable_test",
"metadata_tests",
"mpeg2dec",
"mvcdec",
- "ns_hidden_child_helper",
"pngtest",
"preinit_getauxval_test_helper",
"preinit_syscall_test_helper",
"psnr",
"quat_test",
- "rappor-tests", // depends on unconverted modules: jsr305, guava
"scudo_unit_tests",
- "stats-log-api-gen-test", // depends on unconverted modules: libstats_proto_host
"thread_exit_cb_helper",
- "tls_properties_helper",
"ulp",
"vec_test",
"yuvconstants",
@@ -1672,8 +1528,6 @@
"libtest_with_dependency_loop_c",
"libtestshared",
- "merge_ota", // depends on ota_metadata_proto_java
-
// releasetools
"verity_utils",
"check_ota_package_signature",
@@ -1721,20 +1575,12 @@
"CtsPkgInstallerConstants",
"guava-android-testlib",
- "MetaDataBaseUnitTest", // depends on libstagefright
- "AVCUtilsUnitTest", // depends on libstagefright
- "ColorUtilsTest", // depends on libmediandk
-
// python_test_host with test data
"sbom_writers_test",
"hidl_test",
- // TODO(B/283193845): tradefed and its java_test_host dependents
+ // TODO(B/283193845): Remove tradefed from this list.
"tradefed",
- "permissive_mte_test",
- "ICU4CTestRunner",
- "DeviceLongPollingStubTest",
- "FastDeployHostTests",
"libprotobuf-full-test", // TODO(b/246997908): cannot convert proto_libraries which implicitly include other srcs in the same directory
"libprotobuf-lite-test", // TODO(b/246997908): cannot convert proto_libraries which implicitly include other srcs in the same directory
@@ -1743,27 +1589,11 @@
"expresscatalogvalidator", // TODO(b/246997908): cannot convert proto_libraries which implicitly include other srcs in the same directory
- // depends on other //art modules
- "libart-for-test",
- "libart_generated_headers",
- "libart-runtime-gtest",
- "libartd-runtime-gtest",
- "libart-unstripped",
-
- // depends on libart-unstripped and new module type llvm_prebuilt_build_tool
- "check_cfi",
-
- // depends on unconverted module tradefed
- "HelloWorldPerformanceTest",
-
// r8 is a java_binary, which creates an implicit "r8.jar" target, but the
// same package contains a "r8.jar" file which gets overshadowed by the implicit target.
// We don't need this target as we're not using the Soong wrapper for now
"r8",
- // Depends on the module defined in the directory not bp2build default allowed
- "ota_from_raw_img",
-
// TODO(b/299924782): Fix linking error
"libbinder_on_trusty_mock",
@@ -1777,23 +1607,8 @@
// TODO(b/297356704) sdk_version is unset.
"VendorAtomCodeGenJavaTest",
- // android_test from allowlisted packages, but with unconverted deps
- "MtsLibnativehelperLazyTestCases",
+ // TODO: b/305223367 - Missing dep on android.test.base-neverlink
"ObjenesisTck",
- "DevCodelabTest",
- "MtsTimeZoneDataTestCases",
- "NanoAndroidTest",
- "MtsLibnativehelperTestCases",
-
- // Depends on androidx.test.rules
- "DexmakerTests",
- "dexmaker-tests-lib",
- "dexmaker-mockmaker-tests",
- "dexmaker-inline-mockmaker-tests",
- "dexmaker-extended-mockmaker-tests",
-
- // android_test_helper_app from allowlisted packages, but with unconverted deps
- "SharedLibraryInfoTestApp",
}
// Bazel prod-mode allowlist. Modules in this list are built by Bazel
diff --git a/bp2build/java_import_conversion_test.go b/bp2build/java_import_conversion_test.go
index bba2f50..ad69ed5 100644
--- a/bp2build/java_import_conversion_test.go
+++ b/bp2build/java_import_conversion_test.go
@@ -52,13 +52,15 @@
}
`,
ExpectedBazelTargets: []string{
- MakeBazelTarget("java_import", "example_import", AttrNameToString{
- "jars": `["import.jar"]`,
+ MakeBazelTarget("filegroup", "example_import-jars", AttrNameToString{
+ "srcs": `["import.jar"]`,
}),
- MakeBazelTarget("java_library", "example_import-neverlink", AttrNameToString{
- "exports": `[":example_import"]`,
- "neverlink": `True`,
- "sdk_version": `"none"`,
+ MakeBazelTarget("java_import", "example_import", AttrNameToString{
+ "jars": `[":example_import-jars"]`,
+ }),
+ MakeBazelTarget("java_import", "example_import-neverlink", AttrNameToString{
+ "jars": `[":example_import-jars"]`,
+ "neverlink": `True`,
}),
}})
}
@@ -86,17 +88,19 @@
}
`,
ExpectedBazelTargets: []string{
- MakeBazelTarget("java_import", "example_import", AttrNameToString{
- "jars": `select({
+ MakeBazelTarget("filegroup", "example_import-jars", AttrNameToString{
+ "srcs": `select({
"//build/bazel_common_rules/platforms/os:android": ["android.jar"],
"//build/bazel_common_rules/platforms/os:linux_glibc": ["linux.jar"],
"//conditions:default": [],
})`,
}),
- MakeBazelTarget("java_library", "example_import-neverlink", AttrNameToString{
- "exports": `[":example_import"]`,
- "neverlink": `True`,
- "sdk_version": `"none"`,
+ MakeBazelTarget("java_import", "example_import", AttrNameToString{
+ "jars": `[":example_import-jars"]`,
+ }),
+ MakeBazelTarget("java_import", "example_import-neverlink", AttrNameToString{
+ "jars": `[":example_import-jars"]`,
+ "neverlink": `True`,
}),
}})
}
@@ -117,13 +121,15 @@
}
`,
ExpectedBazelTargets: []string{
- MakeBazelTarget("java_import", "example_import", AttrNameToString{
- "jars": `["import.jar"]`,
+ MakeBazelTarget("filegroup", "example_import-jars", AttrNameToString{
+ "srcs": `["import.jar"]`,
}),
- MakeBazelTarget("java_library", "example_import-neverlink", AttrNameToString{
- "exports": `[":example_import"]`,
- "neverlink": `True`,
- "sdk_version": `"none"`,
+ MakeBazelTarget("java_import", "example_import", AttrNameToString{
+ "jars": `[":example_import-jars"]`,
+ }),
+ MakeBazelTarget("java_import", "example_import-neverlink", AttrNameToString{
+ "jars": `[":example_import-jars"]`,
+ "neverlink": `True`,
}),
}})
}
@@ -142,13 +148,15 @@
}
`,
ExpectedBazelTargets: []string{
- MakeBazelTarget("java_import", "test_lib", AttrNameToString{
- "jars": `["test.jar"]`,
+ MakeBazelTarget("filegroup", "test_lib-jars", AttrNameToString{
+ "srcs": `["test.jar"]`,
}),
- MakeBazelTarget("java_library", "test_lib-neverlink", AttrNameToString{
- "exports": `[":test_lib"]`,
- "neverlink": `True`,
- "sdk_version": `"none"`,
+ MakeBazelTarget("java_import", "test_lib", AttrNameToString{
+ "jars": `[":test_lib-jars"]`,
+ }),
+ MakeBazelTarget("java_import", "test_lib-neverlink", AttrNameToString{
+ "jars": `[":test_lib-jars"]`,
+ "neverlink": `True`,
}),
},
}, func(ctx android.RegistrationContext) {
diff --git a/cc/config/global.go b/cc/config/global.go
index 0354b25..62b008b 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -170,9 +170,6 @@
// Emit additional debug info for AutoFDO
"-fdebug-info-for-profiling",
-
- // Enable Hot Cold splitting optimization.
- "-mllvm -hot-cold-split=true",
}
commonGlobalLldflags = []string{
diff --git a/java/aar.go b/java/aar.go
index 368f241..479b5e0 100644
--- a/java/aar.go
+++ b/java/aar.go
@@ -849,6 +849,17 @@
}
}
+func (a *AndroidLibrary) IDEInfo(dpInfo *android.IdeInfo) {
+ a.Library.IDEInfo(dpInfo)
+ a.aapt.IDEInfo(dpInfo)
+}
+
+func (a *aapt) IDEInfo(dpInfo *android.IdeInfo) {
+ if a.useResourceProcessorBusyBox() {
+ dpInfo.Jars = append(dpInfo.Jars, a.rJar.String())
+ }
+}
+
// android_library builds and links sources into a `.jar` file for the device along with Android resources.
//
// An android_library has a single variant that produces a `.jar` file containing `.class` files that were
diff --git a/java/app.go b/java/app.go
index ce94aba..0cb72e2 100755
--- a/java/app.go
+++ b/java/app.go
@@ -1073,6 +1073,11 @@
var _ cc.Coverage = (*AndroidApp)(nil)
+func (a *AndroidApp) IDEInfo(dpInfo *android.IdeInfo) {
+ a.Library.IDEInfo(dpInfo)
+ a.aapt.IDEInfo(dpInfo)
+}
+
// android_app compiles sources and Android resources into an Android application package `.apk` file.
func AndroidAppFactory() android.Module {
module := &AndroidApp{}
diff --git a/java/java.go b/java/java.go
index bc24050..de74ab2 100644
--- a/java/java.go
+++ b/java/java.go
@@ -2971,6 +2971,10 @@
// TODO(b/297356582): handle core_platform in bp2build
ctx.MarkBp2buildUnconvertible(bp2build_metrics_proto.UnconvertedReasonType_PROPERTY_UNSUPPORTED, "sdk_version core_platform")
return &javaCommonAttributes{}, &bp2BuildJavaInfo{}, false
+ } else if proptools.String(m.deviceProperties.Sdk_version) == "none" {
+ // TODO(b/297356703): handle system_modules
+ ctx.MarkBp2buildUnconvertible(bp2build_metrics_proto.UnconvertedReasonType_PROPERTY_UNSUPPORTED, "sdk_version none")
+ return &javaCommonAttributes{}, &bp2BuildJavaInfo{}, false
}
archVariantProps := m.GetArchVariantProperties(ctx, &CommonProperties{})
@@ -3405,9 +3409,14 @@
return libName
}
-type bazelJavaImportAttributes struct {
- Jars bazel.LabelListAttribute
- Exports bazel.LabelListAttribute
+type importAttributes struct {
+ Jars bazel.LabelListAttribute
+ Exports bazel.LabelListAttribute
+ Neverlink *bool
+}
+
+type filegroupAttrs struct {
+ Srcs bazel.LabelListAttribute
}
// java_import bp2Build converter.
@@ -3423,28 +3432,36 @@
}
}
- attrs := &bazelJavaImportAttributes{
- Jars: jars,
+ name := android.RemoveOptionalPrebuiltPrefix(i.Name())
+ filegroupTargetName := name + "-jars"
+
+ ctx.CreateBazelTargetModule(
+ bazel.BazelTargetModuleProperties{
+ Rule_class: "filegroup",
+ Bzl_load_location: "//build/bazel/rules:filegroup.bzl",
+ },
+ android.CommonAttributes{Name: filegroupTargetName},
+ &filegroupAttrs{
+ Srcs: jars,
+ },
+ )
+
+ attrs := &importAttributes{
+ Jars: bazel.MakeSingleLabelListAttribute(bazel.Label{Label: ":" + filegroupTargetName}),
}
props := bazel.BazelTargetModuleProperties{
Rule_class: "java_import",
Bzl_load_location: "//build/bazel/rules/java:import.bzl",
}
- name := android.RemoveOptionalPrebuiltPrefix(i.Name())
-
ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: name}, attrs)
- neverlink := true
- neverlinkAttrs := &javaLibraryAttributes{
- Neverlink: bazel.BoolAttribute{Value: &neverlink},
- Exports: bazel.MakeSingleLabelListAttribute(bazel.Label{Label: ":" + name}),
- javaCommonAttributes: &javaCommonAttributes{
- Sdk_version: bazel.StringAttribute{Value: proptools.StringPtr("none")},
- },
+ neverlinkAttrs := &importAttributes{
+ Jars: attrs.Jars,
+ Neverlink: proptools.BoolPtr(true),
}
ctx.CreateBazelTargetModule(
- javaLibraryBazelTargetModuleProperties(),
+ props,
android.CommonAttributes{Name: name + "-neverlink"},
neverlinkAttrs)
}