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
bazel: Fix bazel query and provide a default java toolchain #98611
Conversation
These are fixes for problems I ran into with: - `bazel test //example:cpp-test` This needed `build --host_javabase='@local_jdk//:jdk'` - `bazel query 'deps(//example:cpp-test)'` This needed the same flags as `build`. Is it contentious to (partially?) configure the default java toolchain? I don't see it as much different than providing the bazel server's java. It would continue to be configurable/overridable by overriding the flags. --- And a random notes from this escapade, but https://github.com/bazelbuild/bazel/blob/master/WORKSPACE#L144-L308 looks a little different from https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/build-managers/bazel/bazel_3/src-deps.json so one of them is probably wrong :)
Could this be related to tweag/rules_haskell#1414? In my quick testing, this PR's bazel didn't fix that issue, so maybe not. |
It looks like the same sort of problem. In your case none of the .bazelrc
flags apply to query which might be the source of the problem.
…On Mon, Sep 28, 2020 at 8:00 AM Silvan Mosberger ***@***.***> wrote:
Could this be related to tweag/rules_haskell#1414
<tweag/rules_haskell#1414>? In my quick
testing, this PR's bazel didn't fix that issue, so maybe not.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#98611 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAROG6BSWPK2U3QHL4XTGYDSIB3F3ANCNFSM4RXYWHGQ>
.
|
@aherrmann does this look familiar to you? |
The problem with
|
So sounds to me like this is a “works as intended” situation? It is confusing, but we can’t really compensate for it. |
If you use bazel with internet access, it will download the other platforms' java_tools to resolve the query. Given that nix is doing the fetching, I think this makes sense. The cost to this fix is downloading two extra .zip files that total ~100mb. I can see the argument that a person shouldn't be using Separately, any thoughts on the |
I am not deep enough into the bazel build anymore to have much of an opinion on whether this change is correct, it is all very confusing and you never know if things have to be there because of a bug in bazel or a works-as-intended. So I’d say let’s merge this and see what breaks. |
I nearly missed this, but I don’t understand what you mean by that? Can you elaborate? |
Nixpkgs' list of bazels' dependencies is different from upstream's, but I
assume ours is a superset so it's not a real problem.
…On Tue, Oct 13, 2020 at 12:43 PM Profpatsch ***@***.***> wrote:
And a random notes from this escapade, but
https://github.com/bazelbuild/bazel/blob/master/WORKSPACE#L144-L308 looks
a little different from
https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/build-managers/bazel/bazel_3/src-deps.json
so one of them is probably wrong :)
I nearly missed this, but I don’t understand what you mean by that? Can
you elaborate?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#98611 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAROG6F5VMZVJSVOIONASLDSKR7RTANCNFSM4RXYWHGQ>
.
|
If you look into the code definition there’s an update which the
maintainers run when updating bazel:
https://github.com/NixOS/nixpkgs/blob/7e757502e95a2a22522151f9036da7db161f0ef9/pkgs/development/tools/build-managers/bazel/bazel_3/default.nix#L290-L297
it will use the exact version of the WORKSPACE from that release, so it
should always correspond exactly to it.
On Tue, Oct 13, 2020 at 7:00 PM Marco Farrugia <notifications@github.com>
wrote:
… Nixpkgs' list of bazels' dependencies is different from upstream's, but I
assume ours is a superset so it's not a real problem.
On Tue, Oct 13, 2020 at 12:43 PM Profpatsch ***@***.***>
wrote:
> And a random notes from this escapade, but
> https://github.com/bazelbuild/bazel/blob/master/WORKSPACE#L144-L308
looks
> a little different from
>
https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/build-managers/bazel/bazel_3/src-deps.json
> so one of them is probably wrong :)
>
> I nearly missed this, but I don’t understand what you mean by that? Can
> you elaborate?
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#98611 (comment)>, or
> unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AAROG6F5VMZVJSVOIONASLDSKR7RTANCNFSM4RXYWHGQ
>
> .
>
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#98611 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAYB5ZUXBM6WAQCXE3GHUOTSKSBRLANCNFSM4RXYWHGQ>
.
|
https://github.com/NixOS/nixpkgs/blob/7e757502e95a2a22522151f9036da7db161f0ef9/pkgs/development/tools/build-managers/bazel/update-srcDeps.py
is parsing the entire WORKSPACE file, so it is indeed a superset. It could
probably just read additional_distfiles from bazel, but I'm not interested
in pursuing this further.
…On Tue, Oct 13, 2020 at 3:17 PM Profpatsch ***@***.***> wrote:
If you look into the code definition there’s an update which the
maintainers run when updating bazel:
https://github.com/NixOS/nixpkgs/blob/7e757502e95a2a22522151f9036da7db161f0ef9/pkgs/development/tools/build-managers/bazel/bazel_3/default.nix#L290-L297
it will use the exact version of the WORKSPACE from that release, so it
should always correspond exactly to it.
On Tue, Oct 13, 2020 at 7:00 PM Marco Farrugia ***@***.***>
wrote:
> Nixpkgs' list of bazels' dependencies is different from upstream's, but I
> assume ours is a superset so it's not a real problem.
>
> On Tue, Oct 13, 2020 at 12:43 PM Profpatsch ***@***.***>
> wrote:
>
> > And a random notes from this escapade, but
> > https://github.com/bazelbuild/bazel/blob/master/WORKSPACE#L144-L308
> looks
> > a little different from
> >
>
https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/build-managers/bazel/bazel_3/src-deps.json
> > so one of them is probably wrong :)
> >
> > I nearly missed this, but I don’t understand what you mean by that? Can
> > you elaborate?
> >
> > —
> > You are receiving this because you authored the thread.
> > Reply to this email directly, view it on GitHub
> > <#98611 (comment)>,
or
> > unsubscribe
> > <
>
https://github.com/notifications/unsubscribe-auth/AAROG6F5VMZVJSVOIONASLDSKR7RTANCNFSM4RXYWHGQ
> >
> > .
> >
>
> —
> You are receiving this because your review was requested.
> Reply to this email directly, view it on GitHub
> <#98611 (comment)>, or
> unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AAYB5ZUXBM6WAQCXE3GHUOTSKSBRLANCNFSM4RXYWHGQ
>
> .
>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#98611 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAROG6GO4XX4Y4KCUDPA5MDSKSRWJANCNFSM4RXYWHGQ>
.
|
It's not relevant to this PR. https://docs.bazel.build/versions/master/guide.html#running-bazel-in-an-airgapped-environment suggests that bazel should only need https://github.com/bazelbuild/bazel/blob/master/WORKSPACE#L144-L308 to work airgapped. We are doing something different than |
Oh, but nix won’t download any artifacts from the lock file that are not
actually needed, so the most we are optimizing here is for code bloat in
the repository, and I think it’s not relevant to spend any time on that tbh.
…On Fri, Oct 16, 2020 at 6:18 PM Marco Farrugia ***@***.***> wrote:
It's not relevant to this PR.
https://docs.bazel.build/versions/master/guide.html#running-bazel-in-an-airgapped-environment
suggests that bazel should only need
https://github.com/bazelbuild/bazel/blob/master/WORKSPACE#L144-L308 to
work airgapped. We are doing something different than bazel build
@additional_distfiles//:archives.tar that, if the docs are to be
believed, are downloading a superset of the necessary files.
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#98611 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAYB5ZV7FY37GUD7JM3MM53SLBW4PANCNFSM4RXYWHGQ>
.
|
Okay, I merged under the assumption that this PR does set a sensible default. We’ll see if any complaints come in. |
Motivation for this change
These are fixes for problems I ran into with:
bazel test //example:cpp-test
This needed
build --host_javabase='@local_jdk//:jdk'
bazel query 'deps(//example:cpp-test)'
This needed the same flags as
build
. (Trying to get a sense of why the cpp-test needs java!)Is it contentious to (partially?) configure the default java toolchain? I don't see it as much different than providing the bazel server's java.
It would continue to be configurable/overridable by overriding the flags.
#86410 is related.
(will rewrite commit later, web ui is tricky :))
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)And a random notes from this escapade, but https://github.com/bazelbuild/bazel/blob/master/WORKSPACE#L144-L308 looks a little different from https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/build-managers/bazel/bazel_3/src-deps.json so one of them is probably wrong :)