Karyo
Documentation/ Decision records

ADR 0020: The free and commercial boundary is drawn per Gradle module

Karyo 2.1.1rendered at build time
On this page

Status: Superseded by ADR 0029. Kept as history: it records how the 1.x free/commercial split was built. At the Karyo 2.0.0 release the whole product becomes one Apache-2.0 distribution and there is no commercial boundary.

Context

Karyo is offered in two halves: a free warehouse management system under Apache-2.0, and nine optional commercial engines licensed separately - event monitors, demand forecasting, slotting advice, reorder simulation, cross-docking, wave fulfilment, order streaming, document templates and cartonization.

The two halves meet at many points. A commercial engine implements an interface the free product declares, observes events the free product fires, reads tables the free product owns, and appears in the free front ends. The interfaces at those meeting points have to be readable, compilable and implementable by anyone: the free product declares seams it does not fill, and an extension author compiles against the same seams (ADR 0019).

A boundary drawn by service directory does not fit that shape. Two free domains hold a commercial capability beside free code - fulfilment beside cartonization, the document archive beside template administration - and every engine's interface module would fall on the commercial side of its directory, taking the seams with it.

Decision

  • The licence boundary is the Gradle module. Nine -core modules are commercial. Every other module is Apache-2.0, including every -api module, every SPI a commercial engine implements, and libs/karyo-license, which holds the gate mechanism.
  • No module mixes free and commercial code. Where a commercial capability belongs to a free domain it is its own module (karyo-cartonization-core beside karyo-fulfillment-core, karyo-doctemplates-core beside karyo-docstore-core), and the SPI it implements stays in the free module next to it: PackoutStrategy in karyo-fulfillment-api, DocumentTemplateProvider in libs/karyo-documents.
  • The module boundary is also the repository boundary. The nine commercial modules are not in this repository. settings.gradle.kts includes them only when a commercial checkout is present (-Pkaryo.commercial=<path> or KARYO_COMMERCIAL=<path>, or a checkout found beside this one) and takes their project directories from it; services/karyo-app depends on whichever of them were included. With nothing beside this checkout the build is the complete free product.
  • Free code never names a commercial module. The engines plug in through the SPIs and CDI events declared in the free -api modules, and are found at runtime.

Consequences

  • Whether a file is free is decided by where it lives. No list of paths has to agree with the tree, and nothing has to be filtered out of anything before it is published.
  • Free code cannot come to depend on a commercial module by accident: the free build, which is what this repository's CI runs, has no such project to resolve, so the dependency fails to build.
  • A licence cannot install code that is not on disk. A free build carries no commercial engine, so no entitlement can unlock one; such a build reports itself as the community edition (ADR 0021).
  • An image says which halves it carries. Built with commercial engines, the application image holds each one's own licence and a licence label naming the commercial terms beside Apache-2.0; built from this repository alone it holds neither, and a label that disagrees with what the image holds fails the build.
  • Anyone can build against every seam. An extension compiles against the Apache-2.0 -api modules only (ADR 0019).
  • The free repository still describes the commercial half in outline. settings.gradle.kts names the nine module directories; the engines' -api modules, their Flyway migrations (db/migration/{monitors,crossdock,wave,streaming}), their configuration keys in application.yaml and their front-end screens are all here. A free installation therefore creates the engines' tables and leaves them empty, carries their keys unread, and shows their screens, which answer with a licence refusal. The schema and the interfaces are public; the algorithms are not.
  • A change that touches both a commercial engine and the free seam it plugs into is two changes, in two repositories, reviewed and merged separately.
  • One commercial engine depends on a free -core rather than on its -api: karyo-monitors-core uses karyo-replenishment-core. The edge points the permitted way, commercial on free, and it is one of the two recorded waivers of the module rule (ADR 0006). It also means a commercial build needs this repository's source tree, not only its interface jars.

Alternatives considered

  • A boundary per service directory. Rejected. It puts each engine's -api module under the commercial licence, which takes the interfaces the free product and extension authors compile against out of Apache-2.0, and it cannot separate cartonization from free fulfilment or template administration from the free document archive, which share a directory.
  • One repository holding both halves, with the free tree produced from it by filtering. Rejected. Every filtering rule is a second place that has to agree with the first, and the free tree would be a rendering of the product rather than its source.
  • Publishing the free modules as jars for a separate commercial build to depend on. Rejected. Because one engine depends on a free -core, that would mean publishing implementation jars of the free product as well as its interfaces - a distribution channel and a versioning surface with no other reason to exist.
  • A Gradle composite build joining two independent builds. Rejected. The commercial build would need its own settings, convention plugins and version catalog, kept in step with these by hand.

Evidence

These citations describe the historical tree at commit e714516b (the parent of the change that removed the commercial overlay), not the current distribution. The overlay, LicenseEdition and the commercial-module notice no longer exist; ADR 0029 owns their replacements.

  • settings.gradle.kts, karyo.commercial overlay (historical) - the optional commercial overlay
  • services/karyo-app/build.gradle.kts, dependencies - whatever was included is picked up, along with the commercial test suites
  • services/fulfillment-service/karyo-fulfillment-api/src/main/kotlin/com/karyo/fulfillment/spi/PackoutStrategy.kt and libs/karyo-documents/src/main/kotlin/com/karyo/documents/DocumentTemplateProvider.kt - the two SPIs that stay free beside a commercial module
  • libs/karyo-license/src/main/kotlin/com/karyo/license/LicenseEdition.kt, LicenseEdition - the edition is a property of what the build contains
  • NOTICE, commercial-module notice (historical) - the nine commercial modules, named as outside the Apache grant and absent from a build of this repository alone
  • services/karyo-app/build.gradle.kts, imageLegalFiles and infrastructure/docker/Dockerfile.service, LABEL org.opencontainers.image.licenses
    • the application image states which halves it carries
  • The commercial boundary
  • Commercial engines
  • ADR 0001 - one deployable, assembled from modules
  • ADR 0006 - the -api and -core rule, and its two waivers
  • ADR 0019 - extensions build against the same seams
  • ADR 0021 - what decides which present engines may run