Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 43 additions & 4 deletions .aspect/workflows/config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,46 @@
# See https://docs.aspect.build/workflows/configuration
---
workspaces:
- .
- e2e/smoke
- e2e/repository-rule-deps
- e2e/system-interpreter
- examples/uv_pip_compile

tasks:
# TODO(reid): Rosetta doesn't like HEAD version strings seemingly
# - test:
# name: test-os:linux-bzl:head
# queue: aspect-default
# hooks:
# - type: before_task
# command: |
# rm .bazelversion
# echo "USE_BAZEL_VERSION=last_green" > .bazeliskrc

- test:
- finalization:
queue: aspect-small
notifications:
github: {}
name: test-os:linux-bzl:latest
queue: aspect-default
hooks:
- type: before_task
command: |
rm .bazelversion
echo "USE_BAZEL_VERSION=latest" > .bazeliskrc

- test:
name: test-os:linux-bzl:8
queue: aspect-default
hooks:
- type: before_task
command: |
rm .bazelversion
echo "USE_BAZEL_VERSION=8.2.1" > .bazeliskrc

- test:
name: test-os:linux-bzl:7
queue: aspect-default
hooks:
- type: before_task
command: |
rm .bazelversion
echo "USE_BAZEL_VERSION=7.6.1" > .bazeliskrc
7 changes: 6 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@
test --test_output=errors

# TODO(alex): enable
common --noenable_bzlmod
common --enable_bzlmod

# Define value used by tests
build --define=SOME_VAR=SOME_VALUE

common --features=-libtool
common --incompatible_enable_cc_toolchain_resolution

# Use prebuilt protoc
common --incompatible_enable_proto_toolchain_resolution
common --per_file_copt=external/.*protobuf.*@--PROTOBUF_WAS_NOT_SUPPOSED_TO_BE_BUILT
common --host_per_file_copt=external/.*protobuf.*@--PROTOBUF_WAS_NOT_SUPPOSED_TO_BE_BUILT
common --per_file_copt=external/.*grpc.*@--GRPC_WAS_NOT_SUPPOSED_TO_BE_BUILT
common --host_per_file_copt=external/.*grpc.*@--GRPC_WAS_NOT_SUPPOSED_TO_BE_BUILT

# Use local rules_python
# Enable with --config=dev
Expand Down
18 changes: 0 additions & 18 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,6 @@ concurrency:
cancel-in-progress: ${{ github.ref_name != 'main' }}

jobs:
test:
uses: bazel-contrib/.github/.github/workflows/bazel.yaml@646899086d7aaee8e532540480f3e91e00596234 # 11 Dec 2024
with:
# NB: the root folder is tested with Aspect Workflows on BuildKite, see /.aspect/workflows/config.yaml
folders: '["e2e/smoke", "e2e/repository-rule-deps", "e2e/system-interpreter", "examples/uv_pip_compile"]'
# TODO: Build Windows tools and add to toolchain
# TODO(alex): switch the root folder to bzlmod
# TODO: fix remaining folders on Bazel 8
exclude: |
[
{"os": "windows-latest"},
{"folder": "e2e/repository-rule-deps", "bzlmodEnabled": false},
{"folder": "e2e/system-interpreter", "bzlmodEnabled": false},
{"folder": "examples/uv_pip_compile", "bzlmodEnabled": false},
{"folder": "e2e/smoke", "bazelversion": "8.0.0"}
]

pre-commit:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -81,7 +64,6 @@ jobs:
# on "all matrix jobs were successful".
conclusion:
needs:
- test
- verify-bcr-patches
- test-release
- pre-commit
Expand Down
152 changes: 149 additions & 3 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,56 @@ module(
# py_image_layer needs repo_mapping fix.
bazel_dep(name = "aspect_bazel_lib", version = "2.16.0")
bazel_dep(name = "bazel_skylib", version = "1.4.2")
bazel_dep(name = "rules_python", version = "0.29.0")

bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.5.0", dev_dependency = True)
bazel_dep(name = "gazelle", version = "0.31.0", dev_dependency = True, repo_name = "bazel_gazelle")

bazel_dep(name = "platforms", version = "0.0.7")
bazel_dep(name = "rules_python", version = "1.0.0")

bazel_dep(name = "rules_python_gazelle_plugin", version = "1.0.0", dev_dependency = True)
bazel_dep(name = "toolchains_musl", version = "0.1.20", dev_dependency = True)
bazel_dep(name = "toolchains_llvm", version = "1.4.0", dev_dependency = True)
bazel_dep(name = "toolchains_protoc", version = "0.4.3", dev_dependency = True)

protoc = use_extension("@toolchains_protoc//protoc:extensions.bzl", "protoc")
use_repo(protoc, "toolchains_protoc_hub")
register_toolchains("@toolchains_protoc_hub//:all")

single_version_override(
module_name = "rules_python",
patch_strip = 0,
patches = [
"//third_party/com.github/bazel-contrib/rules_python:dev_pip.patch",
],
version = "1.0.0",
)

bazel_lib = use_extension("@aspect_bazel_lib//lib:extensions.bzl", "toolchains")
bazel_lib.expand_template()
bazel_lib.tar()
use_repo(bazel_lib, "bsd_tar_toolchains")

# Custom python version for testing only
python = use_extension("@rules_python//python/extensions:python.bzl", "python", dev_dependency = True)
python.toolchain(
is_default = False,
python_version = "3.9",
is_default = True,
python_version = "3.11",
)

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_dependency = True)
pip.parse(
hub_name = "pypi",
python_version = "3.11",
requirements_lock = "//:requirements.txt",
)
pip.parse(
hub_name = "django",
python_version = "3.11",
requirements_lock = "//py/tests/virtual/django:requirements.txt",
)
use_repo(pip, "django", "pypi", "pypi_311_pytest")

