diff --git a/moshi-ir/README.md b/moshi-ir/README.md index e6e5d535..b708db17 100644 --- a/moshi-ir/README.md +++ b/moshi-ir/README.md @@ -40,6 +40,8 @@ plugins { moshi { // Opt-in to enable moshi-sealed, disabled by default. enableSealed.set(true) + // You can use moshiVersion property to override version of Moshi dependency applied by IR plugin. + moshiVersion.set("1.15.1") } ``` diff --git a/moshi-ir/moshi-gradle-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/gradle/MoshiGradlePluginExtension.kt b/moshi-ir/moshi-gradle-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/gradle/MoshiGradlePluginExtension.kt index c07fdc61..e704c1ba 100644 --- a/moshi-ir/moshi-gradle-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/gradle/MoshiGradlePluginExtension.kt +++ b/moshi-ir/moshi-gradle-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/gradle/MoshiGradlePluginExtension.kt @@ -21,4 +21,6 @@ abstract class MoshiPluginExtension @Inject constructor(objects: ObjectFactory) val generatedAnnotation: Property = objects.property(String::class.java) /** Enables moshi-sealed code gen. Disabled by default. */ val enableSealed: Property = objects.property(Boolean::class.java).convention(false) + /** Moshi version to be used when applying dependency **/ + val moshiVersion: Property = objects.property(String::class.java).convention("1.15.1") } diff --git a/moshi-ir/moshi-gradle-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/gradle/MoshiGradleSubplugin.kt b/moshi-ir/moshi-gradle-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/gradle/MoshiGradleSubplugin.kt index 0e412298..1b11e677 100644 --- a/moshi-ir/moshi-gradle-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/gradle/MoshiGradleSubplugin.kt +++ b/moshi-ir/moshi-gradle-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/gradle/MoshiGradleSubplugin.kt @@ -105,10 +105,10 @@ class MoshiGradleSubplugin : KotlinCompilerPluginSupportPlugin { val generatedAnnotation = extension.generatedAnnotation.orNull - // Minimum Moshi version + val moshiVersion = extension.moshiVersion.get() project.dependencies.add( kotlinCompilation.implementationConfigurationName, - "com.squareup.moshi:moshi:1.15.1", + "com.squareup.moshi:moshi:$moshiVersion", ) val enableSealed = extension.enableSealed.get()