Coder Social home page Coder Social logo

2024-04-10-bazel-toolchain-version-constraint's Introduction

Toolchain Version Constraints and Selection

Using Toolchain resolution using configuration flags which was introduced in Bazel 4.0.0.

Demo

Build with a specific toolchain version

$ bazel build demo-all --toolchain_resolution_debug=//toolchains:toolchain_type --//toolchains:version=1.0.0
... Selected //toolchains:demo-x86_64-linux-x86_64-linux-1.0.0
... bazel-bin/demo-all.out
$ cat bazel-bin/demo-all.out
output:             bazel-out/k8-fastbuild/bin/demo-all.out
execution platform: x86_64-linux
target platform:    x86_64-linux
compiler version:   1.0.0
$ bazel build demo-all --toolchain_resolution_debug=//toolchains:toolchain_type --//toolchains:version=2.0.0
... Selected //toolchains:demo-x86_64-linux-x86_64-linux-2.0.0
... bazel-bin/demo-all.out
$ cat bazel-bin/demo-all.out
output:             bazel-out/k8-fastbuild/bin/demo-all.out
execution platform: x86_64-linux
target platform:    x86_64-linux
compiler version:   2.0.0

Target compatibility with specific toolchain versions

$ bazel build demo-1 demo-2 --keep_going --show_result=2 --//toolchains:version=1.0.0
...
Target //:demo-2 was skipped
Target //:demo-1 up-to-date:
  bazel-bin/demo-1.out
$ cat bazel-bin/demo-1.out
output:             bazel-out/k8-fastbuild/bin/demo-1.out
execution platform: x86_64-linux
target platform:    x86_64-linux
compiler version:   1.0.0
$ bazel build demo-1 demo-2 --keep_going --show_result=2 --//toolchains:version=2.0.0
...
Target //:demo-1 was skipped
Target //:demo-2 up-to-date:
  bazel-bin/demo-2.out
$ cat bazel-bin/demo-2.out
output:             bazel-out/k8-fastbuild/bin/demo-2.out
execution platform: x86_64-linux
target platform:    x86_64-linux
compiler version:   2.0.0

Transition to specific toolchain version

$ bazel build demo-all-1 --toolchain_resolution_debug=//toolchains:toolchain_type
... Selected //toolchains:demo-x86_64-linux-x86_64-linux-1.0.0
... bazel-bin/demo-all.out
$ cat bazel-bin/demo-all.out
output:             bazel-out/k8-fastbuild/bin/demo-all.out
execution platform: x86_64-linux
target platform:    x86_64-linux
compiler version:   1.0.0
$ bazel build demo-all-1.1 --toolchain_resolution_debug=//toolchains:toolchain_type
... Selected //toolchains:demo-x86_64-linux-x86_64-linux-1.1.0
... bazel-out/k8-fastbuild-ST-f2f601e3226f/bin/demo-all.out
$ cat bazel-out/k8-fastbuild-ST-f2f601e3226f/bin/demo-all.out
output:             bazel-out/k8-fastbuild-ST-f2f601e3226f/bin/demo-all.out
execution platform: x86_64-linux
target platform:    x86_64-linux
compiler version:   1.1.0
$ bazel build demo-all-2 --toolchain_resolution_debug=//toolchains:toolchain_type
... Selected //toolchains:demo-x86_64-linux-x86_64-linux-2.0.0
... bazel-out/k8-fastbuild-ST-6d692ac628d1/bin/demo-all.out
$ cat bazel-out/k8-fastbuild-ST-6d692ac628d1/bin/demo-all.out
output:             bazel-out/k8-fastbuild-ST-6d692ac628d1/bin/demo-all.out
execution platform: x86_64-linux
target platform:    x86_64-linux
compiler version:   2.0.0

2024-04-10-bazel-toolchain-version-constraint's People

Contributors

aherrmann avatar

Stargazers

 avatar

Watchers

 avatar  avatar

2024-04-10-bazel-toolchain-version-constraint's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.