Loading bp2build/cc_library_conversion_test.go +5 −4 Original line number Diff line number Diff line Loading @@ -1031,18 +1031,19 @@ func TestCcLibraryFeatures(t *testing.T) { "features": `[ "disable_pack_relocations", "-no_undefined_symbols", "-coverage", ]`, "native_coverage": `False`, "srcs": `["a.cpp"]`, })...) expected_targets = append(expected_targets, makeCcLibraryTargets("b", AttrNameToString{ "features": `["-coverage"] + select({ "features": `select({ "//build/bazel/platforms/arch:x86_64": [ "disable_pack_relocations", "-no_undefined_symbols", ], "//conditions:default": [], })`, "native_coverage": `False`, "srcs": `["b.cpp"]`, })...) expected_targets = append(expected_targets, makeCcLibraryTargets("c", AttrNameToString{ Loading cc/binary.go +4 −0 Original line number Diff line number Diff line Loading @@ -644,6 +644,8 @@ func binaryBp2buildAttrs(ctx android.TopDownMutatorContext, m *Module) binaryAtt Features: baseAttrs.features, sdkAttributes: bp2BuildParseSdkAttributes(m), Native_coverage: baseAttrs.Native_coverage, } m.convertTidyAttributes(ctx, &attrs.tidyAttributes) Loading Loading @@ -703,4 +705,6 @@ type binaryAttributes struct { sdkAttributes tidyAttributes Native_coverage *bool } cc/bp2build.go +5 −3 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ type staticOrSharedAttributes struct { Enabled bazel.BoolAttribute Native_coverage bazel.BoolAttribute Native_coverage *bool sdkAttributes Loading Loading @@ -358,6 +358,7 @@ type baseAttributes struct { features bazel.StringListAttribute protoDependency *bazel.LabelAttribute aidlDependency *bazel.LabelAttribute Native_coverage *bool } // Convenience struct to hold all attributes parsed from compiler properties. Loading Loading @@ -753,10 +754,10 @@ func bp2BuildParseBaseProps(ctx android.Bp2buildMutatorContext, module *Module) compilerAttrs.convertStlProps(ctx, module) (&linkerAttrs).convertStripProps(ctx, module) var nativeCoverage *bool if module.coverage != nil && module.coverage.Properties.Native_coverage != nil && !Bool(module.coverage.Properties.Native_coverage) { // Native_coverage is arch neutral (&linkerAttrs).features.Append(bazel.MakeStringListAttribute([]string{"-coverage"})) nativeCoverage = BoolPtr(false) } productVariableProps := android.ProductVariableProperties(ctx) Loading Loading @@ -812,6 +813,7 @@ func bp2BuildParseBaseProps(ctx android.Bp2buildMutatorContext, module *Module) *features, protoDep.protoDep, aidlDep, nativeCoverage, } } Loading cc/library.go +10 −0 Original line number Diff line number Diff line Loading @@ -351,6 +351,7 @@ func libraryBp2Build(ctx android.TopDownMutatorContext, m *Module) { System_dynamic_deps: *linkerAttrs.systemDynamicDeps.Clone().Append(staticAttrs.System_dynamic_deps), Runtime_deps: linkerAttrs.runtimeDeps, sdkAttributes: bp2BuildParseSdkAttributes(m), Native_coverage: baseAttributes.Native_coverage, } sharedCommonAttrs := staticOrSharedAttributes{ Loading @@ -369,6 +370,7 @@ func libraryBp2Build(ctx android.TopDownMutatorContext, m *Module) { System_dynamic_deps: *linkerAttrs.systemDynamicDeps.Clone().Append(sharedAttrs.System_dynamic_deps), Runtime_deps: linkerAttrs.runtimeDeps, sdkAttributes: bp2BuildParseSdkAttributes(m), Native_coverage: baseAttributes.Native_coverage, } staticTargetAttrs := &bazelCcLibraryStaticAttributes{ Loading Loading @@ -2869,6 +2871,7 @@ func sharedOrStaticLibraryBp2Build(ctx android.TopDownMutatorContext, module *Mo System_dynamic_deps: linkerAttrs.systemDynamicDeps, sdkAttributes: bp2BuildParseSdkAttributes(module), Runtime_deps: linkerAttrs.runtimeDeps, Native_coverage: baseAttributes.Native_coverage, } module.convertTidyAttributes(ctx, &commonAttrs.tidyAttributes) Loading Loading @@ -2956,6 +2959,13 @@ func sharedOrStaticLibraryBp2Build(ctx android.TopDownMutatorContext, module *Mo } tags := android.ApexAvailableTags(module) // This lib needs some special handling in bazel, so add this tag to the build // file. if module.Name() == "libprofile-clang-extras" { tags.Append(bazel.MakeStringListAttribute([]string{"NO_EXPORTING"})) } ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: module.Name(), Tags: tags}, attrs) } Loading Loading
bp2build/cc_library_conversion_test.go +5 −4 Original line number Diff line number Diff line Loading @@ -1031,18 +1031,19 @@ func TestCcLibraryFeatures(t *testing.T) { "features": `[ "disable_pack_relocations", "-no_undefined_symbols", "-coverage", ]`, "native_coverage": `False`, "srcs": `["a.cpp"]`, })...) expected_targets = append(expected_targets, makeCcLibraryTargets("b", AttrNameToString{ "features": `["-coverage"] + select({ "features": `select({ "//build/bazel/platforms/arch:x86_64": [ "disable_pack_relocations", "-no_undefined_symbols", ], "//conditions:default": [], })`, "native_coverage": `False`, "srcs": `["b.cpp"]`, })...) expected_targets = append(expected_targets, makeCcLibraryTargets("c", AttrNameToString{ Loading
cc/binary.go +4 −0 Original line number Diff line number Diff line Loading @@ -644,6 +644,8 @@ func binaryBp2buildAttrs(ctx android.TopDownMutatorContext, m *Module) binaryAtt Features: baseAttrs.features, sdkAttributes: bp2BuildParseSdkAttributes(m), Native_coverage: baseAttrs.Native_coverage, } m.convertTidyAttributes(ctx, &attrs.tidyAttributes) Loading Loading @@ -703,4 +705,6 @@ type binaryAttributes struct { sdkAttributes tidyAttributes Native_coverage *bool }
cc/bp2build.go +5 −3 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ type staticOrSharedAttributes struct { Enabled bazel.BoolAttribute Native_coverage bazel.BoolAttribute Native_coverage *bool sdkAttributes Loading Loading @@ -358,6 +358,7 @@ type baseAttributes struct { features bazel.StringListAttribute protoDependency *bazel.LabelAttribute aidlDependency *bazel.LabelAttribute Native_coverage *bool } // Convenience struct to hold all attributes parsed from compiler properties. Loading Loading @@ -753,10 +754,10 @@ func bp2BuildParseBaseProps(ctx android.Bp2buildMutatorContext, module *Module) compilerAttrs.convertStlProps(ctx, module) (&linkerAttrs).convertStripProps(ctx, module) var nativeCoverage *bool if module.coverage != nil && module.coverage.Properties.Native_coverage != nil && !Bool(module.coverage.Properties.Native_coverage) { // Native_coverage is arch neutral (&linkerAttrs).features.Append(bazel.MakeStringListAttribute([]string{"-coverage"})) nativeCoverage = BoolPtr(false) } productVariableProps := android.ProductVariableProperties(ctx) Loading Loading @@ -812,6 +813,7 @@ func bp2BuildParseBaseProps(ctx android.Bp2buildMutatorContext, module *Module) *features, protoDep.protoDep, aidlDep, nativeCoverage, } } Loading
cc/library.go +10 −0 Original line number Diff line number Diff line Loading @@ -351,6 +351,7 @@ func libraryBp2Build(ctx android.TopDownMutatorContext, m *Module) { System_dynamic_deps: *linkerAttrs.systemDynamicDeps.Clone().Append(staticAttrs.System_dynamic_deps), Runtime_deps: linkerAttrs.runtimeDeps, sdkAttributes: bp2BuildParseSdkAttributes(m), Native_coverage: baseAttributes.Native_coverage, } sharedCommonAttrs := staticOrSharedAttributes{ Loading @@ -369,6 +370,7 @@ func libraryBp2Build(ctx android.TopDownMutatorContext, m *Module) { System_dynamic_deps: *linkerAttrs.systemDynamicDeps.Clone().Append(sharedAttrs.System_dynamic_deps), Runtime_deps: linkerAttrs.runtimeDeps, sdkAttributes: bp2BuildParseSdkAttributes(m), Native_coverage: baseAttributes.Native_coverage, } staticTargetAttrs := &bazelCcLibraryStaticAttributes{ Loading Loading @@ -2869,6 +2871,7 @@ func sharedOrStaticLibraryBp2Build(ctx android.TopDownMutatorContext, module *Mo System_dynamic_deps: linkerAttrs.systemDynamicDeps, sdkAttributes: bp2BuildParseSdkAttributes(module), Runtime_deps: linkerAttrs.runtimeDeps, Native_coverage: baseAttributes.Native_coverage, } module.convertTidyAttributes(ctx, &commonAttrs.tidyAttributes) Loading Loading @@ -2956,6 +2959,13 @@ func sharedOrStaticLibraryBp2Build(ctx android.TopDownMutatorContext, module *Mo } tags := android.ApexAvailableTags(module) // This lib needs some special handling in bazel, so add this tag to the build // file. if module.Name() == "libprofile-clang-extras" { tags.Append(bazel.MakeStringListAttribute([]string{"NO_EXPORTING"})) } ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: module.Name(), Tags: tags}, attrs) } Loading