MCPcopy
hub / github.com/dagger/dagger / CodeGenerator

Interface CodeGenerator

core/sdk.go:96–127  ·  view source on GitHub ↗

* CodeGenerator is an interface that a SDK may implements to generate code for a module. This can include multiple things, such as a generated client to interact with the Dagger Engine but also any changes in the module's code to run it in the Dagger Engine like dependency configuration, package ma

Source from the content-addressed store, hash-verified

94(`dagger develop`).
95*/
96type CodeGenerator interface {
97 /*
98 Codegen generates code for the module at the given source directory and
99 subpath.
100
101 The Code field of the returned GeneratedCode object should be the generated
102 contents of the module sourceDirSubpath, in the case where that's different
103 than the root of the sourceDir.
104
105 The provided Module is not fully initialized; the Runtime field will not be
106 set yet.
107
108 This function prototype is different from the one exposed by the SDK.
109 SDK must implement the `Codegen` function with the following signature:
110
111 ```gql
112 codegen(
113 modSource: ModuleSource!
114 introspectionJSON: File!
115 ): GeneratedCode!
116 ```
117 */
118 Codegen(
119 context.Context,
120
121 // Current module dependencies.
122 *SchemaBuilder,
123
124 // Current instance of the module source.
125 dagql.ObjectResult[*ModuleSource],
126 ) (*GeneratedCode, error)
127}
128
129/*
130ModuleRuntime is an abstraction over different ways to execute module code.

Callers 8

CodegenMethod · 0.65
invokeFunction · 0.65
runCodegenMethod · 0.65
IntrospectionJSONMethod · 0.65
invokeFunction · 0.65
invokeFunction · 0.65
invokeFunction · 0.65
invokeFunction · 0.65

Implementers 11

OnlyCodegencore/integration/testdata/sdks/only-co
codeGeneratorModulecore/sdk/module_code_generator.go
goSDKcore/sdk/go_sdk.go
dangSDKcore/sdk/dang_sdk.go
Querytoolchains/engine-dev/internal/dagger/
PythonSdksdk/python/runtime/main.go
PhpSdksdk/php/runtime/main.go
TypescriptSdksdk/typescript/runtime/main.go
ElixirSdksdk/elixir/runtime/main.go
JavaSdksdk/java/runtime/main.go

Calls

no outgoing calls

Tested by

no test coverage detected