diff --git a/dagger-module.toml b/dagger-module.toml index 3d53cf8..7465738 100644 --- a/dagger-module.toml +++ b/dagger-module.toml @@ -1,10 +1,6 @@ name = "java-sdk" -engineVersion = "v1.0.0-0" +engineVersion = "v1.0.0-beta.10" [runtime] source = "dang" -[[dependencies]] - name = "polyfill" - source = "github.com/dagger/polyfill@main" - pin = "e90bbfc4843258a877a3a95b8db1571e7981e65f" diff --git a/dagger.json b/dagger.json index e38c38e..95b85ed 100644 --- a/dagger.json +++ b/dagger.json @@ -1,14 +1,7 @@ { "name": "java-sdk", - "engineVersion": "latest", + "engineVersion": "v1.0.0-beta.10", "sdk": { "source": "dang" - }, - "dependencies": [ - { - "name": "polyfill", - "source": "github.com/dagger/polyfill@main", - "pin": "e90bbfc4843258a877a3a95b8db1571e7981e65f" - } - ] + } } diff --git a/dagger.lock b/dagger.lock index f8cfb64..617173c 100644 --- a/dagger.lock +++ b/dagger.lock @@ -1,4 +1,3 @@ [["version","1"]] ["","git.head",["https://github.com/dagger/dang-sdk"],"c724eec4270870aae489daa9f3cb8cbacfb44680","float"] ["","git.head",["https://github.com/dagger/sdk-sdk"],"8c164424b7a8a37b33a77367ef7547490d5b87b5","float"] -["","git.ref",["https://github.com/dagger/polyfill","main"],"ec3ea84a2351b4beb06ecece951f2e5ef66509ff","float"] \ No newline at end of file diff --git a/main.dang b/main.dang index 5673c73..0af8b36 100644 --- a/main.dang +++ b/main.dang @@ -56,14 +56,8 @@ type JavaSdk { rawPath.trimSuffix("/") } - let before = if (modPath == ".") { - ws.directory("/", include: ["**"]) - } else { - ws.directory("/", include: [modPath + "/**"]) - } - let selectedTemplate = if (template == "") { "default" } else { template } - before.withDirectory(modPath, renderedTemplate(name, selectedTemplate)).changes(before) + ws.fork.withNewDirectory("/" + modPath, renderedTemplate(name, selectedTemplate)).changes } """ @@ -96,14 +90,14 @@ type JavaSdk { (currentModule.asSDK.modules). So running from a subdirectory acts on the project you're in — and the projects beneath it — not the whole workspace. - Discovery is the polyfill's cwd-aware findConfigDirs (dagger/dagger#13688); + Discovery is the engine's cwd-aware Workspace.findConfigDirs; this maps its cwd-relative results to workspace-root-relative paths and keeps the ones this SDK manages, whether they use dagger-module.toml or dagger.json. """ pub modules(ws: Workspace!): [Mod!]! { let managed = ws.sdk(name: currentModule.name).modules.{{source}} let cwd = normalizePath(ws.cwd) - polyfill.workspace(ws) + ws .findConfigDirs(moduleConfigFilenames, exclude: ["**/target/**"]) .map { dir => moduleRelPath(cwd, dir) } .uniq diff --git a/mod.dang b/mod.dang index 03102a9..01c3798 100644 --- a/mod.dang +++ b/mod.dang @@ -198,13 +198,10 @@ type Mod { Stage the vendored SDK + generated entrypoint for one module. """ let generateModule(ws: Workspace!, modPathArg: String!): Changeset! { - # Native module-source resolution (Directory.asModuleSource, Query.moduleSource) - # fails from module code: SDK and user-defaults loading need the requester's host - # session. The polyfill resolves the source from a nested client that has one. # Anchor rootPath at "/" so a non-root workspace cwd is not prefixed again. - let modSource = polyfill.workspace(ws).moduleSource("/" + modPathArg) - let name = modSource.core.moduleName - let introspectionJSON = modSource.core.introspectionSchemaJSON + let modSource = ws.moduleSource("/" + modPathArg) + let name = modSource.moduleName + let introspectionJSON = modSource.introspectionSchemaJSON let vendored = vendoredSdk(introspectionJSON, name) # the module as committed, with the whole committed sdk/ dropped (source and @@ -216,21 +213,18 @@ type Mod { .withoutDirectory("src/generated") let entrypoint = generatedEntrypoint(baseDir, name) - let before = if (modPathArg == ".") { - ws.directory("/", include: ["**"]) - } else { - ws.directory("/", include: [modPathArg + "/**"]) - } - let staged = before - .withDirectory(joinPath(modPathArg, "sdk"), vendored) - .withDirectory(joinPath(modPathArg, "src/generated/java"), entrypoint) + # Stage through a workspace fork: the changeset comes back measured from + # the caller's cwd, the way the client applies it. + let staged = ws.fork + .withNewDirectory("/" + joinPath(modPathArg, "sdk"), vendored) + .withNewDirectory("/" + joinPath(modPathArg, "src/generated/java"), entrypoint) if (vendorSdkJar) { staged - .withDirectory(joinPath(modPathArg, "sdk/repo"), vendoredSdkJar(introspectionJSON, name)) - .changes(before) + .withNewDirectory("/" + joinPath(modPathArg, "sdk/repo"), vendoredSdkJar(introspectionJSON, name)) + .changes } else { - staged.changes(before) + staged.changes } }