Skip to content
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: Don't hardcode build tools #42552

Merged
merged 1 commit into from Jun 25, 2018
Merged

Conversation

mboes
Copy link
Contributor

@mboes mboes commented Jun 25, 2018

Bazel is a build tool, much like Make and many others. Like Make, it
should be agnostic to the compiler toolchains the user brings into
scope. Bazel has special rules that encode domain specific knowledge
for how to compile a C++ program, or indeed a Java program and a few
others. But that's not to say that at runtime Bazel should assume
a specific C++ compiler or Java compiler anymore than Make does.

The main impact of this change is that packages that build with Bazel
will have to list the compilers they want in their buildInputs or
similar, rather than relying on the bazel package pulling them in
transitively.

Bazel is a build tool, much like Make and many others. Like Make, it
should be agnostic to the compiler toolchains the user brings into
scope. Bazel has special rules that encode domain specific knowledge
for how to compile a C++ program, or indeed a Java program and a few
others. But that's not to say that at runtime Bazel should assume
a specific C++ compiler or Java compiler anymore than Make does.

The main impact of this change is that packages that build with Bazel
will have to list the compilers they want in their `buildInputs` or
similar, rather than relying on the `bazel` package pulling them in
transitively.
@xeji
Copy link
Contributor

xeji commented Jun 25, 2018

@GrahamcOfBorg build bazel

@GrahamcOfBorg
Copy link

No attempt on aarch64-linux (full log)

The following builds were skipped because they don't evaluate on aarch64-linux: bazel

Partial log (click to expand)


a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowUnfree = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowUnfree = true; }
to ~/.config/nixpkgs/config.nix.


@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: bazel

Partial log (click to expand)

//examples/cpp:hello-success_test                                        PASSED in 0.1s
//examples/java-native/src/test/java/com/example/myproject:hello         PASSED in 0.3s

Executed 2 out of 2 tests: 2 tests pass.
There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these are.
installing
post-installation fixup
patching script interpreter paths in /nix/store/psgm0mahw6kbn8x9yi1c0nzxyb988li4-bazel-0.13.0
checking for references to /tmp in /nix/store/psgm0mahw6kbn8x9yi1c0nzxyb988li4-bazel-0.13.0...
/nix/store/psgm0mahw6kbn8x9yi1c0nzxyb988li4-bazel-0.13.0

@GrahamcOfBorg
Copy link

Failure on x86_64-darwin (full log)

Attempted: bazel

Partial log (click to expand)

./tools/test/collect_coverage.sh: interpreter directive changed from "/bin/bash -x" to "/nix/store/46y32j94pm0cz6ygywb3wxxj0fdbqj13-bash/bin/bash -x"
./tools/test/test-setup.sh: interpreter directive changed from "/bin/bash" to "/nix/store/46y32j94pm0cz6ygywb3wxxj0fdbqj13-bash/bin/bash"
configuring
no configure script, doing nothing
building
Building Bazel from scratch....../usr/bin/xcrun clang -fobjc-arc -framework CoreServices -framework Foundation -o /tmp/bazel_Fe3Y7WVN/archive/_embedded_binaries/xcode-locator tools/osx/xcode_locator.m
xcode-select: error: no developer tools were found at '/Applications/Xcode.app', and no install could be requested (perhaps no UI is present), please install manually from 'developer.apple.com'.
/nix/store/7amnc2662p390bgzj6c0snylj19vxmj2-stdenv-darwin/setup: line 1291: ./output/bazel: No such file or directory
builder for '/nix/store/7aca9sxlamx0qdiaqqpd3hc8wkfq5mc5-bazel-0.13.0.drv' failed with exit code 127
�[31;1merror:�[0m build of '/nix/store/7aca9sxlamx0qdiaqqpd3hc8wkfq5mc5-bazel-0.13.0.drv' failed

@xeji xeji merged commit 06eeb0d into NixOS:master Jun 25, 2018
installPhase = ''
mkdir -p $out/bin
mv output/bazel $out/bin
wrapProgram "$out/bin/bazel" --prefix PATH : "${lib.makeBinPath [ stdenv.cc jdk ]}"
wrapProgram "$out/bin/bazel" --set JAVA_HOME "${jdk}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why leave the wrapper for JAVA_HOME? By the same logic (which I agree with) JAVA_HOME should be set by the caller as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry I'm silly, this is for the JAVA_HOME used to run Bazel, not the one used to build java projects with Bazel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants