Repository navigation
Description
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.
Activity
feat: ModuleSource.generateLocalDependencies
feat: ModuleSource.generateLocalDependencies
feat: ModuleSource.generateLocalDependencies
feat: ModuleSource.generateLocalDependencies (dagger#13715)