Skip to content

New API: ModuleSource.GenerateLocalDependencies #13706

Closed

Description

@kpenfound

This is a solution for #13662

The Problem

To properly codegen a module, the codegen of its dependencies must be up to date. For local dependencies, its quite common for a local set of changes to require codegen for multiple local modules, some of which may depend on each other. This creates a scenario where a local dependency of a module must be codegen'ed before the module itself can codegen. With the codegen responsibility shifting from the engine to SDK modules, the SDK modules currently lack the ability to codegen the full dependency tree in the appropriate order for all modules to successfully codegen.

The Solution

Now that SDK modules are CWD-aware (#13688), SDKs are able to generate specific modules within a Workspace. This gives us a new possibility:

A new API on ModuleSource called ModuleSource.GenerateLocalDependencies() will

  • have knowledge of each of ModuleSource's dependencies, their SDK, and whether they are local
  • for each local dependency, call its SDK's generator at the path of that dependency
  • return a Workspace that includes the codegen for every local dependency module

With that Workspace returned from ModuleSource.GenerateLocalDependencies(), the SDK module can overlay it on its own Workspace, using the new Workspace overlay feature, to correctly codegen its module.

The final Changeset returned by the SDK generator only includes the codegen for the module it was asked to codegen, not local dependencies. The local dependency codegen used for the module codegen is ephemeral and will be discarded. In the case where call dagger generate from the workspace root, each local module is generated concurrently regardless of dependencies and the final Changesets for each will be merged. In the case where we dagger generate from a module within a subdirectory of our Workspace, dagger generate will return a Changeset that only includes that module's codegen because the SDK module is CWD aware.

cc @shykes @TomChv

Activity

  1. added this to the v1.0.0 milestone on Jul 21, 2026
  2. added 3 commits that reference this issue on Jul 27, 2026
    f3a271c
    245624e
    0c1ca57
  3. added a commit that references this issue on Jul 27, 2026
    da3f970
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions