Skip to content

Commit

Permalink
Introduce a task to update version catalogs (#187)
Browse files Browse the repository at this point in the history
This commit upgrades to Gradle 7.2 and offers a new plugin which is responsible
for updating version catalogs. It's an adhoc task which works similarly to the
old "useLatestVersions" task, but uses the information available in version
catalogs instead.

For now, not all notations are supported: only simple version notations are,
which means that if the catalog uses Gradle's "rich versions", then updating
would fail. Similarly, versions are expected to be found on the same line as
the declaration of an alias.

This will allow updating the micronaut core project to use version catalogs
instead of coordinates hardcoded in the build files, and will simplify the
generation/verification of BOM files.

It's worth noting that you must either apply the new update plugin, or the
old one, but it's NOT supported to have both since they use the same task
name: using a different task name would have broken the CI integration.
  • Loading branch information
melix authored Sep 1, 2021
1 parent aadd218 commit 7a07b11
Show file tree
Hide file tree
Showing 45 changed files with 1,708 additions and 135 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ Then, apply the individual plugins as desired

* `io.micronaut.build.internal.dependency-updates`:
* Configures the `com.github.ben-manes.versions` plugin to check for outdated dependencies.
*
* `io.micronaut.build.internal.version-catalog-updates`:
* An alternative to `io.micronaut.build.internal.dependency-updates` which is usable on projects that make use of Gradle's version catalogs

* `io.micronaut.build.internal.publishing`:
* Configures publishing to Sonatype OSSRH and Maven Central.
Expand Down
28 changes: 28 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,24 @@ repositories {
gradlePluginPortal()
}

sourceSets {
functionalTest {
}
}

gradlePlugin.testSourceSets(sourceSets.functionalTest)
configurations.functionalTestImplementation.extendsFrom(configurations.testImplementation)

tasks.register('functionalTest', Test) {
testClassesDirs = sourceSets.functionalTest.output.classesDirs
classpath = sourceSets.functionalTest.runtimeClasspath
useJUnitPlatform()
}

tasks.named('check') {
dependsOn(tasks.functionalTest)
}

dependencies {
implementation "commons-lang:commons-lang:2.6",
'org.grails:grails-gdoc-engine:1.0.1',
Expand All @@ -38,11 +56,17 @@ dependencies {
exclude group: 'bouncycastle', module:'bcprov-jdk14'
}

implementation 'org.tomlj:tomlj:1.0.0'

testImplementation platform("org.spockframework:spock-bom:2.0-groovy-3.0")
testImplementation "org.spockframework:spock-core"

compileOnly "org.jruby:jruby-complete:1.7.26" // Groovy bug :(
testCompileOnly "org.jruby:jruby-complete:1.7.26" // Groovy bug :(

functionalTestImplementation("org.mock-server:mockserver-netty:5.11.2")
functionalTestImplementation("org.mock-server:mockserver-client-java:5.11.2")

}

test {
Expand Down Expand Up @@ -96,6 +120,10 @@ gradlePlugin {
id = 'io.micronaut.build.internal.dependency-updates'
implementationClass = 'io.micronaut.build.MicronautDependencyUpdatesPlugin'
}
versionCatalogUpdates {
id = 'io.micronaut.build.internal.version-catalog-updates'
implementationClass = 'io.micronaut.build.catalogs.MicronautVersionCatalogUpdatePlugin'
}
docs {
id = 'io.micronaut.build.internal.docs'
implementationClass = 'io.micronaut.build.MicronautDocsPlugin'
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
projectVersion=4.0.2-SNAPSHOT
projectVersion=4.1.0-SNAPSHOT
title=Micronaut Build Plugins
projectDesc=Micronaut internal Gradle plugins. Not intended to be used in user's projects
projectUrl=https://micronaut.io
githubSlug=micronaut-projects/micronaut-build
groovyVersion=3.0.7
groovyVersion=3.0.8
micronautVersion=2.5.0
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 7a07b11

Please sign in to comment.