Skip to content

Commit 3ad063a

Browse files
committed
Upgrade gradle 7.6.1
- Switch propdeps-plugin to custom OptionalDependenciesPlugin - Switch io.spring.dependency-management with custom spring-statemachine-platform project - Use proper gradle publication system - Switch to testfixtures from a custom tests jar - Migrate to spring-asciidoctor-backends - Generic changes to bom/starter create as we now use publications
1 parent cf4eb2f commit 3ad063a

File tree

12 files changed

+579
-405
lines changed

12 files changed

+579
-405
lines changed

build.gradle

+228-267
Large diffs are not rendered by default.

buildSrc/build.gradle

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
plugins {
2+
id 'java-gradle-plugin'
3+
}
4+
5+
repositories {
6+
mavenCentral()
7+
gradlePluginPortal()
8+
}
9+
10+
gradlePlugin {
11+
plugins {
12+
optionalDependenciesPlugin {
13+
id = "org.springframework.statemachine.optional-dependencies"
14+
implementationClass = "org.springframework.statemachine.gradle.OptionalDependenciesPlugin"
15+
}
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright 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+
package org.springframework.statemachine.gradle;
17+
18+
import org.gradle.api.Plugin;
19+
import org.gradle.api.Project;
20+
import org.gradle.api.artifacts.Configuration;
21+
import org.gradle.api.plugins.JavaPlugin;
22+
import org.gradle.api.plugins.JavaPluginExtension;
23+
import org.gradle.api.tasks.SourceSetContainer;
24+
25+
/**
26+
* A {@code Plugin} that adds support for Maven-style optional dependencies.
27+
* Creates a new
28+
* {@code optional} configuration. The {@code optional} configuration is part of
29+
* the
30+
* project's compile and runtime classpaths but does not affect the classpath of
31+
* dependent projects.
32+
*
33+
* @author Janne Valkealahti
34+
*/
35+
public class OptionalDependenciesPlugin implements Plugin<Project> {
36+
37+
/**
38+
* Name of the {@code optional} configuration.
39+
*/
40+
public static final String OPTIONAL_CONFIGURATION_NAME = "optional";
41+
42+
@Override
43+
public void apply(Project project) {
44+
Configuration optional = project.getConfigurations().create("optional");
45+
optional.setCanBeConsumed(false);
46+
optional.setCanBeResolved(false);
47+
project.getPlugins().withType(JavaPlugin.class, (javaPlugin) -> {
48+
SourceSetContainer sourceSets = project.getExtensions().getByType(JavaPluginExtension.class)
49+
.getSourceSets();
50+
sourceSets.all((sourceSet) -> {
51+
project.getConfigurations().getByName(sourceSet.getCompileClasspathConfigurationName())
52+
.extendsFrom(optional);
53+
project.getConfigurations().getByName(sourceSet.getRuntimeClasspathConfigurationName())
54+
.extendsFrom(optional);
55+
});
56+
});
57+
}
58+
59+
}

gradle/java-test-fixtures.gradle

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apply plugin: 'java-test-fixtures'
2+
3+
compileTestFixturesJava {
4+
sourceCompatibility = 1.8
5+
targetCompatibility = 1.8
6+
}
7+
8+
eclipse.classpath {
9+
file.whenMerged { classpath ->
10+
classpath.entries.findAll { entry -> entry instanceof org.gradle.plugins.ide.eclipse.model.ProjectDependency && entry.entryAttributes.test }
11+
.each { it.entryAttributes['test'] = 'false' }
12+
}
13+
}
14+
15+
components.java.withVariantsFromConfiguration(configurations.testFixturesApiElements) { skip() }
16+
components.java.withVariantsFromConfiguration(configurations.testFixturesRuntimeElements) { skip() }

gradle/publications.gradle

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
apply plugin: "maven-publish"
2+
3+
publishing {
4+
publications {
5+
mavenJava(MavenPublication) {
6+
pom {
7+
afterEvaluate {
8+
name = project.description
9+
description = project.description
10+
}
11+
url = "https://github.com/spring-projects/spring-statemachine"
12+
organization {
13+
name = "Spring IO"
14+
url = "https://spring.io/spring-statemachine"
15+
}
16+
licenses {
17+
license {
18+
name = "Apache License, Version 2.0"
19+
url = "https://www.apache.org/licenses/LICENSE-2.0"
20+
distribution = "repo"
21+
}
22+
}
23+
scm {
24+
url = "https://github.com/spring-projects/spring-statemachine"
25+
connection = "scm:git:git://github.com/spring-projects/spring-statemachine"
26+
developerConnection = "scm:git:git://github.com/spring-projects/spring-statemachine"
27+
}
28+
developers {
29+
developer {
30+
id = 'jvalkeal'
31+
name = 'Janne Valkealahti'
32+
33+
}
34+
}
35+
issueManagement {
36+
system = "GitHub"
37+
url = "https://github.com/spring-projects/spring-statemachine/issues"
38+
}
39+
}
40+
versionMapping {
41+
usage('java-api') {
42+
fromResolutionResult()
43+
}
44+
usage('java-runtime') {
45+
fromResolutionResult()
46+
}
47+
}
48+
}
49+
}
50+
}
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

settings.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
rootProject.name = 'spring-statemachine'
22

3+
include 'spring-statemachine-platform'
34
include 'spring-statemachine-core'
45
include 'spring-statemachine-test'
56
include 'spring-statemachine-kryo'

spring-statemachine-data/build.gradle

+36-30
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,58 @@
11
description = 'Spring State Machine Data Common'
22

33
project('spring-statemachine-data-jpa') {
4+
apply from: "$rootDir/gradle/java-test-fixtures.gradle"
45
description = 'Spring State Machine Data Jpa'
6+
57
dependencies {
6-
compile project(':spring-statemachine-data-common')
7-
compile 'org.springframework:spring-orm'
8-
testCompile project(':spring-statemachine-test')
9-
testCompile project(path:':spring-statemachine-data-common', configuration:'testArtifacts')
10-
testCompile project(path:':spring-statemachine-core', configuration:'testArtifacts')
11-
testCompile 'io.projectreactor:reactor-test'
8+
api project(':spring-statemachine-data-common')
9+
api 'org.springframework:spring-orm'
10+
testImplementation project(':spring-statemachine-test')
11+
testImplementation(testFixtures(project(":spring-statemachine-data-common")))
12+
testImplementation(testFixtures(project(":spring-statemachine-core")))
13+
testImplementation 'io.projectreactor:reactor-test'
1214
optional 'org.eclipse.persistence:javax.persistence'
13-
testCompile 'org.hsqldb:hsqldb'
14-
testCompile 'org.springframework.boot:spring-boot-starter-test'
15-
testRuntime 'org.springframework.boot:spring-boot-starter-data-jpa'
16-
testRuntime 'org.springframework.boot:spring-boot-starter-web'
15+
testImplementation 'org.hsqldb:hsqldb'
16+
testImplementation 'org.springframework.boot:spring-boot-starter-test'
17+
testRuntimeOnly 'org.springframework.boot:spring-boot-starter-data-jpa'
18+
testRuntimeOnly 'org.springframework.boot:spring-boot-starter-web'
1719
}
1820
}
1921

2022
project('spring-statemachine-data-redis') {
23+
apply from: "$rootDir/gradle/java-test-fixtures.gradle"
2124
description = 'Spring State Machine Data Redis'
25+
2226
dependencies {
23-
compile project(':spring-statemachine-data-common')
24-
compile 'org.springframework.data:spring-data-redis'
25-
testCompile project(':spring-statemachine-test')
27+
api project(':spring-statemachine-data-common')
28+
api 'org.springframework.data:spring-data-redis'
29+
testImplementation project(':spring-statemachine-test')
2630
optional 'org.eclipse.persistence:javax.persistence'
27-
testCompile project(path:':spring-statemachine-data-common', configuration:'testArtifacts')
28-
testCompile project(path:':spring-statemachine-core', configuration:'testArtifacts')
29-
testCompile 'io.projectreactor:reactor-test'
30-
testCompile 'org.springframework.boot:spring-boot-starter-test'
31-
testRuntime 'org.apache.commons:commons-pool2'
32-
testRuntime 'redis.clients:jedis'
33-
testRuntime 'org.springframework.boot:spring-boot-starter-data-redis'
34-
testRuntime 'org.springframework.boot:spring-boot-starter-web'
31+
testImplementation(testFixtures(project(":spring-statemachine-data-common")))
32+
testImplementation(testFixtures(project(":spring-statemachine-core")))
33+
testImplementation 'io.projectreactor:reactor-test'
34+
testImplementation 'org.springframework.boot:spring-boot-starter-test'
35+
testRuntimeOnly 'org.apache.commons:commons-pool2'
36+
testRuntimeOnly 'redis.clients:jedis'
37+
testRuntimeOnly 'org.springframework.boot:spring-boot-starter-data-redis'
38+
testRuntimeOnly 'org.springframework.boot:spring-boot-starter-web'
3539
}
3640
}
3741

3842
project('spring-statemachine-data-mongodb') {
43+
apply from: "$rootDir/gradle/java-test-fixtures.gradle"
3944
description = 'Spring State Machine Data MongoDB'
45+
4046
dependencies {
41-
compile project(':spring-statemachine-data-common')
42-
compile 'org.springframework.data:spring-data-mongodb'
43-
testCompile project(':spring-statemachine-test')
47+
api project(':spring-statemachine-data-common')
48+
api 'org.springframework.data:spring-data-mongodb'
49+
testImplementation project(':spring-statemachine-test')
4450
optional 'org.eclipse.persistence:javax.persistence'
45-
testCompile project(path:':spring-statemachine-data-common', configuration:'testArtifacts')
46-
testCompile project(path:':spring-statemachine-core', configuration:'testArtifacts')
47-
testCompile 'io.projectreactor:reactor-test'
48-
testCompile 'org.springframework.boot:spring-boot-starter-test'
49-
testRuntime 'org.springframework.boot:spring-boot-starter-data-mongodb'
50-
testRuntime 'org.springframework.boot:spring-boot-starter-web'
51+
testImplementation(testFixtures(project(":spring-statemachine-data-common")))
52+
testImplementation(testFixtures(project(":spring-statemachine-core")))
53+
testImplementation 'io.projectreactor:reactor-test'
54+
testImplementation 'org.springframework.boot:spring-boot-starter-test'
55+
testRuntimeOnly 'org.springframework.boot:spring-boot-starter-data-mongodb'
56+
testRuntimeOnly 'org.springframework.boot:spring-boot-starter-web'
5157
}
5258
}
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
plugins {
2+
id 'java-platform'
3+
}
4+
5+
javaPlatform {
6+
allowDependencies()
7+
}
8+
9+
dependencies {
10+
api platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")
11+
constraints {
12+
api "log4j:log4j:$log4jVersion"
13+
api "org.eclipse.persistence:javax.persistence:$eclipsePersistenceVersion"
14+
api "com.esotericsoftware:kryo-shaded:$kryoVersion"
15+
api "org.springframework.shell:spring-shell:$springShellVersion"
16+
api "org.eclipse.uml2:uml:$eclipseUml2UmlVersion"
17+
api "org.eclipse.uml2:types:$eclipseUml2TypesVersion"
18+
api "org.eclipse.uml2:common:$eclipseUml2CommonVersion"
19+
api "org.eclipse.emf:org.eclipse.emf.ecore.xmi:$eclipseEmfXmiVersion"
20+
api "org.eclipse.emf:org.eclipse.emf.ecore:$eclipseEmfEcoreVersion"
21+
api "org.eclipse.emf:org.eclipse.emf.common:$eclipseEmfCommonVersion"
22+
api "org.apache.curator:curator-recipes:$curatorVersion"
23+
api "org.apache.curator:curator-test:$curatorVersion"
24+
api "org.awaitility:awaitility:$awaitilityVersion"
25+
api "io.projectreactor.tools:blockhound:$reactorBlockHoundVersion"
26+
api "io.projectreactor.tools:blockhound-junit-platform:$reactorBlockHoundVersion"
27+
}
28+
}

0 commit comments

Comments
 (0)