Skip to content

Commit 01e3596

Browse files
authored
Merge pull request #2 from spring-projects/main
同步代码
2 parents 3193e26 + b3a6dba commit 01e3596

File tree

2,253 files changed

+80407
-28912
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,253 files changed

+80407
-28912
lines changed

.gitignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ derby.log
2121
/build
2222
buildSrc/build
2323
/spring-*/build
24-
/framework-bom/build
25-
/framework-docs/build
24+
/framework-*/build
2625
/integration-tests/build
2726
/src/asciidoc/build
2827
spring-test/test-output/
@@ -50,3 +49,5 @@ atlassian-ide-plugin.xml
5049

5150
# VS Code
5251
.vscode/
52+
53+
cached-antora-playbook.yml

.sdkmanrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Enable auto-env through the sdkman_auto_env config
22
# Add key=value pairs of SDKs to use below
3-
java=17.0.7-librca
3+
java=17.0.8.1-librca

CONTRIBUTING.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,13 @@ define the source file coding standards we use along with some IDEA editor setti
123123

124124
### Reference Docs
125125

126-
The reference documentation is in the [framework-docs/src/docs/asciidoc](framework-docs/src/docs/asciidoc) directory, in
127-
[Asciidoctor](https://asciidoctor.org/) format. For trivial changes, you may be able to browse,
128-
edit source files, and submit directly from GitHub.
126+
The reference documentation is authored in [Asciidoctor](https://asciidoctor.org/) format
127+
using [Antora](https://docs.antora.org/antora/latest/). The source files for the documentation
128+
reside in the [framework-docs/modules/ROOT](framework-docs/modules/ROOT) directory. For
129+
trivial changes, you may be able to browse, edit source files, and submit directly from GitHub.
129130

130-
When making changes locally, execute `./gradlew :framework-docs:asciidoctor` and then browse the result under
131-
`framework-docs/build/docs/ref-docs/html5/index.html`.
131+
When making changes locally, execute `./gradlew antora` and then browse the results under
132+
`framework-docs/build/site/index.html`.
132133

133134
Asciidoctor also supports live editing. For more details see
134135
[AsciiDoc Tooling](https://docs.asciidoctor.org/asciidoctor/latest/tooling/).
135-

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This is the home of the Spring Framework: the foundation for all [Spring projects](https://spring.io/projects). Collectively the Spring Framework and the family of Spring projects are often referred to simply as "Spring".
44

5-
Spring provides everything required beyond the Java programming language for creating enterprise applications for a wide range of scenarios and architectures. Please read the [Overview](https://docs.spring.io/spring/docs/current/spring-framework-reference/overview.html#spring-introduction) section as reference for a more complete introduction.
5+
Spring provides everything required beyond the Java programming language for creating enterprise applications for a wide range of scenarios and architectures. Please read the [Overview](https://docs.spring.io/spring-framework/reference/overview.html) section of the reference documentation for a more complete introduction.
66

77
## Code of Conduct
88

@@ -14,7 +14,7 @@ For access to artifacts or a distribution zip, see the [Spring Framework Artifac
1414

1515
## Documentation
1616

17-
The Spring Framework maintains reference documentation ([published](https://docs.spring.io/spring-framework/docs/current/spring-framework-reference/) and [source](framework-docs/src/docs/asciidoc)), GitHub [wiki pages](https://github.com/spring-projects/spring-framework/wiki), and an
17+
The Spring Framework maintains reference documentation ([published](https://docs.spring.io/spring-framework/reference/) and [source](framework-docs/modules/ROOT)), GitHub [wiki pages](https://github.com/spring-projects/spring-framework/wiki), and an
1818
[API reference](https://docs.spring.io/spring-framework/docs/current/javadoc-api/). There are also [guides and tutorials](https://spring.io/guides) across Spring projects.
1919

2020
## Micro-Benchmarks

build.gradle

+26-25
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
plugins {
2-
id 'io.freefair.aspectj' version '8.0.1' apply false
2+
id 'io.freefair.aspectj' version '8.4' apply false
33
// kotlinVersion is managed in gradle.properties
44
id 'org.jetbrains.kotlin.plugin.serialization' version "${kotlinVersion}" apply false
5-
id 'org.jetbrains.dokka' version '1.8.10'
6-
id 'org.asciidoctor.jvm.convert' version '3.3.2' apply false
7-
id 'org.asciidoctor.jvm.pdf' version '3.3.2' apply false
5+
id 'org.jetbrains.dokka' version '1.8.20'
86
id 'org.unbroken-dome.xjc' version '2.0.0' apply false
9-
id 'com.github.ben-manes.versions' version '0.46.0'
7+
id 'com.github.ben-manes.versions' version '0.49.0'
108
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
119
id 'de.undercouch.download' version '5.4.0'
12-
id 'me.champeau.jmh' version '0.7.0' apply false
10+
id 'me.champeau.jmh' version '0.7.2' apply false
1311
id 'me.champeau.mrjar' version '0.1.1'
1412
}
1513

1614
ext {
1715
moduleProjects = subprojects.findAll { it.name.startsWith("spring-") }
18-
javaProjects = subprojects - project(":framework-bom") - project(":framework-platform")
16+
javaProjects = subprojects.findAll { !it.name.startsWith("framework-") }
1917
}
2018

2119
configure(allprojects) { project ->
20+
apply plugin: "org.springframework.build.localdev"
21+
group = "org.springframework"
2222
repositories {
2323
mavenCentral()
2424
maven {
@@ -28,7 +28,6 @@ configure(allprojects) { project ->
2828
includeGroup 'io.projectreactor.netty'
2929
}
3030
}
31-
maven { url "https://repo.spring.io/libs-spring-framework-build" }
3231
if (version.contains('-')) {
3332
maven { url "https://repo.spring.io/milestone" }
3433
}
@@ -44,15 +43,7 @@ configure(allprojects) { project ->
4443
}
4544
}
4645

47-
configure([rootProject] + javaProjects) { project ->
48-
group = "org.springframework"
49-
50-
apply plugin: "java"
51-
apply plugin: "java-test-fixtures"
52-
apply plugin: 'org.springframework.build.conventions'
53-
apply from: "${rootDir}/gradle/toolchains.gradle"
54-
apply from: "${rootDir}/gradle/ide.gradle"
55-
46+
configure(allprojects - project(":framework-platform")) {
5647
configurations {
5748
dependencyManagement {
5849
canBeConsumed = false
@@ -61,9 +52,19 @@ configure([rootProject] + javaProjects) { project ->
6152
}
6253
matching { it.name.endsWith("Classpath") }.all { it.extendsFrom(dependencyManagement) }
6354
}
64-
6555
dependencies {
6656
dependencyManagement(enforcedPlatform(dependencies.project(path: ":framework-platform")))
57+
}
58+
}
59+
60+
configure([rootProject] + javaProjects) { project ->
61+
apply plugin: "java"
62+
apply plugin: "java-test-fixtures"
63+
apply plugin: 'org.springframework.build.conventions'
64+
apply from: "${rootDir}/gradle/toolchains.gradle"
65+
apply from: "${rootDir}/gradle/ide.gradle"
66+
67+
dependencies {
6768
testImplementation("org.junit.jupiter:junit-jupiter-api")
6869
testImplementation("org.junit.jupiter:junit-jupiter-params")
6970
testImplementation("org.junit.platform:junit-platform-suite-api")
@@ -90,25 +91,25 @@ configure([rootProject] + javaProjects) { project ->
9091
"https://www.ibm.com/docs/api/v1/content/SSEQTP_8.5.5/com.ibm.websphere.javadoc.doc/web/apidocs/", // com.ibm.*
9192
"https://docs.jboss.org/jbossas/javadoc/4.0.5/connector/", // org.jboss.resource.*
9293
"https://docs.jboss.org/hibernate/orm/5.6/javadocs/",
93-
"https://www.eclipse.org/aspectj/doc/released/aspectj5rt-api/",
94+
"https://eclipse.dev/aspectj/doc/released/aspectj5rt-api",
9495
"https://www.quartz-scheduler.org/api/2.3.0/",
95-
"https://www.javadoc.io/doc/com.fasterxml.jackson.core/jackson-core/2.14.1/",
96-
"https://www.javadoc.io/doc/com.fasterxml.jackson.core/jackson-databind/2.14.1/",
97-
"https://www.javadoc.io/doc/com.fasterxml.jackson.dataformat/jackson-dataformat-xml/2.14.1/",
96+
"https://fasterxml.github.io/jackson-core/javadoc/2.14/",
97+
"https://fasterxml.github.io/jackson-databind/javadoc/2.14/",
98+
"https://fasterxml.github.io/jackson-dataformat-xml/javadoc/2.14/",
9899
"https://hc.apache.org/httpcomponents-client-5.2.x/current/httpclient5/apidocs/",
99100
"https://projectreactor.io/docs/test/release/api/",
100101
"https://junit.org/junit4/javadoc/4.13.2/",
101102
// TODO Uncomment link to JUnit 5 docs once we execute Gradle with Java 18+.
102103
// See https://github.com/spring-projects/spring-framework/issues/27497
103104
//
104-
// "https://junit.org/junit5/docs/5.9.3/api/",
105+
// "https://junit.org/junit5/docs/5.10.0/api/",
105106
"https://www.reactive-streams.org/reactive-streams-1.0.3-javadoc/",
106-
"https://javadoc.io/static/io.rsocket/rsocket-core/1.1.1/",
107+
//"https://javadoc.io/static/io.rsocket/rsocket-core/1.1.1/",
107108
"https://r2dbc.io/spec/1.0.0.RELEASE/api/",
108109
// Previously there could be a split-package issue between JSR250 and JSR305 javax.annotation packages,
109110
// but since 6.0 JSR 250 annotations such as @Resource and @PostConstruct have been replaced by their
110111
// JakartaEE equivalents in the jakarta.annotation package.
111-
"https://www.javadoc.io/doc/com.google.code.findbugs/jsr305/3.0.2/"
112+
//"https://www.javadoc.io/doc/com.google.code.findbugs/jsr305/3.0.2/"
112113
] as String[]
113114
}
114115

buildSrc/build.gradle

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
plugins {
22
id 'java-gradle-plugin'
33
id 'checkstyle'
4-
id 'io.spring.javaformat' version "${javaFormatVersion}"
54
}
65

76
repositories {
@@ -38,6 +37,10 @@ gradlePlugin {
3837
id = "org.springframework.build.conventions"
3938
implementationClass = "org.springframework.build.ConventionsPlugin"
4039
}
40+
localDevPlugin {
41+
id = "org.springframework.build.localdev"
42+
implementationClass = "org.springframework.build.dev.LocalDevelopmentPlugin"
43+
}
4144
optionalDependenciesPlugin {
4245
id = "org.springframework.build.optional-dependencies"
4346
implementationClass = "org.springframework.build.optional.OptionalDependenciesPlugin"
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE module PUBLIC "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" "https://checkstyle.org/dtds/configuration_1_3.dtd">
3+
<module name="com.puppycrawl.tools.checkstyle.Checker">
4+
5+
<!-- Root Checks -->
6+
<module name="io.spring.javaformat.checkstyle.check.SpringHeaderCheck">
7+
<property name="fileExtensions" value="java"/>
8+
<property name="headerType" value="apache2"/>
9+
<property name="headerCopyrightPattern" value="20\d\d-20\d\d"/>
10+
<property name="packageInfoHeaderType" value="none"/>
11+
</module>
12+
<module name="com.puppycrawl.tools.checkstyle.checks.NewlineAtEndOfFileCheck"/>
13+
14+
<!-- TreeWalker Checks -->
15+
<module name="com.puppycrawl.tools.checkstyle.TreeWalker">
16+
17+
<!-- Imports -->
18+
<module name="com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck">
19+
<property name="processJavadoc" value="true"/>
20+
</module>
21+
22+
<!-- Modifiers -->
23+
<module name="com.puppycrawl.tools.checkstyle.checks.modifier.ModifierOrderCheck"/>
24+
25+
</module>
26+
27+
</module>

buildSrc/gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
org.gradle.caching=true
2-
javaFormatVersion=0.0.38
2+
javaFormatVersion=0.0.39

buildSrc/src/main/java/org/springframework/build/CheckstyleConventions.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717
package org.springframework.build;
1818

19+
import java.io.File;
20+
import java.nio.file.Path;
21+
import java.util.List;
22+
1923
import io.spring.javaformat.gradle.SpringJavaFormatPlugin;
2024
import io.spring.nohttp.gradle.NoHttpExtension;
2125
import io.spring.nohttp.gradle.NoHttpPlugin;
@@ -27,12 +31,9 @@
2731
import org.gradle.api.plugins.quality.CheckstyleExtension;
2832
import org.gradle.api.plugins.quality.CheckstylePlugin;
2933

30-
import java.io.File;
31-
import java.nio.file.Path;
32-
import java.util.List;
33-
3434
/**
3535
* {@link Plugin} that applies conventions for checkstyle.
36+
*
3637
* @author Brian Clozel
3738
*/
3839
public class CheckstyleConventions {
@@ -49,7 +50,7 @@ public void apply(Project project) {
4950
project.getPlugins().apply(CheckstylePlugin.class);
5051
project.getTasks().withType(Checkstyle.class).forEach(checkstyle -> checkstyle.getMaxHeapSize().set("1g"));
5152
CheckstyleExtension checkstyle = project.getExtensions().getByType(CheckstyleExtension.class);
52-
checkstyle.setToolVersion("10.10.0");
53+
checkstyle.setToolVersion("10.12.4");
5354
checkstyle.getConfigDirectory().set(project.getRootProject().file("src/checkstyle"));
5455
String version = SpringJavaFormatPlugin.class.getPackage().getImplementationVersion();
5556
DependencySet checkstyleDependencies = project.getConfigurations().getByName("checkstyle").getDependencies();

buildSrc/src/main/java/org/springframework/build/ConventionsPlugin.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* Plugin to apply conventions to projects that are part of Spring Framework's build.
2626
* Conventions are applied in response to various plugins being applied.
2727
*
28-
* When the {@link JavaBasePlugin} is applied, the conventions in {@link CheckstyleConventions},
28+
* <p>When the {@link JavaBasePlugin} is applied, the conventions in {@link CheckstyleConventions},
2929
* {@link TestConventions} and {@link JavaConventions} are applied.
3030
* When the {@link KotlinBasePlugin} is applied, the conventions in {@link KotlinConventions}
3131
* are applied.
@@ -41,4 +41,5 @@ public void apply(Project project) {
4141
new KotlinConventions().apply(project);
4242
new TestConventions().apply(project);
4343
}
44+
4445
}

buildSrc/src/main/java/org/springframework/build/JavaConventions.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.gradle.api.plugins.JavaPluginExtension;
2828
import org.gradle.api.tasks.compile.JavaCompile;
2929
import org.gradle.jvm.toolchain.JavaLanguageVersion;
30+
import org.gradle.jvm.toolchain.JvmVendorSpec;
3031

3132
/**
3233
* {@link Plugin} that applies conventions for compiling Java sources in Spring Framework.
@@ -70,8 +71,10 @@ public void apply(Project project) {
7071
* @param project the current project
7172
*/
7273
private void applyJavaCompileConventions(Project project) {
73-
project.getExtensions().getByType(JavaPluginExtension.class)
74-
.getToolchain().getLanguageVersion().set(JavaLanguageVersion.of(17));
74+
project.getExtensions().getByType(JavaPluginExtension.class).toolchain(toolchain -> {
75+
toolchain.getVendor().set(JvmVendorSpec.BELLSOFT);
76+
toolchain.getLanguageVersion().set(JavaLanguageVersion.of(17));
77+
});
7578
project.getTasks().withType(JavaCompile.class)
7679
.matching(compileTask -> compileTask.getName().equals(JavaPlugin.COMPILE_JAVA_TASK_NAME))
7780
.forEach(compileTask -> {

buildSrc/src/main/java/org/springframework/build/api/ApiDiffPlugin.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.build.api;
1718

1819
import java.io.File;
@@ -131,10 +132,11 @@ private Configuration getRuntimeClassPath(Project project) {
131132
}
132133

133134
private File getOutputFile(String baseLineVersion, Project project) {
134-
Path outDir = Paths.get(project.getRootProject().getBuildDir().getAbsolutePath(),
135-
"reports", "api-diff",
135+
String buildDirectoryPath = project.getRootProject()
136+
.getLayout().getBuildDirectory().getAsFile().get().getAbsolutePath();
137+
Path outDir = Paths.get(buildDirectoryPath, "reports", "api-diff",
136138
baseLineVersion + "_to_" + project.getRootProject().getVersion());
137139
return project.file(outDir.resolve(project.getName() + ".html").toString());
138140
}
139141

140-
}
142+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright 2002-2023 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.build.dev;
18+
19+
import org.gradle.api.Plugin;
20+
import org.gradle.api.Project;
21+
import org.gradle.api.plugins.JavaBasePlugin;
22+
23+
/**
24+
* {@link Plugin} that skips documentation tasks when the {@code "-PskipDocs"} property is defined.
25+
*
26+
* @author Brian Clozel
27+
*/
28+
public class LocalDevelopmentPlugin implements Plugin<Project> {
29+
30+
private static final String SKIP_DOCS_PROPERTY = "skipDocs";
31+
32+
@Override
33+
public void apply(Project target) {
34+
if (target.hasProperty(SKIP_DOCS_PROPERTY)) {
35+
skipDocumentationTasks(target);
36+
target.subprojects(this::skipDocumentationTasks);
37+
}
38+
}
39+
40+
private void skipDocumentationTasks(Project project) {
41+
project.afterEvaluate(p -> {
42+
p.getTasks().matching(task -> {
43+
return JavaBasePlugin.DOCUMENTATION_GROUP.equals(task.getGroup())
44+
|| "distribution".equals(task.getGroup());
45+
})
46+
.forEach(task -> task.setEnabled(false));
47+
});
48+
}
49+
}

0 commit comments

Comments
 (0)