Skip to content

Make module discovery cwd-aware and resolve dagger-module.toml#8

Merged
TomChv merged 1 commit into
mainfrom
feat/make-module-discovery-cwd-aware
Jul 24, 2026
Merged

Make module discovery cwd-aware and resolve dagger-module.toml#8
TomChv merged 1 commit into
mainfrom
feat/make-module-discovery-cwd-aware

Conversation

@TomChv

@TomChv TomChv commented Jul 22, 2026

Copy link
Copy Markdown
Member

What

Ports the cwd-aware module discovery change to the Java SDK, matching the sibling SDK PRs:

Tracking issue: dagger/dagger#13688.

Changes

  • Mod.pathMod.rootPath — the workspace-root-relative path is the module's stable identity. A new computed Mod.path is a cwd-relative view (".", "sub/mod", "..") so listings read the way a shell user sees them.
  • JavaSdk.modules(ws) — new cwd-aware discovery. It goes through the polyfill's findConfigDirs (anchored at the client's cwd, not the workspace root) and intersects the result with the engine-owned currentModule.asSDK.modules list. generateAll now goes through it, so running from a subdirectory acts on the project you're in and the projects beneath it.
  • dagger-module.toml resolution — module roots are discovered by either the CLI 1.0 dagger-module.toml or the legacy dagger.json (moduleConfigFilenames).
  • Polyfill bump — points the polyfill dependency in dagger-module.toml (the effective module config, which still pointed at the old sdk-sdk/polyfill) at github.com/dagger/polyfill@main, which provides findConfigDirs.
  • Workspace wiring — rewrites the stale workspace dagger.toml (it still referenced a Go-based runtime that has since moved to Dang) to register the e2e module and the java SDK with its fixtures.

Tests

Adds modulesCheck and modulesCwdCheck to the e2e module, covering discovery of both config formats, cwd walk-down/find-up scoping, and exclusion of modules this SDK doesn't manage.

Verified against a v1.0.0-beta.7 engine:

✔ e-2-e:modules-check OK
✔ e-2-e:modules-cwd-check OK
✔ e-2-e:init-check OK
✔ e-2-e:skip-generate-filename-check OK
✔ e-2-e:target-runtime-check OK
✔ dang-sdk:generate-all OK

Signed-off-by: Tom Chauveau tom@dagger.io

@TomChv

This comment was marked as outdated.

@TomChv
TomChv requested a review from tiborvass July 22, 2026 12:18
@TomChv
TomChv force-pushed the feat/make-module-discovery-cwd-aware branch from fb14696 to e279505 Compare July 22, 2026 13:13
@TomChv
TomChv force-pushed the feat/make-module-discovery-cwd-aware branch from a163476 to c3f0b0a Compare July 24, 2026 16:16
Port the cwd-aware discovery change from the Go, Python and TypeScript SDKs
(dagger/dagger#13688): modules are discovered relative to the client's
current directory rather than the whole workspace, and both the CLI 1.0
dagger-module.toml and the legacy dagger.json mark a module root.

- Mod.path becomes rootPath (workspace-root-relative, the module's stable
  identity); a new cwd-relative Mod.path renders listings the way a shell
  user sees them.
- JavaSdk.modules(ws) discovers managed modules through the polyfill's
  cwd-aware findConfigDirs, intersected with the workspace's SDK-managed
  list read via ws.sdk(name: currentModule.name) on the passed workspace
  (so it never depends on an ambient current workspace). generateAll goes
  through it, so running from a subdirectory acts on the project you're in
  and the projects beneath it.
- Point the polyfill dependency in dagger-module.toml (the effective module
  config) at github.com/dagger/polyfill@main, which provides findConfigDirs.
- Wire the workspace dagger.toml for e2e (register java-sdk as the "java"
  SDK with fixtures) and add modulesCheck / modulesCwdCheck covering both
  config formats and cwd scoping. The e2e fixtures carry the skip-generate
  marker so generateAll lists but never builds them.
- Make packager:generate byte-reproducible by stripping Maven's install-time
  timestamps from the committed prebuilt repo, which otherwise churn on every
  run and make the generate-check report perpetual drift.

Signed-off-by: Tom Chauveau <tom@dagger.io>
@TomChv
TomChv force-pushed the feat/make-module-discovery-cwd-aware branch from c3f0b0a to ef352c5 Compare July 24, 2026 16:18
@TomChv
TomChv merged commit 610af03 into main Jul 24, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants