@@ -341,29 +341,19 @@ type GoSdk {
341341 """
342342 generate(ws: Workspace!): Changeset! @generate {
343343 let pws = polyfill.workspace(ws)
344-
345- let changes = modules(ws)
346- .filter { !_.skipGenerate(ws) }
347- .map { mod =>
348- # Stage this module's local dependency closure first (leaf-first, possibly
349- # across SDKs) so its codegen sees up-to-date dependency bindings. The dep
350- # codegen is ephemeral: taking the changeset against the staged workspace
351- # cancels it out, leaving only each module's own changes.
352- let stagedWs = ws.withChanges(pws.moduleSource("/" + mod.rootPath).core.generateLocalDependencies(ws))
353- polyfill.workspace(stagedWs).moduleSource("/" + mod.rootPath).generate.changes
354- }
355-
356- # force them to evaluate in parallel by asking each if they have changes
357- changes.{{isEmpty}}
358-
359- # Fold each module's own changes onto an empty base, not ws.changes. When this
360- # @generate runs nested under the engine's ModuleSource.generateLocalDependencies
361- # (the SDK generator invoked per local dependency), ws already has the leaf
362- # closure staged. Folding ws.changes back in re-included that staged closure,
363- # which the engine then re-rooted under the dependent (b/.dagger/modules/a/...)
364- # and octopus-merged against the freshly generated, overlapping files
365- # (apply ours patch: ... already exists). pws.fork.changes is empty, so only
366- # each module's own changes remain.
367- pws.fork.changes.withChangesets(changes)
344+ changeset.withChangesets(
345+ modules(ws)
346+ .filter { !_.skipGenerate(ws) }
347+ .map { mod =>
348+ # Stage this module's local dependency closure first (leaf-first, possibly
349+ # across SDKs) so its codegen sees up-to-date dependency bindings. The dep
350+ # codegen is ephemeral: taking the changeset against the staged workspace
351+ # cancels it out, leaving only each module's own changes.
352+ let stagedWs = ws.withChanges(
353+ pws.moduleSource("/" + mod.rootPath).core.generateLocalDependencies(ws),
354+ )
355+ polyfill.workspace(stagedWs).moduleSource("/" + mod.rootPath).generate
356+ },
357+ )
368358 }
369359}
0 commit comments