Remove fallback code path for missing BCP fragments that is no longer
necessary. #codehealth Test: m nothing Bug: 179354495 Change-Id: Iaddf163e69b52cef82d522311e81bef9bdb4aa8d
This commit is contained in:
@@ -21,6 +21,7 @@ import (
|
|||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
"android/soong/java"
|
"android/soong/java"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
"github.com/google/blueprint/proptools"
|
"github.com/google/blueprint/proptools"
|
||||||
)
|
)
|
||||||
@@ -325,31 +326,15 @@ func TestPlatformBootclasspathDependencies(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TestPlatformBootclasspath_AlwaysUsePrebuiltSdks verifies that the build does not fail when
|
// TestPlatformBootclasspath_AlwaysUsePrebuiltSdks verifies that the build does not fail when
|
||||||
// AlwaysUsePrebuiltSdk() returns true. The structure of the modules in this test matches what
|
// AlwaysUsePrebuiltSdk() returns true.
|
||||||
// currently exists in some places in the Android build but it is not the intended structure. It is
|
|
||||||
// in fact an invalid structure that should cause build failures. However, fixing that structure
|
|
||||||
// will take too long so in the meantime this tests the workarounds to avoid build breakages.
|
|
||||||
//
|
|
||||||
// The main issues with this structure are:
|
|
||||||
// 1. There is no prebuilt_bootclasspath_fragment referencing the "foo" java_sdk_library_import.
|
|
||||||
// 2. There is no prebuilt_apex/apex_set which makes the dex implementation jar available to the
|
|
||||||
// prebuilt_bootclasspath_fragment and the "foo" java_sdk_library_import.
|
|
||||||
//
|
|
||||||
// Together these cause the following symptoms:
|
|
||||||
// 1. The "foo" java_sdk_library_import does not have a dex implementation jar.
|
|
||||||
// 2. The "foo" java_sdk_library_import does not have a myapex variant.
|
|
||||||
//
|
|
||||||
// TODO(b/179354495): Fix the structure in this test once the main Android build has been fixed.
|
|
||||||
func TestPlatformBootclasspath_AlwaysUsePrebuiltSdks(t *testing.T) {
|
func TestPlatformBootclasspath_AlwaysUsePrebuiltSdks(t *testing.T) {
|
||||||
result := android.GroupFixturePreparers(
|
result := android.GroupFixturePreparers(
|
||||||
prepareForTestWithPlatformBootclasspath,
|
prepareForTestWithPlatformBootclasspath,
|
||||||
prepareForTestWithMyapex,
|
prepareForTestWithMyapex,
|
||||||
// Configure two libraries, the first is a java_sdk_library whose prebuilt will be used because
|
// Configure two libraries, the first is a java_sdk_library whose prebuilt will be used because
|
||||||
// of AlwaysUsePrebuiltsSdk() but does not have an appropriate apex variant and does not provide
|
// of AlwaysUsePrebuiltsSdk(). The second is a normal library that is unaffected. The order
|
||||||
// a boot dex jar. The second is a normal library that is unaffected. The order matters because
|
// matters, so that the dependencies resolved by the platform_bootclasspath matches the
|
||||||
// if the dependency on myapex:foo is filtered out because of either of those conditions then
|
// configured list.
|
||||||
// the dependencies resolved by the platform_bootclasspath will not match the configured list
|
|
||||||
// and so will fail the test.
|
|
||||||
java.FixtureConfigureApexBootJars("myapex:foo", "myapex:bar"),
|
java.FixtureConfigureApexBootJars("myapex:foo", "myapex:bar"),
|
||||||
java.PrepareForTestWithJavaSdkLibraryFiles,
|
java.PrepareForTestWithJavaSdkLibraryFiles,
|
||||||
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
||||||
@@ -394,6 +379,12 @@ func TestPlatformBootclasspath_AlwaysUsePrebuiltSdks(t *testing.T) {
|
|||||||
permitted_packages: ["foo"],
|
permitted_packages: ["foo"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prebuilt_apex {
|
||||||
|
name: "myapex",
|
||||||
|
src: "myapex.apex",
|
||||||
|
exported_bootclasspath_fragments: ["mybootclasspath-fragment"],
|
||||||
|
}
|
||||||
|
|
||||||
// A prebuilt java_sdk_library_import that is not preferred by default but will be preferred
|
// A prebuilt java_sdk_library_import that is not preferred by default but will be preferred
|
||||||
// because AlwaysUsePrebuiltSdks() is true.
|
// because AlwaysUsePrebuiltSdks() is true.
|
||||||
java_sdk_library_import {
|
java_sdk_library_import {
|
||||||
@@ -423,6 +414,23 @@ func TestPlatformBootclasspath_AlwaysUsePrebuiltSdks(t *testing.T) {
|
|||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prebuilt_bootclasspath_fragment {
|
||||||
|
name: "mybootclasspath-fragment",
|
||||||
|
apex_available: [
|
||||||
|
"myapex",
|
||||||
|
],
|
||||||
|
contents: [
|
||||||
|
"foo",
|
||||||
|
],
|
||||||
|
hidden_api: {
|
||||||
|
stub_flags: "",
|
||||||
|
annotation_flags: "",
|
||||||
|
metadata: "",
|
||||||
|
index: "",
|
||||||
|
all_flags: "",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
platform_bootclasspath {
|
platform_bootclasspath {
|
||||||
name: "myplatform-bootclasspath",
|
name: "myplatform-bootclasspath",
|
||||||
fragments: [
|
fragments: [
|
||||||
@@ -437,7 +445,7 @@ func TestPlatformBootclasspath_AlwaysUsePrebuiltSdks(t *testing.T) {
|
|||||||
|
|
||||||
java.CheckPlatformBootclasspathModules(t, result, "myplatform-bootclasspath", []string{
|
java.CheckPlatformBootclasspathModules(t, result, "myplatform-bootclasspath", []string{
|
||||||
// The configured contents of BootJars.
|
// The configured contents of BootJars.
|
||||||
"platform:prebuilt_foo", // Note: This is the platform not myapex variant.
|
"myapex:prebuilt_foo",
|
||||||
"myapex:bar",
|
"myapex:bar",
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -456,16 +464,15 @@ func TestPlatformBootclasspath_AlwaysUsePrebuiltSdks(t *testing.T) {
|
|||||||
|
|
||||||
// The platform_bootclasspath intentionally adds dependencies on both source and prebuilt
|
// The platform_bootclasspath intentionally adds dependencies on both source and prebuilt
|
||||||
// modules when available as it does not know which one will be preferred.
|
// modules when available as it does not know which one will be preferred.
|
||||||
//
|
|
||||||
// The source module has an APEX variant but the prebuilt does not.
|
|
||||||
"myapex:foo",
|
"myapex:foo",
|
||||||
"platform:prebuilt_foo",
|
"myapex:prebuilt_foo",
|
||||||
|
|
||||||
// Only a source module exists.
|
// Only a source module exists.
|
||||||
"myapex:bar",
|
"myapex:bar",
|
||||||
|
|
||||||
// The fragments.
|
// The fragments.
|
||||||
"myapex:mybootclasspath-fragment",
|
"myapex:mybootclasspath-fragment",
|
||||||
|
"myapex:prebuilt_mybootclasspath-fragment",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -95,15 +95,6 @@ func addDependencyOntoApexModulePair(ctx android.BottomUpMutatorContext, apex st
|
|||||||
if ctx.OtherModuleDependencyVariantExists(variations, prebuiltName) {
|
if ctx.OtherModuleDependencyVariantExists(variations, prebuiltName) {
|
||||||
ctx.AddVariationDependencies(variations, tag, prebuiltName)
|
ctx.AddVariationDependencies(variations, tag, prebuiltName)
|
||||||
addedDep = true
|
addedDep = true
|
||||||
} else if ctx.Config().AlwaysUsePrebuiltSdks() && len(variations) > 0 {
|
|
||||||
// TODO(b/179354495): Remove this code path once the Android build has been fully migrated to
|
|
||||||
// use bootclasspath_fragment properly.
|
|
||||||
// Some prebuilt java_sdk_library modules do not yet have an APEX variations so try and add a
|
|
||||||
// dependency on the non-APEX variant.
|
|
||||||
if ctx.OtherModuleDependencyVariantExists(nil, prebuiltName) {
|
|
||||||
ctx.AddVariationDependencies(nil, tag, prebuiltName)
|
|
||||||
addedDep = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no appropriate variant existing for this, so no dependency could be added, then it is an
|
// If no appropriate variant existing for this, so no dependency could be added, then it is an
|
||||||
|
Reference in New Issue
Block a user