Fix Bazel hot-reload: handle .swift-suffixed include paths and stale -o flags#130
Merged
johnno1962 merged 1 commit intojohnno1962:Xcode26.3from Apr 16, 2026
Merged
Conversation
johnno1962
added a commit
that referenced
this pull request
Apr 17, 2026
* Streamline DLKit.appImages. * Xcode 26.3 * Bump version for log parsing changes. * Restructure. * Fallback to builtin swiftc. * Afterthoughts. * Simplify, simplify. * feat(Xcode26.3): Fix The Bazel ✏️ (#130) * Add MCP server for AI-driven control of InjectionNext (#129) * Add MCP server for AI-driven control of InjectionNext - ControlServer: local TCP server (localhost:8919) that exposes app actions as JSON commands (watch project, enable devices, get status, etc.) - LogBuffer: ring buffer capturing injection logs, compilation errors, and file watcher activity for AI consumption - MCP server (Node.js): 13 tools exposing InjectionNext to AI agents via the Model Context Protocol (get_status, watch_project, get_logs, etc.) - Hook log() and InjectionServer.log/error into LogBuffer for real-time debug console access Made-with: Cursor * Update README.md * Address review: opt-in mcpServer default, harden ControlServer - Add Defaults.mcpServer boolean (set via `defaults write`); ControlServer and LogBuffer only start when enabled. - Make LogBuffer.shared optional; all call sites use optional chaining. - Clamp get_logs limit to 0...500 to prevent negative/overflow traps. - Add 64KB max request size guard on TCP read loop. - Add zod as direct dependency and engines field in package.json. - Update README with enable step and correct Node.js version. Made-with: Cursor * Bump InjectionLite. --------- Co-authored-by: Matheus Gois <matheus.gois@doordash.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes three issues that prevent hot-reload injection from working in Bazel monorepos (particularly with
rules_xcodeproj):1.
.swift-suffixed include paths misclassified as source filesFrontendServer.swift—CompilationArgParser.processSPM packages with names ending in
.swift(e.g.ulid.swift) produce include paths like-I/path/to/swiftpkg_ulid.swift. The arg parser checkshasSuffix(".swift")and only excluded-Fas a predecessor flag. This caused the path to be added toswiftFilesinstead ofargs, breaking compilation.Fix: Expanded the guard to check for
-I,-iquote,-isystemin addition to-F. Also handles the concatenated form (-I/path/...) where the flag and path are a single token, by checkinghasPrefix("-I")andhasPrefix("-F").2. Stale
-oflag from original build causes object file to be written to wrong pathNextCompiler.swift—recompileThe stored compilation arguments contain the original
-o /path/to/bazel/output.ofrom the Bazel build.NextCompilerappends its own-o eval1.o, butswift-frontenduses the first-oit encounters, so the.ofile is written to the Bazel path instead of the expected temp path. The linker then fails withno such file or directory: eval1.o.Fix: Filter out any existing
-o <value>pair fromstored.argumentsbefore appending the new output path. Uses askipNextflag to consume the value token after-o.Also re-adds WMO flag filtering (
-whole-module-optimization,-internalize-at-link,-no-serialize-debugging-options) that was removed in the Xcode26.3 branch — these flags prevent single-file recompilation.3. Restored local
tmpbaseforNextCompilerThe Xcode26.3 branch switched
NextCompilerto useReloader.tmpbase(which resolves toNSTemporaryDirectory() + "eval\(N)"), but thelink()method inNextCompilerexpects the object at/tmp/injectionNext_N.o. Restored the locallet tmpbase = "/tmp/injectionNext"to keep the two paths consistent.4. Updated BAZEL.md documentation
Replaced the "rules_xcodeproj Limitation" warning (which stated hot-reload doesn't work with rules_xcodeproj) with documentation explaining how InjectionNext now handles
rules_xcodeprojoutput bases.Impact on other Bazel implementations
These changes are backwards-compatible and should not break existing Bazel workflows:
-I/-Fprefix check inFrontendServeris strictly additive — it only prevents misclassification of paths that were previously incorrectly treated as source files. Standard.swiftsource files are unaffected since they don't start with-Ior-F.-ostripping inNextCompileronly affects the stored args before the injection-specific-ois appended. The original build is never modified.mainbranch — this just restores it toXcode26.3.tmpbasechange only affectsNextCompiler's internal temp file paths and doesn't touch any Bazel build artifacts.Testing
Tested on Bazel project with
rules_xcodeproj:ulid.swiftinclude paths from source file list.opathRelated Pull Request: johnno1962/InjectionLite#23
Made with Cursor