Allow boards to turn overriding commands into an error

Many board still have this problem, but if we can switch some over,
we'll prevent global problems and have the ability to clean boards up
one-by-one.

Bug: 77611511
Test: lunch aosp_arm-eng; m nothing
Test: lunch aosp_marlin-eng; m nothing
Test: build_test on all downstream branches
Change-Id: I78bee44adde2059d01188658b9050927748d2028
This commit is contained in:
Dan Willemsen
2018-04-04 22:25:56 -07:00
parent 51ba4a7970
commit 3d60b115a0
3 changed files with 20 additions and 0 deletions

View File

@@ -48,6 +48,8 @@ type configImpl struct {
ninjaArgs []string
katiSuffix string
targetDevice string
brokenDupRules bool
}
const srcDirFileCheck = "build/soong/root.bp"
@@ -556,3 +558,11 @@ func (c *configImpl) PrebuiltBuildTool(name string) string {
}
return filepath.Join("prebuilts/build-tools", c.HostPrebuiltTag(), "bin", name)
}
func (c *configImpl) SetBuildBrokenDupRules(val bool) {
c.brokenDupRules = val
}
func (c *configImpl) BuildBrokenDupRules() bool {
return c.brokenDupRules
}

View File

@@ -156,6 +156,9 @@ func runMakeProductConfig(ctx Context, config Config) {
// To find target/product/<DEVICE>
"TARGET_DEVICE",
// Whether --werror_overriding_commands will work
"BUILD_BROKEN_DUP_RULES",
}, exportEnvVars...), BannerVars...)
make_vars, err := dumpMakeVars(ctx, config, config.Arguments(), allVars, true)
@@ -179,4 +182,6 @@ func runMakeProductConfig(ctx Context, config Config) {
config.SetKatiArgs(strings.Fields(make_vars["KATI_GOALS"]))
config.SetNinjaArgs(strings.Fields(make_vars["NINJA_GOALS"]))
config.SetTargetDevice(make_vars["TARGET_DEVICE"])
config.SetBuildBrokenDupRules(make_vars["BUILD_BROKEN_DUP_RULES"] != "false")
}

View File

@@ -81,6 +81,10 @@ func runKati(ctx Context, config Config) {
"-f", "build/make/core/main.mk",
}
if !config.BuildBrokenDupRules() {
args = append(args, "--werror_overriding_commands")
}
if !config.Environment().IsFalse("KATI_EMULATE_FIND") {
args = append(args, "--use_find_emulator")
}
@@ -190,6 +194,7 @@ func runKatiCleanSpec(ctx Context, config Config) {
"--color_warnings",
"--gen_all_targets",
"--werror_find_emulator",
"--werror_overriding_commands",
"--use_find_emulator",
"-f", "build/make/core/cleanbuild.mk",
"BUILDING_WITH_NINJA=true",