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
diff --git a/java/bootclasspath_fragment_test.go b/java/bootclasspath_fragment_test.go
index d3de675..2307ce0 100644
--- a/java/bootclasspath_fragment_test.go
+++ b/java/bootclasspath_fragment_test.go
@@ -278,3 +278,42 @@
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())
+}