https://github.com/aherrmann/bazel-toolchain-version-select
https://github.com/aherrmann/bazel-toolchain-version-select
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/aherrmann/bazel-toolchain-version-select
- Owner: aherrmann
- Created: 2021-09-03T11:00:34.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-09-03T11:00:41.000Z (almost 5 years ago)
- Last Synced: 2025-03-02T22:18:30.238Z (over 1 year ago)
- Language: Starlark
- Homepage:
- Size: 5.86 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Using transitions
Emulates regular compilation from x86_64 to x86_64 using compiler version 1:
```
$ bazel clean && bazel run //:hello_1_x86_64
...
INFO: From Compiling Example binary hello.sh:
! Example compiler
! Version 1
! Running on x86_64 linux
! Targetting x86_64 linux
...
INFO: Running command line: bazel-out/k8-fastbuild-ST-6b3e419c2935/bin/hello_1_xINFO: Build completed successfully, 6 total actions
! Example program
! Compiled by version 1
! Compiled on x86_64 linux
! Running on x86_64 linux
Hello world
```
Emulates regular compilation from x86_64 to x86_64 using compiler version 2:
```
$ bazel clean && bazel run //:hello_2_x86_64
...
INFO: From Compiling Example binary hello.sh:
! Example compiler
! Version 2
! Running on x86_64 linux
! Targetting x86_64 linux
...
INFO: Running command line: bazel-out/k8-fastbuild-ST-2c5ddf0f26b1/bin/hello_2_xINFO: Build completed successfully, 6 total actions
! Example program
! Compiled by version 2
! Compiled on x86_64 linux
! Running on x86_64 linux
Hello world
```
Emulates cross-compilation from x86_64 to arm using compiler version 1:
```
$ bazel clean && bazel run //:hello_1_arm
...
INFO: From Compiling Example binary hello.sh:
! Example compiler
! Version 1
! Running on x86_64 linux
! Targetting arm linux
...
INFO: Running command line: bazel-out/k8-fastbuild-ST-e0a3cdaa9904/bin/hello_1_aINFO: Build completed successfully, 6 total actions
! Example program
! Compiled by version 1
! Compiled on x86_64 linux
! Running on arm linux
Hello world
```
Emulates cross-compilation from x86_64 to arm using compiler version 2:
```
$ bazel clean && bazel run //:hello_2_arm
...
INFO: From Compiling Example binary hello.sh:
! Example compiler
! Version 2
! Running on x86_64 linux
! Targetting arm linux
...
INFO: Running command line: bazel-out/k8-fastbuild-ST-6cb406987aa8/bin/hello_2_aINFO: Build completed successfully, 6 total actions
! Example program
! Compiled by version 2
! Compiled on x86_64 linux
! Running on arm linux
Hello world
```
# Using platform and build setting flags
Emulates regular compilation from x86_64 to x86_64 using compiler version 1:
```
$ bazel run //:hello --platforms=//platforms:linux_x86_64 --//rules_example/version=1
...
INFO: From Compiling Example binary hello.sh:
! Example compiler
! Version 1
! Running on x86_64 linux
! Targetting x86_64 linux
...
INFO: Build completed successfully, 3 total actions
! Example program
! Compiled by version 1
! Compiled on x86_64 linux
! Running on x86_64 linux
Hello world
```
Emulates regular compilation from x86_64 to x86_64 using compiler version 2:
```
$ bazel run //:hello --platforms=//platforms:linux_x86_64 --//rules_example/version=2
...
INFO: From Compiling Example binary hello.sh:
! Example compiler
! Version 2
! Running on x86_64 linux
! Targetting x86_64 linux
...
INFO: Build completed successfully, 3 total actions
! Example program
! Compiled by version 2
! Compiled on x86_64 linux
! Running on x86_64 linux
Hello world
```
Emulates cross-compilation from x86_64 to arm using compiler version 1:
```
$ bazel run //:hello --platforms=//platforms:linux_arm --//rules_example/version=1
...
INFO: From Compiling Example binary hello.sh:
! Example compiler
! Version 1
! Running on x86_64 linux
! Targetting arm linux
...
INFO: Build completed successfully, 2 total actions
! Example program
! Compiled by version 1
! Compiled on x86_64 linux
! Running on arm linux
Hello world
```
Emulates cross-compilation from x86_64 to arm using compiler version 2:
```
$ bazel run //:hello --platforms=//platforms:linux_arm --//rules_example/version=2
...
INFO: From Compiling Example binary hello.sh:
! Example compiler
! Version 2
! Running on x86_64 linux
! Targetting arm linux
...
INFO: Build completed successfully, 2 total actions
! Example program
! Compiled by version 2
! Compiled on x86_64 linux
! Running on arm linux
Hello world
```