Skip to content

Commit 11a41d2

Browse files
committed
Merge branch 'main' into psi_resolution_WIP_2
* main: parse the declarations of named companion objects and their members fixes #705 use graphviz-java for dot graph generation Update dependency com.autonomousapps.dependency-analysis to v1.4.0 Update dependency com.osacky.doctor to v0.8.1 update website actions to use node 18.x treat annotation processor dependencies the same as runtime dependencies for `McProject.uses()` and overshot behavior (#701) # Conflicts: # modulecheck-gradle/plugin/src/main/kotlin/modulecheck/gradle/internal/GradleProjectProvider.kt # modulecheck-project/testing/build.gradle.kts # modulecheck-project/testing/src/main/kotlin/modulecheck/project/test/McProjectBuilder.kt # modulecheck-project/testing/src/main/kotlin/modulecheck/project/test/ProjectCollector.kt
2 parents c3c2dce + 38f42df commit 11a41d2

File tree

139 files changed

+5323
-1168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+5323
-1168
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ jobs:
210210
- name: Set up Node
211211
uses: actions/setup-node@v3
212212
with:
213-
node-version: 16.x
213+
node-version: 18.x
214214
cache: yarn
215215
cache-dependency-path: website/yarn.lock
216216

.github/workflows/website.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Set up Node
2222
uses: actions/setup-node@v3
2323
with:
24-
node-version: 14.x
24+
node-version: 18.x
2525
cache: yarn
2626
cache-dependency-path: website/yarn.lock
2727

artifacts.json

