diff --git a/build.gradle b/build.gradle index 4522ba8..0b28595 100644 --- a/build.gradle +++ b/build.gradle @@ -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" diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 28861d2..5c2d1cf 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f4d7b2b..3ab0b72 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/gradlew b/gradlew index cccdd3d..b0d6d0a 100755 --- a/gradlew +++ b/gradlew @@ -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" diff --git a/gradlew.bat b/gradlew.bat index f955316..9991c50 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -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 diff --git a/publish-maven.gradle b/publish-maven.gradle index b93cacd..3c449da 100644 --- a/publish-maven.gradle +++ b/publish-maven.gradle @@ -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) + } } } } diff --git a/settings.gradle b/settings.gradle index 74450a5..16918a2 100644 --- a/settings.gradle +++ b/settings.gradle @@ -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' diff --git a/spring-credhub-core/build.gradle b/spring-credhub-core/build.gradle index 7eaaa65..b34d833 100644 --- a/spring-credhub-core/build.gradle +++ b/spring-credhub-core/build.gradle @@ -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") diff --git a/spring-credhub-docs/build.gradle b/spring-credhub-docs/build.gradle index 9cbe76a..5394ff7 100644 --- a/spring-credhub-docs/build.gradle +++ b/spring-credhub-docs/build.gradle @@ -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/", diff --git a/spring-credhub-integration-tests/build.gradle b/spring-credhub-integration-tests/build.gradle index 5c5ea6a..71b3a33 100644 --- a/spring-credhub-integration-tests/build.gradle +++ b/spring-credhub-integration-tests/build.gradle @@ -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 { diff --git a/spring-credhub-reactive-integration-tests/build.gradle b/spring-credhub-reactive-integration-tests/build.gradle index b87289b..ab1e93f 100644 --- a/spring-credhub-reactive-integration-tests/build.gradle +++ b/spring-credhub-reactive-integration-tests/build.gradle @@ -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 { diff --git a/spring-credhub-starter/build.gradle b/spring-credhub-starter/build.gradle index 80414c8..4944ba0 100644 --- a/spring-credhub-starter/build.gradle +++ b/spring-credhub-starter/build.gradle @@ -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") diff --git a/src/nohttp/allowlist.lines b/src/nohttp/allowlist.lines new file mode 100644 index 0000000..cdb38d4 --- /dev/null +++ b/src/nohttp/allowlist.lines @@ -0,0 +1,2 @@ +// ASLv2 header +^http://www.apache.org/licenses/LICENSE-2.0.*$ \ No newline at end of file