Loading apex/apex.go +29 −3 Original line number Diff line number Diff line Loading @@ -267,6 +267,10 @@ type apexBundleProperties struct { // List of sanitizer names that this APEX is enabled for SanitizerNames []string `blueprint:"mutated"` PreventInstall bool `blueprint:"mutated"` HideFromMake bool `blueprint:"mutated"` } type apexTargetBundleProperties struct { Loading Loading @@ -549,7 +553,7 @@ func (a *apexBundle) Srcs() android.Paths { } func (a *apexBundle) installable() bool { return a.properties.Installable == nil || proptools.Bool(a.properties.Installable) return !a.properties.PreventInstall && (a.properties.Installable == nil || proptools.Bool(a.properties.Installable)) } func (a *apexBundle) getImageVariation(config android.DeviceConfig) string { Loading Loading @@ -584,6 +588,18 @@ func (a *apexBundle) IsSanitizerEnabled(ctx android.BaseModuleContext, sanitizer return android.InList(sanitizerName, globalSanitizerNames) } func (a *apexBundle) IsNativeCoverageNeeded(ctx android.BaseContext) bool { return ctx.Device() && ctx.DeviceConfig().NativeCoverageEnabled() } func (a *apexBundle) PreventInstall() { a.properties.PreventInstall = true } func (a *apexBundle) HideFromMake() { a.properties.HideFromMake = true } func getCopyManifestForNativeLibrary(cc *cc.Module, handleSpecialLibs bool) (fileToCopy android.Path, dirInApex string) { // Decide the APEX-local directory by the multilib of the library // In the future, we may query this to the module. Loading Loading @@ -1083,6 +1099,11 @@ func (a *apexBundle) buildFlattenedApex(ctx android.ModuleContext) { } func (a *apexBundle) AndroidMk() android.AndroidMkData { if a.properties.HideFromMake { return android.AndroidMkData{ Disabled: true, } } writers := []android.AndroidMkData{} if a.apexTypes.image() { writers = append(writers, a.androidMkForType(imageApex)) Loading Loading @@ -1172,9 +1193,14 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, name, moduleDir string, apex fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_java_prebuilt.mk") } else if fi.class == nativeSharedLib || fi.class == nativeExecutable { fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", fi.builtFile.Base()) if cc, ok := fi.module.(*cc.Module); ok && cc.UnstrippedOutputFile() != nil { if cc, ok := fi.module.(*cc.Module); ok { if cc.UnstrippedOutputFile() != nil { fmt.Fprintln(w, "LOCAL_SOONG_UNSTRIPPED_BINARY :=", cc.UnstrippedOutputFile().String()) } if cc.CoverageOutputFile().Valid() { fmt.Fprintln(w, "LOCAL_PREBUILT_COVERAGE_ARCHIVE :=", cc.CoverageOutputFile().String()) } } fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_cc_prebuilt.mk") } else { fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", fi.builtFile.Base()) Loading cc/binary.go +4 −0 Original line number Diff line number Diff line Loading @@ -421,6 +421,10 @@ func (binary *binaryDecorator) nativeCoverage() bool { return true } func (binary *binaryDecorator) coverageOutputFilePath() android.OptionalPath { return binary.coverageOutputFile } // /system/bin/linker -> /apex/com.android.runtime/bin/linker func (binary *binaryDecorator) installSymlinkToRuntimeApex(ctx ModuleContext, file android.Path) { dir := binary.baseInstaller.installDir(ctx) Loading cc/cc.go +8 −0 Original line number Diff line number Diff line Loading @@ -311,6 +311,7 @@ type linker interface { unstrippedOutputFilePath() android.Path nativeCoverage() bool coverageOutputFilePath() android.OptionalPath } type installer interface { Loading Loading @@ -420,6 +421,13 @@ func (c *Module) UnstrippedOutputFile() android.Path { return nil } func (c *Module) CoverageOutputFile() android.OptionalPath { if c.linker != nil { return c.linker.coverageOutputFilePath() } return android.OptionalPath{} } func (c *Module) RelativeInstallPath() string { if c.installer != nil { return c.installer.relativeInstallPath() Loading cc/coverage.go +17 −1 Original line number Diff line number Diff line Loading @@ -140,7 +140,6 @@ func (cov *coverage) begin(ctx BaseModuleContext) { } else { // Check if Native_coverage is set to false. This property defaults to true. needCoverageVariant = BoolDefault(cov.Properties.Native_coverage, true) if sdk_version := ctx.sdkVersion(); ctx.useSdk() && sdk_version != "current" { // Native coverage is not supported for SDK versions < 23 if fromApi, err := strconv.Atoi(sdk_version); err == nil && fromApi < 23 { Loading @@ -158,6 +157,14 @@ func (cov *coverage) begin(ctx BaseModuleContext) { cov.Properties.NeedCoverageVariant = needCoverageVariant } // Coverage is an interface for non-CC modules to implement to be mutated for coverage type Coverage interface { android.Module IsNativeCoverageNeeded(ctx android.BaseModuleContext) bool PreventInstall() HideFromMake() } func coverageMutator(mctx android.BottomUpMutatorContext) { if c, ok := mctx.Module().(*Module); ok && c.coverage != nil { needCoverageVariant := c.coverage.Properties.NeedCoverageVariant Loading @@ -177,5 +184,14 @@ func coverageMutator(mctx android.BottomUpMutatorContext) { m[1].(*Module).coverage.Properties.CoverageEnabled = needCoverageBuild m[1].(*Module).coverage.Properties.IsCoverageVariant = true } } else if cov, ok := mctx.Module().(Coverage); ok && cov.IsNativeCoverageNeeded(mctx) { // APEX modules fall here // Note: variant "" is also created because an APEX can be depended on by another // module which are split into "" and "cov" variants. e.g. when cc_test refers // to an APEX via 'data' property. m := mctx.CreateVariations("", "cov") m[0].(Coverage).PreventInstall() m[0].(Coverage).HideFromMake() } } cc/library.go +4 −0 Original line number Diff line number Diff line Loading @@ -758,6 +758,10 @@ func (library *libraryDecorator) nativeCoverage() bool { return true } func (library *libraryDecorator) coverageOutputFilePath() android.OptionalPath { return library.coverageOutputFile } func getRefAbiDumpFile(ctx ModuleContext, vndkVersion, fileName string) android.Path { isLlndk := inList(ctx.baseModuleName(), llndkLibraries) || inList(ctx.baseModuleName(), ndkMigratedLibs) Loading Loading
apex/apex.go +29 −3 Original line number Diff line number Diff line Loading @@ -267,6 +267,10 @@ type apexBundleProperties struct { // List of sanitizer names that this APEX is enabled for SanitizerNames []string `blueprint:"mutated"` PreventInstall bool `blueprint:"mutated"` HideFromMake bool `blueprint:"mutated"` } type apexTargetBundleProperties struct { Loading Loading @@ -549,7 +553,7 @@ func (a *apexBundle) Srcs() android.Paths { } func (a *apexBundle) installable() bool { return a.properties.Installable == nil || proptools.Bool(a.properties.Installable) return !a.properties.PreventInstall && (a.properties.Installable == nil || proptools.Bool(a.properties.Installable)) } func (a *apexBundle) getImageVariation(config android.DeviceConfig) string { Loading Loading @@ -584,6 +588,18 @@ func (a *apexBundle) IsSanitizerEnabled(ctx android.BaseModuleContext, sanitizer return android.InList(sanitizerName, globalSanitizerNames) } func (a *apexBundle) IsNativeCoverageNeeded(ctx android.BaseContext) bool { return ctx.Device() && ctx.DeviceConfig().NativeCoverageEnabled() } func (a *apexBundle) PreventInstall() { a.properties.PreventInstall = true } func (a *apexBundle) HideFromMake() { a.properties.HideFromMake = true } func getCopyManifestForNativeLibrary(cc *cc.Module, handleSpecialLibs bool) (fileToCopy android.Path, dirInApex string) { // Decide the APEX-local directory by the multilib of the library // In the future, we may query this to the module. Loading Loading @@ -1083,6 +1099,11 @@ func (a *apexBundle) buildFlattenedApex(ctx android.ModuleContext) { } func (a *apexBundle) AndroidMk() android.AndroidMkData { if a.properties.HideFromMake { return android.AndroidMkData{ Disabled: true, } } writers := []android.AndroidMkData{} if a.apexTypes.image() { writers = append(writers, a.androidMkForType(imageApex)) Loading Loading @@ -1172,9 +1193,14 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, name, moduleDir string, apex fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_java_prebuilt.mk") } else if fi.class == nativeSharedLib || fi.class == nativeExecutable { fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", fi.builtFile.Base()) if cc, ok := fi.module.(*cc.Module); ok && cc.UnstrippedOutputFile() != nil { if cc, ok := fi.module.(*cc.Module); ok { if cc.UnstrippedOutputFile() != nil { fmt.Fprintln(w, "LOCAL_SOONG_UNSTRIPPED_BINARY :=", cc.UnstrippedOutputFile().String()) } if cc.CoverageOutputFile().Valid() { fmt.Fprintln(w, "LOCAL_PREBUILT_COVERAGE_ARCHIVE :=", cc.CoverageOutputFile().String()) } } fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_cc_prebuilt.mk") } else { fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", fi.builtFile.Base()) Loading
cc/binary.go +4 −0 Original line number Diff line number Diff line Loading @@ -421,6 +421,10 @@ func (binary *binaryDecorator) nativeCoverage() bool { return true } func (binary *binaryDecorator) coverageOutputFilePath() android.OptionalPath { return binary.coverageOutputFile } // /system/bin/linker -> /apex/com.android.runtime/bin/linker func (binary *binaryDecorator) installSymlinkToRuntimeApex(ctx ModuleContext, file android.Path) { dir := binary.baseInstaller.installDir(ctx) Loading
cc/cc.go +8 −0 Original line number Diff line number Diff line Loading @@ -311,6 +311,7 @@ type linker interface { unstrippedOutputFilePath() android.Path nativeCoverage() bool coverageOutputFilePath() android.OptionalPath } type installer interface { Loading Loading @@ -420,6 +421,13 @@ func (c *Module) UnstrippedOutputFile() android.Path { return nil } func (c *Module) CoverageOutputFile() android.OptionalPath { if c.linker != nil { return c.linker.coverageOutputFilePath() } return android.OptionalPath{} } func (c *Module) RelativeInstallPath() string { if c.installer != nil { return c.installer.relativeInstallPath() Loading
cc/coverage.go +17 −1 Original line number Diff line number Diff line Loading @@ -140,7 +140,6 @@ func (cov *coverage) begin(ctx BaseModuleContext) { } else { // Check if Native_coverage is set to false. This property defaults to true. needCoverageVariant = BoolDefault(cov.Properties.Native_coverage, true) if sdk_version := ctx.sdkVersion(); ctx.useSdk() && sdk_version != "current" { // Native coverage is not supported for SDK versions < 23 if fromApi, err := strconv.Atoi(sdk_version); err == nil && fromApi < 23 { Loading @@ -158,6 +157,14 @@ func (cov *coverage) begin(ctx BaseModuleContext) { cov.Properties.NeedCoverageVariant = needCoverageVariant } // Coverage is an interface for non-CC modules to implement to be mutated for coverage type Coverage interface { android.Module IsNativeCoverageNeeded(ctx android.BaseModuleContext) bool PreventInstall() HideFromMake() } func coverageMutator(mctx android.BottomUpMutatorContext) { if c, ok := mctx.Module().(*Module); ok && c.coverage != nil { needCoverageVariant := c.coverage.Properties.NeedCoverageVariant Loading @@ -177,5 +184,14 @@ func coverageMutator(mctx android.BottomUpMutatorContext) { m[1].(*Module).coverage.Properties.CoverageEnabled = needCoverageBuild m[1].(*Module).coverage.Properties.IsCoverageVariant = true } } else if cov, ok := mctx.Module().(Coverage); ok && cov.IsNativeCoverageNeeded(mctx) { // APEX modules fall here // Note: variant "" is also created because an APEX can be depended on by another // module which are split into "" and "cov" variants. e.g. when cc_test refers // to an APEX via 'data' property. m := mctx.CreateVariations("", "cov") m[0].(Coverage).PreventInstall() m[0].(Coverage).HideFromMake() } }
cc/library.go +4 −0 Original line number Diff line number Diff line Loading @@ -758,6 +758,10 @@ func (library *libraryDecorator) nativeCoverage() bool { return true } func (library *libraryDecorator) coverageOutputFilePath() android.OptionalPath { return library.coverageOutputFile } func getRefAbiDumpFile(ctx ModuleContext, vndkVersion, fileName string) android.Path { isLlndk := inList(ctx.baseModuleName(), llndkLibraries) || inList(ctx.baseModuleName(), ndkMigratedLibs) Loading