Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish module-alignment metadata (#2075) #2082

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ apply from: script("ide")

boolean isCiServer = System.env["CI"] || System.env["GITHUB_ACTIONS"]
subprojects {
if (it.name == "spock-bom") return

apply plugin: "java-library"
apply plugin: "groovy"
apply plugin: "jacoco"
Expand Down Expand Up @@ -160,6 +162,7 @@ subprojects {
}

dependencies {
api platform(projects.spockBom)
implementation(project.name == "spock-gradle" ? [] : groovylibs.groovy)
}

Expand Down Expand Up @@ -238,7 +241,7 @@ tasks.register("collectTestXml") {
tasks.register("codeCoverageReport", JacocoReport) {
group = 'Coverage reports'
description = "Creates an aggregate coverage for the whole project."
def reportingProjects = subprojects
def reportingProjects = subprojects - project(projects.spockBom.path)
dependsOn(reportingProjects.tasks.collectMany { it.withType(Test) })

additionalSourceDirs.from(reportingProjects.sourceSets.main.allSource.srcDirs)
Expand Down Expand Up @@ -348,8 +351,8 @@ tasks.register("tagRelease", Exec) {
tasks.register("javadoc", Javadoc) {
title "Spock Framework API Documentation ($variantLessVersion)"
destinationDir file("build/javadoc/$variantLessVersion")
source subprojects.collect { project -> project.tasks.named("javadoc").map { it.source } }
classpath = files(subprojects.collect { project -> project.tasks.named("javadoc").map { it.classpath } })
source((subprojects - project(projects.spockBom.path)).collect { project -> project.tasks.named("javadoc").map { it.source } })
classpath = files((subprojects - project(projects.spockBom.path)).collect { project -> project.tasks.named("javadoc").map { it.classpath } })
}

configureJavadoc(tasks.named("javadoc"), true)
Expand All @@ -358,9 +361,9 @@ tasks.register("groovydoc", Groovydoc) {
docTitle "Spock Framework API Documentation ($variantLessVersion)"
windowTitle "Spock Framework API Documentation ($variantLessVersion)"
destinationDir file("build/groovydoc/$variantLessVersion")
source subprojects.collect { project -> project.tasks.named("groovydoc").map { it.source } }
classpath = files(subprojects.collect { project -> project.tasks.named("groovydoc").map { it.classpath } })
groovyClasspath = files(projects.spockCore.dependencyProject.tasks.named("groovydoc").map { it.groovyClasspath })
source((subprojects - project(projects.spockBom.path)).collect { project -> project.tasks.named("groovydoc").map { it.source } })
classpath = files((subprojects - project(projects.spockBom.path)).collect { project -> project.tasks.named("groovydoc").map { it.classpath } })
groovyClasspath = files(project(projects.spockCore.path).tasks.named("groovydoc").map { it.groovyClasspath })

access = GroovydocAccess.PROTECTED
processScripts = false
Expand Down
4 changes: 3 additions & 1 deletion gradle/publishMaven.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ publishing {
maven(MavenPublication) {
afterEvaluate {
pom.packaging = project.ext.packaging
if (project.ext.packaging != "pom") {
if (project.ext.packaging == "pom") {
from(components.javaPlatform)
} else {
from(components.java)
artifact(sourcesJar)
artifact(javadocJar)
Expand Down
35 changes: 13 additions & 22 deletions spock-bom/bom.gradle
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
apply from: script("publishMaven")

def modifyBom = { xml ->
def projectNode = xml.asNode()

projectNode.appendNode('properties').appendNode('spock.version', project.fullVersion)

def dependencyManagement = projectNode.appendNode('dependencyManagement').appendNode('dependencies')
plugins {
id('java-platform')
}
apply from: script('publishMaven')

def mvnProjects = project.parent.subprojects.findAll { it.plugins.hasPlugin('maven-publish') } // find all published projects
mvnProjects -= project // don't self reference
(rootProject.subprojects - project).each {
evaluationDependsOn(it.path)
}

String groupId = project.group
mvnProjects.name.each {
dependencyManagement.appendNode('dependency').with { dep ->
dep.appendNode('groupId', groupId)
dep.appendNode('artifactId', it)
dep.appendNode('version', '${spock.version}')
dependencies {
constraints {
def mvnProjects = rootProject.subprojects.findAll { it.plugins.hasPlugin('maven-publish') } // find all published projects
mvnProjects -= project // don't self reference
mvnProjects.each {
api("${it.group}:${it.name}:${it.version}")
}
}
}

ext.displayName = 'Spock Framework - Bill of Materials'
description = 'This bill of materials provides managed spock dependencies.'
ext.packaging = 'pom'

publishing.publications.maven {
pom {
withXml modifyBom
}
}
Loading