Skip to content

Prevent unnecessary rewrites in generated outputs#45

Open
novr wants to merge 2 commits intomainfrom
feat/issue-42-incremental-build
Open

Prevent unnecessary rewrites in generated outputs#45
novr wants to merge 2 commits intomainfrom
feat/issue-42-incremental-build

Conversation

@novr
Copy link
Copy Markdown
Owner

@novr novr commented Apr 28, 2026

Summary

  • Introduce GeneratedFileWriter.writeIfChanged and route all Kawarimi generated output writes through it.
  • Skip rewriting files when generated content is unchanged so output mtimes remain stable for incremental builds.
  • Add unit tests for writeIfChanged behavior and update KawarimiTests target dependency for direct function testing.

Test plan

  • swift test --filter KawarimiTests
  • Verify writeIfChanged skips write on identical content
  • Verify writeIfChanged overwrites file when content differs

novr added 2 commits April 28, 2026 15:35
Avoid touching generated files when content is unchanged by introducing a shared writeIfChanged helper and routing all Kawarimi output writes through it. This preserves output mtimes and reduces downstream recompilation in incremental builds.
Make KawarimiTests depend on the executable target and add direct unit tests for GeneratedFileWriter.writeIfChanged. This validates both skip-on-same-content and overwrite-on-diff behavior without relying on full CLI execution.
@github-actions
Copy link
Copy Markdown

Kawarimi [kawarimi-perf] — small fixture

Commit ae20725 · Kawarimi writes under basename kawarimi-perf-out (see workflow RUNNER_TEMP).

[kawarimi-perf] phase=setup seconds=0.006157
[kawarimi-perf] phase=load seconds=0.015813
[kawarimi-perf] phase=generate_kawarimi seconds=0.001141
[kawarimi-perf] phase=generate_handler seconds=0.003751
[kawarimi-perf] phase=generate_spec seconds=0.003279
[kawarimi-perf] phase=total seconds=0.030450

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