Skip to content

Route Bazel build operations through Xcode - #19

Draft
karim-alweheshy wants to merge 35 commits into
MobileNativeFoundation:mainfrom
karim-alweheshy:bazel-proxy-integration
Draft

Route Bazel build operations through Xcode#19
karim-alweheshy wants to merge 35 commits into
MobileNativeFoundation:mainfrom
karim-alweheshy:bazel-proxy-integration

Conversation

@karim-alweheshy

@karim-alweheshy karim-alweheshy commented Aug 7, 2026

Copy link
Copy Markdown

Summary

  • Add an Xcode 26.5-compatible build-service proxy that forwards native traffic unless a verified rules_xcodeproj manifest owns the operation.
  • Resolve live Xcode settings into a fail-closed Bazel plan, invoke the generated adapter with bounded output and cancellation, validate BEP/receipt/execution evidence, and materialize products transactionally.
  • Show Bazel's current activity and estimated progress while Bazel runs, then open individual native-style action tasks from a scrubbed start feed and close them from exact completion evidence without a synthetic Build with Bazel task.
  • Use sanitized commands, Bazel-recorded timing, compact execution-log cache/runner evidence, and allowlisted BuildBuddy metadata.
  • Backpressure the bounded adapter-output queue when Xcode presentation falls behind, preserving production-scale action streams without unbounded memory.
  • Keep whole configured-action inventory off the production path: Xcode shows work Bazel reports, not thousands of configured up-to-date actions.
  • Pin public SWBProtocol and SWBUtil products from swift-build commit e4f6fc77ebe727657dadfedf50462f5a1a626ead; no swift-build source change is required.

The proxy implementation is split into fork draft PRs #1 through #21. Live progress is isolated in #16, production-output limits in #17, recorded timing in #18, live task lifecycle in #19, build metadata in #20, and production-scale output backpressure in #21. Companion rules changes are stacked through rules_xcodeproj#3336.

Validation

  • Full Swift suite: 234 tests, 3 opt-in skips, 0 failures; strict formatting, diff check, and release build pass.
  • Final release proxy is 12.2 MB with SHA-256 6ecb5b29f07bf4e3db6279555678e8cc25847455cbcdd67bcde29ced17573998.
  • A full-source RedditApp Xcode negative reproduced standardOutput event buffer limit was exceeded after Bazel reported 16,349 actions.
  • The backpressured candidate reached Bazel SUCCESS with 17,064 live action starts and 27,466 successful action completions, with no wrapper or buffer failure. Starts included 2,884 Swift compiles, 634 Objective-C compiles, 601 C++ compiles, 15 C++ links, and 6 Objective-C links.
  • Xcode's report row was terminal-success and the built RedditApp.app existed. The candidate handled a 6.9 MB start ledger, 377.8 MB BEP, and 15.8 MB compact execution log.
  • PID-bound Xcode 26.5 Accessibility previously observed a Link task in progress before adapter completion. That 44.0-second run succeeded with 11.6-second Swift compile and 6.7-second app-link task durations.
  • A metadata build displayed its BuildBuddy results URL, remote-cache provider, Bazel version, and invocation ID. Xcode 26.5 exposes the URL as visible/copyable text with no URL press action.
  • Bazel environment names are manifest-declared and receipt-validated; values are never intentionally presented to Xcode.

Testing

Build the proxy with swift build -c release --product ModernBuildServiceProxy, configure the executable and SHA-256 on an opt-in rules_xcodeproj target, generate the project, and launch Xcode through the generated launcher. Use Product > Build on a production-sized target. Verify Compile/Link rows appear in progress before completion, their final durations reflect the open task interval, the BuildBuddy metadata is visible, no Build with Bazel wrapper exists, and the report reaches the real terminal result without dropping adapter output.

Remaining risk

  • Stock Bazel's BEP is completion-oriented. The paired rules slice requests Bazel's action-start header, suppresses its sensitive environment/command block, and publishes only bounded allowlisted identity fields. Cache completions without a current execution start retain completion-only fallback rows.
  • Raw Bazel BEP command-line events can include client environment values and remote headers. The decoder retains only allowlisted fields and operation artifacts are private, but automatic terminal cleanup remains required before release.
  • Xcode 26.5 does not create a clickable web-link affordance from the available public Swift Build progress, diagnostic, or console-output messages; the canonical results URL is copyable text.
  • Background prepareForIndexing still follows rules_xcodeproj's generated native index path. Interactive SwiftUI previews, broader framework/extension/test/archive/dSYM coverage, concurrent operations, cancellation/failure at consumer scale, Bazel 8, and adjacent-Xcode compatibility remain separate release gates.

Karim Alweheshy added 17 commits August 7, 2026 22:46
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
@karim-alweheshy
karim-alweheshy force-pushed the bazel-proxy-integration branch from 21a53a3 to 42741bf Compare August 8, 2026 07:43
Karim Alweheshy added 3 commits August 8, 2026 12:09
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
@karim-alweheshy

Copy link
Copy Markdown
Author

The existing implementation history is now exposed as an immutable draft review stack without rebasing or force-pushing this upstream rollup:

  1. Modern pass-through
  2. Evaluated settings
  3. Service-independent Bazel core
  4. Verified Bazel execution
  5. Build-operation protocol
  6. Verified operation planning
  7. Xcode routing
  8. Bazel action reporting

These review PRs live in the fork because the contributor cannot create upstream base branches. This PR remains the complete upstream rollup. After review, layers can be promoted upstream sequentially as prior bases merge, or maintainers can choose temporary upstream integration branches.

Root epic and the companion five-PR rules_xcodeproj stack are tracked from rules_xcodeproj#1953.

The current live-Xcode fixture evidence is retained, while compact execution-log adoption, production-graph latency/CPU/RSS, real remote cache, incremental streaming, Preview Canvas, IDE indexing, broader product coverage, and adjacent-Xcode compatibility remain explicit release gates.

Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
@karim-alweheshy

Copy link
Copy Markdown
Author

The immutable review stack now has a ninth layer:

  1. Compact execution-log decoder

The upstream rollup branch was fast-forwarded to proxy commit 4b8017c; no stack history was rewritten. The companion rules layer is rules_xcodeproj#3331.

Independent adversarial review returned SHIP for the compact pair. Final Xcode 26.5 source-changing acceptance used the exact release binary and showed 18 native-style Bazel action rows (4 executed, 3 completed with unavailable cache status, 11 up to date) with sanitized command detail. Production-shaped latency/RSS, a real remote-cache compact artifact, interactive previews/indexing, and the broader product matrix remain explicit release gates.

Karim Alweheshy added 12 commits August 10, 2026 13:15
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Signed-off-by: Karim Alweheshy <karim.alweheshy@reddit.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant