Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .dagger/modules/e2e/main.dang
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,13 @@ type E2e {
modules that live outside it.
"""
modulesCwdCheck(ws: Workspace!): Void @check {
# A stable snapshot of the workspace, re-anchorable at any cwd. Keep every
# module config (both dagger.json and dagger-module.toml, for discovery) and
# the nested .keep so lookup/app/nested survives the include filter and can
# serve as a config-less subdirectory.
let root = ws.directory("/", include: ["**/dagger.json", "**/dagger-module.toml", "**/.keep"])
# A stable snapshot of the workspace, re-anchorable at any cwd. Keep the
# workspace config (dagger.toml, whose [modules.<sdk>.as-sdk] list is what
# modules() resolves the re-anchored workspace against), every module config
# (both dagger.json and dagger-module.toml, for discovery) and the nested
# .keep so lookup/app/nested survives the include filter and can serve as a
# config-less subdirectory.
let root = ws.directory("/", include: ["dagger.toml", "**/dagger.json", "**/dagger-module.toml", "**/.keep"])

# Walk-down: from fixtures/generate only generate/app is in the cone; the
# sibling managed modules live outside it and must be excluded. Its
Expand Down
8 changes: 4 additions & 4 deletions go-sdk.dang
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type GoSdk {
beneath it — not the whole workspace.
"""
modules(ws: Workspace!): [Mod!]! {
let managed = currentModule.asSDK.modules.{{path}}
let managed = currentModule.asSDK(workspace: ws).modules.{{path}}
let cwd = ws.cwd.trimPrefix("/").trimSuffix("/")
polyfill
.workspace(ws)
Expand Down Expand Up @@ -108,12 +108,12 @@ type GoSdk {
The workspace's [[modules.<sdk>.as-sdk.modules]] entries are the source of
truth for SDK-managed modules, so membership needs no config sniffing.
"""
let managedBase(path: String!): String {
let managedBase(ws: Workspace!, path: String!): String {
# asSDK raises when this module is not installed as an SDK in the active
# workspace, which is the normal case for a legacy dagger.json-only repo.
# The `.{{path}}` selection is what executes the query, so it must sit
# inside the guard.
let managed = currentModule.asSDK.modules.{{path}} rescue []
let managed = currentModule.asSDK(workspace: ws).modules.{{path}} rescue []

managed
.map { m => normalizePath(m.path) }
Expand All @@ -138,7 +138,7 @@ type GoSdk {
let modPath = if (findUp) {
let needle = normalizePath(path)

let asSdkBase = managedBase(needle)
let asSdkBase = managedBase(ws, needle)
let foundToml = ws.findUp("dagger-module.toml", path)
let foundJson = ws.findUp("dagger.json", path)
let tomlBase = if (foundToml == null) { null } else {
Expand Down