2.2 KiB
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 — broader build lifecycle
- Language builds — per-language builder details
Sources
(no raw/ sources at bootstrap)