diff --git a/core/.bazelignore b/core/.bazelignore index a61f183f2..850ed9f95 100644 --- a/core/.bazelignore +++ b/core/.bazelignore @@ -1,2 +1,2 @@ -bazel-* +bazel-core testing diff --git a/core/BUILD.bazel b/core/BUILD.bazel index 74cb7a809..f19c53c0b 100644 --- a/core/BUILD.bazel +++ b/core/BUILD.bazel @@ -26,6 +26,7 @@ bzl_library( srcs = [ "nixpkgs.bzl", "util.bzl", + "private/get_cpu_value.bzl", ], deps = [ ":bazel_tools", diff --git a/core/private/get_cpu_value.bzl b/core/private/get_cpu_value.bzl new file mode 100644 index 000000000..f2fcc5776 --- /dev/null +++ b/core/private/get_cpu_value.bzl @@ -0,0 +1,48 @@ +load("@bazel_skylib//lib:versions.bzl", "versions") + +# see https://github.com/tweag/rules_nixpkgs/pull/613 +# taken from https://github.com/bazelbuild/rules_cc/blob/8395ec0172270f3bf92cd7b06c9b5b3f1f679e88/cc/private/toolchain/lib_cc_configure.bzl#L225 +def get_cpu_value(repository_ctx): + """Compute the cpu_value based on the OS name. Doesn't %-escape the result! + + Args: + repository_ctx: The repository context. + Returns: + One of (darwin, freebsd, x64_windows, ppc, s390x, arm, aarch64, k8, piii) + """ + os_name = repository_ctx.os.name + arch = repository_ctx.os.arch + if os_name.startswith("mac os"): + # Check if we are on x86_64 or arm64 and return the corresponding cpu value. + if arch == "aarch64": + return "darwin_arm64" + + # NOTE(cb) for backward compatibility return "darwin" for Bazel < 7 on x86_64 + if versions.is_at_least("7.0.0", versions.get()): + return "darwin_x86_64" + else: + return "darwin" + + if os_name.find("freebsd") != -1: + return "freebsd" + if os_name.find("openbsd") != -1: + return "openbsd" + if os_name.find("windows") != -1: + if arch == "aarch64": + return "arm64_windows" + else: + return "x64_windows" + + if arch in ["power", "ppc64le", "ppc", "ppc64"]: + return "ppc" + if arch in ["s390x"]: + return "s390x" + if arch in ["mips64"]: + return "mips64" + if arch in ["riscv64"]: + return "riscv64" + if arch in ["arm", "armv7l"]: + return "arm" + if arch in ["aarch64"]: + return "aarch64" + return "k8" if arch in ["amd64", "x86_64", "x64"] else "piii" diff --git a/core/util.bzl b/core/util.bzl index b7940627b..e9103d6f7 100644 --- a/core/util.bzl +++ b/core/util.bzl @@ -1,44 +1,6 @@ load("@bazel_skylib//lib:paths.bzl", "paths") load("@bazel_skylib//lib:versions.bzl", "versions") - -# see https://github.com/tweag/rules_nixpkgs/pull/613 -# taken from https://github.com/bazelbuild/rules_cc/blob/8395ec0172270f3bf92cd7b06c9b5b3f1f679e88/cc/private/toolchain/lib_cc_configure.bzl#L225 -def get_cpu_value(repository_ctx): - """Compute the cpu_value based on the OS name. Doesn't %-escape the result! - - Args: - repository_ctx: The repository context. - Returns: - One of (darwin, freebsd, x64_windows, ppc, s390x, arm, aarch64, k8, piii) - """ - os_name = repository_ctx.os.name - arch = repository_ctx.os.arch - if os_name.startswith("mac os"): - # Check if we are on x86_64 or arm64 and return the corresponding cpu value. - return "darwin_" + ("arm64" if arch == "aarch64" else "x86_64") - if os_name.find("freebsd") != -1: - return "freebsd" - if os_name.find("openbsd") != -1: - return "openbsd" - if os_name.find("windows") != -1: - if arch == "aarch64": - return "arm64_windows" - else: - return "x64_windows" - - if arch in ["power", "ppc64le", "ppc", "ppc64"]: - return "ppc" - if arch in ["s390x"]: - return "s390x" - if arch in ["mips64"]: - return "mips64" - if arch in ["riscv64"]: - return "riscv64" - if arch in ["arm", "armv7l"]: - return "arm" - if arch in ["aarch64"]: - return "aarch64" - return "k8" if arch in ["amd64", "x86_64", "x64"] else "piii" +load("//:private/get_cpu_value.bzl", "get_cpu_value") def fail_on_err(return_value, prefix = None): """Fail if the given return value indicates an error. diff --git a/nixpkgs/nixpkgs.bzl b/nixpkgs/nixpkgs.bzl index b2f579c3b..b928383d0 100644 --- a/nixpkgs/nixpkgs.bzl +++ b/nixpkgs/nixpkgs.bzl @@ -115,7 +115,7 @@ nixpkgs_package( load("@bazel_tools//tools/cpp:cc_configure.bzl", "cc_autoconf_impl") load( - "@bazel_tools//tools/cpp:lib_cc_configure.bzl", + "@rules_nixpkgs_core//:private/get_cpu_value.bzl", "get_cpu_value", ) load( diff --git a/testing/posix/WORKSPACE b/testing/posix/WORKSPACE index f98782d86..85a8c6995 100644 --- a/testing/posix/WORKSPACE +++ b/testing/posix/WORKSPACE @@ -32,9 +32,9 @@ bazel_skylib_workspace() http_archive( name = "rules_sh", - sha256 = "23a4571ec8afc83db1eae99c0efd0b8b4fa1644069f0340a10f8859e086ba02c", - strip_prefix = "rules_sh-0.4.0", - urls = ["https://github.com/tweag/rules_sh/archive/v0.4.0.tar.gz"], + sha256 = "f96b39c5a07d38424b48b5cc2e5f4b820f2877682a0488faa43f0948def95e28", + strip_prefix = "rules_sh-0.5.0", + urls = ["https://github.com/tweag/rules_sh/archive/v0.5.0.tar.gz"], ) load("@rules_sh//sh:repositories.bzl", "rules_sh_dependencies") diff --git a/testing/python/.bazelignore b/testing/python/.bazelignore new file mode 100644 index 000000000..19c59ca6c --- /dev/null +++ b/testing/python/.bazelignore @@ -0,0 +1 @@ +bazel-python diff --git a/testing/python/poetry.lock b/testing/python/poetry.lock index 31deb3035..5d3a3163c 100644 --- a/testing/python/poetry.lock +++ b/testing/python/poetry.lock @@ -2,13 +2,13 @@ [[package]] name = "blinker" -version = "1.8.2" +version = "1.9.0" description = "Fast, simple object-to-object and broadcast signaling" optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" files = [ - {file = "blinker-1.8.2-py3-none-any.whl", hash = "sha256:1779309f71bf239144b9399d06ae925637cf6634cf6bd131104184531bf67c01"}, - {file = "blinker-1.8.2.tar.gz", hash = "sha256:8f77b09d3bf7c795e969e9486f39c2c5e9c39d4ee07424be2bc594ece9642d83"}, + {file = "blinker-1.9.0-py3-none-any.whl", hash = "sha256:ba0efaa9080b619ff2f3459d1d500c57bddea4a6b424b60a91141db6fd2f08bc"}, + {file = "blinker-1.9.0.tar.gz", hash = "sha256:b4ce2265a7abece45e7cc896e98dbebe6cead56bcf805a3d23136d145f5445bf"}, ] [[package]] @@ -38,22 +38,22 @@ files = [ [[package]] name = "flask" -version = "3.0.3" +version = "3.1.0" description = "A simple framework for building complex web applications." optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" files = [ - {file = "flask-3.0.3-py3-none-any.whl", hash = "sha256:34e815dfaa43340d1d15a5c3a02b8476004037eb4840b34910c6e21679d288f3"}, - {file = "flask-3.0.3.tar.gz", hash = "sha256:ceb27b0af3823ea2737928a4d99d125a06175b8512c445cbd9a9ce200ef76842"}, + {file = "flask-3.1.0-py3-none-any.whl", hash = "sha256:d667207822eb83f1c4b50949b1623c8fc8d51f2341d65f72e1a1815397551136"}, + {file = "flask-3.1.0.tar.gz", hash = "sha256:5f873c5184c897c8d9d1b05df1e3d01b14910ce69607a117bd3277098a5836ac"}, ] [package.dependencies] -blinker = ">=1.6.2" +blinker = ">=1.9" click = ">=8.1.3" -importlib-metadata = {version = ">=3.6.0", markers = "python_version < \"3.10\""} -itsdangerous = ">=2.1.2" +importlib-metadata = {version = ">=3.6", markers = "python_version < \"3.10\""} +itsdangerous = ">=2.2" Jinja2 = ">=3.1.2" -Werkzeug = ">=3.0.0" +Werkzeug = ">=3.1" [package.extras] async = ["asgiref (>=3.2)"] @@ -177,13 +177,13 @@ files = [ [[package]] name = "werkzeug" -version = "3.0.6" +version = "3.1.3" description = "The comprehensive WSGI web application library." optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" files = [ - {file = "werkzeug-3.0.6-py3-none-any.whl", hash = "sha256:1bc0c2310d2fbb07b1dd1105eba2f7af72f322e1e455f2f93c993bee8c8a5f17"}, - {file = "werkzeug-3.0.6.tar.gz", hash = "sha256:a8dd59d4de28ca70471a34cba79bed5f7ef2e036a76b3ab0835474246eb41f8d"}, + {file = "werkzeug-3.1.3-py3-none-any.whl", hash = "sha256:54b78bf3716d19a65be4fceccc0d1d7b89e608834989dfae50ea87564639213e"}, + {file = "werkzeug-3.1.3.tar.gz", hash = "sha256:60723ce945c19328679790e3282cc758aa4a6040e4bb330f53d30fa546d44746"}, ] [package.dependencies] diff --git a/toolchains/cc/cc.bzl b/toolchains/cc/cc.bzl index 6391fe447..4181da05b 100644 --- a/toolchains/cc/cc.bzl +++ b/toolchains/cc/cc.bzl @@ -23,8 +23,11 @@ using `nixpkgs_cc_configure(..., cc_lang = "cuda")` or similar. load("@bazel_skylib//lib:sets.bzl", "sets") load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") load( - "@bazel_tools//tools/cpp:lib_cc_configure.bzl", + "@rules_nixpkgs_core//:private/get_cpu_value.bzl", "get_cpu_value", +) +load( + "@bazel_tools//tools/cpp:lib_cc_configure.bzl", "get_starlark_list", "write_builtin_include_directory_paths", ) diff --git a/toolchains/go/MODULE.bazel b/toolchains/go/MODULE.bazel index 646cebd15..2f877f642 100644 --- a/toolchains/go/MODULE.bazel +++ b/toolchains/go/MODULE.bazel @@ -4,6 +4,10 @@ module( ) bazel_dep(name = "rules_nixpkgs_core", version = "0.12.0") +local_path_override( + module_name = "rules_nixpkgs_core", + path = "../../core", +) bazel_dep(name = "rules_go", repo_name = "io_bazel_rules_go", version = "0.39.1") bazel_dep(name = "bazel_skylib", version = "1.0.3") bazel_dep(name = "platforms", version = "0.0.4") diff --git a/toolchains/java/.bazelignore b/toolchains/java/.bazelignore new file mode 100644 index 000000000..ad4a62544 --- /dev/null +++ b/toolchains/java/.bazelignore @@ -0,0 +1 @@ +bazel-java diff --git a/toolchains/java/MODULE.bazel b/toolchains/java/MODULE.bazel index 5c7a6ed6f..393e61eae 100644 --- a/toolchains/java/MODULE.bazel +++ b/toolchains/java/MODULE.bazel @@ -4,6 +4,10 @@ module( ) bazel_dep(name = "rules_nixpkgs_core", version = "0.12.0") +local_path_override( + module_name = "rules_nixpkgs_core", + path = "../../core", +) bazel_dep(name = "rules_java", version = "7.3.1") bazel_dep(name = "bazel_skylib", version = "1.0.3") diff --git a/toolchains/java/java.bzl b/toolchains/java/java.bzl index 6d3c43b4a..fb229dd8d 100644 --- a/toolchains/java/java.bzl +++ b/toolchains/java/java.bzl @@ -8,7 +8,7 @@ """ load( - "@bazel_tools//tools/cpp:lib_cc_configure.bzl", + "@rules_nixpkgs_core//:private/get_cpu_value.bzl", "get_cpu_value", ) load( diff --git a/toolchains/nodejs/.bazelignore b/toolchains/nodejs/.bazelignore index a61f183f2..18a757817 100644 --- a/toolchains/nodejs/.bazelignore +++ b/toolchains/nodejs/.bazelignore @@ -1,2 +1,2 @@ -bazel-* +bazel-nodejs testing diff --git a/toolchains/nodejs/MODULE.bazel b/toolchains/nodejs/MODULE.bazel index 9b154e7cc..85ef3a3d7 100644 --- a/toolchains/nodejs/MODULE.bazel +++ b/toolchains/nodejs/MODULE.bazel @@ -4,6 +4,10 @@ module( ) bazel_dep(name = "rules_nixpkgs_core", version = "0.12.0") +local_path_override( + module_name = "rules_nixpkgs_core", + path = "../../core", +) bazel_dep(name = "platforms", version = "0.0.4") bazel_dep(name = "rules_nodejs", version = "5.5.3") bazel_dep(name = "bazel_skylib", version = "1.0.3") diff --git a/toolchains/nodejs/testing/.bazelignore b/toolchains/nodejs/testing/.bazelignore new file mode 100644 index 000000000..0d9926e8c --- /dev/null +++ b/toolchains/nodejs/testing/.bazelignore @@ -0,0 +1 @@ +bazel-nodejs diff --git a/toolchains/posix/MODULE.bazel b/toolchains/posix/MODULE.bazel index 3693ab748..b25c24787 100644 --- a/toolchains/posix/MODULE.bazel +++ b/toolchains/posix/MODULE.bazel @@ -4,5 +4,9 @@ module( ) bazel_dep(name = "rules_nixpkgs_core", version = "0.12.0") +local_path_override( + module_name = "rules_nixpkgs_core", + path = "../../core", +) bazel_dep(name = "rules_sh", version = "0.3.0") bazel_dep(name = "bazel_skylib", version = "1.0.3") diff --git a/toolchains/posix/posix.bzl b/toolchains/posix/posix.bzl index 50b50f597..a0c04470c 100644 --- a/toolchains/posix/posix.bzl +++ b/toolchains/posix/posix.bzl @@ -8,7 +8,7 @@ Rules for importing a POSIX toolchain from Nixpkgs. """ load( - "@bazel_tools//tools/cpp:lib_cc_configure.bzl", + "@rules_nixpkgs_core//:private/get_cpu_value.bzl", "get_cpu_value", ) load("@rules_nixpkgs_core//:nixpkgs.bzl", "nixpkgs_package") diff --git a/toolchains/python/MODULE.bazel b/toolchains/python/MODULE.bazel index a867e1aea..d9ebe4368 100644 --- a/toolchains/python/MODULE.bazel +++ b/toolchains/python/MODULE.bazel @@ -4,4 +4,8 @@ module( ) bazel_dep(name = "rules_nixpkgs_core", version = "0.12.0") +local_path_override( + module_name = "rules_nixpkgs_core", + path = "../../core", +) bazel_dep(name = "bazel_skylib", version = "1.0.3") diff --git a/toolchains/rust/.bazelignore b/toolchains/rust/.bazelignore new file mode 100644 index 000000000..ee88e8451 --- /dev/null +++ b/toolchains/rust/.bazelignore @@ -0,0 +1 @@ +bazel-rust diff --git a/toolchains/rust/MODULE.bazel b/toolchains/rust/MODULE.bazel index b3d357170..cdacfe523 100644 --- a/toolchains/rust/MODULE.bazel +++ b/toolchains/rust/MODULE.bazel @@ -4,5 +4,9 @@ module( ) bazel_dep(name = "rules_nixpkgs_core", version = "0.12.0") +local_path_override( + module_name = "rules_nixpkgs_core", + path = "../../core", +) bazel_dep(name = "bazel_skylib", version = "1.5.0") bazel_dep(name = "rules_rust", version = "0.35.0")