diff --git a/utils/bazel/WORKSPACE b/utils/bazel/WORKSPACE --- a/utils/bazel/WORKSPACE +++ b/utils/bazel/WORKSPACE @@ -16,14 +16,16 @@ ], ) -load(":configure.bzl", "llvm_configure") - -llvm_configure( - name = "llvm-project", - overlay_path = "llvm-project-overlay", - src_path = "../..", +new_local_repository( + name = "llvm-archive", + path = "../../", + build_file_content = "# empty", ) +load("@llvm-archive//utils/bazel:configure.bzl", "llvm_configure") + +llvm_configure(name = "llvm-project") + load(":terminfo.bzl", "llvm_terminfo_from_env") maybe( diff --git a/utils/bazel/configure.bzl b/utils/bazel/configure.bzl --- a/utils/bazel/configure.bzl +++ b/utils/bazel/configure.bzl @@ -5,7 +5,6 @@ """Helper macros to configure the LLVM overlay project.""" load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") -load("@bazel_skylib//lib:paths.bzl", "paths") load(":zlib.bzl", "llvm_zlib_disable", "llvm_zlib_system") load(":terminfo.bzl", "llvm_terminfo_disable", "llvm_terminfo_system") @@ -33,23 +32,11 @@ ] def _overlay_directories(repository_ctx): - src_workspace_path = str(repository_ctx.path( - repository_ctx.attr.src_workspace, - ).dirname) - - src_path = paths.join(src_workspace_path, repository_ctx.attr.src_path) - - overlay_workspace_path = str(repository_ctx.path( - repository_ctx.attr.overlay_workspace, - ).dirname) - overlay_path = paths.join( - overlay_workspace_path, - repository_ctx.attr.overlay_path, - ) + src_path = repository_ctx.path(Label("//:WORKSPACE")).dirname + bazel_path = src_path.get_child("utils").get_child("bazel") + overlay_path = bazel_path.get_child("llvm-project-overlay") + script_path = bazel_path.get_child("overlay_directories.py") - overlay_script = repository_ctx.path( - repository_ctx.attr._overlay_script, - ) python_bin = repository_ctx.which("python3") if not python_bin: # Windows typically just defines "python" as python3. The script itself @@ -61,7 +48,7 @@ cmd = [ python_bin, - overlay_script, + script_path, "--src", src_path, "--overlay", @@ -98,14 +85,6 @@ local = True, configure = True, attrs = { - "_overlay_script": attr.label( - default = Label("//:overlay_directories.py"), - allow_single_file = True, - ), - "overlay_workspace": attr.label(default = Label("//:WORKSPACE")), - "overlay_path": attr.string(default = DEFAULT_OVERLAY_PATH), - "src_workspace": attr.label(default = Label("//:WORKSPACE")), - "src_path": attr.string(mandatory = True), "targets": attr.string_list(default = DEFAULT_TARGETS), }, ) diff --git a/utils/bazel/examples/http_archive/WORKSPACE b/utils/bazel/examples/http_archive/WORKSPACE --- a/utils/bazel/examples/http_archive/WORKSPACE +++ b/utils/bazel/examples/http_archive/WORKSPACE @@ -14,8 +14,8 @@ name = "bazel_skylib", sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz".format(version=SKYLIB_VERSION), - "https://github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz".format(version=SKYLIB_VERSION), + "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz".format(version = SKYLIB_VERSION), + "https://github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz".format(version = SKYLIB_VERSION), ], )