8000 [WIP] sdk/java: implementation of moduleTypeDefs by eunomie · Pull Request #10625 · dagger/dagger · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[WIP] sdk/java: implementation of moduleTypeDefs #10625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

eunomie
Copy link
Member
@eunomie eunomie commented Jun 23, 2025

Note

This needs to be merged after #10584
In the meantime, only the last commits flagged sdk/java are really for this PR, the others are from the base branch.

This is the java implementation of the new moduleTypeDefs defined in #10584

This is done by splitting the entry point in two parts, one to register types, on to invoke functions.
This split, at least on the codegen aspect, is interesting even without moduleTypeDefs as it makes responsibilities clearer.

eunomie added 6 commits June 19, 2025 17:12
Go SDK now has a moduleTypeDefs method that is dedicated to return
types exposed by the module.

The `moduleTypeDefs` is similar to `moduleRuntime` but the generated
entrypoint only contains the types and not the invocation code.

Codegen contains a new flag `--typedefs-only` to only generate the
part related to types.

Other than this flag, one change in the codegen is a `register` function
is created to handle the management of the types. `invoke` function
will call `register` when the parent name is empty.
And basically when `--typedefs-only` is set, the invoke function is not
created but the `register` is and is called instead of `invoke`.

Signed-off-by: Yves Brissaud <gh@lgtd.io>
This is an optional new entry point on the module SDK.
It's designed to perform the type definition from the module like
the actual moduleRuntime when an empty string is passed as argument.

If the function doesn't exist, the moduleRuntime is used instead.

But this allows to decouple both of them so we can registry types
of a module without the runnable module itself because to build it
needs the types defined by the module

Signed-off-by: Yves Brissaud <gh@lgtd.io>
Use `moduleTypeDefs` instead of `moduleRuntime` if available.
Cache the runtime as expected if `moduleTypeDefs` has been called.

Signed-off-by: Yves Brissaud <gh@lgtd.io>
Signed-off-by: Yves Brissaud <gh@lgtd.io>
Generate register function for typedefs in a dedicated class so
it can be used independently.

Signed-off-by: Yves Brissaud <gh@lgtd.io>
Use the container returned by `moduleTypeDefs` to get the module's
type definition instead of the runtime container.

This container contains an entrypoint with only the type registration
function and not the invocation code.

Signed-off-by: Yves Brissaud <gh@lgtd.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0