Loading bp2build/cc_library_conversion_test.go +33 −0 Original line number Diff line number Diff line Loading @@ -3508,3 +3508,36 @@ cc_library_static { }, }) } func TestCcLibraryWithTidy(t *testing.T) { runCcLibraryTestCase(t, Bp2buildTestCase{ Description: "cc_library uses tidy properties", ModuleTypeUnderTest: "cc_library", ModuleTypeUnderTestFactory: cc.LibraryFactory, Blueprint: ` cc_library_static { name: "foo", srcs: ["foo.cpp"], tidy: true, tidy_checks: ["check1", "check2"], tidy_checks_as_errors: ["check1error", "check2error"], tidy_disabled_srcs: ["bar.cpp"], }`, ExpectedBazelTargets: []string{ MakeBazelTarget("cc_library_static", "foo", AttrNameToString{ "local_includes": `["."]`, "srcs": `["foo.cpp"]`, "tidy": `True`, "tidy_checks": `[ "check1", "check2", ]`, "tidy_checks_as_errors": `[ "check1error", "check2error", ]`, "tidy_disabled_srcs": `["bar.cpp"]`, }), }, }) } cc/binary.go +1 −1 Original line number Diff line number Diff line Loading @@ -646,7 +646,7 @@ func binaryBp2buildAttrs(ctx android.TopDownMutatorContext, m *Module) binaryAtt sdkAttributes: bp2BuildParseSdkAttributes(m), } m.convertTidyAttributes(&attrs.tidyAttributes) m.convertTidyAttributes(ctx, &attrs.tidyAttributes) return attrs } Loading cc/bp2build.go +14 −1 Original line number Diff line number Diff line Loading @@ -75,9 +75,11 @@ type tidyAttributes struct { Tidy_flags []string Tidy_checks []string Tidy_checks_as_errors []string Tidy_disabled_srcs bazel.LabelListAttribute // TODO(b/255754964) support Tidy_timeout_srcs } func (m *Module) convertTidyAttributes(moduleAttrs *tidyAttributes) { func (m *Module) convertTidyAttributes(ctx android.BaseMutatorContext, moduleAttrs *tidyAttributes) { for _, f := range m.features { if tidy, ok := f.(*tidyFeature); ok { moduleAttrs.Tidy = tidy.Properties.Tidy Loading @@ -85,6 +87,17 @@ func (m *Module) convertTidyAttributes(moduleAttrs *tidyAttributes) { moduleAttrs.Tidy_checks = tidy.Properties.Tidy_checks moduleAttrs.Tidy_checks_as_errors = tidy.Properties.Tidy_checks_as_errors } } archVariantProps := m.GetArchVariantProperties(ctx, &BaseCompilerProperties{}) for axis, configToProps := range archVariantProps { for config, _props := range configToProps { if archProps, ok := _props.(*BaseCompilerProperties); ok { archDisabledSrcs := android.BazelLabelForModuleSrc(ctx, archProps.Tidy_disabled_srcs) moduleAttrs.Tidy_disabled_srcs.SetSelectValue(axis, config, archDisabledSrcs) } } } } Loading cc/library.go +1 −1 Original line number Diff line number Diff line Loading @@ -2791,7 +2791,7 @@ func sharedOrStaticLibraryBp2Build(ctx android.TopDownMutatorContext, module *Mo Runtime_deps: linkerAttrs.runtimeDeps, } module.convertTidyAttributes(&commonAttrs.tidyAttributes) module.convertTidyAttributes(ctx, &commonAttrs.tidyAttributes) var attrs interface{} if isStatic { Loading cc/test.go +1 −1 Original line number Diff line number Diff line Loading @@ -678,7 +678,7 @@ func testBinaryBp2build(ctx android.TopDownMutatorContext, m *Module) { } } m.convertTidyAttributes(&testBinaryAttrs.tidyAttributes) m.convertTidyAttributes(ctx, &testBinaryAttrs.tidyAttributes) for _, propIntf := range m.GetProperties() { if testLinkerProps, ok := propIntf.(*TestLinkerProperties); ok { Loading Loading
bp2build/cc_library_conversion_test.go +33 −0 Original line number Diff line number Diff line Loading @@ -3508,3 +3508,36 @@ cc_library_static { }, }) } func TestCcLibraryWithTidy(t *testing.T) { runCcLibraryTestCase(t, Bp2buildTestCase{ Description: "cc_library uses tidy properties", ModuleTypeUnderTest: "cc_library", ModuleTypeUnderTestFactory: cc.LibraryFactory, Blueprint: ` cc_library_static { name: "foo", srcs: ["foo.cpp"], tidy: true, tidy_checks: ["check1", "check2"], tidy_checks_as_errors: ["check1error", "check2error"], tidy_disabled_srcs: ["bar.cpp"], }`, ExpectedBazelTargets: []string{ MakeBazelTarget("cc_library_static", "foo", AttrNameToString{ "local_includes": `["."]`, "srcs": `["foo.cpp"]`, "tidy": `True`, "tidy_checks": `[ "check1", "check2", ]`, "tidy_checks_as_errors": `[ "check1error", "check2error", ]`, "tidy_disabled_srcs": `["bar.cpp"]`, }), }, }) }
cc/binary.go +1 −1 Original line number Diff line number Diff line Loading @@ -646,7 +646,7 @@ func binaryBp2buildAttrs(ctx android.TopDownMutatorContext, m *Module) binaryAtt sdkAttributes: bp2BuildParseSdkAttributes(m), } m.convertTidyAttributes(&attrs.tidyAttributes) m.convertTidyAttributes(ctx, &attrs.tidyAttributes) return attrs } Loading
cc/bp2build.go +14 −1 Original line number Diff line number Diff line Loading @@ -75,9 +75,11 @@ type tidyAttributes struct { Tidy_flags []string Tidy_checks []string Tidy_checks_as_errors []string Tidy_disabled_srcs bazel.LabelListAttribute // TODO(b/255754964) support Tidy_timeout_srcs } func (m *Module) convertTidyAttributes(moduleAttrs *tidyAttributes) { func (m *Module) convertTidyAttributes(ctx android.BaseMutatorContext, moduleAttrs *tidyAttributes) { for _, f := range m.features { if tidy, ok := f.(*tidyFeature); ok { moduleAttrs.Tidy = tidy.Properties.Tidy Loading @@ -85,6 +87,17 @@ func (m *Module) convertTidyAttributes(moduleAttrs *tidyAttributes) { moduleAttrs.Tidy_checks = tidy.Properties.Tidy_checks moduleAttrs.Tidy_checks_as_errors = tidy.Properties.Tidy_checks_as_errors } } archVariantProps := m.GetArchVariantProperties(ctx, &BaseCompilerProperties{}) for axis, configToProps := range archVariantProps { for config, _props := range configToProps { if archProps, ok := _props.(*BaseCompilerProperties); ok { archDisabledSrcs := android.BazelLabelForModuleSrc(ctx, archProps.Tidy_disabled_srcs) moduleAttrs.Tidy_disabled_srcs.SetSelectValue(axis, config, archDisabledSrcs) } } } } Loading
cc/library.go +1 −1 Original line number Diff line number Diff line Loading @@ -2791,7 +2791,7 @@ func sharedOrStaticLibraryBp2Build(ctx android.TopDownMutatorContext, module *Mo Runtime_deps: linkerAttrs.runtimeDeps, } module.convertTidyAttributes(&commonAttrs.tidyAttributes) module.convertTidyAttributes(ctx, &commonAttrs.tidyAttributes) var attrs interface{} if isStatic { Loading
cc/test.go +1 −1 Original line number Diff line number Diff line Loading @@ -678,7 +678,7 @@ func testBinaryBp2build(ctx android.TopDownMutatorContext, m *Module) { } } m.convertTidyAttributes(&testBinaryAttrs.tidyAttributes) m.convertTidyAttributes(ctx, &testBinaryAttrs.tidyAttributes) for _, propIntf := range m.GetProperties() { if testLinkerProps, ok := propIntf.(*TestLinkerProperties); ok { Loading