File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed
moshi-gradle-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/gradle Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ plugins {
40
40
moshi {
41
41
// Opt-in to enable moshi-sealed, disabled by default.
42
42
enableSealed.set(true)
43
+ // Opt-out to disable auto-application of Moshi dependency, enabled by default.
44
+ applyMoshi.set(false)
43
45
}
44
46
```
45
47
Original file line number Diff line number Diff line change @@ -21,4 +21,9 @@ abstract class MoshiPluginExtension @Inject constructor(objects: ObjectFactory)
21
21
val generatedAnnotation: Property <String > = objects.property(String ::class .java)
22
22
/* * Enables moshi-sealed code gen. Disabled by default. */
23
23
val enableSealed: Property <Boolean > = objects.property(Boolean ::class .java).convention(false )
24
+ /* *
25
+ * Set this property to false to disable auto-application of the Moshi dependency. Enabled by
26
+ * default.
27
+ */
28
+ val applyMoshi: Property <Boolean > = objects.property(Boolean ::class .java).convention(true )
24
29
}
Original file line number Diff line number Diff line change @@ -106,10 +106,13 @@ class MoshiGradleSubplugin : KotlinCompilerPluginSupportPlugin {
106
106
val generatedAnnotation = extension.generatedAnnotation.orNull
107
107
108
108
// Minimum Moshi version
109
- project.dependencies.add(
110
- kotlinCompilation.implementationConfigurationName,
111
- " com.squareup.moshi:moshi:1.13.0" ,
112
- )
109
+ val applyMoshi = extension.applyMoshi.get()
110
+ if (applyMoshi) {
111
+ project.dependencies.add(
112
+ kotlinCompilation.implementationConfigurationName,
113
+ " com.squareup.moshi:moshi:1.13.0" ,
114
+ )
115
+ }
113
116
114
117
val enableSealed = extension.enableSealed.get()
115
118
if (enableSealed) {
You can’t perform that action at this time.
0 commit comments