Skip to content

Commit a6474c6

Browse files
committed
prepare for release of 0.12.4
1 parent fa9b603 commit a6474c6

25 files changed

+1100
-3
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# 0.12.4
2+
3+
### 🐛 Bug Fixes
4+
5+
* don't crash if Anvil isn't in the buildScript classpath by @RBusarow
6+
in https://github.com/RBusarow/ModuleCheck/pull/944
7+
* ignore suppress/noinspection names which don't fit the FindingName pattern by @RBusarow
8+
in https://github.com/RBusarow/ModuleCheck/pull/945
9+
10+
### Other Changes
11+
12+
* GitHub release notes config by @RBusarow in https://github.com/RBusarow/ModuleCheck/pull/946
13+
14+
**Full Changelog**: https://github.com/RBusarow/ModuleCheck/compare/0.12.3...0.12.4
15+
116
# 0.12.3
217

318
### 🐛 Bug Fixes
@@ -149,7 +164,9 @@
149164
- revert KaptMatcher name
150165
to `modulecheck.api.KaptMatcher` [@RBusarow](https://github.com/RBusarow) ([#613](https://github.com/rbusarow/ModuleCheck/pull/613))
151166
-
167+
152168
delete `ConfiguredModule` [@RBusarow](https://github.com/RBusarow) ([#609](https://github.com/rbusarow/ModuleCheck/pull/609))
169+
153170
- disable the "use tab character" option in IDE
154171
codestyle [@RBusarow](https://github.com/RBusarow) ([#607](https://github.com/rbusarow/ModuleCheck/pull/607))
155172
- replace `java-test-fixtures` usages with `-testing`

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pluginManagement {
3737
// top-level build.gradle.kts
3838

3939
plugins {
40-
id("com.rickbusarow.module-check") version "0.12.3"
40+
id("com.rickbusarow.module-check") version "0.12.4"
4141
}
4242
```
4343

build-logic/mcbuild/src/main/kotlin/modulecheck/builds/publishing.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2021-2022 Rick Busarow
2+
* Copyright (C) 2021-2023 Rick Busarow
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.
55
* You may obtain a copy of the License at
@@ -34,7 +34,7 @@ import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask
3434

3535
const val GROUP = "com.rickbusarow.modulecheck"
3636
const val PLUGIN_ID = "com.rickbusarow.module-check"
37-
const val VERSION_NAME = "0.13.0-SNAPSHOT"
37+
const val VERSION_NAME = "0.12.4"
3838
const val SOURCE_WEBSITE = "https://github.com/rbusarow/ModuleCheck"
3939
const val DOCS_WEBSITE = "https://rbusarow.github.io/ModuleCheck"
4040

website/src/pages/changelog.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
## 0.12.4
2+
3+
#### 🐛 Bug Fixes
4+
5+
* don't crash if Anvil isn't in the buildScript classpath by @RBusarow
6+
in https://github.com/RBusarow/ModuleCheck/pull/944
7+
* ignore suppress/noinspection names which don't fit the FindingName pattern by @RBusarow
8+
in https://github.com/RBusarow/ModuleCheck/pull/945
9+
10+
#### Other Changes
11+
12+
* GitHub release notes config by @RBusarow in https://github.com/RBusarow/ModuleCheck/pull/946
13+
14+
**Full Changelog**: https://github.com/RBusarow/ModuleCheck/compare/0.12.3...0.12.4
15+
116
## 0.12.3
217

318
#### 🐛 Bug Fixes
@@ -149,7 +164,9 @@
149164
- revert KaptMatcher name
150165
to `modulecheck.api.KaptMatcher` [@RBusarow](https://github.com/RBusarow) ([#613](https://github.com/rbusarow/ModuleCheck/pull/613))
151166
-
167+
152168
delete `ConfiguredModule` [@RBusarow](https://github.com/RBusarow) ([#609](https://github.com/rbusarow/ModuleCheck/pull/609))
169+
153170
- disable the "use tab character" option in IDE
154171
codestyle [@RBusarow](https://github.com/RBusarow) ([#607](https://github.com/rbusarow/ModuleCheck/pull/607))
155172
- replace `java-test-fixtures` usages with `-testing`
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
---
2+
id: ci-workflow
3+
4+
sidebar_label: CI Workflow
5+
6+
title: CI Workflow
7+
---
8+
9+
ModuleCheck will automatically fix most issues. Most CI platforms are able to commit changes, and
10+
automatically cancel out-of-date jobs when the branch has been updated. This tooling can be used to
11+
apply ModuleCheck's automatic fixes (if any) as part of a CI run, then cancel and start a new run.
12+
This is similar to a git pre-commit hook, except the work is delegated to a build server.
13+
14+
### Using CI over git hooks
15+
16+
The traditional method for applying changes automatically is with a git hook, such as pre-commit or
17+
pre-push. But if the task-to-be-automated has a runtime of more than a few seconds, this is a poor
18+
developer experience. With a CI task, the execution is done automatically and asynchronously, while
19+
the developer is already moving on to something else.
20+
21+
A git hook also technically doesn't guarantee that a task is executed before code is checked in to a
22+
main branch, since there's no guarantee that a hook is enabled. With CI, the task will output a
23+
status check. If a branch protection rule is enabled, that status check can be required. This will
24+
then guarantee that the task has run (successfully) before any code is checked in to the protected
25+
branch.
26+
27+
### Example Flow chart
28+
29+
This is a simplified flowchart of how I would run ModuleCheck with unit tests in CI. The
30+
cancellation, test, and ModuleCheck jobs run in parallel on three different runners. This is an
31+
"optimistic" workflow, in that it assumes that the `modulecheck` task will not generate changes
32+
which would trigger a restart.
33+
34+
```mermaid
35+
flowchart TB
36+
Start(CI Start):::good --> mGraph
37+
Start --> tGraph
38+
Start --> cGraph
39+
40+
subgraph mGraph [runner 1]
41+
direction TB
42+
ModuleCheck(./gradlew moduleCheckAuto):::code --> ChangesModuleCheck
43+
ChangesModuleCheck{Graph changes?} --- yesM[yes]:::lineLabel --> CommitModuleCheck(Commit changes and push):::stop
44+
ChangesModuleCheck --- noM[no]:::lineLabel --> EndModuleCheck("#10003;"):::good
45+
end
46+
47+
subgraph tGraph [runner 2]
48+
direction TB
49+
Tests(./gradlew test):::code --> EndTests("#10003;"):::good
50+
end
51+
52+
subgraph cGraph [runner 3]
53+
direction TB
54+
Cancel(Cancel previous CI run):::code
55+
end
56+
57+
style tGraph fill:#EEE,stroke:#000
58+
style cGraph fill:#EEE,stroke:#000
59+
style mGraph fill:#EEE,stroke:#000
60+
61+
classDef good fill:#0B0,stroke:#000
62+
classDef stop fill:#E33,stroke:#000
63+
64+
classDef code fill:#AAA,stroke:#000
65+
66+
style ChangesModuleCheck fill:#CD1,stroke:#000
67+
68+
classDef lineLabel fill:#FFF,stroke:#FFF
69+
```
70+
71+
### Example GitHub Action
72+
73+
Here's an Action which will run ModuleCheck, then commit any changes
74+
using [Stefanzweifel's auto-commit](https://github.com/stefanzweifel/git-auto-commit-action). This
75+
requires a personal access token secret, or the commit step will fail.
76+
77+
```yaml title=.github/workflows.module-check.yml
78+
name: ModuleCheck
79+
80+
on:
81+
pull_request:
82+
83+
jobs:
84+
85+
cancel-stale-jobs:
86+
name: Cancel stale jobs
87+
runs-on: ubuntu-latest
88+
89+
steps:
90+
# cancel previous jobs
91+
- name: Cancel Previous Runs
92+
uses: styfle/[email protected]
93+
env:
94+
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
95+
96+
ModuleCheck:
97+
name: ModuleCheck
98+
runs-on: ubuntu-latest
99+
100+
steps:
101+
- uses: actions/checkout@v2
102+
with:
103+
ref: ${{ github.event.pull_request.head.ref }}
104+
# Must use a personal access token in order to commit changes
105+
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
106+
fetch-depth: 0
107+
108+
- name: Set up JDK
109+
uses : actions/setup-java@v2
110+
with :
111+
distribution : 'temurin'
112+
java-version : '11'
113+
114+
# performs tree-shaking on the Gradle dependency graph
115+
- name: modulecheck
116+
run: ./gradlew moduleCheckAuto --no-daemon
117+
118+
# If ModuleCheck generated changes, commit and push those changes.
119+
# If there are no changes, then this is a no-op.
120+
- name: commit changes
121+
uses: stefanzweifel/git-auto-commit-action@v4
122+
with:
123+
commit_message: Apply ModuleCheck changes
124+
commit_options: '--no-verify --signoff'
125+
126+
tests:
127+
name: Unit tests
128+
runs-on: ubuntu-latest
129+
130+
steps:
131+
- uses: actions/checkout@v2
132+
with:
133+
ref: ${{ github.event.pull_request.head.ref }}
134+
token: ${{ secrets.GITHUB_TOKEN }}
135+
fetch-depth: 0
136+
137+
- name: Set up JDK
138+
uses : actions/setup-java@v2
139+
with :
140+
distribution : 'temurin'
141+
java-version : '14'
142+
143+
- name: all tests
144+
run: ./gradlew test --no-daemon
145+
```
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
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

Comments
 (0)