Drop the cc_defaults module for libdexfile_external_static users.
It won't work in SDK snapshots (b/169779783).
This means external dependencies (libbase, liblog, libz, libziparchive)
are included as whole_static_libs, as before
https://r.android.com/1435792, even if that may lead to duplicated code
in depending modules. We cannot let them depend on those libraries
separately without better tools to avoid version conflicts.
Test: atest --host art_libdexfile_external_static_tests
Bug: 142944931
Bug: 169885605
Change-Id: I9fc176dd798ce64cbb806905e665bc03c247fddb
diff --git a/libdexfile/Android.bp b/libdexfile/Android.bp
index c08a244..6ce66cd 100644
--- a/libdexfile/Android.bp
+++ b/libdexfile/Android.bp
@@ -454,60 +454,38 @@
],
}
-// External packages allowed to link in static libdexfile_support. This is not
-// allowed in any module that may end up in an APEX or platform image, so
-// visibility is restrictive.
-libdexfile_external_static_visibility = [
- // Required for simpleperf, libsimpleperf_record, and libsimpleperf_report
- // in the NDK.
- "//system/extras/simpleperf",
- "//cts/tests/tests/simpleperf",
-]
-
+// For use by external packages allowed to link in static libdexfile_support.
+// This is not allowed in any module that may end up in an APEX or platform
+// image, so visibility is restrictive.
cc_library_static {
name: "libdexfile_external_static",
host_supported: true,
- visibility: libdexfile_external_static_visibility,
- // Include internal library dependencies that should have no external
- // visibility. We cannot use libdexfile_support_static_defaults because that
- // one also includes external dependencies, and libs using this one may then
- // get duplicate copies of them.
- whole_static_libs: [
- "libartbase",
- "libartpalette",
- "libdexfile",
- "libdexfile_external",
- "libdexfile_support_static",
+ visibility: [
+ // Required for simpleperf, libsimpleperf_record, and libsimpleperf_report
+ // in the NDK.
+ "//system/extras/simpleperf",
+ "//cts/tests/tests/simpleperf",
],
-}
-
-cc_defaults {
- name: "libdexfile_external_static_defaults",
- defaults_visibility: libdexfile_external_static_visibility,
- target: {
- linux: {
- // This cc_defaults somewhat arbitrarily limits the libs to linux,
- // because that's what the users in simpleperf need.
- static_libs: [
- "libdexfile_external_static",
- // External dependencies:
- "libbase",
- "liblog",
- "libz",
- "libziparchive",
- ],
- },
- },
+ // Using libdexfile_support_static_defaults will link in external libs like
+ // libbase and libz statically as well, which are likely to cause duplicate
+ // copies in the depending module.
+ // TODO(b/169885605): Avoid exposing symbols from those libs.
+ defaults: [
+ "art_defaults",
+ "libdexfile_support_static_defaults",
+ ],
}
art_cc_test {
name: "art_libdexfile_external_static_tests",
host_supported: true,
test_suites: ["general-tests"],
- defaults: ["libdexfile_external_static_defaults"],
srcs: [
"external/dex_file_supp_test.cc",
],
+ static_libs: [
+ "libdexfile_external_static",
+ ],
enabled: false,
target: {
linux: {