Closed fmeum closed 1 year ago
java_binary's env attribute is ignored when the binary is run with bazel run.
java_binary
env
bazel run
# Foo.java public class Foo { public static void main(String[] args) { System.out.println("Hello, " + System.getenv("MY_NAME") + "!"); } } # BUILD java_binary( name = "Foo", srcs = ["Foo.java"], env = {"MY_NAME": "Bazel"}, main_class = "Foo", )
$ USE_BAZEL_VERSION=6.3.0 bazel run //:foo ... Hello, Bazel! $ USE_BAZEL_VERSION=1f0f6670088bcd7b6d6ded4b32c6eedc7a9027d9 bazel run //:Foo ... Hello, null!
Linux
bazel info release
1f0f6670088bcd7b6d6ded4b32c6eedc7a9027d9
development version
(@non-git)
No response
git remote get-url origin; git rev-parse master; git rev-parse HEAD
It looks like the Starlark implementation of java_binary doesn't return RunEnvironmentInfo.
RunEnvironmentInfo
CC @hvadehra
I'll push out a fix soon.
Description of the bug:
java_binary
'senv
attribute is ignored when the binary is run withbazel run
.What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Which operating system are you running Bazel on?
Linux
What is the output of
bazel info release
?1f0f6670088bcd7b6d6ded4b32c6eedc7a9027d9
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD
?No response
Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
It looks like the Starlark implementation of
java_binary
doesn't returnRunEnvironmentInfo
.