A build profile can choose different flags for local development and release output.

build profile A build profile is a named set of choices used while compiling or packaging a project.

Build Profile Flags

profile
BuildProfileFlags.kt
Replay: real traced execution (multi-file project)
fun main() {
    val profile = "debug"
    val minify = profile == "release"
    val warningsAsErrors = profile == "ci" || profile == "release"
    val label = when (profile) {
        "debug" -> "fast feedback"
        "release" -> "ship artifact"
        else -> "verification"
    }

    println("profile=$profile")
    println("minify=$minify")
    println("warningsAsErrors=$warningsAsErrors")
    println("label=$label")
}
fun main() {
    val profile = "release"
    val minify = profile == "release"
    val warningsAsErrors = profile == "ci" || profile == "release"
    val label = when (profile) {
        "debug" -> "fast feedback"
        "release" -> "ship artifact"
        else -> "verification"
    }

    println("profile=$profile")
    println("minify=$minify")
    println("warningsAsErrors=$warningsAsErrors")
    println("label=$label")
}
fun main() {
    val profile = "ci"
    val minify = profile == "release"
    val warningsAsErrors = profile == "ci" || profile == "release"
    val label = when (profile) {
        "debug" -> "fast feedback"
        "release" -> "ship artifact"
        else -> "verification"
    }

    println("profile=$profile")
    println("minify=$minify")
    println("warningsAsErrors=$warningsAsErrors")
    println("label=$label")
}
  1. profile ← debug, minify ← false, warningsAsErrors ← false, label ← fast feedback

    1fun main() {2    val profile→ debug = "debug" //@profile="release", "ci"3    val minify→ false = profiledebug == "release"4    val warningsAsErrors→ false = profiledebug == "ci" || profile == "release"5    val label→ fast feedback = when (profiledebug) {6        "debug" -> "fast feedback"7        "release" -> "ship artifact"8        else -> "verification"9    }1011    println("profile=$profiledebug")12    println("minify=$minifyfalse")13    println("warningsAsErrors=$warningsAsErrorsfalse")14    println("label=$labelfast feedback")15}
    outputprofile=debug
    minify=false
    warningsAsErrors=false
    label=fast feedback
  1. profile ← release, minify ← true, warningsAsErrors ← true, label ← ship artifact

    1fun main() {2    val profile→ release = "release"3    val minify→ true = profilerelease == "release"4    val warningsAsErrors→ true = profilerelease == "ci" || profile == "release"5    val label→ ship artifact = when (profilerelease) {6        "debug" -> "fast feedback"7        "release" -> "ship artifact"8        else -> "verification"9    }1011    println("profile=$profilerelease")12    println("minify=$minifytrue")13    println("warningsAsErrors=$warningsAsErrorstrue")14    println("label=$labelship artifact")15}
    outputprofile=release
    minify=true
    warningsAsErrors=true
    label=ship artifact
  1. profile ← ci, minify ← false, warningsAsErrors ← true, label ← verification

    1fun main() {2    val profile→ ci = "ci"3    val minify→ false = profileci == "release"4    val warningsAsErrors→ true = profileci == "ci" || profile == "release"5    val label→ verification = when (profileci) {6        "debug" -> "fast feedback"7        "release" -> "ship artifact"8        else -> "verification"9    }1011    println("profile=$profileci")12    println("minify=$minifyfalse")13    println("warningsAsErrors=$warningsAsErrorstrue")14    println("label=$labelverification")15}
    outputprofile=ci
    minify=false
    warningsAsErrors=true
    label=verification