Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed May 4, 2022
1 parent 88c4e0c commit 9dfd5e5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.google.devtools.build.lib.packages.BuiltinProvider;
import com.google.devtools.build.lib.packages.NativeInfo;
import com.google.devtools.build.lib.starlarkbuildapi.RunEnvironmentInfoApi;
import com.google.devtools.build.lib.starlarkbuildapi.test.TestEnvironmentInfoApi;
import java.util.List;
import java.util.Map;
import net.starlark.java.eval.Dict;
Expand All @@ -16,8 +15,7 @@
import net.starlark.java.eval.StarlarkList;

@Immutable
public final class RunEnvironmentInfo extends NativeInfo implements RunEnvironmentInfoApi,
TestEnvironmentInfoApi {
public final class RunEnvironmentInfo extends NativeInfo implements RunEnvironmentInfoApi {

/**
* Singleton instance of the provider type for {@link DefaultInfo}.
Expand Down Expand Up @@ -88,7 +86,7 @@ public RunEnvironmentInfoApi constructor(Dict<?, ?> environment,
Dict.cast(environment, String.class, String.class, "environment"),
StarlarkList.immutableCopyOf(
Sequence.cast(inheritedEnvironment, String.class, "inherited_environment")),
true);
/* shouldErrorOnNonExecutableRule */ true);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ public RunEnvironmentInfo testEnvironment(
Dict.cast(environment, String.class, String.class, "environment"),
StarlarkList.immutableCopyOf(
Sequence.cast(inheritedEnvironment, String.class, "inherited_environment")),
false);
/* shouldErrorOnNonExecutableRule */ false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,19 @@ public interface RunEnvironmentInfoApi extends StructApi {

@StarlarkMethod(
name = "environment",
doc = "A dict containing environment variables which should be set when executing the rule"
+ " that returns this provider.",
doc = "A map of string keys and values that represent environment variables and their values."
+ " These will be made available when the target that returns this provider is executed,"
+ " either as a test or via the run command.",
structField = true)
Map<String, String> getEnvironment();

@StarlarkMethod(
name = "inherited_environment",
doc = "A list of variables that should be inherited from the shell environment when executing"
+ " the rule that returns this provider.",
doc = "A sequence of names of environment variables. These variables are made available with"
+ " their current value taken from the shell environment when the target that returns"
+ " this provider is executed, either as a test or via the run command. If a variable is"
+ " contained in both <code>environment</code> and <code>inherited_environment</code>,"
+ " the value inherited from the shell environment will take precedence if set.",
structField = true)
List<String> getInheritedEnvironment();

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

package com.google.devtools.build.lib.starlarkbuildapi.test;

import com.google.devtools.build.lib.starlarkbuildapi.RunEnvironmentInfoApi;
import net.starlark.java.annot.Param;
import net.starlark.java.annot.ParamType;
import net.starlark.java.annot.StarlarkBuiltin;
Expand Down Expand Up @@ -76,7 +77,7 @@ ExecutionInfoApi executionInfo(Dict<?, ?> requirements // <String, String> expec
+ " and <code>inherited_environment</code>, the value inherited from the"
+ " shell environment will take precedence if set.")
})
TestEnvironmentInfoApi testEnvironment(
RunEnvironmentInfoApi testEnvironment(
Dict<?, ?> environment, // <String, String> expected
Sequence<?> inheritedEnvironment /* <String> expected */)
throws EvalException;
Expand Down

0 comments on commit 9dfd5e5

Please sign in to comment.