Support dex_import on platform_bootclasspath
Maintain compatibility with previous behavior by ignoring dex_import
during hidden API processing.
Bug: 179354495
Test: m nothing
Change-Id: I976b02129bf981b7b61dce233567d6f89e04f92d
diff --git a/java/platform_bootclasspath.go b/java/platform_bootclasspath.go
index 4cb02e3..3a59822 100644
--- a/java/platform_bootclasspath.go
+++ b/java/platform_bootclasspath.go
@@ -321,6 +321,8 @@
}
hiddenAPISupportingModules = append(hiddenAPISupportingModules, hiddenAPISupportingModule)
+ } else if _, ok := module.(*DexImport); ok {
+ // Ignore this for the purposes of hidden API processing
} else {
ctx.ModuleErrorf("module %s of type %s does not support hidden API processing", module, ctx.OtherModuleType(module))
}
diff --git a/java/platform_bootclasspath_test.go b/java/platform_bootclasspath_test.go
index 2216b11..98d4614 100644
--- a/java/platform_bootclasspath_test.go
+++ b/java/platform_bootclasspath_test.go
@@ -133,6 +133,23 @@
"platform:bar",
})
})
+
+ t.Run("dex import", func(t *testing.T) {
+ result := android.GroupFixturePreparers(
+ preparer,
+ android.FixtureAddTextFile("deximport/Android.bp", `
+ dex_import {
+ name: "foo",
+ jars: ["a.jar"],
+ }
+ `),
+ ).RunTest(t)
+
+ CheckPlatformBootclasspathModules(t, result, "platform-bootclasspath", []string{
+ "platform:prebuilt_foo",
+ "platform:bar",
+ })
+ })
}
func TestPlatformBootclasspath_Fragments(t *testing.T) {