diff --git a/dagger.json b/dagger.json index 29862d1..02fcca0 100644 --- a/dagger.json +++ b/dagger.json @@ -8,7 +8,7 @@ { "name": "polyfill", "source": "github.com/dagger/polyfill@main", - "pin": "e90bbfc4843258a877a3a95b8db1571e7981e65f" + "pin": "16627066d1852106320bdc0cfa0e5f901efe5970" } ] } diff --git a/mod.dang b/mod.dang index 45f95ea..589732a 100644 --- a/mod.dang +++ b/mod.dang @@ -54,7 +54,10 @@ type Mod { } else { # rootPath is workspace-root-relative, so anchor it before passing it # through the cwd-aware polyfill. - polyfill.workspace(ws).moduleSource("/" + rootPath).generate.changes + # Stage the local dependency closure so this module's codegen sees + # up-to-date dependency bindings before generating it. + let stagedWs = ws.withChanges(polyfill.workspace(ws).moduleSource("/" + rootPath).core.generateLocalDependencies(ws)) + polyfill.workspace(stagedWs).moduleSource("/" + rootPath).generate.changes } } } diff --git a/php-sdk.dang b/php-sdk.dang index 32462e2..2abba6c 100644 --- a/php-sdk.dang +++ b/php-sdk.dang @@ -227,7 +227,12 @@ type PhpSdk { modules(ws) .filter { mod => mod.skipGenerate == false } .reduce(pws.fork) { fork, mod => - fork.merge(pws.moduleSource("/" + mod.rootPath).generate) + # Stage this module's local dependency closure first (leaf-first, possibly + # across SDKs) so its codegen sees up-to-date dependency bindings. The dep + # codegen is ephemeral: it appears in both the fork's before and after, so + # it cancels in the merge, leaving only each module's own changes. + let stagedWs = ws.withChanges(pws.moduleSource("/" + mod.rootPath).core.generateLocalDependencies(ws)) + fork.merge(polyfill.workspace(stagedWs).moduleSource("/" + mod.rootPath).generate) } .changes }