From 4e9937fb47480ec1a5c0e30c4adaf90bffb9a46d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Kautler?= Date: Mon, 6 Feb 2023 04:06:16 +0100 Subject: [PATCH] Apply refreshVersions plugin --- gradle/build-logic/settings.gradle.kts | 48 +++++++++++++++++++ .../settings.gradle.kts | 48 +++++++++++++++++++ settings.gradle.kts | 33 +++++++++++++ 3 files changed, 129 insertions(+) diff --git a/gradle/build-logic/settings.gradle.kts b/gradle/build-logic/settings.gradle.kts index cc2ec846..b8eb9c95 100644 --- a/gradle/build-logic/settings.gradle.kts +++ b/gradle/build-logic/settings.gradle.kts @@ -14,6 +14,7 @@ * limitations under the License. */ +import de.fayard.refreshVersions.core.FeatureFlag.GRADLE_UPDATES import org.gradle.api.initialization.resolve.RepositoriesMode.FAIL_ON_PROJECT_REPOS pluginManagement { @@ -24,6 +25,53 @@ pluginManagement { } } +plugins { + id("de.fayard.refreshVersions") version "0.51.0" +} + +refreshVersions { + featureFlags { + disable(GRADLE_UPDATES) + } + rejectVersionIf { + candidate.stabilityLevel.isLessStableThan(current.stabilityLevel) + } + // work-around for https://github.com/jmfayard/refreshVersions/issues/662 + file("build/tmp/refreshVersions").mkdirs() + // work-around for https://github.com/jmfayard/refreshVersions/issues/640 + versionsPropertiesFile = file("build/tmp/refreshVersions/versions.properties") +} + +// work-around for https://github.com/jmfayard/refreshVersions/issues/596 +gradle.rootProject { + tasks.configureEach { + if (name == "refreshVersions") { + doFirst { + copy { + from(gradle.parent!!.rootProject.file("gradle/libs.versions.toml")) + into("gradle") + } + } + doLast { + // work-around for https://github.com/jmfayard/refreshVersions/issues/661 + // and https://github.com/jmfayard/refreshVersions/issues/663 + file("gradle/libs.versions.toml").apply { + readText() + .replace("⬆ =", " ⬆ =") + .replace("]\n\n", "]\n") + .replace("""(?s)^(.*)(\n\Q[plugins]\E[^\[]*)(\n.*)$""".toRegex(), "$1$3$2") + .also { writeText(it) } + } + copy { + from("gradle/libs.versions.toml") + into(gradle.parent!!.rootProject.file("gradle")) + } + delete("gradle") + } + } + } +} + dependencyResolutionManagement { repositories { mavenCentral() diff --git a/gradle/dependency-updates-report-aggregation/settings.gradle.kts b/gradle/dependency-updates-report-aggregation/settings.gradle.kts index 6a46b6c3..23d35d37 100644 --- a/gradle/dependency-updates-report-aggregation/settings.gradle.kts +++ b/gradle/dependency-updates-report-aggregation/settings.gradle.kts @@ -14,6 +14,7 @@ * limitations under the License. */ +import de.fayard.refreshVersions.core.FeatureFlag.GRADLE_UPDATES import org.gradle.api.initialization.resolve.RepositoriesMode.FAIL_ON_PROJECT_REPOS pluginManagement { @@ -23,6 +24,53 @@ pluginManagement { } } +plugins { + id("de.fayard.refreshVersions") version "0.51.0" +} + +refreshVersions { + featureFlags { + disable(GRADLE_UPDATES) + } + rejectVersionIf { + candidate.stabilityLevel.isLessStableThan(current.stabilityLevel) + } + // work-around for https://github.com/jmfayard/refreshVersions/issues/662 + file("build/tmp/refreshVersions").mkdirs() + // work-around for https://github.com/jmfayard/refreshVersions/issues/640 + versionsPropertiesFile = file("build/tmp/refreshVersions/versions.properties") +} + +// work-around for https://github.com/jmfayard/refreshVersions/issues/596 +gradle.rootProject { + tasks.configureEach { + if (name == "refreshVersions") { + doFirst { + copy { + from(gradle.parent!!.rootProject.file("gradle/libs.versions.toml")) + into("gradle") + } + } + doLast { + // work-around for https://github.com/jmfayard/refreshVersions/issues/661 + // and https://github.com/jmfayard/refreshVersions/issues/663 + file("gradle/libs.versions.toml").apply { + readText() + .replace("⬆ =", " ⬆ =") + .replace("]\n\n", "]\n") + .replace("""(?s)^(.*)(\n\Q[plugins]\E[^\[]*)(\n.*)$""".toRegex(), "$1$3$2") + .also { writeText(it) } + } + copy { + from("gradle/libs.versions.toml") + into(gradle.parent!!.rootProject.file("gradle")) + } + delete("gradle") + } + } + } +} + dependencyResolutionManagement { repositories { mavenCentral() diff --git a/settings.gradle.kts b/settings.gradle.kts index 91830d44..c748dd9e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -14,6 +14,7 @@ * limitations under the License. */ +import de.fayard.refreshVersions.core.FeatureFlag.GRADLE_UPDATES import org.gradle.api.initialization.resolve.RepositoriesMode.PREFER_SETTINGS pluginManagement { @@ -29,9 +30,41 @@ pluginManagement { } plugins { + id("de.fayard.refreshVersions") version "0.51.0" id("com.gradle.enterprise") version "3.6.1" } +refreshVersions { + featureFlags { + disable(GRADLE_UPDATES) + } + rejectVersionIf { + candidate.stabilityLevel.isLessStableThan(current.stabilityLevel) + } + // work-around for https://github.com/jmfayard/refreshVersions/issues/662 + file("build/tmp/refreshVersions").mkdirs() + // work-around for https://github.com/jmfayard/refreshVersions/issues/640 + versionsPropertiesFile = file("build/tmp/refreshVersions/versions.properties") +} + +gradle.rootProject { + tasks.configureEach { + if (name == "refreshVersions") { + doLast { + // work-around for https://github.com/jmfayard/refreshVersions/issues/661 + // and https://github.com/jmfayard/refreshVersions/issues/663 + file("gradle/libs.versions.toml").apply { + readText() + .replace("⬆ =", " ⬆ =") + .replace("]\n\n", "]\n") + .replace("""(?s)^(.*)(\n\Q[plugins]\E[^\[]*)(\n.*)$""".toRegex(), "$1$3$2") + .also { writeText(it) } + } + } + } + } +} + dependencyResolutionManagement { repositories { ivy("https://nodejs.org/dist/") {