|
| 1 | +--- |
| 2 | +id: configuration |
| 3 | +sidebar_label: Configuration |
| 4 | +--- |
| 5 | + |
| 6 | +import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; |
| 7 | + |
| 8 | +<Tabs groupId="language" |
| 9 | + defaultValue="Kotlin" |
| 10 | + values={[ |
| 11 | + {label: 'Kotlin', value: 'Kotlin'}, {label: 'Groovy', value: 'Groovy'}, |
| 12 | + ]}> |
| 13 | + |
| 14 | + <TabItem value="Kotlin"> |
| 15 | + |
| 16 | + ``` kotlin title="root/build.gradle.kts" |
| 17 | + plugins { |
| 18 | + id("com.rickbusarow.module-check") version "0.13.0-SNAPSHOT" |
| 19 | + } |
| 20 | + |
| 21 | + moduleCheck { |
| 22 | + |
| 23 | + deleteUnused = true // default is false |
| 24 | + |
| 25 | + checks { |
| 26 | + overShotDependency = true // default is true |
| 27 | + redundantDependency = false // default is false |
| 28 | + unusedDependency = true // default is true |
| 29 | + mustBeApi = true // default is true |
| 30 | + inheritedDependency = true // default is true |
| 31 | + sortDependencies = false // default is false |
| 32 | + sortPlugins = false // default is false |
| 33 | + unusedKapt = true // default is true |
| 34 | + anvilFactoryGeneration = true // default is true |
| 35 | + disableAndroidResources = false // default is false |
| 36 | + disableViewBinding = false // default is false |
| 37 | + unusedKotlinAndroidExtensions = false // default is false |
| 38 | + depths = false // default is false |
| 39 | + } |
| 40 | + |
| 41 | + // allow these modules to be declared as dependency anywhere, |
| 42 | + // regardless of whether they're used |
| 43 | + ignoreUnusedFinding = setOf(":test:core-jvm", ":test:core-android") |
| 44 | + |
| 45 | + // do not check the dependencies of these modules. |
| 46 | + // in this case, :app could declare any module it wants without issue |
| 47 | + doNotCheck = setOf(":app") |
| 48 | + |
| 49 | + additionalCodeGenerators = listOf( |
| 50 | + modulecheck.config.CodeGeneratorBinding.AnnotationProcessor( |
| 51 | + name = "My Processor", |
| 52 | + generatorMavenCoordinates = "my-project.codegen:processor", |
| 53 | + annotationNames = listOf( |
| 54 | + "myproject.MyInject", |
| 55 | + "myproject.MyInject.Factory", |
| 56 | + "myproject.MyInjectParam", |
| 57 | + "myproject.MyInjectModule" |
| 58 | + ) |
| 59 | + ) |
| 60 | + ) |
| 61 | + |
| 62 | + reports { |
| 63 | + checkstyle { |
| 64 | + enabled = true // default is false |
| 65 | + outputPath = "${project.buildDir}/reports/modulecheck/checkstyle.xml" |
| 66 | + } |
| 67 | + sarif { |
| 68 | + enabled = true // default is false |
| 69 | + outputPath = "${project.buildDir}/reports/modulecheck/modulecheck.sarif" |
| 70 | + } |
| 71 | + depths { |
| 72 | + enabled = true // default is false |
| 73 | + outputPath = "${project.buildDir}/reports/modulecheck/depths.txt" |
| 74 | + } |
| 75 | + graphs { |
| 76 | + enabled = true // default is false |
| 77 | + // The root directory of all generated graphs. If set, directories will be created |
| 78 | + // for each module, mirroring the structure of the project. If this property is null, |
| 79 | + // graphs will be created in the `build/reports/modulecheck/graphs/` relative |
| 80 | + // directory of each project. |
| 81 | + outputDir = "${project.buildDir}/reports/modulecheck/graphs" |
| 82 | + } |
| 83 | + text { |
| 84 | + enabled = true // default is false |
| 85 | + outputPath = "${project.buildDir}/reports/modulecheck/report.txt" |
| 86 | + } |
| 87 | + } |
| 88 | + } |
| 89 | + ``` |
| 90 | + |
| 91 | + </TabItem> |
| 92 | + |
| 93 | + <TabItem value="Groovy"> |
| 94 | + |
| 95 | + ``` groovy title="root/build.gradle" |
| 96 | + plugins { |
| 97 | + id 'com.rickbusarow.module-check' version '0.13.0-SNAPSHOT' |
| 98 | + } |
| 99 | +
|
| 100 | + moduleCheck { |
| 101 | + deleteUnused = true // default is false |
| 102 | +
|
| 103 | + checks { |
| 104 | + overShotDependency = true // default is true |
| 105 | + redundantDependency = false // default is false |
| 106 | + unusedDependency = true // default is true |
| 107 | + mustBeApi = true // default is true |
| 108 | + inheritedDependency = true // default is true |
| 109 | + sortDependencies = false // default is false |
| 110 | + sortPlugins = false // default is false |
| 111 | + unusedKapt = true // default is true |
| 112 | + anvilFactoryGeneration = true // default is true |
| 113 | + disableAndroidResources = false // default is false |
| 114 | + disableViewBinding = false // default is false |
| 115 | + unusedKotlinAndroidExtensions = false // default is false |
| 116 | + depths = false // default is false |
| 117 | + } |
| 118 | +
|
| 119 | + // allow these modules to be declared as dependency anywhere, |
| 120 | + // regardless of whether they're used |
| 121 | + ignoreUnusedFinding = [':test:core-jvm', ':test:core-android'] |
| 122 | +
|
| 123 | + // do not check the dependencies of these modules. |
| 124 | + // in this case, :app could declare any module it wants without issue |
| 125 | + doNotCheck = [':app'] |
| 126 | +
|
| 127 | + additionalCodeGenerators = [ |
| 128 | + new modulecheck.config.CodeGeneratorBinding.AnnotationProcessor( |
| 129 | + 'My Processor', |
| 130 | + 'my-project.codegen:processor', |
| 131 | + [ |
| 132 | + "myproject.MyInject", |
| 133 | + "myproject.MyInject.Factory", |
| 134 | + "myproject.MyInjectParam", |
| 135 | + "myproject.MyInjectModule" |
| 136 | + ] |
| 137 | + ) |
| 138 | + ] |
| 139 | +
|
| 140 | + reports { |
| 141 | + checkstyle { |
| 142 | + it.enabled = true // default is false |
| 143 | + it.outputPath = "${project.buildDir}/reports/modulecheck/checkstyle.xml" |
| 144 | + } |
| 145 | + sarif { |
| 146 | + it.enabled = true // default is false |
| 147 | + it.outputPath = "${project.buildDir}/reports/modulecheck/modulecheck.sarif" |
| 148 | + } |
| 149 | + depths { |
| 150 | + it.enabled = true // default is false |
| 151 | + it.outputPath = "${project.buildDir}/reports/modulecheck/depths.txt" |
| 152 | + } |
| 153 | + graphs { |
| 154 | + it.enabled = true // default is false |
| 155 | + // The root directory of all generated graphs. If set, directories will be created |
| 156 | + // for each module, mirroring the structure of the project. If this property is null, |
| 157 | + // graphs will be created in the `build/reports/modulecheck/graphs/` relative |
| 158 | + // directory of each project. |
| 159 | + it.outputDir = "${project.buildDir}/reports/modulecheck/graphs" |
| 160 | + } |
| 161 | + text { |
| 162 | + it.enabled = true // default is false |
| 163 | + it.outputPath = "${project.buildDir}/reports/modulecheck/report.txt" |
| 164 | + } |
| 165 | + } |
| 166 | +
|
| 167 | + } |
| 168 | + ``` |
| 169 | + </TabItem> |
| 170 | +</Tabs> |
0 commit comments