Ensure consistent APEX variation for java_sdk_library and java_sdk_library_import

Previously, a java_sdk_library with shared_library = true would create
a variation per APEX because it depends on an sdkLibraryXml module
which generates a file containing the APEX name. However, a shared
java_sdk_library_import would create a merged APEX variation. The
inconsistent variations caused failures in sdkDepsReplaceMutator.

This change ensures that both java_sdk_library and
java_sdk_library_import create an APEX specific variation when their
shared_library property is true.

Bug: 190499958
Test: m nothing
      - ran the above command after modifying the test to reproduce the
        problem and then after fixing to verify that it fixed the problem.
Change-Id: Iee81776a8569db3e871c40cbde14d248dfeb56e4
This commit is contained in:
Paul Duffin
2021-06-24 13:25:57 +01:00
parent a8de9fb2ae
commit ea8f808580
2 changed files with 30 additions and 6 deletions

View File

@@ -273,7 +273,7 @@ func TestSnapshotWithBootClasspathFragment_Contents(t *testing.T) {
name: "myothersdklibrary",
apex_available: ["myapex"],
srcs: ["Test.java"],
shared_library: false,
compile_dex: true,
public: {enabled: true},
min_sdk_version: "2",
permitted_packages: ["myothersdklibrary"],
@@ -283,7 +283,7 @@ func TestSnapshotWithBootClasspathFragment_Contents(t *testing.T) {
name: "mycoreplatform",
apex_available: ["myapex"],
srcs: ["Test.java"],
shared_library: false,
compile_dex: true,
public: {enabled: true},
min_sdk_version: "2",
}
@@ -334,7 +334,8 @@ java_sdk_library_import {
prefer: false,
visibility: ["//visibility:public"],
apex_available: ["myapex"],
shared_library: false,
shared_library: true,
compile_dex: true,
public: {
jars: ["sdk_library/public/myothersdklibrary-stubs.jar"],
stub_srcs: ["sdk_library/public/myothersdklibrary_stub_sources"],
@@ -364,7 +365,8 @@ java_sdk_library_import {
prefer: false,
visibility: ["//visibility:public"],
apex_available: ["myapex"],
shared_library: false,
shared_library: true,
compile_dex: true,
public: {
jars: ["sdk_library/public/mycoreplatform-stubs.jar"],
stub_srcs: ["sdk_library/public/mycoreplatform_stub_sources"],
@@ -414,7 +416,8 @@ java_sdk_library_import {
sdk_member_name: "myothersdklibrary",
visibility: ["//visibility:public"],
apex_available: ["myapex"],
shared_library: false,
shared_library: true,
compile_dex: true,
public: {
jars: ["sdk_library/public/myothersdklibrary-stubs.jar"],
stub_srcs: ["sdk_library/public/myothersdklibrary_stub_sources"],
@@ -444,7 +447,8 @@ java_sdk_library_import {
sdk_member_name: "mycoreplatform",
visibility: ["//visibility:public"],
apex_available: ["myapex"],
shared_library: false,
shared_library: true,
compile_dex: true,
public: {
jars: ["sdk_library/public/mycoreplatform-stubs.jar"],
stub_srcs: ["sdk_library/public/mycoreplatform_stub_sources"],