Create public stub for platform's sysprop_library
Java modules using SystemAPI can now link against platform owned sysprop_library with public stub. This allows modules to use platform's public sysprops (which should be regarded as an API) without any hidden API usages, if using dynamic linking and boot class path. This doesn't affect any vendor or odm owned sysprop_library. Bug: 141246285 Bug: 145167888 Test: m Change-Id: I99824fb24a75cc8282211c2ad6c6296ae9fca393
This commit is contained in:
@@ -24,6 +24,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/proptools"
|
||||
)
|
||||
|
||||
@@ -77,7 +78,8 @@ func testContext(config android.Config, bp string,
|
||||
ctx.BottomUp("vndk", cc.VndkMutator).Parallel()
|
||||
ctx.BottomUp("version", cc.VersionMutator).Parallel()
|
||||
ctx.BottomUp("begin", cc.BeginMutator).Parallel()
|
||||
ctx.BottomUp("sysprop", cc.SyspropMutator).Parallel()
|
||||
ctx.BottomUp("sysprop_cc", cc.SyspropMutator).Parallel()
|
||||
ctx.BottomUp("sysprop_java", java.SyspropMutator).Parallel()
|
||||
})
|
||||
|
||||
ctx.RegisterModuleType("sysprop_library", syspropLibraryFactory)
|
||||
@@ -209,6 +211,13 @@ func TestSyspropLibrary(t *testing.T) {
|
||||
libs: ["sysprop-platform"],
|
||||
}
|
||||
|
||||
java_library {
|
||||
name: "java-platform-private",
|
||||
srcs: ["c.java"],
|
||||
platform_apis: true,
|
||||
libs: ["sysprop-platform"],
|
||||
}
|
||||
|
||||
java_library {
|
||||
name: "java-product",
|
||||
srcs: ["c.java"],
|
||||
@@ -307,6 +316,7 @@ func TestSyspropLibrary(t *testing.T) {
|
||||
}
|
||||
|
||||
ctx.ModuleForTests("sysprop-platform", "android_common")
|
||||
ctx.ModuleForTests("sysprop-platform_public", "android_common")
|
||||
ctx.ModuleForTests("sysprop-vendor", "android_common")
|
||||
|
||||
// Check for exported includes
|
||||
@@ -359,4 +369,17 @@ func TestSyspropLibrary(t *testing.T) {
|
||||
t.Errorf("flags for vendor must contain %#v and %#v, but was %#v.",
|
||||
platformPublicVendorPath, vendorInternalPath, vendorFlags)
|
||||
}
|
||||
|
||||
// Java modules linking against system API should use public stub
|
||||
javaSystemApiClient := ctx.ModuleForTests("java-platform", "android_common")
|
||||
publicStubFound := false
|
||||
ctx.VisitDirectDeps(javaSystemApiClient.Module(), func(dep blueprint.Module) {
|
||||
if dep.Name() == "sysprop-platform_public" {
|
||||
publicStubFound = true
|
||||
}
|
||||
})
|
||||
if !publicStubFound {
|
||||
t.Errorf("system api client should use public stub")
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user