Merge "Modify static lib stub library visiblity" into main
This commit is contained in:
commit
968c735108
2 changed files with 31 additions and 2 deletions
|
@ -1633,7 +1633,7 @@ func (module *SdkLibrary) createStubsLibrary(mctx android.DefaultableHookContext
|
||||||
}{}
|
}{}
|
||||||
|
|
||||||
props.Name = proptools.StringPtr(module.sourceStubLibraryModuleName(apiScope))
|
props.Name = proptools.StringPtr(module.sourceStubLibraryModuleName(apiScope))
|
||||||
props.Visibility = childModuleVisibility(module.sdkLibraryProperties.Stubs_library_visibility)
|
props.Visibility = []string{"//visibility:override", "//visibility:private"}
|
||||||
// sources are generated from the droiddoc
|
// sources are generated from the droiddoc
|
||||||
props.Srcs = []string{":" + module.stubsSourceModuleName(apiScope)}
|
props.Srcs = []string{":" + module.stubsSourceModuleName(apiScope)}
|
||||||
sdkVersion := module.sdkVersionForStubsLibrary(mctx, apiScope)
|
sdkVersion := module.sdkVersionForStubsLibrary(mctx, apiScope)
|
||||||
|
@ -1829,7 +1829,7 @@ func (module *SdkLibrary) createApiLibrary(mctx android.DefaultableHookContext,
|
||||||
}{}
|
}{}
|
||||||
|
|
||||||
props.Name = proptools.StringPtr(module.apiLibraryModuleName(apiScope))
|
props.Name = proptools.StringPtr(module.apiLibraryModuleName(apiScope))
|
||||||
props.Visibility = childModuleVisibility(module.sdkLibraryProperties.Stubs_library_visibility)
|
props.Visibility = []string{"//visibility:override", "//visibility:private"}
|
||||||
|
|
||||||
apiContributions := []string{}
|
apiContributions := []string{}
|
||||||
|
|
||||||
|
|
|
@ -1474,3 +1474,32 @@ func TestJavaSdkLibrary_ApiLibrary(t *testing.T) {
|
||||||
android.AssertStringEquals(t, "Module expected to contain full api surface api library", c.fullApiSurfaceStub, *m.properties.Full_api_surface_stub)
|
android.AssertStringEquals(t, "Module expected to contain full api surface api library", c.fullApiSurfaceStub, *m.properties.Full_api_surface_stub)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestStaticDepStubLibrariesVisibility(t *testing.T) {
|
||||||
|
android.GroupFixturePreparers(
|
||||||
|
prepareForJavaTest,
|
||||||
|
PrepareForTestWithJavaSdkLibraryFiles,
|
||||||
|
FixtureWithLastReleaseApis("foo"),
|
||||||
|
android.FixtureMergeMockFs(
|
||||||
|
map[string][]byte{
|
||||||
|
"A.java": nil,
|
||||||
|
"dir/Android.bp": []byte(
|
||||||
|
`
|
||||||
|
java_library {
|
||||||
|
name: "bar",
|
||||||
|
srcs: ["A.java"],
|
||||||
|
libs: ["foo.stubs.from-source"],
|
||||||
|
}
|
||||||
|
`),
|
||||||
|
"dir/A.java": nil,
|
||||||
|
},
|
||||||
|
).ExtendWithErrorHandler(
|
||||||
|
android.FixtureExpectsAtLeastOneErrorMatchingPattern(
|
||||||
|
`module "bar" variant "android_common": depends on //.:foo.stubs.from-source which is not visible to this module`)),
|
||||||
|
).RunTestWithBp(t, `
|
||||||
|
java_sdk_library {
|
||||||
|
name: "foo",
|
||||||
|
srcs: ["A.java"],
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue