Loading android/config.go +4 −0 Original line number Diff line number Diff line Loading @@ -1619,6 +1619,10 @@ func (c *deviceConfig) ShippingApiLevel() ApiLevel { return uncheckedFinalApiLevel(apiLevel) } func (c *deviceConfig) BuildBrokenClangProperty() bool { return c.config.productVariables.BuildBrokenClangProperty } func (c *deviceConfig) BuildBrokenEnforceSyspropOwner() bool { return c.config.productVariables.BuildBrokenEnforceSyspropOwner } Loading android/variable.go +1 −0 Original line number Diff line number Diff line Loading @@ -430,6 +430,7 @@ type productVariables struct { ShippingApiLevel *string `json:",omitempty"` BuildBrokenClangProperty bool `json:",omitempty"` BuildBrokenDepfile *bool `json:",omitempty"` BuildBrokenEnforceSyspropOwner bool `json:",omitempty"` BuildBrokenTrebleSyspropNeverallow bool `json:",omitempty"` Loading cc/cc.go +2 −0 Original line number Diff line number Diff line Loading @@ -1900,6 +1900,8 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) { if c.Properties.Clang != nil && *c.Properties.Clang == false { ctx.PropertyErrorf("clang", "false (GCC) is no longer supported") } else if c.Properties.Clang != nil && !ctx.DeviceConfig().BuildBrokenClangProperty() { ctx.PropertyErrorf("clang", "property is deprecated, see Changes.md file") } flags := Flags{ Loading cc/cc_test.go +50 −0 Original line number Diff line number Diff line Loading @@ -4336,3 +4336,53 @@ func TestIncludeDirectoryOrdering(t *testing.T) { } } func TestCcBuildBrokenClangProperty(t *testing.T) { tests := []struct { name string clang bool BuildBrokenClangProperty bool err string }{ { name: "error when clang is set to false", clang: false, err: "is no longer supported", }, { name: "error when clang is set to true", clang: true, err: "property is deprecated, see Changes.md", }, { name: "no error when BuildBrokenClangProperty is explicitly set to true", clang: true, BuildBrokenClangProperty: true, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { bp := fmt.Sprintf(` cc_library { name: "foo", clang: %t, }`, test.clang) if test.err == "" { android.GroupFixturePreparers( prepareForCcTest, android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) { if test.BuildBrokenClangProperty { variables.BuildBrokenClangProperty = test.BuildBrokenClangProperty } }), ).RunTestWithBp(t, bp) } else { prepareForCcTest. ExtendWithErrorHandler(android.FixtureExpectsOneErrorPattern(test.err)). RunTestWithBp(t, bp) } }) } } Loading
android/config.go +4 −0 Original line number Diff line number Diff line Loading @@ -1619,6 +1619,10 @@ func (c *deviceConfig) ShippingApiLevel() ApiLevel { return uncheckedFinalApiLevel(apiLevel) } func (c *deviceConfig) BuildBrokenClangProperty() bool { return c.config.productVariables.BuildBrokenClangProperty } func (c *deviceConfig) BuildBrokenEnforceSyspropOwner() bool { return c.config.productVariables.BuildBrokenEnforceSyspropOwner } Loading
android/variable.go +1 −0 Original line number Diff line number Diff line Loading @@ -430,6 +430,7 @@ type productVariables struct { ShippingApiLevel *string `json:",omitempty"` BuildBrokenClangProperty bool `json:",omitempty"` BuildBrokenDepfile *bool `json:",omitempty"` BuildBrokenEnforceSyspropOwner bool `json:",omitempty"` BuildBrokenTrebleSyspropNeverallow bool `json:",omitempty"` Loading
cc/cc.go +2 −0 Original line number Diff line number Diff line Loading @@ -1900,6 +1900,8 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) { if c.Properties.Clang != nil && *c.Properties.Clang == false { ctx.PropertyErrorf("clang", "false (GCC) is no longer supported") } else if c.Properties.Clang != nil && !ctx.DeviceConfig().BuildBrokenClangProperty() { ctx.PropertyErrorf("clang", "property is deprecated, see Changes.md file") } flags := Flags{ Loading
cc/cc_test.go +50 −0 Original line number Diff line number Diff line Loading @@ -4336,3 +4336,53 @@ func TestIncludeDirectoryOrdering(t *testing.T) { } } func TestCcBuildBrokenClangProperty(t *testing.T) { tests := []struct { name string clang bool BuildBrokenClangProperty bool err string }{ { name: "error when clang is set to false", clang: false, err: "is no longer supported", }, { name: "error when clang is set to true", clang: true, err: "property is deprecated, see Changes.md", }, { name: "no error when BuildBrokenClangProperty is explicitly set to true", clang: true, BuildBrokenClangProperty: true, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { bp := fmt.Sprintf(` cc_library { name: "foo", clang: %t, }`, test.clang) if test.err == "" { android.GroupFixturePreparers( prepareForCcTest, android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) { if test.BuildBrokenClangProperty { variables.BuildBrokenClangProperty = test.BuildBrokenClangProperty } }), ).RunTestWithBp(t, bp) } else { prepareForCcTest. ExtendWithErrorHandler(android.FixtureExpectsOneErrorPattern(test.err)). RunTestWithBp(t, bp) } }) } }