Brian Silverman | 7d89e28 | 2021-11-17 17:36:54 -0800 | [diff] [blame^] | 1 | # Copyright 2021 The Bazel Authors. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | load( |
| 16 | "//toolchain/internal:common.bzl", |
| 17 | _os = "os", |
| 18 | ) |
| 19 | load( |
| 20 | "//toolchain/internal:llvm_distributions.bzl", |
| 21 | _download_llvm_preconfigured = "download_llvm_preconfigured", |
| 22 | ) |
| 23 | |
| 24 | def llvm_repo_impl(rctx): |
| 25 | os = _os(rctx) |
| 26 | if os == "windows": |
| 27 | rctx.file("BUILD", executable = False) |
| 28 | return |
| 29 | |
| 30 | rctx.file( |
| 31 | "BUILD.bazel", |
| 32 | content = rctx.read(Label("//toolchain:BUILD.llvm_repo")), |
| 33 | executable = False, |
| 34 | ) |
| 35 | |
| 36 | _download_llvm_preconfigured(rctx) |
| 37 | |
| 38 | # We try to avoid patches to the downloaded repo so that it is easier for |
| 39 | # users to bring their own LLVM distribution through `http_archive`. If we |
| 40 | # do want to make changes, then we should do it through a patch file, and |
| 41 | # document it for users of toolchain_roots attribute. |