Skip to content

Latest commit

 

History

History
93 lines (64 loc) · 3.78 KB

README.md

File metadata and controls

93 lines (64 loc) · 3.78 KB

Kradle

A portmanteau of the words Kotlin and Gradle, this is a group of Gradle plugins that aim to reduce boilerplate for regular JVM and Android modules.



Most plugins accept configuration through their respective extension blocks.

They can also be configured from the root project by applying the *-config plugins. For example, to configure the target and minimum SDK for all Android modules:

plugins {
    id("io.github.lyxnx.kradle.android-config") version "<version>"
}

kradle {
    android {
        minSdk = 21
        targetSdk = 34
    }
}

Then simply apply the respective plugin depending on whether the module is a library or application

Most plugins will also adjust their configuration if the Kotlin Multiplatform plugin is applied

Plugin Mapping

ID Class Description
io.github.lyxnx.kradle.kotlin-config io.github.lyxnx.kradle.kotlin.KotlinConfigPlugin Allows configuring of Kotlin properties for the project
io.github.lyxnx.kradle.kotlin-library io.github.lyxnx.kradle.kotlin.KotlinLibraryPlugin Applies defaults for a kotlin module
io.github.lyxnx.kradle.android-config io.github.lyxnx.kradle.android.AndroidConfigPlugin Allows configuration of Android properties for applications and libraries
io.github.lyxnx.kradle.android-application io.github.lyxnx.kradle.android.AndroidApplicationPlugin Configures Android application modules
io.github.lyxnx.kradle.android-library io.github.lyxnx.kradle.android.AndroidLibraryPlugin Configures Android library modules

Kotlin

Provides common configuration for Kotlin modules.

  • Applies the kotlin plugin
  • Configures the JVM versions
  • Configures test options (JUnit 4/Jupiter (JUnit 5))

Android

Both will:

  • Apply the org.gradle.android.cache-fix plugin (if added)
    • If not applied, a warning will be shown that can be suppressed with kradle.android.suppressCacheFixWarning=true in your gradle.properties
  • Apply the kotlin plugin
  • Configure test options from the aforementioned kotlin plugin
  • Set the minimum and target SDKs
  • Disable the aidl, renderScript, and shaders build features

Library

  • Apply the AGP com.android.library plugin
  • Disable the buildConfig, resValues, and androidResources build features

Application

  • Apply the AGP com.android.application plugin
  • Configures the debug and release build types