( ctx context.Context, modSource *dagger.ModuleSource, introspectionJSON *dagger.File, )
| 294 | } |
| 295 | |
| 296 | func (m *JavaSdk) ModuleRuntime( |
| 297 | ctx context.Context, |
| 298 | modSource *dagger.ModuleSource, |
| 299 | introspectionJSON *dagger.File, |
| 300 | ) (*dagger.Container, error) { |
| 301 | if err := m.setModuleConfig(ctx, modSource); err != nil { |
| 302 | return nil, err |
| 303 | } |
| 304 | |
| 305 | // Get a container with the user module sources and the SDK packages built and installed |
| 306 | mvnCtr, err := m.codegenBase(ctx, modSource, introspectionJSON) |
| 307 | if err != nil { |
| 308 | return nil, err |
| 309 | } |
| 310 | // Build the executable jar |
| 311 | jar, err := m.buildJar(ctx, mvnCtr) |
| 312 | if err != nil { |
| 313 | return nil, err |
| 314 | } |
| 315 | |
| 316 | javaCtr, err := m.jreContainer(ctx) |
| 317 | if err != nil { |
| 318 | return nil, err |
| 319 | } |
| 320 | javaCtr = javaCtr. |
| 321 | WithFile(filepath.Join(ModDirPath, "module.jar"), jar). |
| 322 | WithWorkdir(ModDirPath). |
| 323 | WithEntrypoint([]string{"java", "-jar", filepath.Join(ModDirPath, "module.jar")}) |
| 324 | |
| 325 | return javaCtr, nil |
| 326 | } |
| 327 | |
| 328 | // buildJar builds and returns the generated jar from the user module |
| 329 | func (m *JavaSdk) buildJar( |
no test coverage detected