Commit Graph

63 Commits

Author SHA1 Message Date
Fabian Meumertzheim 81f85c02f8
Make system module map generation faster and fully hermetic (#280)
* `system_module_maps` no longer performs any IO.
* The generated module map no longer references any non-hermetic paths
and can thus be cached remotely, even when toolchain or sysroot are
provided as absolute paths.
2024-03-14 11:23:15 +01:00
Siddhartha Bagaria 8f4a0b2c40
Support exec platform different from host (#292)
Resolves #206.
2024-03-14 02:10:25 -07:00
Rahul Butani 512a3608d4
Resolve Labels for toolchain roots and sysroots correctly under bzlmod (#235)
Currently the repo rule and tag class accept string-form labels for
toolchain root packages and sysroots. Under `bzlmod` this is problematic
because users may pass us labels that point at repos that are not in
this module's repo mapping. To support such labels, they need to be
passed to us as actual `Label`s (not strings).

This necessitates some (**breaking**) changes to interface for the
module extension tags. The repo rule interface remains the same.

For the "llvm" module extension, two new tags have been introduced:
- `toolchain_root`, and 
- `sysroot` 

Alternatives considered:
1. Using a `label_keyed_string_dict` would not work if we still want to
    support absolute paths in these attributes.
2. Using string aliases instead of string labels, and then a separate
    attribute for a side table that maps labels to their aliases could also
    work. This would have to be done only for the module extension
    and not the repo rule, because specifying labels in repo rules
    eagerly fetches them.

I've also enabled bzlmod-enabled tests for the system paths, absolute
paths, and cross tests in CI.

Fixes #234. cc: @steve-261370

---------

Co-authored-by: Siddhartha Bagaria <starsid@gmail.com>
2024-03-12 21:37:39 -07:00
Siddhartha Bagaria f9666fff58
Move minimum supported version to Bazel 7.0.0 (#229)
This removes the need to provide flags like:

- `--incompatible_enable_cc_toolchain_resolution`
- `--features=-libtool` on macOS.
- `--features=-supports_dynamic_linker` on macOS.

As part of the update, test dep versions have also been updated.
2024-03-11 21:53:46 -07:00
Siddhartha Bagaria ba56fd4258
List new shasum for recent releases (#255)
Closes #253.
2024-02-13 09:58:56 -08:00
Siddhartha Bagaria 228c08c8f3 Refacter links after repo transfer 2024-02-12 16:41:43 -08:00
Siddhartha Bagaria a29c67a7ab
Prepare for transfer to bazel-contrib (#251)
- Removes maintenance notice at top of README.
- Adds CODEOWNERS file.
2024-02-06 11:53:40 -08:00
Fabian Meumertzheim 05f0bc1f4b
Add support for `layering_check` (#246)
* Add support for `layering_check`

The general support for this feature is inherited from the
Bazel-provided Unix C++ toolchain, except that a module map for the
toolchain and sysroot headers has to be supplied to the `cc_toolchain`.

Requires an update of abseil-cpp to make it compatible with
`layering_check`. Some other deps also needed to be updated.

Also fixes some nits related to Bazel 7 upgrade.
2024-01-19 14:31:56 -08:00
Siddhartha Bagaria df8ee5a0d6 Automated release workflow with notes generation 2023-09-14 08:01:06 +00:00
Siddhartha Bagaria bb94933b62
Misc cleanups (#216)
- Prepare for BCR release as 0.10.0
- Rename repo name to toolchains_llvm
- Upgrade Go version in tests and remove -nopie flag
- Combine lint and tests workflow
2023-09-14 00:03:26 -07:00
Siddhartha Bagaria 1cf6ea867f Update README for 0.9 2023-09-14 04:16:21 +00:00
Siddhartha Bagaria 87b25ed659
Fix all lint warnings (#214)
As per `trunk check --all`.
2023-09-12 17:48:11 -07:00
Siddhartha Bagaria c196bc1e10
Format all files (#213)
Formats all files as per `trunk fmt --all`.

Also adds .editorconfig for capturing indent style.
2023-09-12 16:05:22 -07:00
Siddhartha Bagaria 42a5552c76 Minor cleanup for recent bzlmod support 2023-09-12 20:10:41 +00:00
Gabriel Féron 5c6f8066fa
Add support for bzlmod (#198)
This is a fairly straightforward change that adds support for using `bazel-toolchain` with `bzlmod`.

The `llvm.toolchain` extension is only a wrapper around the existing `llvm_toolchain` repository rule and supports the same attributes.

For trying it out, add the following to your `MODULE.bazel`:

```
bazel_dep(name = "com_grail_bazel_toolchain", version = "0.8")
git_override(module_name = "com_grail_bazel_toolchain", remote = "https://github.com/grailbio/bazel-toolchain", commit = "cf915e5c7cfcd19a3e71de54e385e01240b865dc")

llvm = use_extension("@com_grail_bazel_toolchain//toolchain:extensions.bzl", "llvm")
llvm.toolchain(
    llvm_version = "15.0.0"
)

use_repo(llvm, "llvm_toolchain")

register_toolchains("@llvm_toolchain//:all")
```

---------

Co-authored-by: James Sharpe <james.sharpe@zenotech.com>
Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
Co-authored-by: Gabriel Féron <g@leirbagl.net>
2023-09-12 09:46:02 -07:00
David Zbarsky 9d8cc8a498
Fix OSX tests (#211) 2023-09-01 11:11:58 -07:00
David Zbarsky 04a5253ea5
Use llvm-ar on darwin (#210) 2023-09-01 07:45:06 -07:00
Marcus Boerger 41ff2a05c0
Auto-detect toolchain from llvm_versions attr (#196)
The `llvm_versions` attr is currently not being used to auto-detect toolchains
and is only used for the `urls` and `toolchain_roots` attributes.

Users who want to simply specify different LLVM versions for different host
OS/arch currently also need to specify the `urls` attribute even when the
auto-detection logic would otherwise be sufficient (see default toolchain in
tests/WORKSPACE).

With this change, the `urls` and associated `strip_prefix` and `sha256`
attributes will be unnecessary. The default toolchain in `tests/WORKSPACE`
has also been changed to reflect this.

---------

Co-authored-by: Siddhartha Bagaria <sidb@x.team>
2023-05-15 09:48:29 -07:00
Siddhartha Bagaria b38f3ea407 Update README for 0.8.2 2023-01-17 14:37:10 -08:00
Siddhartha Bagaria 7ef60cc5eb Update README for 0.8.1 2023-01-16 21:34:56 +00:00
Siddhartha Bagaria 70a0fb5566 Remove migration tests
These tests have not been useful for many past bazel versions, and
mostly not reliable. As bazel has become more stable, we expect
migration issues to be fewer. We do run tests with our minimum supported
bazel version and with the latest version of bazel. So a breakage with a
new release of bazel will be caught.
2023-01-06 07:44:29 +00:00
Siddhartha Bagaria d46339675a Update README for 0.8 2022-12-19 18:59:34 +00:00
Gary Miguel 2f6e6adf93
update link to bazel doc (#166) 2022-12-07 22:55:34 -08:00
Siddhartha Bagaria c16d31a299 Properly handle system paths for LLVM distribution
Code was not very clear in how system paths were being handled after the
last refactoring. Now cleaned up the code and some variable names to
read better, and added a unit test in CI.

Fixes #162.
2022-11-23 23:55:43 +00:00
Nicholas Skehin 4d8e4cb92f
Point to correct WORKSPACE file (#150)
The one at the root of the repo isn't very interesting, the one with the sysroot toolchain defined lives in `tests`
2022-08-15 09:14:58 -07:00
Siddhartha Bagaria c63521c22a Update README for 0.7.2 2022-05-23 23:00:00 +00:00
Zhanyong Wan 3c5a553a31
Reference latest LLVM version in README (#147) 2022-05-23 13:17:45 -07:00
Siddhartha Bagaria 15549d770e Run tests for minimum supported bazel version 2022-05-23 11:47:47 -07:00
Siddhartha Bagaria 9e71d56202 Update README for 0.7.1 2022-04-17 20:47:45 +00:00
Siddhartha Bagaria 14e7622e48 Minor whitespace fix in README 2022-04-17 19:39:46 +00:00
Siddhartha Bagaria 7c9e0d5b64 Update README with 0.7 release 2022-03-08 00:58:27 -08:00
Siddhartha Bagaria 58af2170da README section on supporting new targets 2022-03-08 00:35:01 -08:00
Siddhartha Bagaria c728048463 urls and sha256 attributes for llvm archive download
Current strategy for detecting OS name and matching it to an LLVM
distribution archive has many corner cases. Moreover, people might have
their own URLs where they host these archives.

Having an explicit dict of URLs and sha256, keyed by OS name, version
and arch, will help people get over these corner cases, and be able to
try new LLVM releases without waiting for an update to this repository.
Note that the keys here are different than the `toolchain_roots`
attribute.

While this method does have an extra setup step for each new OS type
that the user's workspace needs to support, this approach is more
flexible.

If we notice that people are using this feature more than the
auto inferred URLs, or that the llvm_release_names.py script is out of
date, we may just retain this feature, and delete the other way of
getting archives.

Additionally, fixes #125. People with that use case can now use the
`urls` attribute, or use the new convenience aliases.
2022-03-07 22:01:16 +00:00
Laurenz 560cf0f5b7
Fix dead link to Chromium sysroot doc (#126) 2021-12-29 11:05:31 -08:00
Rahul Butani 25f6fb9582
release: update the README instructions for 0.6.3 2021-10-14 10:37:20 -05:00
Yasushi Saito 03f380c8f9
Support Clang 13 (#113)
Closes #110.

* Support Clang 13

* misc: update the README

* distributions: add LLVM 12.0.1

* distributions: add a missing armv7a-hf entry for LLVM 10

Co-authored-by: Rahul Butani <rr.butani@gmail.com>
2021-10-13 21:43:37 -05:00
Siddhartha Bagaria ddcdd61f64 Update latest tag in README to 0.6.2 2021-09-26 13:18:46 -07:00
Siddhartha Bagaria 70d91f14d9
Ensure /usr/bin is in PATH for macOS (#106)
This is an alternative fix to what was included in #105.
2021-09-26 07:40:39 -07:00
Siddhartha Bagaria 657f504687 Update latest tag in README to 0.6.1 2021-09-23 13:24:02 -07:00
Siddhartha Bagaria aacb824e32 Mention crosstool_top is no longer supported 2021-09-23 13:10:44 -07:00
Siddhartha Bagaria ef31d2cedc Refresh README for release 0.6 2021-09-23 02:37:23 -07:00
Siddhartha Bagaria fab4cd905c
Refactor to support cross-compilation (#98)
Make separate the notion of host and target OS and CPU architecture
throughout the codebase.

Always take {os}-{arch} pairs where we were taking just the os name
before and be clear when it is intended to be host and when target.
2021-09-22 20:51:37 -07:00
Siddhartha Bagaria 94271a4ebd
Remove urls attribute of llvm_toolchain (#96)
It is now easier to directly use `http_archive` through
`toolchain_roots`.
2021-09-22 01:47:03 -07:00
Siddhartha Bagaria e4b62c9a4f
Separate LLVM distribution repo (#94)
Separating the distribution from the configuration will allow users to
bring the distribution in other forms, like through `local_repository`.

It will also make it such that the LLVM distribution does not have to
be downloaded and extracted for toolchain registration during
workspace initialization.

Fixes #40.
2021-09-22 00:44:02 -07:00
Siddhartha Bagaria 58327cd93a Separate migration tests into their own workflow. 2020-06-16 22:25:15 -07:00
Siddhartha Bagaria aaa68b07e9 Do not fail fast in tests 2020-06-09 15:51:38 -07:00
Siddhartha Bagaria 9c6adbf7e8 Replace Travis badge with Github Actions badge 2020-03-10 01:20:24 -07:00
Siddhartha Bagaria 215482ad36 llvm_toolchain: use rules_cc
The toolchain now requires `rules_cc` to be defined either manually by
the user, or through `bazel_toolchain_dependencies` before the llvm
toolchain is defined.

Resolves #34.
2020-02-23 08:22:45 +00:00
Trevor Hickey b9fffc17ef
llvm_toolchain: adjust flag name in README (#33) 2020-02-22 21:01:22 -08:00
Siddhartha Bagaria 78079f7da2 Add note on version req in README 2019-10-17 10:50:54 -07:00