Skip to content

Commit

Permalink
Make it possible to override version of Moshi dependency applied by I…
Browse files Browse the repository at this point in the history
…R plugin
  • Loading branch information
plnice committed Sep 5, 2024
1 parent e6a64e7 commit da0bcfa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions moshi-ir/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ abstract class MoshiPluginExtension @Inject constructor(objects: ObjectFactory)
val generatedAnnotation: Property<String> = objects.property(String::class.java)
/** Enables moshi-sealed code gen. Disabled by default. */
val enableSealed: Property<Boolean> = objects.property(Boolean::class.java).convention(false)
/** Moshi version to be used when applying dependency **/
val moshiVersion: Property<String> = objects.property(String::class.java).convention("1.15.1")
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit da0bcfa

Please sign in to comment.