Upgrade Gradle and plugins

This commit is contained in:
Scott Frederick
2021-10-05 17:58:38 -05:00
parent 6c0d5dcfba
commit 0d249cf1ef
13 changed files with 170 additions and 125 deletions

View File

@@ -14,24 +14,15 @@
* limitations under the License.
*/
description = "Spring CredHub"
buildscript {
repositories {
gradlePluginPortal()
mavenCentral()
maven { url 'https://repo.spring.io/plugins-release' }
}
dependencies {
classpath 'io.spring.gradle:propdeps-plugin:0.0.10.RELEASE'
classpath 'io.spring.gradle:dependency-management-plugin:1.0.8.RELEASE'
classpath 'io.spring.gradle:spring-io-plugin:0.0.8.RELEASE'
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.12'
classpath 'io.spring.nohttp:nohttp-gradle:0.0.1.RELEASE'
classpath 'io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.22'
}
plugins {
id 'checkstyle'
id 'io.spring.nohttp' version '0.0.10'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'io.spring.javaformat' version '0.0.29'
}
description = "Spring CredHub"
ext {
springVersion = "5.2.5.RELEASE"
springBootVersion = "2.2.6.RELEASE"
@@ -53,57 +44,46 @@ ext {
] as String[]
}
allprojects {
configure(allprojects) {
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'propdeps'
apply plugin: 'propdeps-maven'
apply plugin: 'propdeps-idea'
apply plugin: 'propdeps-eclipse'
apply plugin: "io.spring.dependency-management"
apply plugin: 'org.asciidoctor.gradle.asciidoctor'
apply plugin: 'io.spring.nohttp'
apply plugin: 'io.spring.javaformat'
apply plugin: 'checkstyle'
checkstyle {
toolVersion = 8.29
configDir = new File("${rootProject.projectDir}/src/checkstyle")
}
group = 'org.springframework.credhub'
asciidoctor {
sourceDir = new File("docs/src/main/asciidoc")
outputDir = new File("docs/target/generated-docs")
options = [
'doctype': 'book'
]
attributes = [
'source-highlighter': 'coderay'
]
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/release' }
}
if (version =~ /((-M|-RC)[0-9]+|-SNAPSHOT)$/) {
repositories {
maven { url 'https://repo.spring.io/milestone' }
}
}
if (version.endsWith('-SNAPSHOT')) {
repositories {
maven { url 'https://repo.spring.io/snapshot' }
}
}
}
configure(allprojects - [project(':spring-credhub-docs')]) {
apply plugin: 'checkstyle'
apply plugin: 'io.spring.nohttp'
apply plugin: 'io.spring.javaformat'
checkstyle {
toolVersion = "8.45.1"
configDirectory.set(rootProject.file("src/checkstyle"))
}
if (project.hasProperty('platformVersion')) {
apply plugin: 'spring-io'
// necessary to resolve the Spring IO versions (which may include snapshots)
repositories {
maven { url "https://repo.spring.io/libs-snapshot" }
}
dependencyManagement {
springIoTestRuntime {
imports {
mavenBom("io.spring.platform:platform-bom:${platformVersion}") {
bomProperty "mockito.version", "${mockitoVersion}"
}
}
}
}
nohttp {
allowlistFile = rootProject.file("src/nohttp/allowlist.lines")
}
dependencies {
checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:0.0.29")
}
}
@@ -122,48 +102,55 @@ subprojects {
options.encoding = 'UTF-8'
}
task packageSources(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar) {
classifier = "javadoc"
from javadoc
}
artifacts {
archives packageSources
archives javadocJar
java {
registerFeature('reactive') {
usingSourceSet(sourceSets.main)
}
registerFeature('security') {
usingSourceSet(sourceSets.main)
}
registerFeature('httpclient') {
usingSourceSet(sourceSets.main)
}
registerFeature('okhttp') {
usingSourceSet(sourceSets.main)
}
registerFeature('netty') {
usingSourceSet(sourceSets.main)
}
}
javadoc {
options.encoding = 'UTF-8'
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.memberLevel = JavadocMemberLevel.PROTECTED
options.author = true
options.header = project.name
}
dependencies {
checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:0.0.22")
testCompile("junit:junit:$junitVersion")
testCompile("org.mockito:mockito-core:$mockitoVersion")
}
repositories {
mavenCentral()
}
}
configure(rootProject) {
task sourcesJar(type: Jar) {
archiveClassifier.set('sources')
from sourceSets.main.allSource
}
task javadocJar(type: Jar) {
archiveClassifier.set('javadoc')
from javadoc.destinationDir
}
task api(type: Javadoc) {
group = "Documentation"
description = "Generates aggregated Javadoc API documentation."
title = "${rootProject.description} ${version} API"
options.encoding = 'UTF-8'
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.memberLevel = JavadocMemberLevel.PROTECTED
options.author = true
options.header = rootProject.description
options.links(project.ext.javadocLinks)
@@ -184,8 +171,8 @@ configure(rootProject) {
task docsZip(type: Zip, dependsOn: [':spring-credhub-docs:asciidoctor']) {
group = 'Distribution'
classifier = 'docs'
description = "Builds -${classifier} archive containing api and reference " +
archiveClassifier.set('docs')
description = "Builds -${archiveClassifier} archive containing api and reference " +
"for deployment at docs.spring.io/spring-credhub/docs."
from(api) {
@@ -199,6 +186,16 @@ configure(rootProject) {
artifacts {
archives docsZip
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact sourcesJar
artifact javadocJar
artifact docsZip
}
}
}
task dist(dependsOn: assemble) {
group = "Distribution"

Binary file not shown.

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

18
gradlew vendored
View File

@@ -1,5 +1,21 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

18
gradlew.bat vendored
View File

@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

View File

@@ -24,6 +24,7 @@ publishing {
}
publications {
mavenJava(MavenPublication) {
suppressAllPomMetadataWarnings()
from components.java
pom {
afterEvaluate {
@@ -32,7 +33,7 @@ publishing {
}
url = "https://spring.io/projects/spring-credhub"
organization {
name = "Spring IO"
name = "VMware, Inc."
url = "https://spring.io"
}
licenses {
@@ -59,6 +60,20 @@ publishing {
}
}
}
// Published pom will use fully-qualified dependency versions and no BOMs
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom.withXml {
def dependencyManagementNode = asNode().get("dependencyManagement")
asNode().remove(dependencyManagementNode)
}
}
}
}

View File

@@ -14,6 +14,24 @@
* limitations under the License.
*/
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
maven { url "https://repo.spring.io/plugins-release" }
if (version.endsWith('-SNAPSHOT')) {
maven { url "https://repo.spring.io/plugins-snapshot" }
}
}
resolutionStrategy {
eachPlugin {
if (requested.id.id == "io.spring.javaformat") {
useModule "io.spring.javaformat:spring-javaformat-gradle-plugin:${requested.version}"
}
}
}
}
rootProject.name = 'spring-credhub'
include ':spring-credhub-core'

View File

@@ -31,19 +31,21 @@ dependencies {
compile("org.springframework:spring-web")
compile("com.fasterxml.jackson.core:jackson-databind:2.9.7")
optional("org.springframework:spring-webflux")
optional("io.projectreactor.netty:reactor-netty")
reactiveImplementation("org.springframework:spring-webflux")
reactiveImplementation("io.projectreactor.netty:reactor-netty")
compile("org.springframework.security:spring-security-oauth2-client") {
exclude module: "spring-security-web"
}
optional("org.springframework.security:spring-security-config")
securityImplementation("org.springframework.security:spring-security-config")
optional("org.apache.httpcomponents:httpclient:${httpClientVersion}") {
httpclientImplementation("org.apache.httpcomponents:httpclient:${httpClientVersion}") {
exclude(group: 'commons-logging', module: 'commons-logging')
}
optional("com.squareup.okhttp3:okhttp:${okHttp3Version}")
optional("io.netty:netty-all:${nettyVersion}")
okhttpImplementation("com.squareup.okhttp3:okhttp:${okHttp3Version}")
nettyImplementation("io.netty:netty-all:${nettyVersion}")
testImplementation("org.springframework:spring-test")
testImplementation("io.projectreactor:reactor-test")

View File

@@ -15,7 +15,7 @@
*/
plugins {
id 'org.asciidoctor.convert'
id 'org.asciidoctor.jvm.convert' version '3.2.0'
}
dependencyManagement {
@@ -27,13 +27,6 @@ dependencyManagement {
description = "Spring CredHub Documentation"
apply plugin: 'org.asciidoctor.convert'
repositories {
maven { url "https://repo.spring.io/libs-release-local" }
mavenCentral()
}
configurations {
docs
}
@@ -43,7 +36,7 @@ dependencies {
compile("io.projectreactor:reactor-core")
compile("org.springframework.boot:spring-boot-autoconfigure")
docs("io.spring.docresources:spring-doc-resources:0.1.2.RELEASE@zip")
docs("io.spring.docresources:spring-doc-resources:0.2.5@zip")
}
task prepareAsciidocBuild(type: Sync) {
@@ -59,6 +52,7 @@ task prepareAsciidocBuild(type: Sync) {
}
asciidoctor {
baseDirFollowsSourceFile()
sourceDir = file("$buildDir/asciidoc")
sources {
include '*.adoc'
@@ -69,7 +63,7 @@ asciidoctor {
}
}
logDocuments = true
backends = ["html5"]
// backends = ["html5"]
options doctype: 'book', eruby: 'erubis'
attributes 'icons': 'font',
'idprefix': '',
@@ -77,7 +71,7 @@ asciidoctor {
docinfo: 'shared',
revnumber: project.version,
'spring-version': project.version,
'branch-or-tag': project.version.endsWith('SNAPSHOT') ? 'master' : "v${project.version}",
'branch-or-tag': project.version.endsWith('SNAPSHOT') ? 'main' : "v${project.version}",
sectanchors: '',
sectnums: '',
stylesdir: "css/",

View File

@@ -18,8 +18,6 @@ description = 'Spring CredHub Integration Tests'
buildscript {
dependencies {
classpath 'io.spring.gradle:propdeps-plugin:0.0.10.RELEASE'
classpath 'io.spring.gradle:spring-io-plugin:0.0.8.RELEASE'
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
}
@@ -30,13 +28,7 @@ buildscript {
}
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'propdeps'
apply plugin: 'propdeps-maven'
apply plugin: 'propdeps-idea'
apply plugin: 'propdeps-eclipse'
apply plugin: 'org.springframework.boot'
dependencies {

View File

@@ -18,8 +18,6 @@ description = 'Spring CredHub Reactive Integration Tests'
buildscript {
dependencies {
classpath 'io.spring.gradle:propdeps-plugin:0.0.10.RELEASE'
classpath 'io.spring.gradle:spring-io-plugin:0.0.8.RELEASE'
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
}
@@ -30,13 +28,7 @@ buildscript {
}
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'propdeps'
apply plugin: 'propdeps-maven'
apply plugin: 'propdeps-idea'
apply plugin: 'propdeps-eclipse'
apply plugin: 'org.springframework.boot'
dependencies {

View File

@@ -26,19 +26,20 @@ dependencies {
compile project(':spring-credhub-core')
compile("org.springframework.boot:spring-boot-autoconfigure")
optional("org.springframework.boot:spring-boot-starter-webflux")
reactiveImplementation("org.springframework.boot:spring-boot-starter-webflux")
optional("org.springframework.security:spring-security-config")
optional("org.springframework.security:spring-security-oauth2-client")
securityImplementation("org.springframework.security:spring-security-config")
securityImplementation("org.springframework.security:spring-security-oauth2-client")
optional("org.apache.httpcomponents:httpclient") {
httpclientImplementation("org.apache.httpcomponents:httpclient") {
exclude(group: 'commons-logging', module: 'commons-logging')
}
optional("com.squareup.okhttp3:okhttp:${okHttp3Version}")
optional("io.netty:netty-all:${nettyVersion}")
okhttpImplementation("com.squareup.okhttp3:okhttp:${okHttp3Version}")
nettyImplementation("io.netty:netty-all:${nettyVersion}")
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
annotationProcessor("org.springframework.boot:spring-boot-autoconfigure-processor")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.springframework.boot:spring-boot-starter-web")

View File

@@ -0,0 +1,2 @@
// ASLv2 header
^http://www.apache.org/licenses/LICENSE-2.0.*$