Search Gradle plugins

io.github.appspiriment.library

This Gradle plugin configures an Android Library module with Hilt Dependency Injection (DI) using KSP (Kotlin Symbol Processing) and does not configure KAPT. It automatically applies the Hilt plugin to the library, enabling DI functionality with KSP. The plugin features a configurable extension, `configureLibrary`, which allows you to enable Compose capabilities by setting `isComposeLibrary` to true within the extension. Additionally, the plugin updates the `appspirimentlibs.versions.toml` file to manage and include the required dependencies for the library. This plugin streamlines the setup for Android libraries, providing seamless integration with Hilt (via KSP) and optional support for Compose.

https://github.com/appspiriment/AndroidConventionPlugins

Sources: https://github.com/appspiriment/AndroidConventionPlugins

Version 0.0.3 (latest)

Created 25 February 2025.

The Android Compose Library Plugin streamlines the setup of Jetpack Compose and Hilt within your Android library modules. Leveraging the core configurations established by the Android Base Library Plugin, this plugin not only takes care of the fundamental settings like applying the Android and Kotlin plugins, setting SDK versions, and defining build types, but also automates the configuration of Compose build features, sets the correct Kotlin compiler extension version, and adds all the essential Compose dependencies. This includes UI, tooling, and testing libraries. Furthermore, it integrates Hilt by applying the necessary Hilt plugins and adding the required Hilt dependencies. By using this plugin, you can quickly enable Compose and Hilt in your library modules and ensure that all the necessary components are correctly configured, allowing you to start building beautiful and reactive UIs with ease while benefiting from dependency injection. It ensures that your library modules are consistently configured with the base settings, Hilt, and Compose.

Add this plugin to your build using the plugins DSL:

plugins {
  id("io.github.appspiriment.library") version "0.0.3"
}

See also:

  • Adding the plugin to build logic for usage in precompiled script plugins.

    See the relevant documentation for more information.

    Add this plugin as a dependency to <convention-plugins-build>/build.gradle(.kts):

    dependencies {
      implementation("io.github.appspiriment.library:io.github.appspiriment.library.gradle.plugin:0.0.3")
    }
    It can then be applied in the precompiled script plugin:
    plugins {
      id("io.github.appspiriment.library")
    }
  • The legacy method of plugin application. See the relevant documentation for more information.
    buildscript {
      repositories {
        gradlePluginPortal()
      }
      dependencies {
        classpath("io.github.appspiriment.library:io.github.appspiriment.library.gradle.plugin:0.0.3")
      }
    }
    
    apply(plugin = "io.github.appspiriment.library")
  • Applying plugins to all subprojects .