Skip to content

Commit b115958

Browse files
committed
Deprecate ctx.configuration.host_path_separator
Using this field for its intended purpose is essentially almost incorrect as it is based on the OS of the machine running Bazel, not any execution platform. It can be used to sneakily reason about the local machine in a build rule, but that's discouraged and should be done in a repository rule instead.
1 parent 4fd6140 commit b115958

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/main/java/com/google/devtools/build/lib/starlarkbuildapi/BuildConfigurationApi.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,16 @@ public interface BuildConfigurationApi extends StarlarkValue {
4343
@StarlarkMethod(
4444
name = "host_path_separator",
4545
structField = true,
46-
doc = "Returns the separator for PATH environment variable, which is ':' on Unix.")
46+
doc =
47+
"""
48+
Deprecated: This returns the path separator for the OS on which Bazel runs, which may
49+
differ from the execution platforms for actions registered by this rule. Instead, use
50+
<code>ctx.target_platform_has_constraint</code> to check for
51+
<code>@platforms//os:windows</code>, possibly in a dependency with
52+
<code>cfg = "exec"</code>.
53+
<p>Returns the separator for PATH environment variable, which is ':' on Unix.
54+
""")
55+
@Deprecated
4756
String getHostPathSeparator();
4857

4958
@StarlarkMethod(

0 commit comments

Comments
 (0)