Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Build Profiles

Status: 🟢 Implemented — dev and release, 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

devrelease
Debug infoYesNo
OptimizationNoYes
Outputbuild/<target>/dev/build/<target>/release/
Use forEverything you do while writing codePublishing, 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"]
KeyTypeEffect
debugboolEmit debug symbols and line-number tables.
optimizationboolEnable compiler optimizations.
compiler-argslistExtra 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

Next