Skip to content

Convenience Gradle plugin for reliable configuration of Kotlin & KMP projects. Made by Fluxo

License

Notifications You must be signed in to change notification settings

fluxo-kt/fluxo-kmp-conf

Repository files navigation

Fluxo-KMP-Conf

Gradle Plugin Portal JitPack Build Common Changelog

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:
Kotlin Gradle Android Gradle Plugin

How to use

Gradle Plugin Portal

// 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

JitPack

// 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
  }
}

Configuration

You can start by calling the corresponding DSL functions in the build.gradle.kts file of the target module:

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:

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:

Hierarchical KMP project structure

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

Build and development notes

  • 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.

Heavily inspired by

Versioning

Uses SemVer for versioning.

License

License

This project is licensed under the Apache License, Version 2.0 — see the license file for details.