Project Layout
Status: 🟢 Implemented for JVM and single-target layouts. 🟡 Multiplatform and flavor source sets are discovered but not yet fully composed — see Implementation Status.
Kargo discovers sources by convention. There is no sourceSets { } block to write:
put a file in the right directory and it compiles.
JVM projects
my-project/
├── Kargo.toml # manifest (required)
├── Kargo.lock # resolved versions
├── .kargo.env # machine-local secrets (gitignored)
├── .gitignore
├── src/
│ ├── main/kotlin/ # production code
│ ├── main/resources/ # bundled resources
│ ├── test/kotlin/ # tests
│ └── test/resources/ # test fixtures
└── build/ # output (gitignored)
This is the Maven and Gradle layout, so an existing JVM project usually needs nothing moved.
Multiplatform projects
Targets get one source set each, plus commonMain for shared code:
my-kmp-project/
├── Kargo.toml
├── src/
│ ├── commonMain/kotlin/ # compiled into every target
│ ├── commonMain/resources/
│ ├── commonTest/kotlin/
│ ├── jvmMain/kotlin/
│ ├── jvmTest/kotlin/
│ ├── iosMain/kotlin/
│ ├── iosTest/kotlin/
│ ├── jsMain/kotlin/
│ └── composeResources/ # Compose Multiplatform assets
│ ├── drawable/
│ ├── font/
│ └── values/strings.xml
└── build/
The directory name is the contract: src/<sourceSetName>/kotlin, where the source
set name is the target name in camelCase plus Main or Test. ios-arm64
contributes to iosArm64Main, and also to the shared iosMain through the
source-set hierarchy.
Build output
Output is keyed by target and profile so the two never collide:
build/
├── jvm/
│ ├── dev/
│ │ ├── classes/ # compiled .class files
│ │ └── output/my-app-0.1.0.jar
│ └── release/
│ ├── classes/
│ └── output/my-app-0.1.0.jar
└── ios-arm64/
└── dev/
What incremental builds need lives under .kargo/ — fingerprints in
fingerprints/, the compiler's own caches in incremental/ — so that build/
holds output alone. kargo clean removes both, and a variant clean removes that
variant's share of them.
kargo clean # everything
kargo clean --variant jvm/dev # one target and profile
Flavored projects
Status: 🟡 Flavor source sets are specified and parsed; the build path does not compose them yet.
With flavors, each flavor can contribute its own sources, merged over the common ones:
src/
├── main/kotlin/ # all variants
├── freeMain/kotlin/ # tier=free only
├── freeMain/resources/ # e.g. a different app icon
├── paidMain/kotlin/ # tier=paid only
├── stagingMain/kotlin/ # environment=staging only
├── productionMain/kotlin/
└── freeStagingMain/kotlin/ # one exact combination (rare)
Merge order is common → dimension flavor → exact variant, each layer able to
override the one before it. Flavored output goes to build/<variant>/<target>/.
Multiplatform and flavors compose, most specific last:
src/
├── commonMain/kotlin/ # every target, every flavor
├── jvmMain/kotlin/ # JVM, every flavor
├── freeMain/kotlin/ # free, every target
├── freeJvmMain/kotlin/ # free, JVM only
└── paidIosMain/kotlin/ # paid, iOS only
Files Kargo owns
| File | Commit it? | Notes |
|---|---|---|
Kargo.toml | Yes | Your project's definition. |
Kargo.lock | Applications yes, libraries usually not | Why. |
.kargo.env | Never | Secrets. kargo new gitignores it for you. |
build/ | No | Generated. |
.kargo/ | No | Fingerprints, incremental state, cached dependencies. |
The generated .gitignore already covers the last three.
Overriding the conventions
When an existing layout cannot move, declare it instead:
[source-sets.jvmMain]
kotlin = ["legacy/src/java", "generated/kotlin"]
resources = ["legacy/src/resources"]
Paths are relative to the project root, and a key you leave out keeps the convention. Full detail in the Source Sets reference.