Common steps for the ModuleRuntime and Codegen functions
( ctx context.Context, modSource *dagger.ModuleSource, // +optional introspectionJSON *dagger.File, )
| 212 | |
| 213 | // Common steps for the ModuleRuntime and Codegen functions |
| 214 | func (m *PythonSdk) Common( |
| 215 | ctx context.Context, |
| 216 | modSource *dagger.ModuleSource, |
| 217 | // +optional |
| 218 | introspectionJSON *dagger.File, |
| 219 | ) (*PythonSdk, error) { |
| 220 | // The following functions were built to be composable in a granular way, |
| 221 | // to allow a custom SDK to depend on this one and hook into before or |
| 222 | // after major steps in the process. For example, you can get the base |
| 223 | // container, add system packages, use the new one with `WithContainer`, |
| 224 | // and then continue with the rest of the steps. Without this, you'd need |
| 225 | // to copy the entire function and modify it. |
| 226 | |
| 227 | // NB: In extension modules, Load is chainable. |
| 228 | _, err := m.Load(ctx, modSource) |
| 229 | if err != nil { |
| 230 | return nil, err |
| 231 | } |
| 232 | _, err = m.WithBase() |
| 233 | if err != nil { |
| 234 | return nil, err |
| 235 | } |
| 236 | return m. |
| 237 | WithSDK(introspectionJSON). |
| 238 | WithTemplate(). |
| 239 | WithSource(). |
| 240 | WithUpdates(), nil |
| 241 | } |
| 242 | |
| 243 | // Get all the needed information from the module's metadata and source files |
| 244 | func (m *PythonSdk) Load(ctx context.Context, modSource *dagger.ModuleSource) (*PythonSdk, error) { |
no test coverage detected