Skip to content

Commit 0c04581

Browse files
committed
bump polyfill, fmt, simplify
Signed-off-by: Alex Suraci <[email protected]>
1 parent 80e1163 commit 0c04581

3 files changed

Lines changed: 24 additions & 32 deletions

File tree

‎dagger.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"dependencies": [
88
{
99
"name": "polyfill",
10-
"source": "github.com/dagger/polyfill@main",
11-
"pin": "16627066d1852106320bdc0cfa0e5f901efe5970"
10+
"source": "github.com/dagger/polyfill@fix-generate",
11+
"pin": "52562662d26743e69f3f4953b3ce22677f2c2043"
1212
}
1313
]
1414
}

‎go-sdk.dang‎

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

‎mod.dang‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ type Mod {
66
Workspace-root-relative path of this module root — the module's stable
77
identity, independent of where the client is invoked from.
88
"""
9-
pub rootPath: String!
9+
rootPath: String!
1010

1111
"""
1212
Workspace containing this module.
@@ -23,7 +23,7 @@ type Mod {
2323
the module itself, "sub/mod" for a module beneath it, ".." for an enclosing one.
2424
A cwd-relative view of rootPath, so listings read the way a shell user would.
2525
"""
26-
pub path: String! {
26+
path: String! {
2727
let cwd = ws.cwd.trimPrefix("/").trimSuffix("/")
2828
if (rootPath == cwd) {
2929
"."
@@ -42,7 +42,7 @@ type Mod {
4242
"""
4343
Whether this module or an ancestor contains the configured generate skip marker.
4444
"""
45-
pub skipGenerate(ws: Workspace!): Boolean! {
45+
skipGenerate(ws: Workspace!): Boolean! {
4646
hasMarker(ws, skipGenerateFilename)
4747
}
4848

@@ -58,14 +58,16 @@ type Mod {
5858
Generate this module.
5959
If the generate skip marker is present, the changeset is empty.
6060
"""
61-
pub generate(ws: Workspace!): Changeset! {
61+
generate(ws: Workspace!): Changeset! {
6262
if (skipGenerate(ws)) {
6363
polyfill.workspace(ws).fork.changes
6464
} else {
6565
# Stage the local dependency closure so this module's codegen sees
6666
# up-to-date dependency bindings before generating it.
67-
let stagedWs = ws.withChanges(polyfill.workspace(ws).moduleSource("/" + rootPath).core.generateLocalDependencies(ws))
68-
polyfill.workspace(stagedWs).moduleSource("/" + rootPath).generate.changes
67+
let stagedWs = ws.withChanges(
68+
polyfill.workspace(ws).moduleSource("/" + rootPath).core.generateLocalDependencies(ws),
69+
)
70+
polyfill.workspace(stagedWs).moduleSource("/" + rootPath).generate
6971
}
7072
}
7173
}

0 commit comments

Comments
 (0)