-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Added run_under_env
argument to RunEnvironmentInfo
#16540
Conversation
Some open questions for this draft:
|
src/main/java/com/google/devtools/build/lib/analysis/RunEnvironmentInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/devtools/build/lib/analysis/RunEnvironmentInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java
Outdated
Show resolved
Hide resolved
Given that the existing
That is a good question I don't have a good answer to - I yet have to use |
I don't think so. I'm not aware of |
@@ -61,6 +63,15 @@ public interface RunEnvironmentInfoApi extends StructApi { | |||
structField = true) | |||
List<String> getInheritedEnvironment(); | |||
|
|||
// @StarlarkMethod( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fmeum I noticed you did not have a change like like this for arugments
in your PR. Was that intentional? Is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was intentional: Adding such a method/struct field would give Starlark rules access to this information in the provider. I wasn't sure whether arguments
is something that other rules should be able to inspect, so I decided not to expose it for now.
Do you see a reason for depending rules to access the value of run_under_env
? If there is no clear use case, it may be better not to expose it for now. API creep is real and incompatible changes removing functionality are painful.
Note that depending rules can always just forward the provider unchanged, so not exposing this doesn't prevent e.g. transition wrappers.
@fmeum with the first passing build (which took quite a bit of time and effort), I think it's worth a thorough review. Would you be willing to take another look? |
Looks very good now, thanks for investing the time! Given that he also reviewed the other |
src/main/java/com/google/devtools/build/lib/analysis/RuleConfiguredTargetBuilder.java
Show resolved
Hide resolved
@fmeum I think I've addressed all the feedback and the PR is ready for another review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, nothing to add :-)
This still has to be reviewed and imported by a Googler though.
run_under_env
argument to RunEnvironmentInfo
@comius Hello again, would you have time this week to review this as well? 😅 |
I don't have time to do a rebase which is sad because I think these changes would be really good. Closing so the changes don't appear to be in work. |
Executable Starlark rules can use the
run_under_env
parameter ofRunEnvironmentInfo
to define an environment variable with the value of--run_under
when it's set. This is useful in cases where executable targets execute some sort of process-wrapper which either sub-processes or execs into the expected process. Before,--run_under
would happen on the process wrapper which made debuggers and profiling tools harder to use as the process they were attached to was not the process users cared about.After this change, by having an executable Starlark rule return
RunEnvironmentInfo(run_under_env = "RUN_UNDER_VALUE")
,run
ortest
invocations which pass--run_under='strace -c'
will cause the executable to haveRUN_UNDER_VALUE='strace -c'
set in it's environment.RELNOTES: Executable Starlark rules can use the
run_under_env
parameter ofRunEnvironmentInfo
to define an environment variable with the value of--run_under
when it's set. This allows Starlark rule authors to control how this value is used.closes #16232