Skip to content

Commit

Permalink
Upgrade gradle 7.6.1
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
jvalkeal committed May 31, 2023
1 parent cf4eb2f commit 3ad063a
Show file tree
Hide file tree
Showing 12 changed files with 579 additions and 405 deletions.
495 changes: 228 additions & 267 deletions build.gradle

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
plugins {
id 'java-gradle-plugin'
}

repositories {
mavenCentral()
gradlePluginPortal()
}

gradlePlugin {
plugins {
optionalDependenciesPlugin {
id = "org.springframework.statemachine.optional-dependencies"
implementationClass = "org.springframework.statemachine.gradle.OptionalDependenciesPlugin"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright 2023 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
*
* https://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.
*/
package org.springframework.statemachine.gradle;

import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.plugins.JavaPluginExtension;
import org.gradle.api.tasks.SourceSetContainer;

/**
* A {@code Plugin} that adds support for Maven-style optional dependencies.
* Creates a new
* {@code optional} configuration. The {@code optional} configuration is part of
* the
* project's compile and runtime classpaths but does not affect the classpath of
* dependent projects.
*
* @author Janne Valkealahti
*/
public class OptionalDependenciesPlugin implements Plugin<Project> {

/**
* Name of the {@code optional} configuration.
*/
public static final String OPTIONAL_CONFIGURATION_NAME = "optional";

@Override
public void apply(Project project) {
Configuration optional = project.getConfigurations().create("optional");
optional.setCanBeConsumed(false);
optional.setCanBeResolved(false);
project.getPlugins().withType(JavaPlugin.class, (javaPlugin) -> {
SourceSetContainer sourceSets = project.getExtensions().getByType(JavaPluginExtension.class)
.getSourceSets();
sourceSets.all((sourceSet) -> {
project.getConfigurations().getByName(sourceSet.getCompileClasspathConfigurationName())
.extendsFrom(optional);
project.getConfigurations().getByName(sourceSet.getRuntimeClasspathConfigurationName())
.extendsFrom(optional);
});
});
}

}
16 changes: 16 additions & 0 deletions gradle/java-test-fixtures.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apply plugin: 'java-test-fixtures'

compileTestFixturesJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}

eclipse.classpath {
file.whenMerged { classpath ->
classpath.entries.findAll { entry -> entry instanceof org.gradle.plugins.ide.eclipse.model.ProjectDependency && entry.entryAttributes.test }
.each { it.entryAttributes['test'] = 'false' }
}
}

components.java.withVariantsFromConfiguration(configurations.testFixturesApiElements) { skip() }
components.java.withVariantsFromConfiguration(configurations.testFixturesRuntimeElements) { skip() }
50 changes: 50 additions & 0 deletions gradle/publications.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
apply plugin: "maven-publish"

publishing {
publications {
mavenJava(MavenPublication) {
pom {
afterEvaluate {
name = project.description
description = project.description
}
url = "https://github.com/spring-projects/spring-statemachine"
organization {
name = "Spring IO"
url = "https://spring.io/spring-statemachine"
}
licenses {
license {
name = "Apache License, Version 2.0"
url = "https://www.apache.org/licenses/LICENSE-2.0"
distribution = "repo"
}
}
scm {
url = "https://github.com/spring-projects/spring-statemachine"
connection = "scm:git:git://github.com/spring-projects/spring-statemachine"
developerConnection = "scm:git:git://github.com/spring-projects/spring-statemachine"
}
developers {
developer {
id = 'jvalkeal'
name = 'Janne Valkealahti'
email = '[email protected]'
}
}
issueManagement {
system = "GitHub"
url = "https://github.com/spring-projects/spring-statemachine/issues"
}
}
versionMapping {
usage('java-api') {
fromResolutionResult()
}
usage('java-runtime') {
fromResolutionResult()
}
}
}
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
rootProject.name = 'spring-statemachine'

include 'spring-statemachine-platform'
include 'spring-statemachine-core'
include 'spring-statemachine-test'
include 'spring-statemachine-kryo'
Expand Down
66 changes: 36 additions & 30 deletions spring-statemachine-data/build.gradle
Original file line number Diff line number Diff line change
@@ -1,52 +1,58 @@
description = 'Spring State Machine Data Common'

project('spring-statemachine-data-jpa') {
apply from: "$rootDir/gradle/java-test-fixtures.gradle"
description = 'Spring State Machine Data Jpa'

dependencies {
compile project(':spring-statemachine-data-common')
compile 'org.springframework:spring-orm'
testCompile project(':spring-statemachine-test')
testCompile project(path:':spring-statemachine-data-common', configuration:'testArtifacts')
testCompile project(path:':spring-statemachine-core', configuration:'testArtifacts')
testCompile 'io.projectreactor:reactor-test'
api project(':spring-statemachine-data-common')
api 'org.springframework:spring-orm'
testImplementation project(':spring-statemachine-test')
testImplementation(testFixtures(project(":spring-statemachine-data-common")))
testImplementation(testFixtures(project(":spring-statemachine-core")))
testImplementation 'io.projectreactor:reactor-test'
optional 'org.eclipse.persistence:javax.persistence'
testCompile 'org.hsqldb:hsqldb'
testCompile 'org.springframework.boot:spring-boot-starter-test'
testRuntime 'org.springframework.boot:spring-boot-starter-data-jpa'
testRuntime 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.hsqldb:hsqldb'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.springframework.boot:spring-boot-starter-data-jpa'
testRuntimeOnly 'org.springframework.boot:spring-boot-starter-web'
}
}

project('spring-statemachine-data-redis') {
apply from: "$rootDir/gradle/java-test-fixtures.gradle"
description = 'Spring State Machine Data Redis'

dependencies {
compile project(':spring-statemachine-data-common')
compile 'org.springframework.data:spring-data-redis'
testCompile project(':spring-statemachine-test')
api project(':spring-statemachine-data-common')
api 'org.springframework.data:spring-data-redis'
testImplementation project(':spring-statemachine-test')
optional 'org.eclipse.persistence:javax.persistence'
testCompile project(path:':spring-statemachine-data-common', configuration:'testArtifacts')
testCompile project(path:':spring-statemachine-core', configuration:'testArtifacts')
testCompile 'io.projectreactor:reactor-test'
testCompile 'org.springframework.boot:spring-boot-starter-test'
testRuntime 'org.apache.commons:commons-pool2'
testRuntime 'redis.clients:jedis'
testRuntime 'org.springframework.boot:spring-boot-starter-data-redis'
testRuntime 'org.springframework.boot:spring-boot-starter-web'
testImplementation(testFixtures(project(":spring-statemachine-data-common")))
testImplementation(testFixtures(project(":spring-statemachine-core")))
testImplementation 'io.projectreactor:reactor-test'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.apache.commons:commons-pool2'
testRuntimeOnly 'redis.clients:jedis'
testRuntimeOnly 'org.springframework.boot:spring-boot-starter-data-redis'
testRuntimeOnly 'org.springframework.boot:spring-boot-starter-web'
}
}

project('spring-statemachine-data-mongodb') {
apply from: "$rootDir/gradle/java-test-fixtures.gradle"
description = 'Spring State Machine Data MongoDB'

dependencies {
compile project(':spring-statemachine-data-common')
compile 'org.springframework.data:spring-data-mongodb'
testCompile project(':spring-statemachine-test')
api project(':spring-statemachine-data-common')
api 'org.springframework.data:spring-data-mongodb'
testImplementation project(':spring-statemachine-test')
optional 'org.eclipse.persistence:javax.persistence'
testCompile project(path:':spring-statemachine-data-common', configuration:'testArtifacts')
testCompile project(path:':spring-statemachine-core', configuration:'testArtifacts')
testCompile 'io.projectreactor:reactor-test'
testCompile 'org.springframework.boot:spring-boot-starter-test'
testRuntime 'org.springframework.boot:spring-boot-starter-data-mongodb'
testRuntime 'org.springframework.boot:spring-boot-starter-web'
testImplementation(testFixtures(project(":spring-statemachine-data-common")))
testImplementation(testFixtures(project(":spring-statemachine-core")))
testImplementation 'io.projectreactor:reactor-test'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.springframework.boot:spring-boot-starter-data-mongodb'
testRuntimeOnly 'org.springframework.boot:spring-boot-starter-web'
}
}
28 changes: 28 additions & 0 deletions spring-statemachine-platform/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
plugins {
id 'java-platform'
}

javaPlatform {
allowDependencies()
}

dependencies {
api platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")
constraints {
api "log4j:log4j:$log4jVersion"
api "org.eclipse.persistence:javax.persistence:$eclipsePersistenceVersion"
api "com.esotericsoftware:kryo-shaded:$kryoVersion"
api "org.springframework.shell:spring-shell:$springShellVersion"
api "org.eclipse.uml2:uml:$eclipseUml2UmlVersion"
api "org.eclipse.uml2:types:$eclipseUml2TypesVersion"
api "org.eclipse.uml2:common:$eclipseUml2CommonVersion"
api "org.eclipse.emf:org.eclipse.emf.ecore.xmi:$eclipseEmfXmiVersion"
api "org.eclipse.emf:org.eclipse.emf.ecore:$eclipseEmfEcoreVersion"
api "org.eclipse.emf:org.eclipse.emf.common:$eclipseEmfCommonVersion"
api "org.apache.curator:curator-recipes:$curatorVersion"
api "org.apache.curator:curator-test:$curatorVersion"
api "org.awaitility:awaitility:$awaitilityVersion"
api "io.projectreactor.tools:blockhound:$reactorBlockHoundVersion"
api "io.projectreactor.tools:blockhound-junit-platform:$reactorBlockHoundVersion"
}
}
Loading

0 comments on commit 3ad063a

Please sign in to comment.