Skip to content

Commit

Permalink
Merge branch '1.3.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
jgrandja committed Oct 11, 2024
2 parents cd88131 + 31b3e77 commit 24faf3c
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 86 deletions.
21 changes: 10 additions & 11 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ repositories {
}

dependencies {
implementation "com.github.ben-manes:gradle-versions-plugin:0.38.0"
implementation "io.github.gradle-nexus:publish-plugin:1.1.0"
implementation "io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.41"
implementation "io.spring.nohttp:nohttp-gradle:0.0.11"
implementation "org.asciidoctor:asciidoctor-gradle-jvm:3.3.2"
implementation "org.asciidoctor:asciidoctor-gradle-jvm-pdf:3.3.2"
implementation "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
implementation "org.hidetake:gradle-ssh-plugin:2.10.1"
implementation "org.jfrog.buildinfo:build-info-extractor-gradle:5.2.0"
implementation "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.7.1"
implementation "org.springframework:spring-core:6.1.9"
implementation libs.com.github.ben.manes.gradle.versions.plugin
implementation libs.io.github.gradle.nexus.publish.plugin
implementation libs.io.spring.javaformat.spring.javaformat.gradle.plugin
implementation libs.io.spring.nohttp.nohttp.gradle
implementation libs.org.asciidoctor.asciidoctor.gradle.jvm.plugin
implementation libs.org.asciidoctor.asciidoctor.gradle.jvm.pdf.plugin
implementation libs.org.jetbrains.kotlin.kotlin.gradle.plugin
implementation libs.org.hidetake.gradle.ssh.plugin
implementation libs.org.jfrog.buildinfo.build.info.extractor.gradle
implementation libs.org.sonarsource.scanner.gradle.sonarqube.gradle.plugin
}
7 changes: 7 additions & 0 deletions buildSrc/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dependencyResolutionManagement {
versionCatalogs {
libs {
from(files("../gradle/libs.versions.toml"))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
package org.springframework.gradle.checkstyle;

import java.io.File;
import java.util.Objects;

import javax.annotation.Nullable;

import io.spring.javaformat.gradle.tasks.CheckFormat;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.artifacts.VersionCatalog;
import org.gradle.api.artifacts.VersionCatalogsExtension;
import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.plugins.quality.CheckstyleExtension;
import org.gradle.api.plugins.quality.CheckstylePlugin;
Expand All @@ -36,12 +37,6 @@
*/
public class SpringJavaCheckstylePlugin implements Plugin<Project> {
private static final String CHECKSTYLE_DIR = "etc/checkstyle";
private static final String SPRING_JAVAFORMAT_VERSION_PROPERTY = "springJavaformatVersion";
private static final String DEFAULT_SPRING_JAVAFORMAT_VERSION = "0.0.41";
private static final String NOHTTP_CHECKSTYLE_VERSION_PROPERTY = "nohttpCheckstyleVersion";
private static final String DEFAULT_NOHTTP_CHECKSTYLE_VERSION = "0.0.11";
private static final String CHECKSTYLE_TOOL_VERSION_PROPERTY = "checkstyleToolVersion";
private static final String DEFAULT_CHECKSTYLE_TOOL_VERSION = "8.34";
private static final String SPRING_JAVAFORMAT_EXCLUDE_PACKAGES_PROPERTY = "springJavaformatExcludePackages";

@Override
Expand All @@ -51,15 +46,14 @@ public void apply(Project project) {
if (checkstyleDir.exists() && checkstyleDir.isDirectory()) {
project.getPluginManager().apply(CheckstylePlugin.class);

// NOTE: See gradle.properties#springJavaformatVersion for actual version number
project.getDependencies().add("checkstyle", "io.spring.javaformat:spring-javaformat-checkstyle:" + getSpringJavaformatVersion(project));
// NOTE: See gradle.properties#nohttpCheckstyleVersion for actual version number
project.getDependencies().add("checkstyle", "io.spring.nohttp:nohttp-checkstyle:" + getNohttpCheckstyleVersion(project));
VersionCatalog versionCatalog = project.getRootProject().getExtensions().getByType(VersionCatalogsExtension.class).named("libs");

project.getDependencies().add("checkstyle", versionCatalog.findLibrary("io-spring-javaformat-spring-javaformat-checkstyle").get());
project.getDependencies().add("checkstyle", versionCatalog.findLibrary("io-spring-nohttp-nohttp-checkstyle").get());

CheckstyleExtension checkstyle = project.getExtensions().getByType(CheckstyleExtension.class);
checkstyle.getConfigDirectory().set(checkstyleDir);
// NOTE: See gradle.properties#checkstyleToolVersion for actual version number
checkstyle.setToolVersion(getCheckstyleToolVersion(project));
checkstyle.setToolVersion("8.34");
}

// Configure checkFormat task
Expand All @@ -73,30 +67,6 @@ public void apply(Project project) {
});
}

private static String getSpringJavaformatVersion(Project project) {
String springJavaformatVersion = DEFAULT_SPRING_JAVAFORMAT_VERSION;
if (project.hasProperty(SPRING_JAVAFORMAT_VERSION_PROPERTY)) {
springJavaformatVersion = Objects.requireNonNull(project.findProperty(SPRING_JAVAFORMAT_VERSION_PROPERTY)).toString();
}
return springJavaformatVersion;
}

private static String getNohttpCheckstyleVersion(Project project) {
String nohttpCheckstyleVersion = DEFAULT_NOHTTP_CHECKSTYLE_VERSION;
if (project.hasProperty(NOHTTP_CHECKSTYLE_VERSION_PROPERTY)) {
nohttpCheckstyleVersion = Objects.requireNonNull(project.findProperty(NOHTTP_CHECKSTYLE_VERSION_PROPERTY)).toString();
}
return nohttpCheckstyleVersion;
}

private static String getCheckstyleToolVersion(Project project) {
String checkstyleToolVersion = DEFAULT_CHECKSTYLE_TOOL_VERSION;
if (project.hasProperty(CHECKSTYLE_TOOL_VERSION_PROPERTY)) {
checkstyleToolVersion = Objects.requireNonNull(project.findProperty(CHECKSTYLE_TOOL_VERSION_PROPERTY)).toString();
}
return checkstyleToolVersion;
}

@Nullable
private String[] getSpringJavaformatExcludePackages(Project project) {
String springJavaformatExcludePackages = (String) project.findProperty(SPRING_JAVAFORMAT_EXCLUDE_PACKAGES_PROPERTY);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2024 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.
Expand All @@ -25,8 +25,6 @@
import org.gradle.api.tasks.TaskProvider;
import org.gradle.language.base.plugins.LifecycleBasePlugin;

import org.springframework.util.StringUtils;

/**
* @author Andy Wilkinson
* @author Rob Winch
Expand Down Expand Up @@ -55,7 +53,7 @@ private void createProhibitedDependenciesChecks(Project project, String... confi
}

private void createProhibitedDependenciesCheck(Configuration classpath, Project project) {
String taskName = "check" + StringUtils.capitalize(classpath.getName() + "ForProhibitedDependencies");
String taskName = "check" + capitalize(classpath.getName() + "ForProhibitedDependencies");
TaskProvider<CheckClasspathForProhibitedDependencies> checkClasspathTask = project.getTasks().register(taskName,
CheckClasspathForProhibitedDependencies.class, (checkClasspath) -> {
checkClasspath.setGroup(LifecycleBasePlugin.CHECK_TASK_NAME);
Expand All @@ -64,4 +62,25 @@ private void createProhibitedDependenciesCheck(Configuration classpath, Project
});
project.getTasks().named(SpringCheckProhibitedDependenciesLifecyclePlugin.CHECK_PROHIBITED_DEPENDENCIES_TASK_NAME, (checkProhibitedTask) -> checkProhibitedTask.dependsOn(checkClasspathTask));
}

private static String capitalize(String str) {
if (!hasLength(str)) {
return str;
} else {
char baseChar = str.charAt(0);
char updatedChar = Character.toUpperCase(baseChar);
if (baseChar == updatedChar) {
return str;
} else {
char[] chars = str.toCharArray();
chars[0] = updatedChar;
return new String(chars);
}
}
}

private static boolean hasLength(String str) {
return str != null && !str.isEmpty();
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 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.
Expand All @@ -16,8 +16,6 @@

package org.springframework.gradle.jacoco;

import java.util.Objects;

import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.plugins.JavaPlugin;
Expand All @@ -31,8 +29,6 @@
* @author Steve Riesenberg
*/
public class SpringJacocoPlugin implements Plugin<Project> {
private static final String JACOCO_TOOL_VERSION_PROPERTY = "jacocoToolVersion";
private static final String DEFAULT_JACOCO_TOOL_VERSION = "0.8.7";

@Override
public void apply(Project project) {
Expand All @@ -41,16 +37,8 @@ public void apply(Project project) {
project.getTasks().getByName("check").dependsOn(project.getTasks().getByName("jacocoTestReport"));

JacocoPluginExtension jacoco = project.getExtensions().getByType(JacocoPluginExtension.class);
// NOTE: See gradle.properties#jacocoToolVersion for actual version number
jacoco.setToolVersion(getJacocoToolVersion(project));
jacoco.setToolVersion("0.8.7");
});
}

private static String getJacocoToolVersion(Project project) {
String jacocoToolVersion = DEFAULT_JACOCO_TOOL_VERSION;
if (project.hasProperty(JACOCO_TOOL_VERSION_PROPERTY)) {
jacocoToolVersion = Objects.requireNonNull(project.findProperty(JACOCO_TOOL_VERSION_PROPERTY)).toString();
}
return jacocoToolVersion;
}
}
28 changes: 14 additions & 14 deletions dependencies/spring-authorization-server-dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ javaPlatform {
}

dependencies {
api platform("org.springframework:spring-framework-bom:$springFrameworkVersion")
api platform("org.springframework.security:spring-security-bom:$springSecurityVersion")
api platform("com.fasterxml.jackson:jackson-bom:2.17.2")
api platform(libs.org.springframework.spring.framework.bom)
api platform(libs.org.springframework.security.spring.security.bom)
api platform(libs.com.fasterxml.jackson.jackson.bom)
constraints {
api "com.nimbusds:nimbus-jose-jwt:9.41.1"
api "jakarta.servlet:jakarta.servlet-api:6.0.0"
api "org.bouncycastle:bcpkix-jdk18on:1.78.1"
api "org.bouncycastle:bcprov-jdk18on:1.78.1"
api "org.junit.jupiter:junit-jupiter:5.11.0"
api "org.assertj:assertj-core:3.26.3"
api "org.mockito:mockito-core:4.11.0"
api "com.squareup.okhttp3:mockwebserver:4.12.0"
api "com.squareup.okhttp3:okhttp:4.12.0"
api "com.jayway.jsonpath:json-path:2.9.0"
api "org.hsqldb:hsqldb:2.7.3"
api libs.com.nimbusds.nimbus.jose.jwt
api libs.jakarta.servlet.jakarta.servlet.api
api libs.org.bouncycastle.bcpkix.jdk18on
api libs.org.bouncycastle.bcprov.jdk18on
api libs.org.junit.jupiter.junit.jupiter
api libs.org.assertj.assertj.core
api libs.org.mockito.mockito.core
api libs.com.squareup.okhttp3.mockwebserver
api libs.com.squareup.okhttp3.okhttp
api libs.com.jayway.jsonpath.json.path
api libs.org.hsqldb.hsqldb
}
}
6 changes: 0 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,3 @@ version=1.4.0-SNAPSHOT
org.gradle.jvmargs=-Xmx3g -XX:+HeapDumpOnOutOfMemoryError
org.gradle.parallel=true
org.gradle.caching=true
springFrameworkVersion=6.2.0-RC1
springSecurityVersion=6.4.0-M4
springJavaformatVersion=0.0.41
checkstyleToolVersion=8.34
nohttpCheckstyleVersion=0.0.11
jacocoToolVersion=0.8.7
42 changes: 42 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[versions]
org-springframework = "6.2.0-RC1"
org-springframework-security = "6.4.0-M4"
com-fasterxml-jackson = "2.17.2"
nimbus-jose-jwt = "9.41.1"
org-bouncycastle = "1.78.1"
com-squareup-okhttp3 = "4.12.0"
io-spring-javaformat = "0.0.41"
io-spring-nohttp = "0.0.11"

[libraries]
org-springframework-spring-framework-bom = { module = "org.springframework:spring-framework-bom", version.ref = "org-springframework" }
org-springframework-security-spring-security-bom = { module = "org.springframework.security:spring-security-bom", version.ref = "org-springframework-security" }
com-fasterxml-jackson-jackson-bom = { module = "com.fasterxml.jackson:jackson-bom", version.ref = "com-fasterxml-jackson" }
com-nimbusds-nimbus-jose-jwt = { module = "com.nimbusds:nimbus-jose-jwt", version.ref = "nimbus-jose-jwt" }
jakarta-servlet-jakarta-servlet-api = "jakarta.servlet:jakarta.servlet-api:6.0.0"
org-bouncycastle-bcpkix-jdk18on = { module = "org.bouncycastle:bcpkix-jdk18on", version.ref = "org-bouncycastle" }
org-bouncycastle-bcprov-jdk18on = { module = "org.bouncycastle:bcprov-jdk18on", version.ref = "org-bouncycastle" }
org-junit-jupiter-junit-jupiter = "org.junit.jupiter:junit-jupiter:5.11.0"
org-assertj-assertj-core = "org.assertj:assertj-core:3.26.3"
org-mockito-mockito-core = "org.mockito:mockito-core:4.11.0"
com-squareup-okhttp3-mockwebserver = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "com-squareup-okhttp3" }
com-squareup-okhttp3-okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "com-squareup-okhttp3" }
com-jayway-jsonpath-json-path = "com.jayway.jsonpath:json-path:2.9.0"
org-hsqldb-hsqldb = "org.hsqldb:hsqldb:2.7.3"

# buildSrc dependencies
com-github-ben-manes-gradle-versions-plugin = "com.github.ben-manes:gradle-versions-plugin:0.38.0"
io-github-gradle-nexus-publish-plugin = "io.github.gradle-nexus:publish-plugin:1.1.0"
io-spring-javaformat-spring-javaformat-checkstyle = { module = "io.spring.javaformat:spring-javaformat-checkstyle", version.ref = "io-spring-javaformat" }
io-spring-javaformat-spring-javaformat-gradle-plugin = { module = "io.spring.javaformat:spring-javaformat-gradle-plugin", version.ref = "io-spring-javaformat" }
io-spring-nohttp-nohttp-checkstyle = { module = "io.spring.nohttp:nohttp-checkstyle", version.ref = "io-spring-nohttp" }
io-spring-nohttp-nohttp-gradle = { module = "io.spring.nohttp:nohttp-gradle", version.ref = "io-spring-nohttp" }
org-asciidoctor-asciidoctor-gradle-jvm-plugin = "org.asciidoctor:asciidoctor-gradle-jvm:3.3.2"
org-asciidoctor-asciidoctor-gradle-jvm-pdf-plugin = "org.asciidoctor:asciidoctor-gradle-jvm-pdf:3.3.2"
org-jetbrains-kotlin-kotlin-gradle-plugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
org-hidetake-gradle-ssh-plugin = "org.hidetake:gradle-ssh-plugin:2.10.1"
org-jfrog-buildinfo-build-info-extractor-gradle = "org.jfrog.buildinfo:build-info-extractor-gradle:5.2.0"
org-sonarsource-scanner-gradle-sonarqube-gradle-plugin = "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.7.1"

[plugins]
org-gradle-wrapper-upgrade = "org.gradle.wrapper-upgrade:0.11.4"

0 comments on commit 24faf3c

Please sign in to comment.