From 7ef63bd2aa1f5696c035ccce40ba2abfa518921a Mon Sep 17 00:00:00 2001 From: xangcastle Date: Mon, 6 Apr 2026 14:05:15 -0600 Subject: [PATCH 1/7] crossbuild with platform_transition_filegroup --- e2e/cases/uv-deps-650/crossbuild/BUILD.bazel | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/e2e/cases/uv-deps-650/crossbuild/BUILD.bazel b/e2e/cases/uv-deps-650/crossbuild/BUILD.bazel index 8ac6632dc..1a699b641 100644 --- a/e2e/cases/uv-deps-650/crossbuild/BUILD.bazel +++ b/e2e/cases/uv-deps-650/crossbuild/BUILD.bazel @@ -40,6 +40,10 @@ py_venv_binary( srcs = ["__main__.py"], main = "__main__.py", python_version = "3.12", + target_compatible_with = [ + "@platforms//os:linux", + "@platforms//cpu:x86_64", + ], venv = "psql", deps = [ "@pypi//psycopg2_binary", @@ -54,12 +58,20 @@ py_image_layer( platform_transition_filegroup( name = "amd64_layers", srcs = [":app_layers"], + target_compatible_with = [ + "@platforms//os:linux", + "@platforms//cpu:x86_64", + ], target_platform = ":amd64_linux", ) platform_transition_filegroup( name = "arm64_layers", srcs = [":app_layers"], + target_compatible_with = [ + "@platforms//os:linux", + "@platforms//cpu:x86_64", + ], target_platform = ":arm64_linux", ) @@ -74,12 +86,20 @@ oci_image( platform_transition_filegroup( name = "amd64_image", srcs = [":image"], + target_compatible_with = [ + "@platforms//os:linux", + "@platforms//cpu:x86_64", + ], target_platform = ":amd64_linux", ) platform_transition_filegroup( name = "arm64_image", srcs = [":image"], + target_compatible_with = [ + "@platforms//os:linux", + "@platforms//cpu:x86_64", + ], target_platform = ":arm64_linux", ) @@ -111,6 +131,10 @@ unpack_toolchain_path( platform_transition_filegroup( name = "unpack_path_for_arm64_transition", srcs = [":unpack_path_for_arm64"], + target_compatible_with = [ + "@platforms//os:linux", + "@platforms//cpu:x86_64", + ], target_platform = ":arm64_linux", ) From 0552d264d8296bb18c4760006962a7d5be3396be Mon Sep 17 00:00:00 2001 From: xangcastle Date: Mon, 6 Apr 2026 15:17:00 -0600 Subject: [PATCH 2/7] crossbuild with platform_transition_filegroup --- e2e/bcr-simulation/BUILD.bazel | 46 ++++++++++++++++++++ e2e/bcr-simulation/MODULE.bazel | 23 ++++++++++ e2e/bcr-simulation/hello.py | 2 + e2e/bcr-simulation/test.sh | 2 + e2e/cases/uv-deps-650/crossbuild/BUILD.bazel | 24 ---------- 5 files changed, 73 insertions(+), 24 deletions(-) create mode 100644 e2e/bcr-simulation/BUILD.bazel create mode 100644 e2e/bcr-simulation/MODULE.bazel create mode 100644 e2e/bcr-simulation/hello.py create mode 100755 e2e/bcr-simulation/test.sh diff --git a/e2e/bcr-simulation/BUILD.bazel b/e2e/bcr-simulation/BUILD.bazel new file mode 100644 index 000000000..263938bcf --- /dev/null +++ b/e2e/bcr-simulation/BUILD.bazel @@ -0,0 +1,46 @@ +load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup") +load("@aspect_rules_py//py/unstable:defs.bzl", "py_venv_binary") +load("@rules_shell//shell:sh_test.bzl", "sh_test") + +platform( + name = "arm64_linux", + constraint_values = [ + "@platforms//os:linux", + "@platforms//cpu:aarch64", + ], +) + +platform( + name = "amd64_linux", + constraint_values = [ + "@platforms//os:linux", + "@platforms//cpu:x86_64", + ], +) + +py_venv_binary( + name = "hello_bin", + srcs = ["hello.py"], + main = "hello.py", + python_version = "3.12", + venv = "hello_venv", +) + +platform_transition_filegroup( + name = "amd64_transition", + srcs = [":hello_bin"], + target_platform = ":amd64_linux", +) + +platform_transition_filegroup( + name = "arm64_transition", + srcs = [":hello_bin"], + target_platform = ":arm64_linux", +) + +sh_test( + name = "bcr_compatibility_test", + srcs = ["test.sh"], + data = [":arm64_transition"], + tags = ["bcr-compat", "manual"], +) diff --git a/e2e/bcr-simulation/MODULE.bazel b/e2e/bcr-simulation/MODULE.bazel new file mode 100644 index 000000000..ca8fb6e5b --- /dev/null +++ b/e2e/bcr-simulation/MODULE.bazel @@ -0,0 +1,23 @@ +module( + name = "rules_py_bcr_simulation", + version = "0.0.0", +) + +bazel_dep(name = "aspect_rules_py", version = "0.0.0") +local_path_override( + module_name = "aspect_rules_py", + path = "../..", +) + +bazel_dep(name = "bazel_skylib", version = "1.7.1") +bazel_dep(name = "platforms", version = "0.0.11") +bazel_dep(name = "aspect_bazel_lib", version = "2.14.0") +bazel_dep(name = "rules_shell", version = "0.3.0") + +python = use_extension("@aspect_rules_py//python/extensions:python.bzl", "python") +python.toolchain( + python_version = "3.12", + is_default = True, +) +use_repo(python, "python_3_12_host") +register_toolchains("@python_3_12_host//:all") diff --git a/e2e/bcr-simulation/hello.py b/e2e/bcr-simulation/hello.py new file mode 100644 index 000000000..db61729aa --- /dev/null +++ b/e2e/bcr-simulation/hello.py @@ -0,0 +1,2 @@ +#!/usr/bin/env python3 +print("Hello from BCR simulation!") diff --git a/e2e/bcr-simulation/test.sh b/e2e/bcr-simulation/test.sh new file mode 100755 index 000000000..550c2f20d --- /dev/null +++ b/e2e/bcr-simulation/test.sh @@ -0,0 +1,2 @@ +#!/bin/bash +echo "BCR compatibility test - if you see this, ARM64 transition succeeded" \ No newline at end of file diff --git a/e2e/cases/uv-deps-650/crossbuild/BUILD.bazel b/e2e/cases/uv-deps-650/crossbuild/BUILD.bazel index 1a699b641..8ac6632dc 100644 --- a/e2e/cases/uv-deps-650/crossbuild/BUILD.bazel +++ b/e2e/cases/uv-deps-650/crossbuild/BUILD.bazel @@ -40,10 +40,6 @@ py_venv_binary( srcs = ["__main__.py"], main = "__main__.py", python_version = "3.12", - target_compatible_with = [ - "@platforms//os:linux", - "@platforms//cpu:x86_64", - ], venv = "psql", deps = [ "@pypi//psycopg2_binary", @@ -58,20 +54,12 @@ py_image_layer( platform_transition_filegroup( name = "amd64_layers", srcs = [":app_layers"], - target_compatible_with = [ - "@platforms//os:linux", - "@platforms//cpu:x86_64", - ], target_platform = ":amd64_linux", ) platform_transition_filegroup( name = "arm64_layers", srcs = [":app_layers"], - target_compatible_with = [ - "@platforms//os:linux", - "@platforms//cpu:x86_64", - ], target_platform = ":arm64_linux", ) @@ -86,20 +74,12 @@ oci_image( platform_transition_filegroup( name = "amd64_image", srcs = [":image"], - target_compatible_with = [ - "@platforms//os:linux", - "@platforms//cpu:x86_64", - ], target_platform = ":amd64_linux", ) platform_transition_filegroup( name = "arm64_image", srcs = [":image"], - target_compatible_with = [ - "@platforms//os:linux", - "@platforms//cpu:x86_64", - ], target_platform = ":arm64_linux", ) @@ -131,10 +111,6 @@ unpack_toolchain_path( platform_transition_filegroup( name = "unpack_path_for_arm64_transition", srcs = [":unpack_path_for_arm64"], - target_compatible_with = [ - "@platforms//os:linux", - "@platforms//cpu:x86_64", - ], target_platform = ":arm64_linux", ) From 9cd5916197cede15e8815eb61b56b40f4f0b83f1 Mon Sep 17 00:00:00 2001 From: "aspect-marvin[bot]" Date: Mon, 6 Apr 2026 21:29:00 +0000 Subject: [PATCH 3/7] Pre-commit changes --- e2e/bcr-simulation/BUILD.bazel | 5 ++++- e2e/bcr-simulation/MODULE.bazel | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/e2e/bcr-simulation/BUILD.bazel b/e2e/bcr-simulation/BUILD.bazel index 263938bcf..dd0a5607f 100644 --- a/e2e/bcr-simulation/BUILD.bazel +++ b/e2e/bcr-simulation/BUILD.bazel @@ -42,5 +42,8 @@ sh_test( name = "bcr_compatibility_test", srcs = ["test.sh"], data = [":arm64_transition"], - tags = ["bcr-compat", "manual"], + tags = [ + "bcr-compat", + "manual", + ], ) diff --git a/e2e/bcr-simulation/MODULE.bazel b/e2e/bcr-simulation/MODULE.bazel index ca8fb6e5b..59411bda3 100644 --- a/e2e/bcr-simulation/MODULE.bazel +++ b/e2e/bcr-simulation/MODULE.bazel @@ -16,8 +16,9 @@ bazel_dep(name = "rules_shell", version = "0.3.0") python = use_extension("@aspect_rules_py//python/extensions:python.bzl", "python") python.toolchain( - python_version = "3.12", is_default = True, + python_version = "3.12", ) use_repo(python, "python_3_12_host") + register_toolchains("@python_3_12_host//:all") From 5ee5018d41cb16417c5949b314d9c9bff4f48624 Mon Sep 17 00:00:00 2001 From: xangcastle Date: Mon, 6 Apr 2026 16:16:25 -0600 Subject: [PATCH 4/7] crossbuild with platform_transition_filegroup --- e2e/bcr-simulation/BUILD.bazel | 15 --------------- e2e/bcr-simulation/MODULE.bazel | 6 ++---- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/e2e/bcr-simulation/BUILD.bazel b/e2e/bcr-simulation/BUILD.bazel index 263938bcf..dc7995b33 100644 --- a/e2e/bcr-simulation/BUILD.bazel +++ b/e2e/bcr-simulation/BUILD.bazel @@ -10,14 +10,6 @@ platform( ], ) -platform( - name = "amd64_linux", - constraint_values = [ - "@platforms//os:linux", - "@platforms//cpu:x86_64", - ], -) - py_venv_binary( name = "hello_bin", srcs = ["hello.py"], @@ -26,12 +18,6 @@ py_venv_binary( venv = "hello_venv", ) -platform_transition_filegroup( - name = "amd64_transition", - srcs = [":hello_bin"], - target_platform = ":amd64_linux", -) - platform_transition_filegroup( name = "arm64_transition", srcs = [":hello_bin"], @@ -42,5 +28,4 @@ sh_test( name = "bcr_compatibility_test", srcs = ["test.sh"], data = [":arm64_transition"], - tags = ["bcr-compat", "manual"], ) diff --git a/e2e/bcr-simulation/MODULE.bazel b/e2e/bcr-simulation/MODULE.bazel index ca8fb6e5b..dfc611354 100644 --- a/e2e/bcr-simulation/MODULE.bazel +++ b/e2e/bcr-simulation/MODULE.bazel @@ -9,7 +9,6 @@ local_path_override( path = "../..", ) -bazel_dep(name = "bazel_skylib", version = "1.7.1") bazel_dep(name = "platforms", version = "0.0.11") bazel_dep(name = "aspect_bazel_lib", version = "2.14.0") bazel_dep(name = "rules_shell", version = "0.3.0") @@ -17,7 +16,6 @@ bazel_dep(name = "rules_shell", version = "0.3.0") python = use_extension("@aspect_rules_py//python/extensions:python.bzl", "python") python.toolchain( python_version = "3.12", - is_default = True, ) -use_repo(python, "python_3_12_host") -register_toolchains("@python_3_12_host//:all") +use_repo(python, "python_3_12") +register_toolchains("@python_3_12//:all") From b030b9fd539383c685a763a50a590e181cf595b4 Mon Sep 17 00:00:00 2001 From: xangcastle Date: Mon, 6 Apr 2026 16:48:29 -0600 Subject: [PATCH 5/7] crossbuild with platform_transition_filegroup --- e2e/bcr-simulation/BUILD.bazel | 2 +- e2e/bcr-simulation/MODULE.bazel | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/e2e/bcr-simulation/BUILD.bazel b/e2e/bcr-simulation/BUILD.bazel index dc7995b33..0548300ba 100644 --- a/e2e/bcr-simulation/BUILD.bazel +++ b/e2e/bcr-simulation/BUILD.bazel @@ -1,4 +1,4 @@ -load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup") +load("@bazel_lib//lib:transitions.bzl", "platform_transition_filegroup") load("@aspect_rules_py//py/unstable:defs.bzl", "py_venv_binary") load("@rules_shell//shell:sh_test.bzl", "sh_test") diff --git a/e2e/bcr-simulation/MODULE.bazel b/e2e/bcr-simulation/MODULE.bazel index dfc611354..6357e7faa 100644 --- a/e2e/bcr-simulation/MODULE.bazel +++ b/e2e/bcr-simulation/MODULE.bazel @@ -9,9 +9,9 @@ local_path_override( path = "../..", ) -bazel_dep(name = "platforms", version = "0.0.11") -bazel_dep(name = "aspect_bazel_lib", version = "2.14.0") -bazel_dep(name = "rules_shell", version = "0.3.0") +bazel_dep(name = "platforms", version = "1.0.0") +bazel_dep(name = "bazel_lib", version = "3.0.0") +bazel_dep(name = "rules_shell", version = "0.6.1") python = use_extension("@aspect_rules_py//python/extensions:python.bzl", "python") python.toolchain( From d721f028b515df2e8c2509e24c26f8cac915e2d5 Mon Sep 17 00:00:00 2001 From: xangcastle Date: Mon, 6 Apr 2026 17:50:57 -0600 Subject: [PATCH 6/7] crossbuild with platform_transition_filegroup --- e2e/bcr-simulation/hello.py | 1 - 1 file changed, 1 deletion(-) diff --git a/e2e/bcr-simulation/hello.py b/e2e/bcr-simulation/hello.py index db61729aa..e44ecc40f 100644 --- a/e2e/bcr-simulation/hello.py +++ b/e2e/bcr-simulation/hello.py @@ -1,2 +1 @@ -#!/usr/bin/env python3 print("Hello from BCR simulation!") From 5736bf18d6f03dbce6a8a5ae6da1bac088b91bea Mon Sep 17 00:00:00 2001 From: xangcastle Date: Mon, 6 Apr 2026 18:46:01 -0600 Subject: [PATCH 7/7] crossbuild with platform_transition_filegroup --- .aspect/workflows/config.yaml | 1 + e2e/bcr-simulation/hello.py | 1 - e2e/bcr-simulation/test.sh | 2 -- .../bcr-simulation-900}/BUILD.bazel | 6 +++++- .../bcr-simulation-900}/MODULE.bazel | 14 +++++++------- e2e/cases/bcr-simulation-900/hello.py | 1 + e2e/cases/bcr-simulation-900/test.sh | 11 +++++++++++ 7 files changed, 25 insertions(+), 11 deletions(-) delete mode 100644 e2e/bcr-simulation/hello.py delete mode 100755 e2e/bcr-simulation/test.sh rename e2e/{bcr-simulation => cases/bcr-simulation-900}/BUILD.bazel (87%) rename e2e/{bcr-simulation => cases/bcr-simulation-900}/MODULE.bazel (56%) create mode 100644 e2e/cases/bcr-simulation-900/hello.py create mode 100644 e2e/cases/bcr-simulation-900/test.sh diff --git a/.aspect/workflows/config.yaml b/.aspect/workflows/config.yaml index 284b08854..c4dcfbab2 100644 --- a/.aspect/workflows/config.yaml +++ b/.aspect/workflows/config.yaml @@ -3,6 +3,7 @@ workspaces: - . - e2e + - e2e/cases/bcr-simulation-900 - examples/uv_pip_compile: tasks: - bazel-9: diff --git a/e2e/bcr-simulation/hello.py b/e2e/bcr-simulation/hello.py deleted file mode 100644 index e44ecc40f..000000000 --- a/e2e/bcr-simulation/hello.py +++ /dev/null @@ -1 +0,0 @@ -print("Hello from BCR simulation!") diff --git a/e2e/bcr-simulation/test.sh b/e2e/bcr-simulation/test.sh deleted file mode 100755 index 550c2f20d..000000000 --- a/e2e/bcr-simulation/test.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -echo "BCR compatibility test - if you see this, ARM64 transition succeeded" \ No newline at end of file diff --git a/e2e/bcr-simulation/BUILD.bazel b/e2e/cases/bcr-simulation-900/BUILD.bazel similarity index 87% rename from e2e/bcr-simulation/BUILD.bazel rename to e2e/cases/bcr-simulation-900/BUILD.bazel index 0548300ba..384ba1f5e 100644 --- a/e2e/bcr-simulation/BUILD.bazel +++ b/e2e/cases/bcr-simulation-900/BUILD.bazel @@ -1,5 +1,5 @@ -load("@bazel_lib//lib:transitions.bzl", "platform_transition_filegroup") load("@aspect_rules_py//py/unstable:defs.bzl", "py_venv_binary") +load("@bazel_lib//lib:transitions.bzl", "platform_transition_filegroup") load("@rules_shell//shell:sh_test.bzl", "sh_test") platform( @@ -28,4 +28,8 @@ sh_test( name = "bcr_compatibility_test", srcs = ["test.sh"], data = [":arm64_transition"], + target_compatible_with = [ + "@platforms//os:linux", + "@platforms//cpu:x86_64", + ], ) diff --git a/e2e/bcr-simulation/MODULE.bazel b/e2e/cases/bcr-simulation-900/MODULE.bazel similarity index 56% rename from e2e/bcr-simulation/MODULE.bazel rename to e2e/cases/bcr-simulation-900/MODULE.bazel index 6357e7faa..6c690ec35 100644 --- a/e2e/bcr-simulation/MODULE.bazel +++ b/e2e/cases/bcr-simulation-900/MODULE.bazel @@ -1,21 +1,21 @@ -module( - name = "rules_py_bcr_simulation", - version = "0.0.0", -) +module(name = "bcr_simulation_900") bazel_dep(name = "aspect_rules_py", version = "0.0.0") local_path_override( module_name = "aspect_rules_py", - path = "../..", + path = "../../..", ) bazel_dep(name = "platforms", version = "1.0.0") -bazel_dep(name = "bazel_lib", version = "3.0.0") +bazel_dep(name = "bazel_lib", version = "3.2.2") bazel_dep(name = "rules_shell", version = "0.6.1") +bazel_dep(name = "rules_python", version = "1.0.0") -python = use_extension("@aspect_rules_py//python/extensions:python.bzl", "python") +python = use_extension("@rules_python//python/extensions:python.bzl", "python") python.toolchain( + is_default = True, python_version = "3.12", ) use_repo(python, "python_3_12") + register_toolchains("@python_3_12//:all") diff --git a/e2e/cases/bcr-simulation-900/hello.py b/e2e/cases/bcr-simulation-900/hello.py new file mode 100644 index 000000000..11b15b1a4 --- /dev/null +++ b/e2e/cases/bcr-simulation-900/hello.py @@ -0,0 +1 @@ +print("hello") diff --git a/e2e/cases/bcr-simulation-900/test.sh b/e2e/cases/bcr-simulation-900/test.sh new file mode 100644 index 000000000..8c55ca611 --- /dev/null +++ b/e2e/cases/bcr-simulation-900/test.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e + +echo "BCR Compatibility Test" +echo "======================" +echo +echo "If this test runs, either:" +echo " 1. ARM64 toolchains are registered (test passes)" +echo " 2. target_compatible_with constraints are properly set (test skipped)" +echo +echo "The arm64_transition target was successfully resolved."