tools = use_extension("//py:extensions.bzl", "py_tools")
tools.rules_py_tools()
use_repo(tools, "rules_py_tools")
Expand All @@ -46,6 +83,100 @@ register_toolchains(
# NOTE: when publishing to BCR, we patch these to be dev_dependency, as we publish pre-built binaries
# along with our releases.

release_tools = use_extension("//tools/release:fetch.bzl", "release_tools", dev_dependency = True)
use_repo(
release_tools,
"musl_toolchains",
"org_chromium_sysroot_linux_arm64",
"org_chromium_sysroot_linux_x86_64",
"sysroot_darwin_universal",
)

llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")

inject_repo(
llvm,
org_chromium_sysroot_linux_arm64 = "org_chromium_sysroot_linux_arm64",
org_chromium_sysroot_linux_x86_64 = "org_chromium_sysroot_linux_x86_64",
sysroot_darwin_universal = "sysroot_darwin_universal",
)

llvm.toolchain(
name = "llvm_toolchain",
llvm_version = "17.0.2",
)
use_repo(llvm, "llvm_toolchain", "llvm_toolchain_llvm")

register_toolchains("@llvm_toolchain//:all")

llvm.toolchain(
name = "llvm_toolchain_linux_x86_64",
llvm_version = "17.0.2",
)
llvm.toolchain_root(
name = "llvm_toolchain_linux_x86_64",
label = "@llvm_toolchain_llvm//:BUILD",
)
llvm.sysroot(
name = "llvm_toolchain_linux_x86_64",
label = "@org_chromium_sysroot_linux_x86_64//:sysroot",
targets = ["linux-x86_64"],
)
use_repo(llvm, "llvm_toolchain_linux_x86_64")

register_toolchains("@llvm_toolchain_linux_x86_64//:all")

llvm.toolchain(
name = "llvm_toolchain_linux_aarch64",
llvm_version = "17.0.2",
)
llvm.toolchain_root(
name = "llvm_toolchain_linux_aarch64",
label = "@llvm_toolchain_llvm//:BUILD",
)
llvm.sysroot(
name = "llvm_toolchain_linux_aarch64",
label = "@org_chromium_sysroot_linux_arm64//:sysroot",
targets = ["linux-aarch64"],
)
use_repo(llvm, "llvm_toolchain_linux_aarch64")

register_toolchains("@llvm_toolchain_linux_aarch64//:all")

llvm.toolchain(
name = "llvm_toolchain_darwin_x86_64",
llvm_version = "17.0.2",
)
llvm.toolchain_root(
name = "llvm_toolchain_darwin_x86_64",
label = "@llvm_toolchain_llvm//:BUILD",
)
llvm.sysroot(
name = "llvm_toolchain_darwin_x86_64",
label = "@sysroot_darwin_universal//:sysroot",
targets = ["darwin-x86_64"],
)
use_repo(llvm, "llvm_toolchain_darwin_x86_64")

register_toolchains("@llvm_toolchain_darwin_x86_64//:all")

llvm.toolchain(
name = "llvm_toolchain_darwin_aarch64",
llvm_version = "17.0.2",
)
llvm.toolchain_root(
name = "llvm_toolchain_darwin_aarch64",
label = "@llvm_toolchain_llvm//:BUILD",
)
llvm.sysroot(
name = "llvm_toolchain_darwin_aarch64",
label = "@sysroot_darwin_universal//:sysroot",
targets = ["darwin-aarch64"],
)
use_repo(llvm, "llvm_toolchain_darwin_aarch64")

register_toolchains("@llvm_toolchain_darwin_aarch64//:all")

bazel_dep(
name = "rules_rust",
version = "0.53.0",
Expand All @@ -59,6 +190,12 @@ rust = use_extension(
)
rust.toolchain(
edition = "2021",
extra_target_triples = [
"aarch64-apple-darwin",
"aarch64-unknown-linux-gnu",
"x86_64-apple-darwin",
"x86_64-unknown-linux-gnu",
],
versions = ["1.81.0"],
)
use_repo(rust, "rust_toolchains")
Expand Down Expand Up @@ -110,3 +247,12 @@ oci.pull(
tag = "latest",
)
use_repo(oci, "ubuntu", "ubuntu_linux_amd64", "ubuntu_linux_arm64_v8")

http_file = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")

http_file(
name = "django_4_2_4",
downloaded_file_path = "Django-4.2.4-py3-none-any.whl",
sha256 = "860ae6a138a238fc4f22c99b52f3ead982bb4b1aad8c0122bcd8c8a3a02e409d",
urls = ["https://files.pythonhosted.org/packages/7f/9e/fc6bab255ae10bc57fa2f65646eace3d5405fbb7f5678b90140052d1db0f/Django-4.2.4-py3-none-any.whl"],
)
Loading
Loading