Build Profiles
Status: 🟢 Implemented —
devandrelease, plus custom named profiles.
A profile is a named set of compiler settings. dev optimizes for fast feedback,
release for the artifact you ship.
kargo build # dev (default)
kargo build --release # release
kargo build -p perf # a custom profile
The two built-in profiles
dev | release | |
|---|---|---|
| Debug info | Yes | No |
| Optimization | No | Yes |
| Output | build/<target>/dev/ | build/<target>/release/ |
| Use for | Everything you do while writing code | Publishing, benchmarking, shipping |
Both exist without being declared. Override them only where you disagree:
[profile.dev]
debug = true
optimization = false
[profile.release]
debug = false
optimization = true
compiler-args = ["-Xjvm-default=all"]
| Key | Type | Effect |
|---|---|---|
debug | bool | Emit debug symbols and line-number tables. |
optimization | bool | Enable compiler optimizations. |
compiler-args | list | Extra flags passed straight to the Kotlin compiler. |
Custom profiles
Any [profile.<name>] section defines a profile:
[profile.perf]
debug = true # keep symbols so profilers can attribute samples
optimization = true
[profile.ci]
debug = false
optimization = false # fastest possible compile; artifacts are discarded
kargo build --profile perf
kargo test --profile ci
perf is the common case worth knowing: a release-speed binary that a profiler
can still read. Without debug info, flame graphs show you addresses instead of
function names.
Output isolation
Each profile owns its output directory, so profiles never invalidate one another:
build/jvm/dev/
build/jvm/release/
build/jvm/perf/
Switching back and forth costs nothing after the first build of each. The
fingerprint for a compilation unit includes the profile's compiler arguments, so
changing compiler-args correctly forces a rebuild of exactly that profile.
compiler-args
An escape hatch for compiler flags Kargo has no manifest key for:
[profile.release]
compiler-args = [
"-Xjvm-default=all",
"-opt-in=kotlin.ExperimentalStdlibApi",
"-Xcontext-receivers",
]
Flags land on the kotlinc command line verbatim. Two cautions: they are not
validated, so a typo surfaces as a compiler error; and they are target-specific,
so a JVM-only flag in a profile used by a Native build will fail there. Prefer a
manifest key when one exists.
Interaction with flavors
Status: 🟡 Flavors do not reach the build path yet — see Flavors and Variants.
A variant is a flavor combination plus a profile, so profiles multiply the variant matrix: two flavor dimensions of two values each, with two profiles, is eight variants.
kargo build --variant free-staging-dev