Skip to content

Commit

Permalink
Use io.freefair.aggregate-javadoc plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
artembilan committed Aug 5, 2024
1 parent c1d527a commit db812c8
Showing 1 changed file with 46 additions and 36 deletions.
82 changes: 46 additions & 36 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,25 @@ plugins {
id 'org.antora' version '1.0.0'
id 'io.spring.antora.generate-antora-yml' version '0.0.1'
id 'com.github.spotbugs' version '6.0.19'
id 'io.freefair.aggregate-javadoc' version '8.6'
}

description = 'Spring AMQP'

ext {
linkHomepage = 'https://projects.spring.io/spring-amqp'
linkCi = 'https://build.spring.io/browse/AMQP'
linkIssue = 'https://jira.spring.io/browse/AMQP'
linkScmUrl = 'https://github.com/spring-projects/spring-amqp'
linkScmConnection = 'git://github.com/spring-projects/spring-amqp.git'
linkCi = 'https://build.spring.io/browse/AMQP'
linkIssue = 'https://jira.spring.io/browse/AMQP'
linkScmUrl = 'https://github.com/spring-projects/spring-amqp'
linkScmConnection = 'git://github.com/spring-projects/spring-amqp.git'
linkScmDevConnection = 'git@github.com:spring-projects/spring-amqp.git'

modifiedFiles =
files()
.from {
files(grgit.status().unstaged.modified)
.filter { f -> f.name.endsWith('.java') || f.name.endsWith('.kt') }
}
files()
.from {
files(grgit.status().unstaged.modified)
.filter { f -> f.name.endsWith('.java') || f.name.endsWith('.kt') }
}
modifiedFiles.finalizeValueOnRead()

assertjVersion = '3.26.3'
Expand Down Expand Up @@ -91,9 +92,9 @@ antora {
}

tasks.named('generateAntoraYml') {
asciidocAttributes = project.provider( {
return ['project-version' : project.version ]
} )
asciidocAttributes = project.provider({
return ['project-version': project.version]
})
baseAntoraYmlFile = file('src/reference/antora/antora.yml')
}

Expand Down Expand Up @@ -152,9 +153,9 @@ allprojects {
ext {
expandPlaceholders = '**/quick-tour.xml'
javadocLinks = [
'https://docs.oracle.com/en/java/javase/17/docs/api/',
'https://jakarta.ee/specifications/platform/9/apidocs/',
'https://docs.spring.io/spring-framework/docs/current/javadoc-api/'
'https://docs.oracle.com/en/java/javase/17/docs/api/',
'https://jakarta.ee/specifications/platform/9/apidocs/',
'https://docs.spring.io/spring-framework/docs/current/javadoc-api/'
] as String[]
}

Expand All @@ -166,7 +167,7 @@ configure(javaProjects) { subproject ->
apply plugin: 'kotlin'
apply plugin: 'kotlin-spring'

apply from: "${rootProject.projectDir}/gradle/publish-maven.gradle"
apply from: "${rootProject.projectDir}/gradle/publish-maven.gradle"

def scopeAttribute = Attribute.of('dependency.scope', String)

Expand All @@ -183,7 +184,7 @@ configure(javaProjects) { subproject ->
}

components.java.addVariantsFromConfiguration(configurations.optional) {
mapToOptional()
mapToOptional()
}

java {
Expand Down Expand Up @@ -219,7 +220,7 @@ configure(javaProjects) { subproject ->

testImplementation 'org.apache.logging.log4j:log4j-core'
testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion"
testImplementation ("org.mockito:mockito-core:$mockitoVersion") {
testImplementation("org.mockito:mockito-core:$mockitoVersion") {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
testImplementation "org.mockito:mockito-junit-jupiter:$mockitoVersion"
Expand All @@ -240,6 +241,8 @@ configure(javaProjects) { subproject ->

testImplementation 'org.jetbrains.kotlin:kotlin-reflect'
testImplementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'


}

// enable all compiler warnings; individual projects may customize further
Expand Down Expand Up @@ -368,7 +371,7 @@ project('spring-amqp') {

dependencies {
api 'org.springframework:spring-core'
api ("org.springframework.retry:spring-retry:$springRetryVersion") {
api("org.springframework.retry:spring-retry:$springRetryVersion") {
exclude group: 'org.springframework'
}
optional 'org.springframework:spring-messaging'
Expand All @@ -382,11 +385,11 @@ project('spring-amqp') {
optional 'com.fasterxml.jackson.module:jackson-module-parameter-names'
optional 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
optional 'com.fasterxml.jackson.datatype:jackson-datatype-joda'
optional ('com.fasterxml.jackson.module:jackson-module-kotlin') {
optional('com.fasterxml.jackson.module:jackson-module-kotlin') {
exclude group: 'org.jetbrains.kotlin'
}
// Spring Data projection message binding support
optional ('org.springframework.data:spring-data-commons') {
optional('org.springframework.data:spring-data-commons') {
exclude group: 'org.springframework'
exclude group: 'io.micrometer'
}
Expand Down Expand Up @@ -440,7 +443,7 @@ project('spring-rabbit') {
optional 'io.micrometer:micrometer-core'
optional 'io.micrometer:micrometer-tracing'
// Spring Data projection message binding support
optional ("org.springframework.data:spring-data-commons") {
optional("org.springframework.data:spring-data-commons") {
exclude group: 'org.springframework'
}
optional "com.jayway.jsonpath:json-path:$jaywayJsonPathVersion"
Expand All @@ -461,7 +464,7 @@ project('spring-rabbit') {
testRuntimeOnly 'com.fasterxml.jackson.core:jackson-databind'
testRuntimeOnly 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml'
testRuntimeOnly 'com.fasterxml.jackson.module:jackson-module-kotlin'
testRuntimeOnly ("junit:junit:$junit4Version") {
testRuntimeOnly("junit:junit:$junit4Version") {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
}
Expand Down Expand Up @@ -511,7 +514,7 @@ project('spring-rabbit-junit') {
api 'org.springframework:spring-web'
api 'org.junit.jupiter:junit-jupiter-api'
api "org.assertj:assertj-core:$assertjVersion"
optional ("junit:junit:$junit4Version") {
optional("junit:junit:$junit4Version") {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
optional "org.testcontainers:rabbitmq"
Expand Down Expand Up @@ -572,38 +575,45 @@ tasks.register('filterMetricsDocsContent', Copy) {
filter { line -> line.replaceAll('org.springframework.*.micrometer.', '').replaceAll('^Fully qualified n', 'N') }
}

tasks.register('api', Javadoc) {
group = 'Documentation'
description = 'Generates aggregated Javadoc API documentation.'
dependencies {
javaProjects.each {
javadoc it
}
}

javadoc {
title = "${rootProject.description} ${version} API"
options {
encoding = 'UTF-8'
memberLevel = JavadocMemberLevel.PROTECTED
author = true
header = rootProject.description
header = project.description
use = true
overview = 'src/api/overview.html'
splitIndex = true
links(project.ext.javadocLinks)
addBooleanOption('Xdoclint:syntax', true) // only check syntax with doclint
}

source javaProjects.collect { project ->
project.sourceSets.main.allJava
}
destinationDir = new File('build', 'api')
destinationDir = file('build/api')
classpath = files().from { files(javaProjects.collect { it.sourceSets.main.compileClasspath }) }
}

tasks.register('api') {
group = 'Documentation'
description = 'Generates aggregated Javadoc API documentation.'
dependsOn javadoc
}

tasks.register('schemaZip', Zip) {
group = 'Distribution'
archiveClassifier = 'schema'
description = "Builds -${archiveClassifier} archive containing all " +
"XSDs for deployment at static.springframework.org/schema."
"XSDs for deployment at static.springframework.org/schema."

javaProjects.each { subproject ->
def Set files = new HashSet()
def Properties schemas = new Properties();
Set files = new HashSet()
Properties schemas = new Properties();
def shortName = subproject.name.replaceFirst("${rootProject.name}-", '')

if (subproject.name.endsWith('-rabbit')) {
Expand Down Expand Up @@ -643,7 +653,7 @@ tasks.register('docsZip', Zip) {
include 'changelog.txt'
}

from(api) {
from(javadoc) {
into 'api'
}
}
Expand Down

0 comments on commit db812c8

Please sign in to comment.