When a stub is built for APEX, it is generated with --apex
Now, symbols that are only to be visible to across APEXes can be tagged as # vndk. Then when generating the stubs library, the tagged symbol is included. The symbol is NOT included in other cases; build NDK stubs, etc. Bug: 120638081 Test: m (apex_test updated.) Change-Id: Idb2b552badddfc26af113cc8d4b984788f478813
This commit is contained in:
@@ -321,6 +321,9 @@ func TestApexWithStubs(t *testing.T) {
|
||||
// Ensure that stubs libs are built without -include flags
|
||||
mylib2Cflags := ctx.ModuleForTests("mylib2", "android_arm64_armv8-a_static_myapex").Rule("cc").Args["cFlags"]
|
||||
ensureNotContains(t, mylib2Cflags, "-include ")
|
||||
|
||||
// Ensure that genstub is invoked with --apex
|
||||
ensureContains(t, "--apex", ctx.ModuleForTests("mylib2", "android_arm64_armv8-a_static_3_myapex").Rule("genStubSrc").Args["flags"])
|
||||
}
|
||||
|
||||
func TestApexWithExplicitStubsDependency(t *testing.T) {
|
||||
|
@@ -395,7 +395,7 @@ func extractExportIncludesFromFlags(flags []string) []string {
|
||||
|
||||
func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects {
|
||||
if library.buildStubs() {
|
||||
objs, versionScript := compileStubLibrary(ctx, flags, String(library.Properties.Stubs.Symbol_file), library.MutatedProperties.StubsVersion, "")
|
||||
objs, versionScript := compileStubLibrary(ctx, flags, String(library.Properties.Stubs.Symbol_file), library.MutatedProperties.StubsVersion, "--apex")
|
||||
library.versionScriptPath = versionScript
|
||||
return objs
|
||||
}
|
||||
|
@@ -31,9 +31,9 @@ var (
|
||||
genStubSrc = pctx.AndroidStaticRule("genStubSrc",
|
||||
blueprint.RuleParams{
|
||||
Command: "$toolPath --arch $arch --api $apiLevel --api-map " +
|
||||
"$apiMap $vndk $in $out",
|
||||
"$apiMap $flags $in $out",
|
||||
CommandDeps: []string{"$toolPath"},
|
||||
}, "arch", "apiLevel", "apiMap", "vndk")
|
||||
}, "arch", "apiLevel", "apiMap", "flags")
|
||||
|
||||
ndkLibrarySuffix = ".ndk"
|
||||
|
||||
@@ -271,7 +271,7 @@ func (stub *stubDecorator) compilerFlags(ctx ModuleContext, flags Flags, deps Pa
|
||||
return addStubLibraryCompilerFlags(flags)
|
||||
}
|
||||
|
||||
func compileStubLibrary(ctx ModuleContext, flags Flags, symbolFile, apiLevel, vndk string) (Objects, android.ModuleGenPath) {
|
||||
func compileStubLibrary(ctx ModuleContext, flags Flags, symbolFile, apiLevel, genstubFlags string) (Objects, android.ModuleGenPath) {
|
||||
arch := ctx.Arch().ArchType.String()
|
||||
|
||||
stubSrcPath := android.PathForModuleGen(ctx, "stub.c")
|
||||
@@ -288,7 +288,7 @@ func compileStubLibrary(ctx ModuleContext, flags Flags, symbolFile, apiLevel, vn
|
||||
"arch": arch,
|
||||
"apiLevel": apiLevel,
|
||||
"apiMap": apiLevelsJson.String(),
|
||||
"vndk": vndk,
|
||||
"flags": genstubFlags,
|
||||
},
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user