Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow hiding deprecated config options #2853

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .plzconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[parse]
BlacklistDirs = tree ; The performance test repo
preloadsubincludes = ///go//build_defs:go
preloadsubincludes = ///cc//build_defs:cc
preloadsubincludes = ///cc//build_defs:cc
preloadsubincludes = ///python//build_defs:python
preloadsubincludes = ///shell//build_defs:shell

Expand Down Expand Up @@ -88,3 +88,6 @@ accept = Artistic License
accept = ISC
# Not really a licence, but Bazel projects commonly describe things this way.
accept = notice

[featureflags]
hidedeprecatedconfigoptions = true
4 changes: 2 additions & 2 deletions docs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ genrule(

# Plugin versions to pull the docs from
plugins = {
"python": "v1.3.0",
"python": "v1.4.0",
"java": "v0.3.0",
"go": "v1.7.6",
"cc": "v0.3.2",
"shell": "v0.1.2",
"shell": "v0.2.0",
"go-proto": "v0.2.0",
"python-proto": "v0.1.0",
"proto": "v0.2.1",
Expand Down
4 changes: 2 additions & 2 deletions plugins/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ plugin_repo(
plugin_repo(
name = "shell",
plugin = "shell-rules",
revision = "v0.1.1",
revision = "v0.2.0",
)

plugin_repo(
name = "python",
plugin = "python-rules",
revision = "v1.2.4",
revision = "v1.4.0",
)
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 @@ -78,6 +78,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
8 changes: 1 addition & 7 deletions test/build_defs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ filegroup(
name = "build_defs",
srcs = ["test.build_defs"],
visibility = [
"//test/...",
"//src/test/...",
"//test/...",
],
)

Expand All @@ -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,
)

2 changes: 1 addition & 1 deletion test/proto_plugin/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ please_repo_e2e_test(
plz_command = "plz -o plugin.go.gotool:$TOOLS_GO test",
repo = "test_repo",
tools = {
"go": [CONFIG.GO_TOOL],
"go": [CONFIG.GO.GO_TOOL],
},
)
Loading