Skip to content

Commit

Permalink
validation: Add plugins resolve validation (#151)
Browse files Browse the repository at this point in the history
Co-authored-by: Yuriy Elistratov <[email protected]>
  • Loading branch information
TopHlop and Yuriy Elistratov authored Oct 28, 2024
1 parent 131bc3e commit a472176
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

### Stack

- *No changes*
- :x: `org.jetbrains.dokka-android` removed, use `org.jetbrains.dokka`, because they were merged in [version 0.10.0](https://github.com/Kotlin/dokka/releases/tag/0.10.0)

## [2024.09.04]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ abstract class ValidateVersionCatalogTask : DefaultTask() {
fun validate() {
val catalog = dependenciesModel.get()

// Check libraries in catalog are resolvable
// Check libraries and plugins in catalog are resolvable
val configuration = createConfiguration()
configuration.addLibraries(catalog)
configuration.addPlugins(catalog)
logger.debug("Resolved dependencies:")
configuration.resolvedConfiguration
.firstLevelModuleDependencies
Expand Down Expand Up @@ -61,6 +62,15 @@ abstract class ValidateVersionCatalogTask : DefaultTask() {
}
}

private fun Configuration.addPlugins(catalog: DefaultVersionCatalog) {
catalog.plugins
.forEach { plugin ->
// Used plugin marker https://docs.gradle.org/current/userguide/plugins.html#sec:plugin_markers
val pluginNotation = "${plugin.id}:${plugin.id}.gradle.plugin:${plugin.version}"
project.dependencies.add(name, pluginNotation)
}
}

private fun DefaultVersionCatalog.checkVersionsUsed() {
val librariesVersions = libraries.map { it.versionRef }.toSet()
val pluginsVersions = plugins.map { it.versionRef }.toSet()
Expand Down
1 change: 0 additions & 1 deletion versions-stack/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ kotlin-scripting = { id = "org.jetbrains.kotlin.plugin.scripting", version.ref =
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }

dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
dokka-android = { id = "org.jetbrains.dokka-android", version.ref = "dokka" }

dagger-hilt-android = { id = "com.google.dagger.hilt.android" , version.ref = "dagger" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp"}
Expand Down

0 comments on commit a472176

Please sign in to comment.