54 lines
2.2 KiB
Markdown
54 lines
2.2 KiB
Markdown
<!-- m-wiki: type=concept slug=build-dispatch topic=build base-sha=28f54cf7bef9 generated-at=2026-05-12T00:00:00+00:00 sources=[] -->
|
|
|
|
> Generated 2026-05-12 at base-sha 28f54cf7bef9. Type: concept. 0 sources.
|
|
|
|
# Build Dispatch
|
|
|
|
`buildObjHelper.run(build_tool)` maps a `build_tool` string from `config.yaml` to a concrete builder class instance using a Groovy `switch/case` with regex patterns.
|
|
|
|
## Where it applies in this repo
|
|
|
|
`src/com/meesho/stages/buildObjHelper.groovy:run`
|
|
|
|
The full dispatch table (in order, first match wins):
|
|
|
|
| Pattern | Builder class |
|
|
|---------|--------------|
|
|
| `maven` (exact) | `buildMaven` |
|
|
| `docker` (exact) | `buildDocker` |
|
|
| `~/^maven-.*/` | `buildMaven` |
|
|
| `~/^python-.*/` | `buildPython` |
|
|
| `~/^node-.*/` | `buildNode` |
|
|
| `~/^rust.*/` | `buildRust` |
|
|
| `~/^go.*/` | `buildGo` |
|
|
| `gradle` (exact) | `buildGradle` |
|
|
| `php` (exact) | `buildPhp` |
|
|
| default | `defaultBuild()` |
|
|
|
|
Each builder is instantiated fresh per build — no shared state between builds.
|
|
|
|
## Why this design
|
|
|
|
Groovy `switch/case` evaluates patterns top-to-bottom and returns on the first match. Regex patterns (the `~/…/` syntax) cover version-suffixed variants like `go-1.22`, `node-20`, `python-3.12` without requiring an exhaustive case list. The exact-match cases for `maven` and `docker` appear before the regex catch-all `~/^maven-.*/` to handle the legacy bare-string case.
|
|
|
|
If no case matches, `defaultBuild()` is called without logging a warning — the pipeline reports success with no artifact produced. A typo in `config.yaml` (e.g. `golang` instead of `go`) produces this silent no-op. If a build succeeds but produces no Docker image, check `build_tool` spelling in `config.yaml` first.
|
|
|
|
## Related
|
|
|
|
- [Build stages](../03-BUILD-STAGES.md) — broader build lifecycle
|
|
- [Language builds](../07-LANGUAGE-BUILDS.md) — per-language builder details
|
|
|
|
## Sources
|
|
|
|
(no raw/ sources at bootstrap)
|
|
|
|
## Notes
|
|
|
|
<!-- Anything below is human-owned. wiki-init never reads or modifies content under this heading. -->
|
|
|
|
---
|
|
|
|
[← Wiki index](../../index.md)
|
|
|
|
<!-- atomic: keep this page ≤600 words. New scope → new concept page that builds on this one. Do not append paragraphs here. -->
|