Skip to content

Commit 6f2917e

Browse files
authored
Merge pull request #16 from dtolnay/buildscript
Delete `sysroot-deps` constraint in favor of `build-script` constraint
2 parents 110e360 + 26012fb commit 6f2917e

File tree

8 files changed

+57
-56
lines changed

8 files changed

+57
-56
lines changed

allocator/BUCK

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ rust_library(
1717
],
1818
target_compatible_with = [
1919
"//constraints:library",
20-
"//constraints:sysroot-deps=explicit",
20+
"//constraints:build-script=false",
2121
],
2222
visibility = ["PUBLIC"],
2323
deps = [

constraints/BUCK

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
load(":defs.bzl", "constraint")
22

3-
constraint(
4-
setting = "sysroot-deps",
5-
values = [
6-
# Crate must declare explicit dependencies on standard library. This is
7-
# enabled within standard library code.
8-
"sysroot-deps=explicit",
9-
# Crate implicitly receives access to standard library crates, such as
10-
# within compiler code and standard library build scripts.
11-
"sysroot-deps=implicit",
12-
],
13-
)
14-
153
constraint(
164
setting = "workspace",
175
values = [
@@ -32,10 +20,26 @@ constraint(
3220
],
3321
)
3422

23+
constraint(
24+
setting = "build-script",
25+
values = [
26+
"build-script=false",
27+
"build-script=true",
28+
],
29+
)
30+
3531
constraint(
3632
setting = "opt-level",
3733
values = [
3834
"opt-level=0",
3935
"opt-level=3",
4036
],
4137
)
38+
39+
config_setting(
40+
name = "library-build-script",
41+
constraint_values = [
42+
":library",
43+
":build-script=true",
44+
],
45+
)

defs.bzl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,11 @@ def _target_constraints(crate_root):
153153
if crate_root and crate_root.startswith("rust/library/"):
154154
target_compatible_with = [
155155
"//constraints:library",
156-
"//constraints:sysroot-deps=explicit",
156+
"//constraints:build-script=false",
157157
]
158158
elif crate_root and (crate_root.startswith("rust/compiler/") or crate_root.startswith("rust/src/")):
159159
target_compatible_with = [
160160
"//constraints:compiler",
161-
"//constraints:sysroot-deps=implicit",
162161
]
163162
else:
164163
target_compatible_with = select({

platforms/defs.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ platform = rule(
6666
# this list are preserved.
6767
"transition": attrs.list(attrs.configuration_label(), default = [
6868
"//constraints:bootstrap-stage",
69+
"//constraints:build-script",
6970
"//constraints:opt-level",
70-
"//constraints:sysroot-deps",
7171
"//constraints:workspace",
7272
]),
7373
},

platforms/stage1/BUCK

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ platform(
44
name = "library",
55
base = "//platforms:host",
66
constraint_values = [
7+
"//constraints:build-script=false",
78
"//constraints:library",
89
"//constraints:opt-level=3",
910
"//constraints:stage1",
10-
"//constraints:sysroot-deps=explicit",
1111
],
1212
visibility = ["PUBLIC"],
1313
)
@@ -16,8 +16,8 @@ platform(
1616
name = "library-build-script",
1717
base = ":library",
1818
constraint_values = [
19+
"//constraints:build-script=true",
1920
"//constraints:opt-level=0",
20-
"//constraints:sysroot-deps=implicit",
2121
],
2222
visibility = ["PUBLIC"],
2323
)
@@ -26,10 +26,10 @@ platform(
2626
name = "compiler",
2727
base = "//platforms:host",
2828
constraint_values = [
29+
"//constraints:build-script=false",
2930
"//constraints:compiler",
3031
"//constraints:opt-level=3",
3132
"//constraints:stage1",
32-
"//constraints:sysroot-deps=implicit",
3333
],
3434
visibility = ["PUBLIC"],
3535
)
@@ -38,6 +38,7 @@ platform(
3838
name = "compiler-build-script",
3939
base = ":compiler",
4040
constraint_values = [
41+
"//constraints:build-script=true",
4142
"//constraints:opt-level=0",
4243
],
4344
visibility = ["PUBLIC"],

platforms/stage2/BUCK

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ platform(
44
name = "library",
55
base = "//platforms:host",
66
constraint_values = [
7+
"//constraints:build-script=false",
78
"//constraints:library",
89
"//constraints:opt-level=3",
910
"//constraints:stage2",
10-
"//constraints:sysroot-deps=explicit",
1111
],
1212
visibility = ["PUBLIC"],
1313
)
@@ -16,8 +16,8 @@ platform(
1616
name = "library-build-script",
1717
base = ":library",
1818
constraint_values = [
19+
"//constraints:build-script=true",
1920
"//constraints:opt-level=0",
20-
"//constraints:sysroot-deps=implicit",
2121
],
2222
visibility = ["PUBLIC"],
2323
)
@@ -26,10 +26,10 @@ platform(
2626
name = "compiler",
2727
base = "//platforms:host",
2828
constraint_values = [
29+
"//constraints:build-script=false",
2930
"//constraints:compiler",
3031
"//constraints:opt-level=3",
3132
"//constraints:stage2",
32-
"//constraints:sysroot-deps=implicit",
3333
],
3434
visibility = ["PUBLIC"],
3535
)
@@ -38,6 +38,7 @@ platform(
3838
name = "compiler-build-script",
3939
base = ":compiler",
4040
constraint_values = [
41+
"//constraints:build-script=true",
4142
"//constraints:opt-level=0",
4243
],
4344
visibility = ["PUBLIC"],

toolchains/BUCK

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,14 @@ rust_toolchain(
3636
compiler = select({
3737
"rust//constraints:stage1": "rust//stage0:rustc",
3838
"rust//constraints:stage2": select({
39-
"rust//constraints:sysroot-deps=explicit": "rust//stage1:rustc",
40-
"rust//constraints:sysroot-deps=implicit": select({
41-
"rust//constraints:library": "rust//stage0:rustc",
42-
"rust//constraints:compiler": "rust//stage1:rustc",
43-
}),
39+
"rust//constraints:library": "rust//stage1:rustc",
40+
"rust//constraints:library-build-script": "rust//stage0:rustc",
41+
"rust//constraints:compiler": "rust//stage1:rustc",
4442
}),
4543
}),
4644
exec_compatible_with = [
4745
"rust//constraints:opt-level=0",
48-
"rust//constraints:sysroot-deps=implicit",
46+
"rust//constraints:build-script=true",
4947
] + select({
5048
"rust//constraints:compiler": ["rust//constraints:compiler"],
5149
"rust//constraints:library": ["rust//constraints:library"],
@@ -71,33 +69,31 @@ rust_toolchain(
7169
"rust//constraints:stage2": "rust//stage1:rustdoc",
7270
}),
7371
sysroot = select({
74-
"rust//constraints:sysroot-deps=explicit": None,
75-
"rust//constraints:sysroot-deps=implicit": select({
76-
"rust//constraints:library": "rust//stage0:sysroot",
77-
"rust//constraints:compiler": select({
78-
"rust//constraints:stage1": dict(
79-
alloc = "rust//stage1:alloc",
80-
compiler_builtins = "rust//stage1:compiler_builtins",
81-
core = "rust//stage1:core",
82-
panic_abort = "rust//stage1:panic_abort",
83-
panic_unwind = "rust//stage1:panic_unwind",
84-
proc_macro = "rust//stage1:proc_macro",
85-
rust_allocator = "rust//stage1:rust_allocator",
86-
std = "rust//stage1:std",
87-
test = "rust//stage1:test",
88-
),
89-
"rust//constraints:stage2": dict(
90-
alloc = "rust//stage2:alloc",
91-
compiler_builtins = "rust//stage2:compiler_builtins",
92-
core = "rust//stage2:core",
93-
panic_abort = "rust//stage2:panic_abort",
94-
panic_unwind = "rust//stage2:panic_unwind",
95-
proc_macro = "rust//stage2:proc_macro",
96-
rust_allocator = "rust//stage2:rust_allocator",
97-
std = "rust//stage2:std",
98-
test = "rust//stage2:test",
99-
),
100-
}),
72+
"rust//constraints:library": None,
73+
"rust//constraints:library-build-script": "rust//stage0:sysroot",
74+
"rust//constraints:compiler": select({
75+
"rust//constraints:stage1": dict(
76+
alloc = "rust//stage1:alloc",
77+
compiler_builtins = "rust//stage1:compiler_builtins",
78+
core = "rust//stage1:core",
79+
panic_abort = "rust//stage1:panic_abort",
80+
panic_unwind = "rust//stage1:panic_unwind",
81+
proc_macro = "rust//stage1:proc_macro",
82+
rust_allocator = "rust//stage1:rust_allocator",
83+
std = "rust//stage1:std",
84+
test = "rust//stage1:test",
85+
),
86+
"rust//constraints:stage2": dict(
87+
alloc = "rust//stage2:alloc",
88+
compiler_builtins = "rust//stage2:compiler_builtins",
89+
core = "rust//stage2:core",
90+
panic_abort = "rust//stage2:panic_abort",
91+
panic_unwind = "rust//stage2:panic_unwind",
92+
proc_macro = "rust//stage2:proc_macro",
93+
rust_allocator = "rust//stage2:rust_allocator",
94+
std = "rust//stage2:std",
95+
test = "rust//stage2:test",
96+
),
10197
}),
10298
}),
10399
visibility = ["PUBLIC"],

toolchains/cxx/BUCK

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ configuration_transition(
55
name = "prune_cxx_configuration",
66
discard_settings = [
77
"rust//constraints:bootstrap-stage",
8-
"rust//constraints:sysroot-deps",
8+
"rust//constraints:build-script",
99
"rust//constraints:workspace",
1010
],
1111
label = "cxx",

0 commit comments

Comments
 (0)