Convenience Gradle plugin for reliable configuration of Kotlin & KMP projects.
- Completely lazy on-demand project configuration framework with many nice-to-have things out-of-the-box.
- Automatically configures hierarchical source sets, proveds convenience DSL for them.
- You can control, which targets are enabled by passing properties at build time. With no errors in modules with all targets disabled!
- Ready for Android, JS, KMP, KMM, JVM, or IDEA plugin modules.
- Allows configuring verification tasks (Detekt, Lint, BinaryCompatibilityValidator with JS support!).
- Provides merged Sarif reports for the whole project.
- Provides baseline configuration tasks.
- Convenience console tests report at the end of the build along with a merged XML report for the whole project.
- Allows using ProGuard and/or R8 as an optimizer for JVM targets.
- Enables passing of build targets via command line to control what gets configured (great for CI).
Initially made for the Fluxo state management framework and other libraries, then published for general use.
Targeted for Gradle 8+ and Kotlin 1.9+. Built with:
// in the `build.gradle.kts` of the target module.
plugins {
kotlin("multiplatform") version "2.0.21"
id("io.github.fluxo-kt.fluxo-kmp-conf") version "0.13.2" // <-- add here
}
How to use snapshots from JitPack repository
// in the `build.gradle.kts` of the target module.
plugins {
kotlin("multiplatform") version "2.0.21"
id("io.github.fluxo-kt.fluxo-kmp-conf") // ← add here, no version needed for jitpack usage
}
// in the `settings.gradle.kts` of the project
pluginManagement {
repositories {
gradlePluginPortal()
maven("https://jitpack.io") // <-- add jitpack repo
}
resolutionStrategy.eachPlugin {
if (requested.id.toString() == "io.github.fluxo-kt.fluxo-kmp-conf")
useModule("com.github.fluxo-kt.fluxo-kmp-conf:fluxo-kmp-conf:47d9c55ab6") // ← specify a version or commit
}
}
You can start by calling the corresponding DSL functions in the build.gradle.kts
file of the target module:
fkcSetupAndroidLibrary()
for the Android library setup.fkcSetupGradlePlugin()
for the Gradle plugin setup.fkcSetupKotlin()
for the regular Kotlin JVM setup of any kind.- or
fkcSetupKotlinApp()
- same but a bit tailored the JVM applications.
- or
fkcSetupMultiplatform()
for the Kotlin Multiplatform setup.
See the corresponding KDocs for more details.
Fluxo-KMP-Conf
will automatically configure the project based on the module configuration, plugins, and the targets enabled. But it's possible to tune literally tens of settings via the DSL. Here are the full listings of these settings:
FluxoConfigurationExtensionCommon
FluxoConfigurationExtensionKotlinOptions
FluxoConfigurationExtensionKotlin
FluxoConfigurationExtensionAndroid
FluxoConfigurationExtensionPublication
Only the most safe, universal, and useful settings are enabled by default, so you can start using the plugin without any additional configuration.
A few examples of configuration:
- Kotlin docs: Hierarchical project structure
- Kotlin/Native target support
- Distinguish several targets for one platform
Fluxo-KMP-Conf
automatically configures KMP projects with a hierarchical source-set structure based on the module configuration.
common
|-- commonJvm
| |-- jvm
| '-- android
'-- nonJvm
|-- commonJs
| |-- js
| '-- commonWasm (unstable, may be not available)
| |-- wasmJs
| '-- wasmWasi (experimental)
'-- native
|-- nix (unix-like systems)
| |-- apple
| | |-- ios
| | | |-- iosArm64
| | | |-- iosX64
| | | '-- iosSimulatorArm64
| | |-- macos
| | | |-- macosArm64
| | | '-- macosX64
| | |-- tvos
| | | |-- tvosArm64
| | | |-- tvosX64
| | | '-- tvosSimulatorArm64
| | '-- watchos
| | |-- watchosArm32
| | |-- watchosArm64
| | |-- watchosDeviceArm64 (tier 3)
| | |-- watchosX64
| | '-- watchosSimulatorArm64
| |-- linux
| | |-- linuxArm32Hfp (deprecated)
| | |-- linuxArm64
| | '-- linuxX64
| '-- androidNative (tier 3, can has limited set of POSIX APIs)
| |-- androidNativeArm32
| |-- androidNativeArm64
| |-- androidNativeX64
| '-- androidNativeX86
'-- mingw (Windows with limited set of POSIX APIs)
'-- mingwX64
- REQUIRES ENABLED GIT SYMLINKS for the project to work correctly during plugin development!
- not needed for the plugin usage!
- Usually it’s already enabled on Linux or macOS.
- On Windows, see this doc for more info.
- See CONTRIBUTING.md for more info on how to contribute.
- Gradle-Setup-Plugin by @arkivanov
- Gradle-Kmp-Configuration-Plugin and kotlin-components by @05nelsonm
- Slack-Gradle-Plugin (docs)
- Gradle-Spotless-Plugin from @diffplug
- AndroidX Baseline Profile Gradle Plugin
- Avito android infrastructure (docs)
Uses SemVer for versioning.
This project is licensed under the Apache License, Version 2.0 — see the license file for details.