Skip to content

Commit fd26e2d

Browse files
committed
Don't set defaultVersionCatalogFile if there's no version catalog
Fixes #698
1 parent 6a5c0af commit fd26e2d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

plugins/core/src/main/kotlin/de/fayard/refreshVersions/core/RefreshVersionsCorePlugin.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ open class RefreshVersionsCorePlugin : Plugin<Project> {
2525
group = "refreshVersions"
2626
description = "Search for new dependencies versions and update $versionsFileName"
2727
if (shouldUpdateVersionCatalogs) {
28-
this.defaultVersionCatalog = VersionsCatalogs.getDefault(project)
29-
this.defaultVersionCatalogFile = project.file(VersionsCatalogs.LIBS_VERSIONS_TOML)
28+
this.defaultVersionCatalog = VersionsCatalogs.getDefault(project)?.also {
29+
this.defaultVersionCatalogFile = project.file(VersionsCatalogs.LIBS_VERSIONS_TOML)
30+
}
3031
}
3132
rootProjectSettingsFile = project.file("settings.gradle.kts").let { kotlinDslSettings ->
3233
if (kotlinDslSettings.exists()) kotlinDslSettings else {

plugins/core/src/main/kotlin/de/fayard/refreshVersions/core/RefreshVersionsTask.kt

+1-2
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ open class RefreshVersionsTask : DefaultTask() {
129129
if (versionPropertiesUpdated) OutputFile.VERSIONS_PROPERTIES.logFileWasModified()
130130

131131
if (shouldUpdateVersionCatalogs) {
132-
val libsToml = defaultVersionCatalogFile!!
133-
if (libsToml.canRead()) {
132+
defaultVersionCatalogFile?.let { libsToml ->
134133
val updated = VersionsCatalogUpdater(
135134
file = libsToml,
136135
dependenciesUpdates = result.dependenciesUpdatesForVersionCatalog

0 commit comments

Comments
 (0)