diff --git a/dagger.json b/dagger.json index ee7e4dc..f9a92fa 100644 --- a/dagger.json +++ b/dagger.json @@ -8,7 +8,7 @@ { "name": "polyfill", "source": "github.com/dagger/polyfill@main", - "pin": "b30eb839000fe179e5d0544a9b667b21817b8120" + "pin": "16627066d1852106320bdc0cfa0e5f901efe5970" } ] } diff --git a/go-sdk.dang b/go-sdk.dang index d766828..379279a 100644 --- a/go-sdk.dang +++ b/go-sdk.dang @@ -330,7 +330,12 @@ type GoSdk { modules(ws) .filter { mod => mod.skipGenerate(ws) == 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 } diff --git a/mod.dang b/mod.dang index c146bbd..2fdd162 100644 --- a/mod.dang +++ b/mod.dang @@ -62,7 +62,10 @@ type Mod { if (skipGenerate(ws)) { polyfill.workspace(ws).fork.changes } else { - 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 } } }