Skip to content

Commit

Permalink
Apply refreshVersions plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Vampire committed Feb 16, 2023
1 parent 0ea1923 commit 4e9937f
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 0 deletions.
48 changes: 48 additions & 0 deletions gradle/build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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()
Expand Down
48 changes: 48 additions & 0 deletions gradle/dependency-updates-report-aggregation/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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()
Expand Down
33 changes: 33 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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/") {
Expand Down

0 comments on commit 4e9937f

Please sign in to comment.