5151import com .google .devtools .build .lib .packages .Target ;
5252import com .google .devtools .build .lib .packages .TestTimeout ;
5353import com .google .devtools .build .lib .skyframe .serialization .autocodec .AutoCodec ;
54- import com .google .devtools .build .lib .skylarkinterface . SkylarkCallable ;
54+ import com .google .devtools .build .lib .skylarkbuildapi . BuildConfigurationApi ;
5555import com .google .devtools .build .lib .skylarkinterface .SkylarkInterfaceUtils ;
5656import com .google .devtools .build .lib .skylarkinterface .SkylarkModule ;
57- import com .google .devtools .build .lib .skylarkinterface .SkylarkModuleCategory ;
5857import com .google .devtools .build .lib .util .OS ;
5958import com .google .devtools .build .lib .util .RegexFilter ;
6059import com .google .devtools .build .lib .vfs .Path ;
102101 *
103102 * <pre>c1.equals(c2) <=> c1==c2.</pre>
104103 */
105- @ SkylarkModule (
106- name = "configuration" ,
107- category = SkylarkModuleCategory .BUILTIN ,
108- doc =
109- "This object holds information about the environment in which the build is running. See "
110- + "the <a href='../rules.$DOC_EXT#configurations'>Rules page</a> for more on the general "
111- + "concept of configurations."
112- )
113104// TODO(janakr): If overhead of fragments class names is too high, add constructor that just takes
114105// fragments and gets names from them.
115106@ AutoCodec
116- public class BuildConfiguration {
107+ public class BuildConfiguration implements BuildConfigurationApi {
117108 /**
118109 * Sorts fragments by class name. This produces a stable order which, e.g., facilitates consistent
119110 * output from buildMnemonic.
@@ -1453,8 +1444,7 @@ public ArtifactRoot getOutputDirectory(RepositoryName repositoryName) {
14531444 }
14541445
14551446 /** Returns the bin directory for this build configuration. */
1456- @ SkylarkCallable (name = "bin_dir" , structField = true , documented = false )
1457- @ Deprecated
1447+ @ Override
14581448 public ArtifactRoot getBinDirectory () {
14591449 return getBinDirectory (RepositoryName .MAIN );
14601450 }
@@ -1488,8 +1478,7 @@ public ArtifactRoot getIncludeDirectory(RepositoryName repositoryName) {
14881478 }
14891479
14901480 /** Returns the genfiles directory for this build configuration. */
1491- @ SkylarkCallable (name = "genfiles_dir" , structField = true , documented = false )
1492- @ Deprecated
1481+ @ Override
14931482 public ArtifactRoot getGenfilesDirectory () {
14941483 return getGenfilesDirectory (RepositoryName .MAIN );
14951484 }
@@ -1538,8 +1527,7 @@ public PathFragment getGenfilesFragment() {
15381527 * not match the host platform. You should only use this when invoking tools that are known to use
15391528 * the native path separator, i.e., the path separator for the machine that they run on.
15401529 */
1541- @ SkylarkCallable (name = "host_path_separator" , structField = true ,
1542- doc = "Returns the separator for PATH environment variable, which is ':' on Unix." )
1530+ @ Override
15431531 public String getHostPathSeparator () {
15441532 // TODO(bazel-team): Maybe do this in the constructor instead? This isn't serialization-safe.
15451533 return OS .getCurrent () == OS .WINDOWS ? ";" : ":" ;
@@ -1578,13 +1566,6 @@ public ActionEnvironment getActionEnvironment() {
15781566 return actionEnv ;
15791567 }
15801568
1581- @ SkylarkCallable (
1582- name = "default_shell_env" ,
1583- structField = true ,
1584- doc =
1585- "A dictionary representing the static local shell environment. It maps variables "
1586- + "to their values (strings)."
1587- )
15881569 /**
15891570 * Return the "fixed" part of the actions' environment variables.
15901571 *
@@ -1596,7 +1577,7 @@ public ActionEnvironment getActionEnvironment() {
15961577 * <p>Since values of the "fixed" variables are already known at analysis phase, it is returned
15971578 * here as a map.
15981579 */
1599- @ Deprecated // Use getActionEnvironment instead.
1580+ @ Override
16001581 public ImmutableMap <String , String > getLocalShellEnvironment () {
16011582 return actionEnv .getFixedEnv ();
16021583 }
@@ -1749,14 +1730,7 @@ public boolean legacyExternalRunfiles() {
17491730 * Returns user-specified test environment variables and their values, as set by the --test_env
17501731 * options.
17511732 */
1752- @ Deprecated
1753- @ SkylarkCallable (
1754- name = "test_env" ,
1755- structField = true ,
1756- doc =
1757- "A dictionary containing user-specified test environment variables and their values, "
1758- + "as set by the --test_env options. DO NOT USE! This is not the complete environment!"
1759- )
1733+ @ Override
17601734 public ImmutableMap <String , String > getTestEnv () {
17611735 return testEnv .getFixedEnv ();
17621736 }
@@ -1785,11 +1759,7 @@ public boolean deferParamFiles() {
17851759 return options .deferParamFiles ;
17861760 }
17871761
1788- @ SkylarkCallable (name = "coverage_enabled" , structField = true ,
1789- doc = "A boolean that tells whether code coverage is enabled for this run. Note that this "
1790- + "does not compute whether a specific rule should be instrumented for code coverage "
1791- + "data collection. For that, see the <a href=\" ctx.html#coverage_instrumented\" ><code>"
1792- + "ctx.coverage_instrumented</code></a> function." )
1762+ @ Override
17931763 public boolean isCodeCoverageEnabled () {
17941764 return options .collectCodeCoverage ;
17951765 }
0 commit comments