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

Workspaces

Status: 🟡 Partial — [workspace] parses and validates, including glob members. Building members as one unit is not orchestrated yet; each module builds on its own. See Implementation Status.

A workspace is several Kargo packages that build together, share a dependency graph, and resolve to one consistent set of versions.

Layout

my-workspace/
├── Kargo.toml           # workspace root — [workspace] and [catalog], no [package]
├── Kargo.lock           # one lockfile for every member
├── app/
│   ├── Kargo.toml
│   └── src/main/kotlin/
├── shared/
│   ├── Kargo.toml
│   └── src/commonMain/kotlin/
└── libs/
    ├── http/Kargo.toml
    └── storage/Kargo.toml

Root manifest:

[workspace]
members = ["app", "shared", "libs/*"]
exclude = ["experimental"]

[catalog.versions]
kotlin = "2.4.21"
ktor = "2.3.0"

members accepts globs. exclude removes paths a glob would otherwise pull in — a spike directory you do not want in CI, for instance.

Depending on another member

# app/Kargo.toml
[dependencies]
shared = { path = "../shared" }
http = { path = "../libs/http" }

Path dependencies compile from source. Changing shared rebuilds app; no publishing step and no version to bump while iterating.

One lockfile

The root Kargo.lock covers every member, which is the point: two modules cannot end up on different patch versions of the same library, because there is only one resolution.

kargo lock      # from the root, relocks everything
kargo update    # updates every member together

Building

Status: 🟡 Member orchestration is planned; today, build each module from its own directory.

# planned
kargo build                      # every member, in dependency order
kargo build -p app               # one member and its path dependencies
kargo test -p shared             # one member's tests
kargo build --exclude experimental
# today
cd shared && kargo build
cd ../app && kargo build

Members with no dependency between them are intended to build in parallel; the dependency graph determines the order, so you never declare it.

Shared configuration

Settings that belong to the whole repository live at the root:

[workspace]
members = ["app", "shared"]

[catalog.versions]
kotlin = "2.4.21"

[profile.release]
optimization = true

[lint]
rules = ["naming", "style", "complexity"]

Members inherit and may override locally. Put the Kotlin version in a catalog rather than repeating it in every member — a workspace where modules compile with different compilers is a long afternoon.

When to split a module

ReasonVerdict
Two deliverables share codeSplit. This is what workspaces are for.
A library you also publish separatelySplit.
Platform-specific codeDo not split — use targets and expect/actual.
Build-time variationDo not split — use flavors.
"Modules are good architecture"Do not split. Each one adds a manifest and a boundary to maintain.

A module boundary is a dependency edge you have to keep acyclic forever. Add one when something concrete needs it.

Next