Skip to content
Snippets Groups Projects
Commit 4671ab97 authored by Spandan Das's avatar Spandan Das Committed by Gerrit Code Review
Browse files

Merge "Enforce bcp/sscp stubs do not compile against apps" into main

parents 48165939 67b7906e
No related branches found
No related tags found
No related merge requests found
......@@ -79,7 +79,45 @@ func registerBuildComponents(ctx android.RegistrationContext) {
var PrepareForCombinedApisTest = android.FixtureRegisterWithContext(registerBuildComponents)
func (a *CombinedApis) apiFingerprintStubDeps() []string {
ret := []string{}
ret = append(
ret,
transformArray(a.properties.Bootclasspath, "", ".stubs")...,
)
ret = append(
ret,
transformArray(a.properties.Bootclasspath, "", ".stubs.system")...,
)
ret = append(
ret,
transformArray(a.properties.Bootclasspath, "", ".stubs.module_lib")...,
)
ret = append(
ret,
transformArray(a.properties.System_server_classpath, "", ".stubs.system_server")...,
)
return ret
}
func (a *CombinedApis) DepsMutator(ctx android.BottomUpMutatorContext) {
ctx.AddDependency(ctx.Module(), nil, a.apiFingerprintStubDeps()...)
}
func (a *CombinedApis) GenerateAndroidBuildActions(ctx android.ModuleContext) {
ctx.WalkDeps(func(child, parent android.Module) bool {
if _, ok := child.(java.AndroidLibraryDependency); ok && child.Name() != "framework-res" {
// Stubs of BCP and SSCP libraries should not have any dependencies on apps
// This check ensures that we do not run into circular dependencies when UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT=true
ctx.ModuleErrorf(
"Module %s is not a valid dependency of the stub library %s\n."+
"If this dependency has been added via `libs` of java_sdk_library, please move it to `impl_only_libs`\n",
child.Name(), parent.Name())
return false // error detected
}
return true
})
}
type genruleProps struct {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment