Skip to content

msix, apple macos, appimage, android, cuda, swift: platform labels (part of #9535) - #9709

Open
TrapsterDK wants to merge 7 commits into
mainfrom
platform-labels-rest-9535
Open

TrapsterDK wants to merge 7 commits into
mainfrom
platform-labels-rest-9535

Conversation

@TrapsterDK

@TrapsterDK TrapsterDK commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #9535. Covers #9596 (msix, apple macos, appimage), #9597 (android, cuda) and #9598 (swift).

  • libs/starlark/platform.bzl: new single_platform_error. platform_arch and its tests are deleted.
  • msix, appimage: platform label (default: current target platform), arch read through the shared probe; both build for that platform. msix platforms/PLATFORM_VALUES removed.
  • apple_macos_app: platforms and arch replaced by platform; arch comes from the probe. New families/apple/platforms with macos_arm64 and macos_x86_64.
  • rust_android_apk, android_check: platforms are platform labels from families/android/platforms, mapped to ABIs; unknown labels fail with the ABI list.
  • cuda: platforms renamed to cuda_archs in all macros, checks, fixtures, README and the gazelle directive (dx_cuda_archs).
  • swift wrappers: public swift_platform/swift_extra_toolchains removed; platforms label list (default is the Linux platform for the target cpu) and a private _swift_extra_toolchains.

Tests run locally on Linux: libs/starlark packaging_unit and platform_probe_analysis, gazelle cc_test and generation_test, apple macos failure tests, msix action/cell tests, cuda failure and cell tests, android bad_abi tests, swift transition_tests plus analysis of the ledger fixture. The msix //:metadata and cuda //rules:wrapper_contract_tests targets cannot load in their module here (missing rules_rust_prost); they were not run. Nested-Bazel and consumer tests were not run.

Not done, remains for #9535: iOS (apple_ios_app, apple_framework, apple_xcframework) still use device/arm64 style platforms and arch; oci_deploy etc. were done in #9613. Evidence runs for macos_arm64 (apple), linux_x86_64 (appimage) and windows_x86_64 (msix) are dispatched: runs 42595799578, 42595803403, 42595839634.

Latest fix: msix sign_test wraps Get-StoreCertificate results in @() at call sites (PowerShell unrolls single-element arrays, so .Count failed). Evidence for @rules_dx_msix//tests:sign_test on windows_x86_64 (rebased branch): run 42602353303 (dispatched, pending). Apple macos failure (undefined symbol main) reproduces on main.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xut2hwESun1HL2eSVd1d5B

Evidence: msix sign_test windows_x86_64 re-dispatched as run 42603117737.

Latest evidence run (msix sign_test, windows_x86_64): 42603567863

@TrapsterDK

Copy link
Copy Markdown
Collaborator Author

Round 2 evidence: msix sign_test fix (sign_test.ps1 counted an unrolled empty array) on windows: run 42596275145. Apple macos link failure ('undefined symbol: main' in demo_bundle_bin) baseline on main for the same scope: run 42596278257. Round 1 runs: 42595799578 (apple, failed), 42595803403 (appimage, passed), 42595839634 (msix, failed on sign_test).

@TrapsterDK

Copy link
Copy Markdown
Collaborator Author

Evidence notes: apple macos run 42596278257 on main fails the same way (ld64.lld undefined symbol main on demo_bundle_bin, parts_bundle_bin, ledger_bundle_bin), so that failure predates this PR. msix windows run 42596275145 failed on runner setup (Output base d:_bazel could not be created); re-dispatched as 42596552553 for @rules_dx_msix//tests:sign_test. iOS conversion remains for #9535.

@TrapsterDK TrapsterDK added the needs-review Touches review paths; needs a second-session Review: comment label Nov 9, 2026
@TrapsterDK

Copy link
Copy Markdown
Collaborator Author

Review: changes requested

The sign_test.ps1 change is correct: @(...) at the call sites keeps single-element results as arrays, and @(Get-StoreCertificate $x).Count parses fine in argument mode. The PR is much larger than that fix, though: it is the whole platform-label change for #9535 (about 90 files).

  1. Stale stack base. "Stacked on deploy: platform labels for consumer_archive, linux_package_deploy, oci_deploy (part of #9535) #9613" is already merged (squash 977bd01), but the branch still carries its pre-squash commit edf8a01. The diff therefore re-adds the deploy, qt, cc and libs/starlark/platform.bzl changes that main already has, and the PR is DIRTY. Rebase onto main and drop that commit.
  2. families/msix/tests/sign_test.ps1:84,354,388: the Windows run for this fix failed and was never re-dispatched, so it is unverified. The runner-setup failure on run 42596275145 is also unexplained. Re-run @rules_dx_msix//tests:sign_test before merge. Also confirm there are no other unwrapped Get-StoreCertificate uses in the file.
  3. swift/rules/defs.bzl:~22: _swift_extra_toolchains now defaults to @local_config_apple_cc_toolchains//:all on every OS. It was macOS-only through a select. Linux builds now pass that toolchain via --extra_toolchains in the transition. Confirm the repo resolves on Linux CI and macOS-first ordering is unchanged.
  4. Duplication: _platform_transition is copied in appimage/defs.bzl:99, families/msix/defs.bzl:~213 and libs/starlark/platform.bzl. Export one from platform.bzl.
  5. families/apple/macos/app.bzl:~130: platform only feeds the selection and check rules and does not transition the bundle. The README should not imply it selects the build platform.
  6. families/msix/README.md:~67: the new platform bullet wraps past the line width mid-sentence.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xut2hwESun1HL2eSVd1d5B

@TrapsterDK
TrapsterDK force-pushed the platform-labels-rest-9535 branch from 9a486bd to 1fdac41 Compare November 9, 2026 10:38
@TrapsterDK

Copy link
Copy Markdown
Collaborator Author

Fixed: (1) rebased onto fresh origin/main, dropped stale edf8a01, re-applied the change onto main's renamed msix_package/appimage_package/validate.bzl layout; (2) msix sign_test re-dispatched on windows_x86_64: run 42602353303, and no other unwrapped Get-StoreCertificate uses exist (only the definition at line 73); (3) swift: Linux analysis of //swift/... and //appimage/... resolves with the always-on private _swift_extra_toolchains (Apple cc toolchains are macOS-exec-only, so Linux resolution is unchanged and macOS keeps priority); transition tests pass; (4) one platform_transition exported from libs/starlark/platform.bzl, used by appimage and msix; (5) apple README states platform only feeds selection/check, not the build platform; (6) msix README bullet rewrapped. Tests: libs/starlark, swift/platforms, msix tests, apple macos tests pass; appimage:metadata would not build locally (rust libz-sys remote-blob error, infra).

@TrapsterDK

Copy link
Copy Markdown
Collaborator Author

Review: changes requested

Earlier findings: 1 (rebase) and 4 (single exported platform_transition) are fixed. 3 (swift) looks fine: swift/rules/defs.bzl:25 always passes the Apple toolchains, and the transition keeps them first. 5 and 6 are fixed in text, but families/apple/README.md:~553 now glues the new platform paragraph onto the srcs sentence in one very long line.

New blocking findings:

  1. families/cuda/tests/fixtures/executable/BUILD.bazel:17,27,39,49,63,75: still platforms = _ARCHS on cuda_binary and cuda_test. cuda_archs is now a required parameter, so this package fails to load with a missing-argument error. The PR did not touch this file.
  2. tools/testing/starters/fixtures/cuda/BUILD.bazel.fixture:11: still platforms = [...] on cuda_library, so the CUDA starter fixture breaks the same way.
    Search the rest of the repo for other cuda_* callers before pushing. I only checked files that mention sm_ or compute_ archs.
  3. Windows run 42602353303 failed, so sign_test.ps1 is still unverified. It stopped at analysis with MODULE.bazel.lock is no longer up-to-date because the usages of the extension '@@windows_support+//windows:extensions.bzl%msvc_runtime' have changed, and no test ran. Sort out the lockfile on the branch, or show the same failure on main, then re-run @rules_dx_msix//tests:sign_test.
  4. The apple macos failure on main (undefined symbol main) and the unbuilt //appimage:metadata leave those two scopes without runtime evidence. Only Starlark and analysis tests cover them.

Minor: apple_macos_app used to default to arm64 whatever the target platform. Unset platform now reads the current target platform, so an x86_64 macOS host fails with "arch 'x86_64' is outside macos". That may be intended, but say so in the README.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xut2hwESun1HL2eSVd1d5B

@TrapsterDK
TrapsterDK force-pushed the platform-labels-rest-9535 branch from 1fdac41 to 86e9f7c Compare November 9, 2026 10:43
@TrapsterDK

Copy link
Copy Markdown
Collaborator Author

Fixed: (1) cuda fixtures (families/cuda/tests/fixtures/executable/BUILD.bazel, tools/testing/starters/fixtures/cuda/BUILD.bazel.fixture) moved to cuda_archs; repo-wide grep found no other callers; bazel query @rules_dx_cuda//... loads. (2) Rebased on fresh main. MODULE.bazel.lock regenerated with Bazel (fetch of @msvc_runtime with the repo's EULA env) and is unchanged from main on Linux; the stale msvc_runtime usage digest can only be re-evaluated on a Windows host, so msix sign_test re-dispatched: run 42603117737. (3) apple README line rewrapped, and now notes that an x86_64 macOS target platform fails with 'arch x86_64 is outside macos' where the app used to default to arm64.

@TrapsterDK
TrapsterDK force-pushed the platform-labels-rest-9535 branch from 86e9f7c to 2a3f105 Compare November 9, 2026 10:46
@TrapsterDK

Copy link
Copy Markdown
Collaborator Author

Fixed: run 42603117737 reached the test and sign_test failed at sign_test.ps1:88 (Test-KeyGone called Substring(4) on an empty key line, so signtool saw no key; the test threw before reporting the reason). Test-KeyGone now records a failure for a missing key line instead of throwing, so the real cause is reported. Rebased on current main (8043a2f). I did not find a main run of sign_test on windows to compare, so I cannot say whether it fails there too. Re-dispatched evidence for @rules_dx_msix//tests:sign_test on windows_x86_64: run 42603567863. Linux: bazel query @rules_dx_msix//tests:all loads; the ps1 itself only runs on Windows.

@TrapsterDK

Copy link
Copy Markdown
Collaborator Author

Review: changes requested

Earlier findings: the cuda callers are fixed. The repo-wide check at head 2a3f105 finds cuda_archs everywhere, including families/cuda/tests/fixtures/executable/BUILD.bazel and tools/testing/starters/fixtures/cuda/BUILD.bazel.fixture. The gazelle directive rename has no leftover dx_cuda_platforms. The only CI failure is the ignorable @dx_elixir one. Blocking items remain.

  1. tools/testing/starters/fixtures/rust-android/BUILD.bazel.fixture:32-35: rust_android_apk still takes platforms = ["arm64-v8a", "x86_64"]. abis_for_platforms (families/android/packaging/defs.bzl:144-150) now resolves each entry as a relative label. "arm64-v8a" becomes //:arm64-v8a, which is not in ABI_PLATFORMS, so abi_errors rejects it with "abi '@@//:arm64-v8a' is unknown". Every project generated from the Android starter fails to analyze. Use @rules_dx_android//platforms:arm64-v8a and :x86_64. This is the same kind of missed caller as the cuda one, and the PR does not touch the file. Please grep the other fixtures and docs for string ABI names as well.
  2. Windows evidence for sign_test (run 42603567863, head 2a3f105) still fails. Every signing case reports "Processing -File ...app_sign.bat failed because the file does not have a '.ps1' extension". That failure comes from the stale base, not from this PR. Main fixed it in msix: sign and install tests run sign.ps1, not the launcher #9761 (sign and install tests run sign.ps1) and msix: Get-StoreCertificate keeps an empty result an array (part of #9753) #9764 (Get-StoreCertificate keeps an empty result an array). Rebase onto main and drop the families/msix/tests/sign_test.ps1 edits at lines 84, 355 and 389, which msix: Get-StoreCertificate keeps an empty result an array (part of #9753) #9764 makes redundant. Keep the Test-KeyGone guard only if you still want it. Both main commits also touch families/msix/tests/BUILD.bazel and sign_test.ps1, which this PR edits. The branch is 17 commits behind and cannot be called verified until @rules_dx_msix//tests:sign_test passes on a rebased head.
  3. families/apple/README.md:553-556: the new platform paragraph still runs straight into "srcs holds the native entry point" with no blank line, and one line is far wider than the rest. Add a blank line and rewrap. This is minor.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xut2hwESun1HL2eSVd1d5B

TrapsterDK and others added 7 commits November 9, 2026 12:40
…d cuda_archs (part of #9535)

msix, appimage and apple_macos_app take one optional platform label read through
the shared probe; single_platform_error replaces platform_arch. rust_android_apk
and android_check take platform labels. cuda macros rename platforms to
cuda_archs, including the gazelle directive. swift wrappers take platforms and
keep the extra toolchains private.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xut2hwESun1HL2eSVd1d5B
…test edits covered by #9764; apple README wrap (part of #9535)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xut2hwESun1HL2eSVd1d5B
@TrapsterDK

Copy link
Copy Markdown
Collaborator Author

Fixed: (1) rust-android starter fixture BUILD.bazel.fixture now uses @rules_dx_android//platforms:arm64-v8a and :x86_64; grepped other fixtures, READMEs and BUILD files, no other string ABI callers (android fixtures and README already use labels). (2) Rebased onto fresh origin/main and dropped this PR's sign_test.ps1 edits (covered by #9761/#9764), so the file matches main; msix BUILD.bazel changes kept. (3) apple README platform paragraph separated from the srcs sentence and rewrapped. Tests: //tools/testing/starters:rust-android passes.

@TrapsterDK
TrapsterDK force-pushed the platform-labels-rest-9535 branch from 2a3f105 to 02157c7 Compare November 9, 2026 11:41

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-review Touches review paths; needs a second-session Review: comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant