Skip to content

Commit 155a7a3

Browse files
committed
Mark config options as deprecated
1 parent 6ae8e2e commit 155a7a3

10 files changed

Lines changed: 91 additions & 293 deletions

File tree

.plzconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,6 @@ accept = notice
9292

9393
[remote]
9494
url =
95+
96+
[featureflags]
97+
hidedeprecatedconfigoptions = true

plugins/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ plugin_repo(
77
plugin_repo(
88
name = "cc",
99
plugin = "cc-rules",
10-
revision = "v0.3.2",
10+
revision = "v0.4.0",
1111
)
1212

1313
plugin_repo(
1414
name = "shell",
1515
plugin = "shell-rules",
16-
revision = "v0.1.1",
16+
revision = "v0.2.0",
1717
)
1818

1919
plugin_repo(

src/core/config.go

Lines changed: 73 additions & 72 deletions
Large diffs are not rendered by default.

src/help/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ func allConfigHelp(config *core.Configuration) helpSection {
7979
help += fmt.Sprintf("\nThis variable is exposed to BUILD rules via the variable ${BOLD_CYAN}CONFIG.%s${RESET},\n"+
8080
"and can be overridden package-locally via ${GREEN}package${RESET}(${YELLOW}%s${RESET}='${GREY}<value>${RESET}').\n", v, strings.ToLower(v))
8181
}
82+
if subt.Tag.Get("deprecated") == "true" {
83+
help += "\n${BOLD_RED}This config option is deprecated and will be removed at the next Please major version.${RESET}\n"
84+
}
8285
sect.Topics[name] = help
8386
sect.Topics[sectname+"."+name] = help
8487
subfields = append(subfields, " "+name)

src/parse/asp/config.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,15 @@ func newConfig(state *core.BuildState) *pyConfig {
3838
base := make(pyDict, 100)
3939

4040
v := reflect.ValueOf(state.Config).Elem()
41+
emitDeprecated := !state.Config.FeatureFlags.HideDeprecatedConfigOptions
4142
for i := 0; i < v.NumField(); i++ {
4243
if field := v.Field(i); field.Kind() == reflect.Struct {
4344
for j := 0; j < field.NumField(); j++ {
4445
subfieldType := field.Type().Field(j)
4546
if varName := subfieldType.Tag.Get("var"); varName != "" {
46-
base[varName] = valueToPyObject(field.Field(j))
47+
if subfieldType.Tag.Get("deprecated") != "true" || emitDeprecated {
48+
base[varName] = valueToPyObject(field.Field(j))
49+
}
4750
}
4851
}
4952
}

test/build_defs/BUILD

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ filegroup(
2525
],
2626
)
2727

28-
filegroup(
29-
name = "cc_embed_binary",
30-
srcs = ["cc_embed_binary.build_defs"],
31-
visibility = ["//test/..."],
32-
)
33-
3428
# Used for some of the parse tests that want a subinclude that isn't visible to them.
3529
filegroup(
3630
name = "not_visible",

test/build_defs/cc_embed_binary.build_defs

Lines changed: 0 additions & 206 deletions
This file was deleted.

test/cross_compile/lib/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This contains an arbitrary set of rules intended to exercise
22
# aspects of the cross-compilation code.
33

4-
subinclude("//test/build_defs:cc_embed_binary", "///cc//build_defs:c")
4+
subinclude("///cc//build_defs:c", "///cc//build_defs:cc_embed_binary")
55

66
go_binary(
77
name = "generator",

test/parse/pre_post_build_config/BUILD.test

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
package(GO_TOOL = "foo")
1+
package(go = {
2+
"go_tool": "foo",
3+
})
24

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

57
build_foo(name = "target")
6-
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
def _prebuild(x):
2-
assert CONFIG.GO_TOOL == "foo"
2+
assert CONFIG.GO.GO_TOOL == "foo"
33

44
def _postbuild(x, y):
5-
assert CONFIG.GO_TOOL == "foo"
5+
assert CONFIG.GO.GO_TOOL == "foo"
66

77
def build_foo(name):
88
return build_rule(
@@ -11,4 +11,3 @@ def build_foo(name):
1111
pre_build = _prebuild,
1212
post_build = _postbuild,
1313
)
14-

0 commit comments

Comments
 (0)