Skip to content

Docs: rewrite prebuild-script migration guide around --combined-output#296

Merged
dfed merged 4 commits into
mainfrom
dfed--prebuild-migration
May 12, 2026
Merged

Docs: rewrite prebuild-script migration guide around --combined-output#296
dfed merged 4 commits into
mainfrom
dfed--prebuild-migration

Conversation

@dfed
Copy link
Copy Markdown
Owner

@dfed dfed commented May 11, 2026

Summary

  • The 2.x migration section in Documentation/Manual.md pointed prebuild-script migrants at generate --swift-manifest, but our own Bazel rule (bazel/safedi.bzl) and Tuist plugin (TuistPlugins/SafeDITuist/.../SafeDI.swift) use generate --combined-output --module-info-output instead — that flow produces a single statically-known output path, which is strictly simpler for any hand-written prebuild script
  • Rewrites the migration section to lead with --combined-output: minimal single-module example, then a multi-module example that wires --module-info-output + --dependent-module-info-file-path for cross-module @Instantiable resolution
  • Links to bazel/safedi.bzl and the Tuist plugin as canonical reference implementations
  • Keeps --swift-manifest documented as the alternative for per-root output files, and notes the two emission modes are mutually exclusive
  • Hardens SafeDITool's path-list CSV parsing: an echo "x.safedi" > deps.csv (as shown in the new docs) writes a trailing newline that previously survived components(separatedBy: ",") + removingEmpty() and got baked into the resolved file URL, failing the dependent-module load with a misleading file-not-found. A new String.parsedPathListCSV() helper now splits on commas/newlines and trims surrounding whitespace; applied to Generate's deps/sources/cache-check sites and Scan's sources site.

Test plan

  • Render Documentation/Manual.md and confirm the new section flows correctly
  • Confirm both internal links (bazel/safedi.bzl, TuistPlugins/SafeDITuist/ProjectDescriptionHelpers/SafeDI.swift) resolve on GitHub
  • Sanity-check the multi-module shell snippet matches what the Bazel rule and Tuist plugin actually invoke
  • New regression test run_combinedOutput_resolvesDependentModuleInfo_whenDepsCSVHasTrailingNewline fails on the pre-fix code (file-not-found on <uuid>.safedi\n) and passes after the helper change
  • Full swift test --traits sourceBuild — 922 tests pass
  • ./CLI/lint.sh clean

🤖 Generated with Claude Code

The migration section pointed migrants at `generate --swift-manifest`,
but our own Bazel rule and Tuist plugin use `generate --combined-output
--module-info-output` instead — it's strictly simpler for hand-written
prebuild scripts because it produces a single statically-known output
path. Rewrite the section to lead with that flow (single-module +
multi-module examples), link to `bazel/safedi.bzl` and the Tuist plugin
as reference implementations, and keep `--swift-manifest` as the
alternative for per-root output files.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread Documentation/Manual.md Outdated
Comment thread Documentation/Manual.md Outdated
Co-authored-by: Dan Federman <dfed@me.com>
@dfed dfed marked this pull request as ready for review May 11, 2026 22:54
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 48700ece56

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Documentation/Manual.md
@codecov
Copy link
Copy Markdown

codecov Bot commented May 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (4b626d5) to head (f48779a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #296   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           41        41           
  Lines         7043      7040    -3     
=========================================
- Hits          7043      7040    -3     
Files with missing lines Coverage Δ
Sources/SafeDITool/GenerateCommand.swift 100.00% <100.00%> (ø)
Sources/SafeDITool/SafeDITool.swift 100.00% <100.00%> (ø)
Sources/SafeDITool/ScanCommand.swift 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

dfed and others added 2 commits May 11, 2026 18:54
A deps CSV produced by `echo "x.safedi" > deps.csv` carries a trailing
newline, which previously survived `components(separatedBy: ",")` +
`removingEmpty()` and ended up baked into the resolved file URL — causing
the dependent module load to fail with a misleading file-not-found error.
Centralize the parse in a `parsedPathListCSV()` helper that splits on
commas/newlines and trims whitespace, applied to all three CSV-reading
sites (Generate's deps + sources + cache-check, Scan's sources).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Per CLAUDE.md: never .contains() for generator output.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dfed dfed merged commit 11422e4 into main May 12, 2026
20 checks passed
@dfed dfed deleted the dfed--prebuild-migration branch May 12, 2026 20:03
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