Support turning phony warnings into errors

These still default to warnings, but if a board decides to set
BOARD_BROKEN_PHONY_TARGETS := false, they'll turn into errors. More
likely I'll just be marking the broken targets as broken, then switching
the logic here to be like the dup rules warnings/errors.

Test: On a build with warnings, try <missing>, "false", and "true"
Change-Id: I041e1ff4618c4114ec43015b6c0ae1b49b36b6f8
This commit is contained in:
Dan Willemsen
2018-08-27 15:01:03 -07:00
parent 0d91f1727e
commit d8aa39d1c3
3 changed files with 20 additions and 3 deletions

View File

@@ -51,7 +51,9 @@ type configImpl struct {
targetDeviceDir string targetDeviceDir string
pdkBuild bool pdkBuild bool
brokenDupRules bool brokenDupRules bool
brokenPhonyTargets bool
pathReplaced bool pathReplaced bool
} }
@@ -577,6 +579,14 @@ func (c *configImpl) BuildBrokenDupRules() bool {
return c.brokenDupRules return c.brokenDupRules
} }
func (c *configImpl) SetBuildBrokenPhonyTargets(val bool) {
c.brokenPhonyTargets = val
}
func (c *configImpl) BuildBrokenPhonyTargets() bool {
return c.brokenPhonyTargets
}
func (c *configImpl) SetTargetDeviceDir(dir string) { func (c *configImpl) SetTargetDeviceDir(dir string) {
c.targetDeviceDir = dir c.targetDeviceDir = dir
} }

View File

@@ -165,10 +165,12 @@ func runMakeProductConfig(ctx Context, config Config) {
// Whether --werror_overriding_commands will work // Whether --werror_overriding_commands will work
"BUILD_BROKEN_DUP_RULES", "BUILD_BROKEN_DUP_RULES",
// Used to turn on --werror_ options in Kati
"BUILD_BROKEN_PHONY_TARGETS",
// Not used, but useful to be in the soong.log // Not used, but useful to be in the soong.log
"BUILD_BROKEN_ANDROIDMK_EXPORTS", "BUILD_BROKEN_ANDROIDMK_EXPORTS",
"BUILD_BROKEN_DUP_COPY_HEADERS", "BUILD_BROKEN_DUP_COPY_HEADERS",
"BUILD_BROKEN_PHONY_TARGETS",
}, exportEnvVars...), BannerVars...) }, exportEnvVars...), BannerVars...)
make_vars, err := dumpMakeVars(ctx, config, config.Arguments(), allVars, true) make_vars, err := dumpMakeVars(ctx, config, config.Arguments(), allVars, true)
@@ -196,4 +198,5 @@ func runMakeProductConfig(ctx Context, config Config) {
config.SetPdkBuild(make_vars["TARGET_BUILD_PDK"] == "true") config.SetPdkBuild(make_vars["TARGET_BUILD_PDK"] == "true")
config.SetBuildBrokenDupRules(make_vars["BUILD_BROKEN_DUP_RULES"] == "true") config.SetBuildBrokenDupRules(make_vars["BUILD_BROKEN_DUP_RULES"] == "true")
config.SetBuildBrokenPhonyTargets(make_vars["BUILD_BROKEN_PHONY_TARGETS"] != "false")
} }

View File

@@ -93,6 +93,10 @@ func runKati(ctx Context, config Config) {
args = append(args, "--werror_overriding_commands") args = append(args, "--werror_overriding_commands")
} }
if !config.BuildBrokenPhonyTargets() {
args = append(args, "--werror_real_to_phony", "--werror_phony_looks_real")
}
if !config.Environment().IsFalse("KATI_EMULATE_FIND") { if !config.Environment().IsFalse("KATI_EMULATE_FIND") {
args = append(args, "--use_find_emulator") args = append(args, "--use_find_emulator")
} }