From 6ef4cdaedf86416014b0e2bf8cc51891e818fc5a Mon Sep 17 00:00:00 2001 From: Manuel Naranjo Date: Fri, 21 Jun 2024 12:50:22 +0200 Subject: [PATCH] Drop workspace mode we will not support workspace mode for those consuming this rules --- .github/workflows/ci.yaml | 2 +- .github/workflows/release_prep.sh | 14 +------------- WORKSPACE.bazel | 1 - e2e/smoke/WORKSPACE.bazel | 19 ------------------- e2e/smoke/WORKSPACE.bzlmod | 2 -- patchelf_prebuilt/repositories.bzl | 24 +----------------------- tools/patchelf_sources.bzl | 6 +++++- 7 files changed, 8 insertions(+), 60 deletions(-) delete mode 100644 WORKSPACE.bazel delete mode 100644 e2e/smoke/WORKSPACE.bazel delete mode 100644 e2e/smoke/WORKSPACE.bzlmod diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bbed39d..53f645a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -32,5 +32,5 @@ jobs: {"bazelversion": "6.4.0", folder: "."}, { folder: ".", "os": "macos-latest"}, { folder: ".", "os": "windows-latest"}, - { folder: ".", bzlmodEnabled: false} + { bzlmodEnabled: false} ] diff --git a/.github/workflows/release_prep.sh b/.github/workflows/release_prep.sh index 34e8ded..5568bb2 100755 --- a/.github/workflows/release_prep.sh +++ b/.github/workflows/release_prep.sh @@ -56,17 +56,5 @@ bazel_dep(name = "com_booking_rules_patchelf_prebuilt", version = "${TAG:1}") ## Using WORKSPACE -Paste this snippet into your \`WORKSPACE.bazel\` file: - -\`\`\`starlark -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -http_archive( - name = "com_booking_rules_patchelf_prebuilt", - sha256 = "${SHA}", - strip_prefix = "${PREFIX}", - url = "https://github.com/bookingcom/rules_patchelf_prebuilt/releases/download/${TAG}/${ARCHIVE}", -) +WORKSPACE mode is not supported EOF - -awk 'f;/--SNIP--/{f=1}' e2e/smoke/WORKSPACE.bazel -echo "\`\`\`" diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel deleted file mode 100644 index 53b52af..0000000 --- a/WORKSPACE.bazel +++ /dev/null @@ -1 +0,0 @@ -# Marker that this is the root of a Bazel workspace. diff --git a/e2e/smoke/WORKSPACE.bazel b/e2e/smoke/WORKSPACE.bazel deleted file mode 100644 index 8ee02c0..0000000 --- a/e2e/smoke/WORKSPACE.bazel +++ /dev/null @@ -1,19 +0,0 @@ -# Override http_archive for local testing -local_repository( - name = "com_booking_rules_patchelf_prebuilt", - path = "../..", -) - -#---SNIP--- Below here is re-used in the workspace snippet published on releases - -###################### -# rules_patchelf_prebuilt setup # -###################### -# Fetches the rules_patchelf_prebuilt dependencies. -# If you want to have a different version of some dependency, -# you should fetch it *before* calling this. -# Alternatively, you can skip calling this function, so long as you've -# already fetched all the dependencies. -load("@com_booking_rules_patchelf_prebuilt//patchelf_prebuilt:repositories.bzl", "rules_patchelf_prebuilt_dependencies") - -rules_patchelf_prebuilt_dependencies() diff --git a/e2e/smoke/WORKSPACE.bzlmod b/e2e/smoke/WORKSPACE.bzlmod deleted file mode 100644 index 7784218..0000000 --- a/e2e/smoke/WORKSPACE.bzlmod +++ /dev/null @@ -1,2 +0,0 @@ -# When --enable_bzlmod is set, this file replaces WORKSPACE.bazel. -# Dependencies then come from MODULE.bazel instead. diff --git a/patchelf_prebuilt/repositories.bzl b/patchelf_prebuilt/repositories.bzl index 08d5863..e6b103e 100644 --- a/patchelf_prebuilt/repositories.bzl +++ b/patchelf_prebuilt/repositories.bzl @@ -4,34 +4,11 @@ These are needed for local dev, and users must install them as well. See https://docs.bazel.build/versions/main/skylark/deploying.html#dependencies """ -load("@bazel_tools//tools/build_defs/repo:http.bzl", _http_archive = "http_archive") -load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") load("//patchelf_prebuilt:version.bzl", "VERSION") load("//patchelf_prebuilt/platforms:platforms.bzl", "PLATFORMS") load("//patchelf_prebuilt/private:integrity.bzl", "RELEASED_BINARY_INTEGRITY") load("//patchelf_prebuilt/private:toolchains_repo.bzl", "toolchains_repo") -def http_archive(name, **kwargs): - maybe(_http_archive, name = name, **kwargs) - -# WARNING: any changes in this function may be BREAKING CHANGES for users -# because we'll fetch a dependency which may be different from one that -# they were previously fetching later in their WORKSPACE setup, and now -# ours took precedence. Such breakages are challenging for users, so any -# changes in this function should be marked as BREAKING in the commit message -# and released only in semver majors. -# This is all fixed by bzlmod, so we just tolerate it for now. -def rules_patchelf_prebuilt_dependencies(): - # The minimal version of bazel_skylib we require - http_archive( - name = "bazel_skylib", - sha256 = "bc283cdfcd526a52c3201279cda4bc298652efa898b10b4db0837dc51652756f", - urls = [ - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz", - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz", - ], - ) - ######## # Remaining content of the file is only used to support toolchains. ######## @@ -99,6 +76,7 @@ def patchelf_prebuilt_register_toolchains(name, register = True, **kwargs): patchelf_prebuilt_repositories( name = name + "_" + platform, platform = platform, + patchelf_prebuilt_version = patchelf_prebuilt_version, **kwargs ) if register: diff --git a/tools/patchelf_sources.bzl b/tools/patchelf_sources.bzl index db06f1b..86b69d8 100644 --- a/tools/patchelf_sources.bzl +++ b/tools/patchelf_sources.bzl @@ -1,6 +1,7 @@ "Creates repositories that can build patchelf for different versions from upstream" -load("@//patchelf_prebuilt:repositories.bzl", "http_archive") +load("@bazel_tools//tools/build_defs/repo:http.bzl", _http_archive = "http_archive") +load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") VERSIONS = { "0.14.5": { @@ -9,6 +10,9 @@ VERSIONS = { }, } +def http_archive(name, **kwargs): + maybe(_http_archive, name = name, **kwargs) + def _patchelf_sources_extension(module_ctx): repos = []