[llvm] [bazel] Update WORKSPACE files for examples (PR #97612)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 3 10:38:35 PDT 2024
https://github.com/kirillpyasecky created https://github.com/llvm/llvm-project/pull/97612
None
>From a8c396efd0d9190065da457e85fe54ef8e5e0b98 Mon Sep 17 00:00:00 2001
From: Kirill <pyasetskiyr at gmail.com>
Date: Wed, 3 Jul 2024 20:38:09 +0300
Subject: [PATCH] [bazel] Update WORKSPACE
---
utils/bazel/examples/submodule/WORKSPACE | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/utils/bazel/examples/submodule/WORKSPACE b/utils/bazel/examples/submodule/WORKSPACE
index e8eff85ffda52..94dffa7fa63ae 100644
--- a/utils/bazel/examples/submodule/WORKSPACE
+++ b/utils/bazel/examples/submodule/WORKSPACE
@@ -2,9 +2,11 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-"""An example WORKSPACE for configuring LLVM using a git submodule."""
+"""An example WORKSPACE for configuring LLVM using http_archive."""
-workspace(name = "submodule_example")
+workspace(name = "http_archive_example")
+
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
SKYLIB_VERSION = "1.0.3"
@@ -17,17 +19,28 @@ http_archive(
],
)
-new_local_repository(
+# Replace with the LLVM commit you want to use.
+LLVM_COMMIT = "926f85db98aae66ab8f57b9981f47ddddb868c51"
+
+# The easiest way to calculate this for a new commit is to set it to empty and
+# then run a bazel build and it will report the digest necessary to cache the
+# archive and make the build reproducible.
+LLVM_SHA256 = "c78c94b2a03b2cf6ef1ba035c31a6f1b0bb7913da8af5aa8d5c2061f6499d589"
+
+http_archive(
name = "llvm-raw",
build_file_content = "# empty",
- # Or wherever your submodule is located.
- path = "third_party/llvm-project",
+ sha256 = LLVM_SHA256,
+ strip_prefix = "llvm-project-" + LLVM_COMMIT,
+ urls = ["https://github.com/llvm/llvm-project/archive/{commit}.tar.gz".format(commit = LLVM_COMMIT)],
)
load("@llvm-raw//utils/bazel:configure.bzl", "llvm_configure")
llvm_configure(name = "llvm-project")
+load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
+
maybe(
http_archive,
name = "llvm_zlib",
More information about the llvm-commits
mailing list