bootclasspath_fragment: Add test specific module type

This is needed to allow the behavior of the bootclasspath_fragment to
be tweaked for test fragments.

Bug: 194063708
Test: m nothing
Change-Id: Iee5c09d5b580d088ba081d95a788dbde883078ed
This commit is contained in:
Paul Duffin
2022-03-31 15:42:30 +01:00
parent 0e3d36c582
commit c15b9e99e5
2 changed files with 54 additions and 0 deletions

View File

@@ -278,3 +278,42 @@ func TestBootclasspathFragment_StubLibs(t *testing.T) {
android.AssertPathsRelativeToTopEquals(t, "widest dex stubs jar", expectedWidestPaths, info.TransitiveStubDexJarsByScope.StubDexJarsForWidestAPIScope())
}
func TestBootclasspathFragment_Test(t *testing.T) {
result := android.GroupFixturePreparers(
prepareForTestWithBootclasspathFragment,
PrepareForTestWithJavaSdkLibraryFiles,
FixtureWithLastReleaseApis("mysdklibrary"),
).RunTestWithBp(t, `
bootclasspath_fragment {
name: "myfragment",
contents: ["mysdklibrary"],
hidden_api: {
split_packages: [],
},
}
bootclasspath_fragment_test {
name: "a_test_fragment",
contents: ["mysdklibrary"],
hidden_api: {
split_packages: [],
},
}
java_sdk_library {
name: "mysdklibrary",
srcs: ["a.java"],
shared_library: false,
public: {enabled: true},
system: {enabled: true},
}
`)
fragment := result.Module("myfragment", "android_common").(*BootclasspathFragmentModule)
android.AssertBoolEquals(t, "not a test fragment", false, fragment.isTestFragment())
fragment = result.Module("a_test_fragment", "android_common").(*BootclasspathFragmentModule)
android.AssertBoolEquals(t, "is a test fragment by type", true, fragment.isTestFragment())
}