Skip to content

Commit

Permalink
Mark config options as deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
peterebden committed Dec 10, 2024
1 parent 6ae8e2e commit 155a7a3
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 293 deletions.
3 changes: 3 additions & 0 deletions .plzconfig
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,6 @@ accept = notice

[remote]
url =

[featureflags]
hidedeprecatedconfigoptions = true
4 changes: 2 additions & 2 deletions plugins/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ plugin_repo(
plugin_repo(
name = "cc",
plugin = "cc-rules",
revision = "v0.3.2",
revision = "v0.4.0",
)

plugin_repo(
name = "shell",
plugin = "shell-rules",
revision = "v0.1.1",
revision = "v0.2.0",
)

plugin_repo(
Expand Down
145 changes: 73 additions & 72 deletions src/core/config.go

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/help/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ func allConfigHelp(config *core.Configuration) helpSection {
help += fmt.Sprintf("\nThis variable is exposed to BUILD rules via the variable ${BOLD_CYAN}CONFIG.%s${RESET},\n"+
"and can be overridden package-locally via ${GREEN}package${RESET}(${YELLOW}%s${RESET}='${GREY}<value>${RESET}').\n", v, strings.ToLower(v))
}
if subt.Tag.Get("deprecated") == "true" {
help += "\n${BOLD_RED}This config option is deprecated and will be removed at the next Please major version.${RESET}\n"
}
sect.Topics[name] = help
sect.Topics[sectname+"."+name] = help
subfields = append(subfields, " "+name)
Expand Down
5 changes: 4 additions & 1 deletion src/parse/asp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,15 @@ func newConfig(state *core.BuildState) *pyConfig {
base := make(pyDict, 100)

v := reflect.ValueOf(state.Config).Elem()
emitDeprecated := !state.Config.FeatureFlags.HideDeprecatedConfigOptions
for i := 0; i < v.NumField(); i++ {
if field := v.Field(i); field.Kind() == reflect.Struct {
for j := 0; j < field.NumField(); j++ {
subfieldType := field.Type().Field(j)
if varName := subfieldType.Tag.Get("var"); varName != "" {
base[varName] = valueToPyObject(field.Field(j))
if subfieldType.Tag.Get("deprecated") != "true" || emitDeprecated {
base[varName] = valueToPyObject(field.Field(j))
}
}
}
}
Expand Down
6 changes: 0 additions & 6 deletions test/build_defs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ filegroup(
],
)

filegroup(
name = "cc_embed_binary",
srcs = ["cc_embed_binary.build_defs"],
visibility = ["//test/..."],
)

# Used for some of the parse tests that want a subinclude that isn't visible to them.
filegroup(
name = "not_visible",
Expand Down
206 changes: 0 additions & 206 deletions test/build_defs/cc_embed_binary.build_defs

This file was deleted.

2 changes: 1 addition & 1 deletion test/cross_compile/lib/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This contains an arbitrary set of rules intended to exercise
# aspects of the cross-compilation code.

subinclude("//test/build_defs:cc_embed_binary", "///cc//build_defs:c")
subinclude("///cc//build_defs:c", "///cc//build_defs:cc_embed_binary")

go_binary(
name = "generator",
Expand Down
5 changes: 3 additions & 2 deletions test/parse/pre_post_build_config/BUILD.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package(GO_TOOL = "foo")
package(go = {
"go_tool": "foo",
})

subinclude("//test/parse/pre_post_build_config/build_defs:build_foo")

build_foo(name = "target")

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
def _prebuild(x):
assert CONFIG.GO_TOOL == "foo"
assert CONFIG.GO.GO_TOOL == "foo"

def _postbuild(x, y):
assert CONFIG.GO_TOOL == "foo"
assert CONFIG.GO.GO_TOOL == "foo"

def build_foo(name):
return build_rule(
Expand All @@ -11,4 +11,3 @@ def build_foo(name):
pre_build = _prebuild,
post_build = _postbuild,
)

0 comments on commit 155a7a3

Please sign in to comment.