feat: regenerate build.ninja when dub.json or dub.selections.json change - #3134
Conversation
Added a regen rule plus a build edge for build.ninja so it rebuilds itself whenever dub.json or dub.selections.json changes. Only adds selections.json as a dependency if it actually exists, since packages with no deps don't have one. Test checks for the regen rule, the generator attribute, and the build edge in ninja-generator.sh. Verified it breaks without this and works with it. Signed-off-by: Hariprakash V <hariprakash4389285@gmail.com>
…egeneration on dub.json change
|
✅ PR OK, no changes in deprecations or warnings Total deprecations: 0 Total warnings: 0 Build statistics: statistics (-before, +after)
-executable size=5722856 bin/dub
-rough build time=53s
+executable size=5726952 bin/dub
+rough build time=54sFull build output |
atilaneves
left a comment
There was a problem hiding this comment.
This still doesn't handle dub.sdl
The regen test only checked for the log message and exit status, which could pass even if build.ninja wasn't actually regenerated. Now it also mutates the recipe (dub.json/dub.sdl) to add an extra import path and checks that build.ninja actually reflects the change, per Atila's review. Also fixes lflags the same way src/regenInputs were already fixed: escaping paths so Windows drive-letter colons don't break ninja.
|
Hi Atila, thanks for approving this one. Quick follow up on #3130 (makedeps) too. I asked on the 22nd whether it landed some other way or needs resubmitting, haven't heard back yet. I've got the commit ready to reapply on current master if you'd like a fresh PR, just want your go ahead first since #3129/#3130 already caused mixup once. No rush, just flagging since final GSoC submissions open Aug 17. |
I closed that one in favour of yours? |
|
checking the data on this: #3130 is under your fork (atilaneves/dub, branch hariprakash-makedeps), which looks like the version you set up after the duplicate account mess in July. It's currently closed and never merged, and I don't see -makedeps or depfile logic anywhere in current master. Would you like me to resubmit that work as a fresh PR from my account, rebased on current master? Happy to do it however works best for you. |
Yes please, resubmit under your normal account. |
Adds a regen rule and build.ninja edge so it rebuilds itself
automatically whenever dub.json changes (dub.selections.json too,
if present).
Independent of #3130 (makedeps-v3, still unmerged) - builds cleanly
on current upstream/master with subpkg (#3133) already merged.
Test verifies the actual behavior, not just config text: touches
dub.json, runs ninja, and asserts "Regenerating build.ninja" genuinely
appears in the output. Confirmed the test fails when the regen rule
is removed and passes when restored. Verified via fresh clone build.