+36-20
Original file line numberDiff line numberDiff line change
@@ -281,26 +281,42 @@
281281
},
282282
{
283283
"gradlePath": ":modulecheck-gradle:platforms:internal-android",
284-
"group": "com.rickbusarow.modulecheck",
285-
"artifactId": "modulecheck-gradle-platform-internal-android",
286-
"description": "Fast dependency graph linting for Gradle projects",
287-
"packaging": "jar",
288-
"javaVersion": "11"
289-
},
290-
{
291-
"gradlePath": ":modulecheck-gradle:platforms:internal-jvm",
292-
"group": "com.rickbusarow.modulecheck",
293-
"artifactId": "modulecheck-gradle-platform-internal-jvm",
294-
"description": "Fast dependency graph linting for Gradle projects",
295-
"packaging": "jar",
296-
"javaVersion": "11"
297-
},
298-
{
299-
"gradlePath": ":modulecheck-parsing:source:api",
300-
"group": "com.rickbusarow.modulecheck",
301-
"artifactId": "modulecheck-parsing-source-api",
302-
"description": "Fast dependency graph linting for Gradle projects",
303-
"packaging": "jar",
284+
"group" : "com.rickbusarow.modulecheck",
285+
"artifactId" : "modulecheck-gradle-platform-internal-android",
286+
"description" : "Fast dependency graph linting for Gradle projects",
287+
"packaging" : "jar",
288+
"javaVersion" : "11"
289+
},
290+
{
291+
"gradlePath" : ":modulecheck-gradle:platforms:internal-jvm",
292+
"group" : "com.rickbusarow.modulecheck",
293+
"artifactId" : "modulecheck-gradle-platform-internal-jvm",
294+
"description" : "Fast dependency graph linting for Gradle projects",
295+
"packaging" : "jar",
296+
"javaVersion" : "11"
297+
},
298+
{
299+
"gradlePath" : ":modulecheck-model:dependency:api",
300+
"group" : "com.rickbusarow.modulecheck",
301+
"artifactId" : "modulecheck-model-dependency-api",
302+
"description" : "Fast dependency graph linting for Gradle projects",
303+
"packaging" : "jar",
304+
"javaVersion" : "11"
305+
},
306+
{
307+
"gradlePath" : ":modulecheck-model:dependency:impl",
308+
"group" : "com.rickbusarow.modulecheck",
309+
"artifactId" : "modulecheck-model-dependency-impl",
310+
"description" : "Fast dependency graph linting for Gradle projects",
311+
"packaging" : "jar",
312+
"javaVersion" : "11"
313+
},
314+
{
315+
"gradlePath" : ":modulecheck-parsing:source:api",
316+
"group" : "com.rickbusarow.modulecheck",
317+
"artifactId" : "modulecheck-parsing-source-api",
318+
"description" : "Fast dependency graph linting for Gradle projects",
319+
"packaging" : "jar",
304320
"javaVersion": "11"
305321
},
306322
{

detekt/detekt-baseline.xml

+77-74
Large diffs are not rendered by default.

gradle/libs.versions.toml

+7-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ benManes-versions = "0.42.0"
2222
changeTracker = "0.7.4"
2323
coil = "1.3.2"
2424
compileSdk = "30"
25-
dependencyAnalysis = "1.3.0"
25+
dependencyAnalysis = "1.4.0"
2626
detekt = "1.20.0-RC2"
2727
dokka = "1.6.21"
2828
dropbox-dependencyGuard = "0.3.0"
@@ -32,7 +32,8 @@ google-accompanist = "0.18.0"
3232
google-dagger = "2.42"
3333
google-material = "1.4.0"
3434

35-
gradleDoctor = "0.8.0"
35+
gradleDoctor = "0.8.1"
36+
graphviz = "0.18.1"
3637
groovy = "3.0.10"
3738
jUnit = "5.8.2"
3839
javaParser = "3.24.2"
@@ -112,6 +113,10 @@ google-dagger-compiler = { module = "com.google.dagger:dagger-compiler", version
112113

113114
google-ksp = { module = "com.google.devtools.ksp:symbol-processing-gradle-plugin", version.ref = "google-ksp" }
114115

116+
graphviz-java = { module = "guru.nidi:graphviz-java", version.ref = "graphviz" }
117+
graphviz-java-min = { module = "guru.nidi:graphviz-java-min-deps", version.ref = "graphviz" }
118+
graphviz-kotlin = { module = "guru.nidi:graphviz-kotlin", version.ref = "graphviz" }
119+
115120
groovy = { module = "org.codehaus.groovy:groovy", version.ref = "groovy" }
116121
groovyXml = { module = "org.codehaus.groovy:groovy-xml", version.ref = "groovy" }
117122

modulecheck-api/build.gradle.kts

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ dependencies {
2929

3030
api(project(path = ":modulecheck-finding:api"))
3131
api(project(path = ":modulecheck-finding:name"))
32+
api(project(path = ":modulecheck-model:dependency:api"))
3233
api(project(path = ":modulecheck-parsing:android"))
3334
api(project(path = ":modulecheck-parsing:gradle:model:api"))
3435
api(project(path = ":modulecheck-parsing:source:api"))
@@ -40,6 +41,8 @@ dependencies {
4041

4142
implementation(libs.kotlin.compiler)
4243

44+
implementation(project(path = ":modulecheck-config:api"))
45+
4346
testImplementation(libs.bundles.hermit)
4447
testImplementation(libs.bundles.jUnit)
4548
testImplementation(libs.bundles.kotest)

modulecheck-api/src/main/kotlin/modulecheck/api/context/AndroidResourceDeclaredNames.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ data class AndroidResourceDeclaredNames(
7575
.mapAsyncNotNull { tpd ->
7676

7777
val transitiveSourceSetName = tpd.source.declaringSourceSetName(
78-
isAndroid = tpd.source.project(project.projectCache).isAndroid()
78+
isAndroid = tpd.source.project(project).isAndroid()
7979
)
8080

81-
tpd.contributed.project(project.projectCache)
81+
tpd.contributed.project(project)
8282
.androidUnqualifiedDeclarationNamesForSourceSetName(transitiveSourceSetName)
8383
} else flowOf()
8484

modulecheck-api/src/main/kotlin/modulecheck/api/context/AnvilGraph.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import kotlinx.coroutines.flow.filter
2020
import kotlinx.coroutines.flow.filterIsInstance
2121
import kotlinx.coroutines.flow.firstOrNull
2222
import kotlinx.coroutines.flow.mapNotNull
23-
import modulecheck.parsing.gradle.model.ConfiguredProjectDependency
23+
import modulecheck.model.dependency.ProjectDependency
2424
import modulecheck.parsing.gradle.model.SourceSetName
2525
import modulecheck.parsing.source.AnvilScopeName
2626
import modulecheck.parsing.source.AnvilScopeNameEntry
@@ -162,7 +162,7 @@ data class AnvilGraph(
162162
.orEmpty()
163163
.asFlow()
164164
.mapNotNull { cpd ->
165-
cpd.project(project.projectCache)
165+
cpd.project(project)
166166
.declarations()
167167
.get(SourceSetName.MAIN, includeUpstream = true)
168168
.filter { maybeExtraReferences.contains(it) }
@@ -183,7 +183,7 @@ data class AnvilGraph(
183183
return AnvilScopeName(rawScopeName)
184184
}
185185

186-
private fun McProject.dependenciesBySourceSetName(): Map<SourceSetName, List<ConfiguredProjectDependency>> {
186+
private fun McProject.dependenciesBySourceSetName(): Map<SourceSetName, List<ProjectDependency>> {
187187
return configurations
188188
.map { (configurationName, _) ->
189189
configurationName.toSourceSetName() to projectDependencies[configurationName].orEmpty()

modulecheck-api/src/main/kotlin/modulecheck/api/context/AnvilScopeDependencies.kt

+5-6
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,22 @@
1515

1616
package modulecheck.api.context
1717

18-
import modulecheck.parsing.gradle.model.ConfiguredProjectDependency
18+
import modulecheck.model.dependency.ProjectDependency
1919
import modulecheck.parsing.gradle.model.SourceSetName
2020
import modulecheck.project.McProject
2121
import modulecheck.project.ProjectContext
2222
import modulecheck.project.project
2323
import modulecheck.utils.cache.SafeCache
2424

2525
data class AnvilScopeDependencies(
26-
private val delegate: SafeCache<SourceSetName, List<ConfiguredProjectDependency>>,
26+
private val delegate: SafeCache<SourceSetName, List<ProjectDependency>>,
2727
private val project: McProject
2828
) : ProjectContext.Element {
2929

3030
override val key: ProjectContext.Key<AnvilScopeDependencies>
3131
get() = Key
3232

33-
suspend fun get(sourceSetName: SourceSetName): List<ConfiguredProjectDependency> {
33+
suspend fun get(sourceSetName: SourceSetName): List<ProjectDependency> {
3434
return delegate.getOrPut(sourceSetName) {
3535
val merged = project.anvilScopeMergesForSourceSetName(sourceSetName)
3636

@@ -43,8 +43,7 @@ data class AnvilScopeDependencies(
4343
.distinct()
4444
.filter { cpd ->
4545

46-
val contributed = cpd
47-
.project(project.projectCache)
46+
val contributed = cpd.project(project)
4847
.anvilScopeContributionsForSourceSetName(cpd.configurationName.toSourceSetName())
4948

5049
contributed.any { (scopeName, _) ->
@@ -67,4 +66,4 @@ suspend fun ProjectContext.anvilScopeDependencies(): AnvilScopeDependencies =
6766

6867
suspend fun ProjectContext.anvilScopeDependenciesForSourceSetName(
6968
sourceSetName: SourceSetName
70-
): List<ConfiguredProjectDependency> = anvilScopeDependencies().get(sourceSetName)
69+
): List<ProjectDependency> = anvilScopeDependencies().get(sourceSetName)

modulecheck-api/src/main/kotlin/modulecheck/api/context/ClasspathDependencies.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
package modulecheck.api.context
1717

18+
import modulecheck.model.dependency.TransitiveProjectDependency
1819
import modulecheck.parsing.gradle.model.ConfigurationName
1920
import modulecheck.parsing.gradle.model.SourceSetName
20-
import modulecheck.parsing.gradle.model.TransitiveProjectDependency
2121
import modulecheck.project.McProject
2222
import modulecheck.project.ProjectContext
2323
import modulecheck.utils.cache.SafeCache

modulecheck-api/src/main/kotlin/modulecheck/api/context/Declarations.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import kotlinx.coroutines.flow.toList
1919
import modulecheck.api.context.Declarations.DeclarationsKey.ALL
2020
import modulecheck.api.context.Declarations.DeclarationsKey.WithUpstream
2121
import modulecheck.api.context.Declarations.DeclarationsKey.WithoutUpstream
22-
import modulecheck.parsing.gradle.model.ConfiguredProjectDependency
22+
import modulecheck.model.dependency.ProjectDependency
2323
import modulecheck.parsing.gradle.model.SourceSetName
2424
import modulecheck.parsing.source.DeclaredName
2525
import modulecheck.project.McProject
@@ -114,7 +114,7 @@ data class Declarations private constructor(
114114

115115
suspend fun ProjectContext.declarations(): Declarations = get(Declarations)
116116

117-
suspend fun ConfiguredProjectDependency.declarations(
117+
suspend fun ProjectDependency.declarations(
118118
projectCache: ProjectCache
119119
): LazySet<DeclaredName> {
120120
val project = projectCache.getValue(path)

modulecheck-api/src/main/kotlin/modulecheck/api/context/DependencySources.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ package modulecheck.api.context
1717

1818
import modulecheck.api.context.DependencySources.SourceResult.Found
1919
import modulecheck.api.context.DependencySources.SourceResult.NOT_PRESENT
20-
import modulecheck.parsing.gradle.model.ConfiguredProjectDependency
20+
import modulecheck.model.dependency.ProjectDependency
2121
import modulecheck.parsing.gradle.model.ProjectPath
2222
import modulecheck.parsing.gradle.model.SourceSetName
2323
import modulecheck.project.McProject
@@ -36,7 +36,7 @@ data class DependencySources(
3636
)
3737

3838
sealed interface SourceResult {
39-
data class Found(val sourceDependency: ConfiguredProjectDependency) : SourceResult
39+
data class Found(val sourceDependency: ProjectDependency) : SourceResult
4040
object NOT_PRESENT : SourceResult
4141
}
4242

@@ -47,7 +47,7 @@ data class DependencySources(
4747
dependencyProjectPath: ProjectPath,
4848
sourceSetName: SourceSetName,
4949
isTestFixture: Boolean
50-
): ConfiguredProjectDependency? {
50+
): ProjectDependency? {
5151

5252
val key = SourceKey(
5353
sourceSetName = sourceSetName,
@@ -91,7 +91,7 @@ suspend fun McProject.requireSourceOf(
9191
dependencyProject: McProject,
9292
sourceSetName: SourceSetName,
9393
isTestFixture: Boolean
94-
): ConfiguredProjectDependency {
94+
): ProjectDependency {
9595
return dependencySources().sourceOfOrNull(
9696
dependencyProjectPath = dependencyProject.path,
9797
sourceSetName = sourceSetName,

modulecheck-api/src/main/kotlin/modulecheck/api/context/Depths.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ data class Depths(
4444

4545
private suspend fun fetchForSourceSet(sourceSetName: SourceSetName): ProjectDepth {
4646
val (childDepth, children) = project.projectDependencies[sourceSetName]
47-
.map { it.project(project.projectCache) }
47+
.map { it.project(project) }
4848
.distinct()
4949
.map { it.depthForSourceSetName(SourceSetName.MAIN) }
5050
.groupBy { it.depth }

modulecheck-api/src/main/kotlin/modulecheck/api/context/DownstreamProjects.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
package modulecheck.api.context
1717

18-
import modulecheck.parsing.gradle.model.DownstreamDependency
18+
import modulecheck.model.dependency.DownstreamDependency
1919
import modulecheck.project.McProject
2020
import modulecheck.project.ProjectContext
2121
import modulecheck.project.project
@@ -38,11 +38,11 @@ data class DownstreamProjects(
3838
otherProject
3939
.classpathDependencies()
4040
.all()
41-
.filter { it.contributed.project(project.projectCache) == project }
41+
.filter { it.contributed.project(project) == project }
4242
.map { transitive ->
4343
DownstreamDependency(
4444
dependentProjectPath = otherProject.path,
45-
configuredProjectDependency = transitive.withContributedConfiguration().contributed
45+
projectDependency = transitive.withContributedConfiguration().contributed
4646
)
4747
}
4848
}

modulecheck-api/src/main/kotlin/modulecheck/api/context/KaptDependencies.kt

+8-4
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515

1616
package modulecheck.api.context
1717

18+
import modulecheck.model.dependency.ConfiguredDependency
1819
import modulecheck.parsing.gradle.model.ConfigurationName
19-
import modulecheck.parsing.gradle.model.ConfiguredDependency
20+
import modulecheck.parsing.gradle.model.MavenCoordinates
2021
import modulecheck.parsing.gradle.model.all
2122
import modulecheck.project.McProject
2223
import modulecheck.project.ProjectContext
@@ -48,16 +49,19 @@ data class KaptDependencies(
4849
val allDependencies = external + internal
4950

5051
allDependencies
51-
.filterNot { it.name == KAPT_PLUGIN_COORDS }
52+
.filterNot { it.identifier == KAPT_PLUGIN_COORDS }
5253
.filter { it.configurationName == configurationName }
5354
.toSet()
5455
}
5556
}
5657

5758
companion object Key : ProjectContext.Key<KaptDependencies> {
5859

59-
internal const val KAPT_PLUGIN_COORDS =
60-
"org.jetbrains.kotlin:kotlin-annotation-processing-gradle"
60+
internal val KAPT_PLUGIN_COORDS = MavenCoordinates(
61+
group = "org.jetbrains.kotlin",
62+
moduleName = "kotlin-annotation-processing-gradle",
63+
version = null
64+
)
6165

6266
override suspend operator fun invoke(project: McProject): KaptDependencies {
6367
return KaptDependencies(SafeCache(), project)

0 commit comments

Comments
 (0)