Loading cc/androidmk.go +3 −0 Original line number Diff line number Diff line Loading @@ -294,6 +294,9 @@ func (library *libraryDecorator) AndroidMkEntries(ctx AndroidMkContext, entries if library.buildStubs() { entries.SetBool("LOCAL_NO_NOTICE_FILE", true) } if library.apiListCoverageXmlPath.String() != "" { entries.SetString("SOONG_CC_API_XML", "$(SOONG_CC_API_XML) "+library.apiListCoverageXmlPath.String()) } }) } // If a library providing a stub is included in an APEX, the private APIs of the library Loading cc/coverage.go +16 −0 Original line number Diff line number Diff line Loading @@ -244,3 +244,19 @@ func coverageMutator(mctx android.BottomUpMutatorContext) { m[1].(Coverage).EnableCoverageIfNeeded() } } func parseSymbolFileForAPICoverage(ctx ModuleContext, symbolFile string) android.ModuleOutPath { apiLevelsJson := android.GetApiLevelsJson(ctx) symbolFilePath := android.PathForModuleSrc(ctx, symbolFile) outputFile := ctx.baseModuleName() + ".xml" parsedApiCoveragePath := android.PathForModuleOut(ctx, outputFile) rule := android.NewRuleBuilder(pctx, ctx) rule.Command(). BuiltTool("ndk_api_coverage_parser"). Input(symbolFilePath). Output(parsedApiCoveragePath). Implicit(apiLevelsJson). FlagWithArg("--api-map ", apiLevelsJson.String()) rule.Build("native_library_api_list", "Generate native API list based on symbol files for coverage measurement") return parsedApiCoveragePath } cc/library.go +8 −0 Original line number Diff line number Diff line Loading @@ -536,6 +536,8 @@ type libraryDecorator struct { *baseInstaller collectedSnapshotHeaders android.Paths apiListCoverageXmlPath android.ModuleOutPath } type ccLibraryBazelHandler struct { Loading Loading @@ -951,6 +953,12 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa objs := compileStubLibrary(ctx, flags, nativeAbiResult.stubSrc) library.versionScriptPath = android.OptionalPathForPath( nativeAbiResult.versionScript) // Parse symbol file to get API list for coverage if library.stubsVersion() == "current" && ctx.PrimaryArch() { library.apiListCoverageXmlPath = parseSymbolFileForAPICoverage(ctx, symbolFile) } return objs } Loading cc/ndk_library.go +1 −26 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import ( func init() { pctx.HostBinToolVariable("ndkStubGenerator", "ndkstubgen") pctx.HostBinToolVariable("ndk_api_coverage_parser", "ndk_api_coverage_parser") pctx.HostBinToolVariable("abidiff", "abidiff") pctx.HostBinToolVariable("abitidy", "abitidy") pctx.HostBinToolVariable("abidw", "abidw") Loading @@ -43,12 +42,6 @@ var ( CommandDeps: []string{"$ndkStubGenerator"}, }, "arch", "apiLevel", "apiMap", "flags") parseNdkApiRule = pctx.AndroidStaticRule("parseNdkApiRule", blueprint.RuleParams{ Command: "$ndk_api_coverage_parser $in $out --api-map $apiMap", CommandDeps: []string{"$ndk_api_coverage_parser"}, }, "apiMap") abidw = pctx.AndroidStaticRule("abidw", blueprint.RuleParams{ Command: "$abidw --type-id-style hash --no-corpus-path " + Loading Loading @@ -276,24 +269,6 @@ func compileStubLibrary(ctx ModuleContext, flags Flags, src android.Path) Object android.Paths{src}, nil, nil) } func parseSymbolFileForCoverage(ctx ModuleContext, symbolFile string) android.ModuleOutPath { apiLevelsJson := android.GetApiLevelsJson(ctx) symbolFilePath := android.PathForModuleSrc(ctx, symbolFile) outputFileName := strings.Split(symbolFilePath.Base(), ".")[0] parsedApiCoveragePath := android.PathForModuleOut(ctx, outputFileName+".xml") ctx.Build(pctx, android.BuildParams{ Rule: parseNdkApiRule, Description: "parse ndk api symbol file for api coverage: " + symbolFilePath.Rel(), Outputs: []android.WritablePath{parsedApiCoveragePath}, Input: symbolFilePath, Implicits: []android.Path{apiLevelsJson}, Args: map[string]string{ "apiMap": apiLevelsJson.String(), }, }) return parsedApiCoveragePath } func (this *stubDecorator) findImplementationLibrary(ctx ModuleContext) android.Path { dep := ctx.GetDirectDepWithTag(strings.TrimSuffix(ctx.ModuleName(), ndkLibrarySuffix), stubImplementation) Loading Loading @@ -454,7 +429,7 @@ func (c *stubDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) O } } if c.apiLevel.IsCurrent() && ctx.PrimaryArch() { c.parsedCoverageXmlPath = parseSymbolFileForCoverage(ctx, symbolFile) c.parsedCoverageXmlPath = parseSymbolFileForAPICoverage(ctx, symbolFile) } return objs } Loading Loading
cc/androidmk.go +3 −0 Original line number Diff line number Diff line Loading @@ -294,6 +294,9 @@ func (library *libraryDecorator) AndroidMkEntries(ctx AndroidMkContext, entries if library.buildStubs() { entries.SetBool("LOCAL_NO_NOTICE_FILE", true) } if library.apiListCoverageXmlPath.String() != "" { entries.SetString("SOONG_CC_API_XML", "$(SOONG_CC_API_XML) "+library.apiListCoverageXmlPath.String()) } }) } // If a library providing a stub is included in an APEX, the private APIs of the library Loading
cc/coverage.go +16 −0 Original line number Diff line number Diff line Loading @@ -244,3 +244,19 @@ func coverageMutator(mctx android.BottomUpMutatorContext) { m[1].(Coverage).EnableCoverageIfNeeded() } } func parseSymbolFileForAPICoverage(ctx ModuleContext, symbolFile string) android.ModuleOutPath { apiLevelsJson := android.GetApiLevelsJson(ctx) symbolFilePath := android.PathForModuleSrc(ctx, symbolFile) outputFile := ctx.baseModuleName() + ".xml" parsedApiCoveragePath := android.PathForModuleOut(ctx, outputFile) rule := android.NewRuleBuilder(pctx, ctx) rule.Command(). BuiltTool("ndk_api_coverage_parser"). Input(symbolFilePath). Output(parsedApiCoveragePath). Implicit(apiLevelsJson). FlagWithArg("--api-map ", apiLevelsJson.String()) rule.Build("native_library_api_list", "Generate native API list based on symbol files for coverage measurement") return parsedApiCoveragePath }
cc/library.go +8 −0 Original line number Diff line number Diff line Loading @@ -536,6 +536,8 @@ type libraryDecorator struct { *baseInstaller collectedSnapshotHeaders android.Paths apiListCoverageXmlPath android.ModuleOutPath } type ccLibraryBazelHandler struct { Loading Loading @@ -951,6 +953,12 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa objs := compileStubLibrary(ctx, flags, nativeAbiResult.stubSrc) library.versionScriptPath = android.OptionalPathForPath( nativeAbiResult.versionScript) // Parse symbol file to get API list for coverage if library.stubsVersion() == "current" && ctx.PrimaryArch() { library.apiListCoverageXmlPath = parseSymbolFileForAPICoverage(ctx, symbolFile) } return objs } Loading
cc/ndk_library.go +1 −26 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import ( func init() { pctx.HostBinToolVariable("ndkStubGenerator", "ndkstubgen") pctx.HostBinToolVariable("ndk_api_coverage_parser", "ndk_api_coverage_parser") pctx.HostBinToolVariable("abidiff", "abidiff") pctx.HostBinToolVariable("abitidy", "abitidy") pctx.HostBinToolVariable("abidw", "abidw") Loading @@ -43,12 +42,6 @@ var ( CommandDeps: []string{"$ndkStubGenerator"}, }, "arch", "apiLevel", "apiMap", "flags") parseNdkApiRule = pctx.AndroidStaticRule("parseNdkApiRule", blueprint.RuleParams{ Command: "$ndk_api_coverage_parser $in $out --api-map $apiMap", CommandDeps: []string{"$ndk_api_coverage_parser"}, }, "apiMap") abidw = pctx.AndroidStaticRule("abidw", blueprint.RuleParams{ Command: "$abidw --type-id-style hash --no-corpus-path " + Loading Loading @@ -276,24 +269,6 @@ func compileStubLibrary(ctx ModuleContext, flags Flags, src android.Path) Object android.Paths{src}, nil, nil) } func parseSymbolFileForCoverage(ctx ModuleContext, symbolFile string) android.ModuleOutPath { apiLevelsJson := android.GetApiLevelsJson(ctx) symbolFilePath := android.PathForModuleSrc(ctx, symbolFile) outputFileName := strings.Split(symbolFilePath.Base(), ".")[0] parsedApiCoveragePath := android.PathForModuleOut(ctx, outputFileName+".xml") ctx.Build(pctx, android.BuildParams{ Rule: parseNdkApiRule, Description: "parse ndk api symbol file for api coverage: " + symbolFilePath.Rel(), Outputs: []android.WritablePath{parsedApiCoveragePath}, Input: symbolFilePath, Implicits: []android.Path{apiLevelsJson}, Args: map[string]string{ "apiMap": apiLevelsJson.String(), }, }) return parsedApiCoveragePath } func (this *stubDecorator) findImplementationLibrary(ctx ModuleContext) android.Path { dep := ctx.GetDirectDepWithTag(strings.TrimSuffix(ctx.ModuleName(), ndkLibrarySuffix), stubImplementation) Loading Loading @@ -454,7 +429,7 @@ func (c *stubDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) O } } if c.apiLevel.IsCurrent() && ctx.PrimaryArch() { c.parsedCoverageXmlPath = parseSymbolFileForCoverage(ctx, symbolFile) c.parsedCoverageXmlPath = parseSymbolFileForAPICoverage(ctx, symbolFile) } return objs } Loading