diff --git a/buildSrc/src/main/groovy/archunit.java-release-check-conventions.gradle b/buildSrc/src/main/groovy/archunit.java-release-check-conventions.gradle index 3ee064c31..6ee53b462 100644 --- a/buildSrc/src/main/groovy/archunit.java-release-check-conventions.gradle +++ b/buildSrc/src/main/groovy/archunit.java-release-check-conventions.gradle @@ -1,3 +1,5 @@ +import groovy.xml.XmlSlurper + import java.nio.file.Files import java.util.jar.JarFile @@ -5,6 +7,33 @@ plugins { id 'archunit.java-artifact-check-conventions' } +task ensureReleaseCheckUpToDate { + doFirst { + def mavenProject = new XmlSlurper().parseText(getExpectedPomFileContent()) + def releaseCheckDependencies = mavenProject.dependencies.dependency + .findAll { it.groupId != 'com.tngtech.archunit' } + .collect { + [groupId: it.groupId.toString(), artifactId: it.artifactId.toString(), version: it.version.toString()] + } + + releaseCheckDependencies.each { releaseCheckDependency -> + def matchingProjectDependency = dependency.values().find { + it.group == releaseCheckDependency.groupId && it.name == releaseCheckDependency.artifactId + } + assert matchingProjectDependency != null: + "No project dependency was found for expected release dependency ${releaseCheckDependency}" + assert matchingProjectDependency.version == releaseCheckDependency.version: + "Release check dependency version ${releaseCheckDependency} doesn't match " + + "project dependency version ${matchingProjectDependency}" + } + } +} +check.dependsOn(ensureReleaseCheckUpToDate) + +ext.getExpectedPomFileContent = { + getClass().getResourceAsStream("release_check/${project.name}.pom").text.replace('${archunit.version}', version).stripIndent() +} + task checkUploadedArtifacts { doLast { def tngRepoId = project.findProperty('tngRepoId') ?: rootProject.closeSonatypeStagingRepository.stagingRepositoryId.get() @@ -26,10 +55,6 @@ task checkUploadedArtifacts { new URL("${createArtifactUrl(project.name)}.pom").text.stripIndent() } - def getExpectedPomFileContent = { - getClass().getResourceAsStream("release_check/${project.name}.pom").text.replace('${archunit.version}', version).stripIndent() - } - def checkPom = { println "Verifying correct POM of ${project.name}"