fix(build): isolate model catalog bundle preparation
This commit is contained in:
@@ -74,23 +74,26 @@ signing {
|
||||
}
|
||||
}
|
||||
|
||||
def bomPublicationPom = layout.buildDirectory.file('publications/bom/pom-default.xml')
|
||||
def expectedBomArtifactIds = modelIds.collect { String modelId -> "radixor-model-${modelId}" }
|
||||
def bomHasJarTasks = !tasks.withType(Jar).isEmpty()
|
||||
tasks.register('verifyPomOnlyPlatform') {
|
||||
group = 'verification'
|
||||
description = 'Verifies the POM-only model dependency-management platform.'
|
||||
dependsOn(tasks.named('generatePomFileForBomPublication'))
|
||||
inputs.file(bomPublicationPom)
|
||||
doLast {
|
||||
File pomFile = layout.buildDirectory.file('publications/bom/pom-default.xml').get().asFile
|
||||
File pomFile = bomPublicationPom.get().asFile
|
||||
Node pom = new XmlParser().parse(pomFile)
|
||||
List<Node> constraints = pom.dependencyManagement.dependencies.dependency as List<Node>
|
||||
List<String> artifactIds = constraints.collect { Node dependency -> dependency.artifactId.text() }
|
||||
List<String> expected = modelIds.collect { String modelId -> "radixor-model-${modelId}" }
|
||||
if (pom.packaging.text() != 'pom' || artifactIds != expected) {
|
||||
if (pom.packaging.text() != 'pom' || artifactIds != expectedBomArtifactIds) {
|
||||
throw new GradleException('radixor-models-bom must publish exactly the ordered model constraints as Maven packaging pom.')
|
||||
}
|
||||
if (!pom.dependencies.isEmpty()) {
|
||||
throw new GradleException('radixor-models-bom must not introduce runtime model dependencies.')
|
||||
}
|
||||
if (!tasks.withType(Jar).isEmpty()) {
|
||||
if (bomHasJarTasks) {
|
||||
throw new GradleException('radixor-models-bom must not create binary, sources, or Javadoc JARs.')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,28 +85,31 @@ signing {
|
||||
}
|
||||
}
|
||||
|
||||
def standardPublicationPom = layout.buildDirectory.file('publications/standard/pom-default.xml')
|
||||
def expectedStandardArtifactIds = defaultModelIds.collect { String modelId -> "radixor-model-${modelId}" }
|
||||
def standardHasJarTasks = !tasks.withType(Jar).isEmpty()
|
||||
tasks.register('verifyPomOnlyAggregate') {
|
||||
group = 'verification'
|
||||
description = 'Verifies the standard POM-only aggregate and its runtime model dependencies.'
|
||||
dependsOn(tasks.named('generatePomFileForStandardPublication'))
|
||||
inputs.file(standardPublicationPom)
|
||||
doLast {
|
||||
File pomFile = layout.buildDirectory.file('publications/standard/pom-default.xml').get().asFile
|
||||
File pomFile = standardPublicationPom.get().asFile
|
||||
Node pom = new XmlParser().parse(pomFile)
|
||||
List<Node> dependencies = pom.dependencies.dependency as List<Node>
|
||||
List<String> artifactIds = dependencies.collect { Node dependency ->
|
||||
dependency.artifactId.text()
|
||||
}
|
||||
List<String> expected = defaultModelIds.collect { String modelId -> "radixor-model-${modelId}" }
|
||||
if (pom.packaging.text() != 'pom') {
|
||||
throw new GradleException('radixor-models-standard must publish Maven packaging pom.')
|
||||
}
|
||||
if (artifactIds != expected || dependencies.any { Node dependency -> dependency.scope.text() != 'runtime' }) {
|
||||
if (artifactIds != expectedStandardArtifactIds || dependencies.any { Node dependency -> dependency.scope.text() != 'runtime' }) {
|
||||
throw new GradleException('radixor-models-standard must contain exactly the ordered default model runtime dependencies.')
|
||||
}
|
||||
if (artifactIds.contains('radixor-model-pl-pl-polimorf')) {
|
||||
throw new GradleException('radixor-models-standard must exclude the optional PoliMorf model.')
|
||||
}
|
||||
if (!tasks.withType(Jar).isEmpty()) {
|
||||
if (standardHasJarTasks) {
|
||||
throw new GradleException('radixor-models-standard must not create binary, sources, or Javadoc JARs.')
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user