From 67ff407dae9d4d8b9cfc63bd96523f2a6ff259f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Kwiecin=CC=81ski?= Date: Mon, 13 Nov 2023 21:00:35 +0100 Subject: [PATCH] Update readme --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.md b/README.md index a901467..100190b 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ licenseeForAndroid { enableResourceGeneration = false resourceFileName = "licensee_artifacts.json" singularVariantName = null + automaticCoreDependencyManagement = true } ``` @@ -49,6 +50,7 @@ licenseeForAndroid { - `enableResourceGeneration` - Enables copying _licensee_ report to asset(Android)/resource(JVM) directory, making it available under 'resourceFileName' name. - `resourceFileName` - The name of the asset/resource file the licensee report gets copied to. - `singularVariantName` - The name of the build variant that all variants will use to have always the same licensed, regardless of app variant. (i.e. `"paidRelease"`) +- `automaticCoreDependencyManagement` - Automatically add `licensee-for-android-core` core artifact as an implementation dependency for the generated code. The idea is to use the core artifact in a consumer project, and wire generated implementation via DI mechanism ### Common recipes @@ -72,6 +74,7 @@ licenseeForAndroid { ``` #### Generate Kotlin code in Kotlin-only module using licensee output from a different module +###### Gradle based approach ```groovy plugins { id("org.jetbrains.kotlin.jvm") // or any other module type @@ -102,5 +105,32 @@ tasks.named("compileKotlin") { } ``` +###### DI based approach + +`app/build.gradle`: + +```groovy +plugins { + id("com.android.application") + id("app.cash.licensee") + id("io.github.usefulness.licensee-for-android") +} +licenseeForAndroid { + enableKotlinCodeGeneration = true +} +``` +\+ provide `LicenseeForAndroid` object as `Licensee` interface + +`consumer/build.gradle`: +```groovy +plugins { + id("org.jetbrains.kotlin.jvm") // or any other module type +} + +dependencies +``` +\+ inject `Licensee` interface + + ### Credits Huge thanks to [premex-ab/gross](https://github.com/premex-ab/gross) which this plugin forked from.