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:
@@ -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())
|
||||
}
|
||||
|
Reference in New Issue
Block a user