diff --git a/build.gradle b/build.gradle index e25d0a3f..b0178e5c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,87 +1,23 @@ -buildscript { - ext { - log4jVersion = '1.2.17' - springBootVersion = '3.1.6' - jakartaPersistenceVersion = '3.1.0' - kryoVersion = '4.0.2' - springCloudClusterVersion = '1.0.2.RELEASE' - springShellVersion = '1.1.0.RELEASE' - eclipseEmfXmiVersion = '2.11.1-v20150805-0538' - eclipseUml2CommonVersion = '2.0.0-v20140602-0749' - eclipseEmfCommonVersion = '2.11.0-v20150805-0538' - eclipseUml2TypesVersion = '2.0.0-v20140602-0749' - eclipseEmfEcoreVersion = '2.11.1-v20150805-0538' - eclipseUml2UmlVersion = '5.0.0-v20140602-0749' - curatorVersion = '2.11.1' - springAsciidoctorBackends = '0.0.5' - awaitilityVersion = '3.1.6' - reactorBlockHoundVersion = '1.0.4.RELEASE' - } - repositories { - gradlePluginPortal() - maven { url 'https://repo.spring.io/plugins-release' } - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion") - } -} - plugins { - id 'org.asciidoctor.jvm.convert' version '3.3.2' - id 'org.asciidoctor.jvm.pdf' version '3.3.2' + id "base" + id 'org.springframework.statemachine.root' } -ext { - moduleProjects = subprojects.findAll { - it.name.startsWith("spring-statemachine-") && !it.name.contains("samples") && !it.name.contains("-bom") && !it.name.contains("-platform") - } - javaProjects = subprojects - project(":spring-statemachine-bom") - project(":spring-statemachine-platform") - javaProjectsAndRoot = javaProjects + rootProject +description = 'Spring Statemachine' + +repositories { + maven { url 'https://repo.spring.io/snapshot' } + maven { url 'https://repo.spring.io/milestone' } + maven { url 'https://repo.spring.io/release' } + mavenCentral() } -def recipeProjects() { - subprojects.findAll { project -> - project.name.contains('spring-statemachine-recipes') && project.name != 'spring-statemachine-recipes-common' - } -} - -def sampleProjects() { - subprojects.findAll { project -> - project.name.contains('spring-statemachine-samples') && project.name != 'spring-statemachine-samples-common' - } -} - -def getResolvedVersionOf(dependency) { - // used for resolving version to docs - return configurations.compileClasspath.resolvedConfiguration.firstLevelModuleDependencies.findAll { it.moduleName == dependency }[0].moduleVersion -} - -configure(javaProjectsAndRoot) { - apply plugin: 'java-library' - apply plugin: 'eclipse' - apply plugin: 'idea' - apply plugin: 'org.springframework.statemachine.optional-dependencies' - - tasks.withType(GenerateModuleMetadata) { - enabled = false - } - - compileJava { - sourceCompatibility = 17 - targetCompatibility = 17 - } - - compileTestJava { - sourceCompatibility = 17 - targetCompatibility = 17 - } - +allprojects { group = 'org.springframework.statemachine' - [compileJava, compileTestJava]*.options*.compilerArgs = ['-Xlint:deprecation'] - repositories { mavenCentral() + maven { url 'https://repo.spring.io/release' } if (version.contains('-')) { maven { url "https://repo.spring.io/milestone" } } @@ -90,720 +26,7 @@ configure(javaProjectsAndRoot) { } } - configurations { - dependencyManagement { - canBeConsumed = false - canBeResolved = false - visible = false - } - matching { it.name.endsWith("Classpath") }.all { it.extendsFrom(dependencyManagement) } - } - - dependencies { - dependencyManagement(enforcedPlatform(dependencies.project(path: ":spring-statemachine-platform"))) - } - - task integrationTest(type: Test) { - include '**/*IntegrationTests.*' - } - - test { - useJUnitPlatform { - if (!project.hasProperty('statemachineIncludeTags') && !project.hasProperty('statemachineExcludeTags')) { - excludeTags = ['smoke'] - } else { - if (project.hasProperty('statemachineIncludeTags') && statemachineIncludeTags.size() > 0) { - includeTags = statemachineIncludeTags.split(',') - } - if (project.hasProperty('statemachineExcludeTags') && statemachineExcludeTags.size() > 0) { - excludeTags = statemachineExcludeTags.split(',') - } - } - } - exclude '**/*IntegrationTests.*' - if (project.hasProperty('statemachineTestResults') && statemachineTestResults.toBoolean()) { - afterSuite { desc, result -> - if (!desc.parent) { - def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)" - def startItem = '| ', endItem = ' |' - def repeatLength = startItem.length() + output.length() + endItem.length() - println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength)) - } - } - } + configurations.all { + resolutionStrategy.cacheChangingModulesFor 1, 'hours' } } - -configure(javaProjects) { subproject -> - apply from: "$rootDir/gradle/publications.gradle" - - dependencies { - testImplementation("org.junit.jupiter:junit-jupiter-api") - testImplementation("io.projectreactor.tools:blockhound") - testImplementation("org.springframework.boot:spring-boot-starter-test") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") - if (project.hasProperty('statemachineBlockHound') && statemachineBlockHound.toBoolean()) { - testRuntimeOnly("org.junit.platform:junit-platform-launcher") - testRuntimeOnly("io.projectreactor.tools:blockhound-junit-platform") - } - } - - jar { - manifest.attributes['Implementation-Title'] = subproject.name - manifest.attributes['Implementation-Version'] = subproject.version - - from("${rootProject.projectDir}/src/dist") { - include "license.txt" - include "notice.txt" - into "META-INF" - expand(copyright: new Date().format('yyyy'), version: project.version) - } - } - - javadoc { - // /config/configuration/StateMachineConfiguration.html... - // java.lang.ClassCastException: com.sun.tools.javadoc.MethodDocImpl cannot be cast - // to com.sun.tools.javadoc.AnnotationTypeElementDocImpl - // @Bean(name = StateMachineSystemConstants.DEFAULT_ID_STATEMACHINEFACTORY) - // vs. - // @Bean - - enabled = false - options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED - options.author = true - options.header = project.name - verbose = true - } - - task sourcesJar(type: Jar, dependsOn:classes) { - classifier = 'sources' - from sourceSets.main.allJava - } - - task javadocJar(type: Jar) { - classifier = 'javadoc' - from javadoc - } - - publishing { - publications { - mavenJava(MavenPublication) { - from components.java - artifact sourcesJar - artifact javadocJar - } - } - } -} - -project('spring-statemachine-core') { - apply from: "$rootDir/gradle/java-test-fixtures.gradle" - description = 'Spring State Machine Core' - - dependencies { - api 'org.springframework:spring-tx' - api 'org.springframework:spring-messaging' - api 'io.projectreactor:reactor-core' - optional 'org.springframework.security:spring-security-core' - - testImplementation 'org.springframework:spring-test' - testImplementation 'org.springframework:spring-web' - testImplementation 'org.springframework:spring-webmvc' - testImplementation 'io.projectreactor:reactor-test' - testFixturesImplementation 'io.projectreactor:reactor-test' - testImplementation 'org.apache.tomcat.embed:tomcat-embed-core' - testImplementation('org.mockito:mockito-core') { dep -> - exclude group: 'org.hamcrest' - } - testImplementation("org.junit.jupiter:junit-jupiter-api") - testImplementation("org.junit.jupiter:junit-jupiter-engine") - testImplementation 'org.assertj:assertj-core' - testFixturesImplementation 'org.assertj:assertj-core' - testImplementation 'org.springframework.security:spring-security-config' - testImplementation 'org.springframework.security:spring-security-test' - testImplementation 'jakarta.servlet:jakarta.servlet-api' - testImplementation 'org.awaitility:awaitility' - testRuntimeOnly 'org.apache.logging.log4j:log4j-core' - } -} - -project('spring-statemachine-autoconfigure') { - description = 'Spring State Machine Boot Autoconfigure' - - dependencies { - api project(':spring-statemachine-core') - api 'org.springframework.boot:spring-boot-autoconfigure' - api 'org.springframework.boot:spring-boot-actuator-autoconfigure' - api 'org.springframework.boot:spring-boot-actuator' - optional project(':spring-statemachine-data-common:spring-statemachine-data-jpa') - optional project(':spring-statemachine-data-common:spring-statemachine-data-redis') - optional project(':spring-statemachine-data-common:spring-statemachine-data-mongodb') - optional 'org.springframework.boot:spring-boot-autoconfigure-processor' - optional 'io.micrometer:micrometer-core' - optional 'jakarta.persistence:jakarta.persistence-api' - optional 'org.springframework.boot:spring-boot-starter-data-jpa' - optional 'org.springframework.boot:spring-boot-starter-data-redis' - optional 'org.springframework.boot:spring-boot-starter-data-mongodb' - testRuntimeOnly 'com.h2database:h2' - testImplementation 'org.springframework.boot:spring-boot-test' - testImplementation 'org.springframework:spring-test' - testImplementation("org.junit.jupiter:junit-jupiter-api") - testImplementation("org.junit.jupiter:junit-jupiter-engine") - } -} - -project('spring-statemachine-test') { - apply from: "$rootDir/gradle/java-test-fixtures.gradle" - description = "Spring State Machine Test" - - dependencies { - api 'org.springframework:spring-context' - api project(':spring-statemachine-core') - api 'org.springframework:spring-test' - api 'org.hamcrest:hamcrest-core' - api 'org.hamcrest:hamcrest-library' - api 'org.assertj:assertj-core' - optional 'junit:junit' - optional 'org.junit.jupiter:junit-jupiter-api' - optional 'org.junit.vintage:junit-vintage-engine' - testImplementation('org.mockito:mockito-core') { dep -> - exclude group: 'org.hamcrest' - } - testImplementation(testFixtures(project(":spring-statemachine-core"))) - testImplementation 'io.projectreactor:reactor-test' - } -} - -project('spring-statemachine-kryo') { - description = 'Spring State Machine Kryo' - - dependencies { - api project(':spring-statemachine-core') - api 'com.esotericsoftware:kryo-shaded' - - testImplementation (project(':spring-statemachine-test')) { dep -> - exclude group: 'junit', module: 'junit' - exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' - } - testImplementation 'org.springframework:spring-test' - testImplementation("org.junit.jupiter:junit-jupiter-api") - testImplementation("org.junit.jupiter:junit-jupiter-engine") - testRuntimeOnly 'org.apache.logging.log4j:log4j-core' - } -} - -project('spring-statemachine-zookeeper') { - description = 'Spring State Machine Zookeeper' - - dependencies { - api 'org.springframework:spring-context' - api project(':spring-statemachine-core') - api project(':spring-statemachine-kryo') - api 'org.apache.curator:curator-recipes' - // github.com/spring-gradle-plugins/dependency-management-plugin/issues/136 - compileOnly 'log4j:log4j' - - testImplementation (project(':spring-statemachine-test')) { dep -> - exclude group: 'junit', module: 'junit' - exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' - } - testImplementation 'org.apache.curator:curator-test' - testImplementation 'org.springframework:spring-test' - testImplementation("org.junit.jupiter:junit-jupiter-api") - testImplementation("org.junit.jupiter:junit-jupiter-engine") - testRuntimeOnly 'org.apache.logging.log4j:log4j-core' - } -} - -project('spring-statemachine-data-common') { - apply from: "$rootDir/gradle/java-test-fixtures.gradle" - - dependencies { - api project(':spring-statemachine-core') - api project(':spring-statemachine-kryo') - api 'org.springframework.data:spring-data-commons' - optional 'org.springframework.security:spring-security-core' - api 'com.fasterxml.jackson.core:jackson-core' - api 'com.fasterxml.jackson.core:jackson-databind' - testImplementation (project(':spring-statemachine-test')) { dep -> - exclude group: 'junit', module: 'junit' - exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' - } - testFixturesImplementation (project(':spring-statemachine-test')) { dep -> - exclude group: 'junit', module: 'junit' - exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' - } - testImplementation(testFixtures(project(":spring-statemachine-core"))) - testImplementation 'io.projectreactor:reactor-test' - testImplementation 'org.springframework.boot:spring-boot-starter-test' - testFixturesImplementation 'org.springframework.boot:spring-boot-starter-test' - testRuntimeOnly 'org.springframework.boot:spring-boot-starter-web' - } -} - -project('spring-statemachine-cluster') { - description = 'Spring State Machine Cluster' - - dependencies { - api project(':spring-statemachine-zookeeper') - api 'org.springframework.integration:spring-integration-zookeeper' - - testImplementation (project(':spring-statemachine-test')) { dep -> - exclude group: 'junit', module: 'junit' - exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' - } - testImplementation 'org.apache.curator:curator-test' - testImplementation 'org.springframework:spring-test' - testImplementation("org.junit.jupiter:junit-jupiter-api") - testImplementation("org.junit.jupiter:junit-jupiter-engine") - testRuntimeOnly 'org.apache.logging.log4j:log4j-core' - } -} - -project('spring-statemachine-uml') { - apply from: "$rootDir/gradle/java-test-fixtures.gradle" - description = 'Spring State Machine Uml' - - dependencies { - api project(':spring-statemachine-core') - optional 'org.springframework.security:spring-security-core' - - // these eclipse maven deps are simply broken - api('org.eclipse.uml2:uml') { dep -> - exclude group: 'org.eclipse.core', module: 'runtime' - exclude group: 'org.eclipse.emf', module: 'ecore' - exclude group: 'org.eclipse.emf.ecore', module: 'xmi' - exclude group: 'org.eclipse.emf.mapping', module: 'ecore2xml' - exclude group: 'org.eclipse.uml2', module: 'common' - exclude group: 'org.eclipse.uml2', module: 'types' - } - api('org.eclipse.uml2:types') { dep -> - exclude group: 'org.eclipse.core', module: 'runtime' - exclude group: 'org.eclipse.emf', module: 'ecore' - exclude group: 'org.eclipse.uml2', module: 'common' - } - api('org.eclipse.uml2:common') { dep -> - exclude group: 'org.eclipse.core', module: 'runtime' - exclude group: 'org.eclipse.emf', module: 'ecore' - } - api 'org.eclipse.emf:org.eclipse.emf.ecore.xmi' - api 'org.eclipse.emf:org.eclipse.emf.ecore' - api 'org.eclipse.emf:org.eclipse.emf.common' - testImplementation(testFixtures(project(":spring-statemachine-core"))) - testImplementation 'io.projectreactor:reactor-test' - testImplementation 'org.springframework:spring-test' - testImplementation("org.junit.jupiter:junit-jupiter-api") - testImplementation("org.junit.jupiter:junit-jupiter-engine") - testImplementation 'org.awaitility:awaitility' - testRuntimeOnly 'org.apache.logging.log4j:log4j-core' - } -} - -project('spring-statemachine-build-tests') { - apply from: "$rootDir/gradle/java-test-fixtures.gradle" - description = 'Spring State Machine Build Tests' - - dependencies { - testImplementation project(':spring-statemachine-uml') - testImplementation project(':spring-statemachine-test') - testImplementation project(':spring-statemachine-data-common:spring-statemachine-data-jpa') - testImplementation project(':spring-statemachine-data-common:spring-statemachine-data-redis') - testImplementation project(':spring-statemachine-data-common:spring-statemachine-data-mongodb') - testImplementation(testFixtures(project(":spring-statemachine-core"))) - testImplementation 'io.projectreactor:reactor-test' - testImplementation 'org.apache.commons:commons-pool2' - testRuntimeOnly 'org.springframework.boot:spring-boot-starter-data-mongodb' - testRuntimeOnly 'org.springframework.boot:spring-boot-starter-data-redis' - testRuntimeOnly 'redis.clients:jedis' - testImplementation 'org.springframework.boot:spring-boot-starter-data-jpa' - testImplementation 'com.h2database:h2' - testImplementation 'org.springframework.boot:spring-boot-starter' - testImplementation 'org.springframework:spring-test' - } -} - -configure(recipeProjects()) { - apply from: "$rootDir/gradle/java-test-fixtures.gradle" - - dependencies { - api project(':spring-statemachine-recipes-common') - testImplementation(testFixtures(project(":spring-statemachine-core"))) - testImplementation 'io.projectreactor:reactor-test' - testImplementation 'org.springframework:spring-test' - testImplementation("org.junit.jupiter:junit-jupiter-api") - testImplementation("org.junit.jupiter:junit-jupiter-engine") - } -} - -project('spring-statemachine-recipes-common') { - apply from: "$rootDir/gradle/java-test-fixtures.gradle" - - dependencies { - api 'org.springframework:spring-context' - api project(':spring-statemachine-core') - testImplementation(testFixtures(project(":spring-statemachine-core"))) - testImplementation 'io.projectreactor:reactor-test' - testImplementation 'org.springframework:spring-test' - testImplementation("org.junit.jupiter:junit-jupiter-api") - testImplementation("org.junit.jupiter:junit-jupiter-engine") - } -} - -project('spring-statemachine-bom') { - apply plugin: 'java-platform' - apply from: "$rootDir/gradle/publications.gradle" - description = 'Spring Statemachine (Bill of Materials)' - group = 'org.springframework.statemachine' - - tasks.withType(GenerateModuleMetadata) { - enabled = false - } - - dependencies { - constraints { - parent.moduleProjects.sort { "$it.name" }.each { - api it - } - } - } - - publishing { - publications { - mavenJava(MavenPublication) { - artifactId = 'spring-statemachine-bom' - from components.javaPlatform - } - } - } - -} - -project('spring-statemachine-starter') { - description = 'Spring Statemachine Starter' - dependencies { - api project(':spring-statemachine-autoconfigure') - api 'org.springframework.boot:spring-boot-starter' - } -} - -configure(sampleProjects()) { - apply plugin: 'org.springframework.boot' - compileJava { - sourceCompatibility = 17 - targetCompatibility = 17 - } - dependencies { - api project(':spring-statemachine-core') - api 'org.springframework:spring-context-support' - testImplementation('org.mockito:mockito-core') { dep -> - exclude group: 'org.hamcrest' - } - testImplementation (project(':spring-statemachine-test')) { dep -> - exclude group: 'junit', module: 'junit' - exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' - } - testImplementation 'org.springframework.boot:spring-boot-test' - testImplementation 'org.springframework:spring-test' - testImplementation("org.junit.jupiter:junit-jupiter-api") - testImplementation("org.junit.jupiter:junit-jupiter-engine") - } - build.dependsOn bootJar - - artifacts { - archives bootJar - } -} - -project('spring-statemachine-samples-common') { - apply from: "$rootDir/gradle/java-test-fixtures.gradle" - - dependencies { - api project(':spring-statemachine-core') - api 'org.springframework.shell:spring-shell' - api 'org.springframework.boot:spring-boot-starter' - testImplementation(testFixtures(project(":spring-statemachine-core"))) - } -} - -configure(rootProject) { - apply from: "$rootDir/gradle/publications.gradle" - description = 'Spring State Machine' - - pluginManager.withPlugin('com.jfrog.artifactory') { - artifactory { - publish { - defaults { - properties { - archives '*:*:*:*@zip', 'zip.deployed': false, 'zip.name': 'spring-statemachine', 'zip.displayname': 'Spring Statemachine' - archives '*:*:*:docs@zip', 'zip.type': 'docs' - archives '*:*:*:dist@zip', 'zip.type': 'dist' - } - } - } - } - } - - dependencies { - // just used to get version into docs - api 'org.springframework:spring-core' - api 'org.springframework.boot:spring-boot' - } - - // don't publish the default jar for the root project - configurations.archives.artifacts.clear() - - afterEvaluate { - tasks.findAll { it.name.startsWith('reference') }.each{ it.dependsOn.add('asciidoctor') } - } - - configurations { - docs - } - - task prepareAsciidocBuild(type: Sync) { - // and doc sources - from 'docs/src/reference/asciidoc/' - // to a build directory of your choice - into "$buildDir/asciidoc/assemble" - } - - asciidoctorj { - version = '2.4.3' - } - - asciidoctor { - configurations "docs" - dependsOn 'prepareAsciidocBuild' - dependsOn 'copyDocsSamples' - baseDirFollowsSourceFile() - sourceDir "$buildDir/asciidoc/assemble" - sources { - include 'index.adoc' - } - resources { - from(sourceDir) { - include 'images/*', 'css/**', 'js/**', 'samples/**' - } - } - outputOptions { - backends "spring-html" - } - options doctype: 'book', eruby: 'erubis' - attributes \ - 'docinfo': 'shared', - 'toc': 'left', - 'toc-levels': '4', - 'stylesdir': "css/", - 'stylesheet': 'spring.css', - 'linkcss': true, - 'icons': 'font', - 'sectanchors': '', - 'idprefix': '', - 'idseparator': '-', - 'spring-statemachine-version' : project.version, - 'spring-version' : getResolvedVersionOf("spring-core"), - 'spring-boot-version' : getResolvedVersionOf("spring-boot"), - 'revnumber' : project.version - } - - asciidoctorPdf { - dependsOn 'copyDocsSamples' - baseDirFollowsSourceFile() - sourceDir "$buildDir/asciidoc/assemble" - sources { - include 'index.adoc' - } - options doctype: 'book', eruby: 'erubis' - attributes \ - 'spring-statemachine-version' : project.version, - 'spring-version' : getResolvedVersionOf("spring-core"), - 'spring-boot-version' : getResolvedVersionOf("spring-boot"), - 'revnumber' : project.version - } - - dependencies { // for integration tests - docs "io.spring.asciidoctor.backends:spring-asciidoctor-backends:${springAsciidoctorBackends}" - } - - task copyDocsSamples(type: Copy) { - from 'spring-statemachine-core/src/test/java/org/springframework/statemachine/docs' - from 'spring-statemachine-test/src/test/java/org/springframework/statemachine/test/docs' - from 'spring-statemachine-recipes/src/test/java/org/springframework/statemachine/recipes/docs' - from 'spring-statemachine-zookeeper/src/test/java/org/springframework/statemachine/zookeeper/docs' - from 'spring-statemachine-uml/src/test/java/org/springframework/statemachine/uml/docs' - from 'spring-statemachine-uml/src/test/resources/org/springframework/statemachine/uml/docs' - from 'spring-statemachine-data/jpa/src/test/java/org/springframework/statemachine/data/jpa/docs' - from 'spring-statemachine-data/redis/src/test/java/org/springframework/statemachine/data/redis/docs' - from 'spring-statemachine-data/mongodb/src/test/java/org/springframework/statemachine/data/mongodb/docs' - from 'spring-statemachine-samples/src/main/java/' - from 'spring-statemachine-samples/washer/src/main/java/' - from 'spring-statemachine-samples/tasks/src/main/java/' - from 'spring-statemachine-samples/turnstile/src/main/java/' - from 'spring-statemachine-samples/turnstilereactive/src/main/java/' - from 'spring-statemachine-samples/showcase/src/main/java/' - from 'spring-statemachine-samples/cdplayer/src/main/java/' - from 'spring-statemachine-samples/persist/src/main/java/' - from 'spring-statemachine-samples/zookeeper/src/main/java/' - from 'spring-statemachine-samples/security/src/main/java/' - from 'spring-statemachine-samples/eventservice/src/main/java/' - from 'spring-statemachine-samples/datajpa/src/main/java/' - from 'spring-statemachine-samples/datajpa/src/main/resources/' - from 'spring-statemachine-samples/datajpamultipersist/src/main/java/' - from 'spring-statemachine-samples/datajpamultipersist/src/main/resources/' - from 'spring-statemachine-samples/datapersist/src/main/java/' - from 'spring-statemachine-samples/monitoring/src/main/java/' - include '**/*.java' - include '**/*.uml' - include '**/*.json' - into 'docs/src/reference/asciidoc/samples' - } - - task api(type: Javadoc) { - group = 'Documentation' - description = 'Generates aggregated Javadoc API documentation.' - title = "${rootProject.description} ${version} API" - options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED - options.author = true - options.header = rootProject.description - options.links( - 'https://docs.jboss.org/jbossas/javadoc/4.0.5/connector' - ) - - // disable javadocs for samples - source javaProjects - .findAll { project -> - !project.name.contains('samples') - } - .collect { project -> - project.sourceSets.main.allJava - } - - destinationDir = new File(buildDir, "api") - classpath = files(javaProjects.collect { project -> - project.sourceSets.main.compileClasspath - }) - maxMemory = '1024m' - } - - task docsZip(type: Zip) { - group = 'Distribution' - classifier = 'docs' - description = "Builds -${classifier} archive containing api and reference for deployment." - from('src/dist') { - include 'changelog.txt' - } - from (api) { - into 'api' - } - from (asciidoctorPdf) { - into 'reference' - include 'index.pdf' - } - from (asciidoctor) { - into 'reference' - include 'index.html' - include 'js/**' - include 'css/**' - include 'images/**' - include 'samples/**' - } - } - - task distZip(type: Zip, dependsOn: [docsZip]) { - group = 'Distribution' - classifier = 'dist' - description = "Builds -${classifier} archive, containing all jars and docs, " + - "suitable for community download page." - - ext.baseDir = "${project.name}-${project.version}"; - - from('src/dist') { - include 'readme.txt' - include 'license.txt' - include 'notice.txt' - into "${baseDir}" - expand(copyright: new Date().format('yyyy'), version: project.version) - } - - from(zipTree(docsZip.archivePath)) { - into "${baseDir}/docs" - } - - javaProjects.each { subproject -> - into ("${baseDir}/libs") { - from subproject.jar - if (subproject.tasks.findByPath('sourcesJar')) { - from subproject.sourcesJar - } - if (subproject.tasks.findByPath('javadocJar')) { - from subproject.javadocJar - } - } - } - } - - task nextVersion { - doLast{ - def properties = new Properties() - def file = new File('gradle.properties') - properties.load(file.newDataInputStream()) - def currentVersion = properties.getProperty('version') - if (currentVersion.indexOf('-SNAPSHOT') < 0) { - throw new GradleException('Version is a non SNAPSHOT version') - } else { - def (major, minor, patch) = version.tokenize('.') - patch = patch.replace('-SNAPSHOT', '') - patch = String.valueOf(patch.toInteger() + 1) - def nextVersion = major + '.' + minor + '.' + patch + '-SNAPSHOT' - properties.setProperty('version', nextVersion) - properties.store(file.newWriter(), null) - } - } - } - - task milestoneVersion { - doLast{ - def postfix = project.getProperty('statemachineMilestone') - if (!(postfix ==~ /(?:M|RC)\d+/)) { - throw new GradleException('Illegal milestone version') - } - def properties = new Properties() - def file = new File('gradle.properties') - properties.load(file.newDataInputStream()) - def currentVersion = properties.getProperty('version') - if (currentVersion.indexOf('-SNAPSHOT') > 0) { - def nextVersion = currentVersion - '-SNAPSHOT' + '-' + postfix - properties.setProperty('version', nextVersion) - properties.store(file.newWriter(), null) - } else { - throw new GradleException('Version is not a SNAPSHOT version') - } - } - } - - task releaseVersion { - doLast{ - def properties = new Properties() - def file = new File('gradle.properties') - properties.load(file.newDataInputStream()) - def currentVersion = properties.getProperty('version') - if (currentVersion.indexOf('-SNAPSHOT') > 0) { - def nextVersion = currentVersion - '-SNAPSHOT' - properties.setProperty('version', nextVersion) - properties.store(file.newWriter(), null) - } else { - throw new GradleException('Version is not a SNAPSHOT version') - } - } - } - - publishing { - publications { - mavenJava(MavenPublication) { - artifact docsZip - artifact distZip - } - } - } - -} diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 68f44bdb..2ef6e247 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -1,17 +1,58 @@ plugins { - id 'java-gradle-plugin' + id "java-gradle-plugin" + id "java" } +sourceCompatibility = JavaVersion.VERSION_17; + repositories { - mavenCentral() gradlePluginPortal() + mavenCentral() + maven { url 'https://repo.spring.io/plugins-release/' } + maven { url "https://repo.spring.io/snapshot" } +} + +ext { + def propertiesFile = new File(new File("$projectDir").parentFile, "gradle.properties") + propertiesFile.withInputStream { + def properties = new Properties() + properties.load(it) + set("springBootVersion", properties["springBootVersion"]) + } +} + +dependencies { + implementation(platform("org.springframework.boot:spring-boot-dependencies:${springBootVersion}")) + implementation("org.springframework:spring-core") + implementation 'org.asciidoctor:asciidoctor-gradle-jvm:3.3.2' + implementation 'org.jfrog.buildinfo:build-info-extractor-gradle:4.29.0' } gradlePlugin { plugins { - optionalDependenciesPlugin { - id = "org.springframework.statemachine.optional-dependencies" - implementationClass = "org.springframework.statemachine.gradle.OptionalDependenciesPlugin" + modulePlugin { + id = "org.springframework.statemachine.module" + implementationClass = "org.springframework.statemachine.gradle.ModulePlugin" + } + starterPlugin { + id = "org.springframework.statemachine.starter" + implementationClass = "org.springframework.statemachine.gradle.StarterPlugin" + } + bomPlugin { + id = "org.springframework.statemachine.bom" + implementationClass = "org.springframework.statemachine.gradle.BomPlugin" + } + docsPlugin { + id = "org.springframework.statemachine.docs" + implementationClass = "org.springframework.statemachine.gradle.DocsPlugin" + } + distPlugin { + id = "org.springframework.statemachine.root" + implementationClass = "org.springframework.statemachine.gradle.RootPlugin" + } + samplePlugin { + id = "org.springframework.statemachine.sample" + implementationClass = "org.springframework.statemachine.gradle.SamplePlugin" } } } diff --git a/buildSrc/src/main/java/org/springframework/statemachine/gradle/ArtifactoryConventions.java b/buildSrc/src/main/java/org/springframework/statemachine/gradle/ArtifactoryConventions.java new file mode 100644 index 00000000..4d322276 --- /dev/null +++ b/buildSrc/src/main/java/org/springframework/statemachine/gradle/ArtifactoryConventions.java @@ -0,0 +1,74 @@ +/* + * Copyright 2022 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 java.util.HashMap; +import java.util.Map; + +import org.gradle.api.Project; +import org.gradle.api.Task; +import org.gradle.api.plugins.PluginManager; +import org.gradle.api.publish.tasks.GenerateModuleMetadata; +import org.jfrog.build.extractor.clientConfiguration.ArtifactSpec; +import org.jfrog.build.extractor.clientConfiguration.ArtifactSpecs; +import org.jfrog.gradle.plugin.artifactory.ArtifactoryPlugin; +import org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask; + +/** + * @author Janne Valkealahti + */ +public class ArtifactoryConventions { + + void apply(Project project) { + PluginManager pluginManager = project.getPluginManager(); + pluginManager.apply(ArtifactoryPlugin.class); + + project.getTasks().withType(GenerateModuleMetadata.class, metadata -> { + metadata.setEnabled(false); + }); + + project.getPlugins().withType(ArtifactoryPlugin.class, artifactory -> { + Task task = project.getTasks().findByName(ArtifactoryTask.ARTIFACTORY_PUBLISH_TASK_NAME); + if (task != null) { + ArtifactoryTask aTask = (ArtifactoryTask) task; + aTask.setCiServerBuild(); + // bom is not a java project so plugin doesn't + // add defaults for publications. + aTask.publications("mavenJava"); + aTask.publishConfigs("archives"); + + // plugin is difficult to work with, use this hack + // to set props before task does its real work + task.doFirst(t -> { + // this needs mods if we ever have zips other than + // docs zip having asciidoc/javadoc. + ArtifactoryTask at = (ArtifactoryTask) t; + ArtifactSpecs artifactSpecs = at.getArtifactSpecs(); + Map propsMap = new HashMap<>(); + propsMap.put("zip.deployed", "false"); + propsMap.put("zip.type", "docs"); + ArtifactSpec spec = ArtifactSpec.builder() + .artifactNotation("*:*:*:*@zip") + // archives is manually set for zip in root plugin + .configuration("archives") + .properties(propsMap) + .build(); + artifactSpecs.add(spec); + }); + } + }); + } +} diff --git a/buildSrc/src/main/java/org/springframework/statemachine/gradle/BomPlugin.java b/buildSrc/src/main/java/org/springframework/statemachine/gradle/BomPlugin.java new file mode 100644 index 00000000..1823da43 --- /dev/null +++ b/buildSrc/src/main/java/org/springframework/statemachine/gradle/BomPlugin.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 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.dsl.DependencyConstraintHandler; +import org.gradle.api.plugins.JavaPlatformPlugin; +import org.gradle.api.plugins.PluginManager; + +/** + * @author Janne Valkealahti + */ +class BomPlugin implements Plugin { + + @Override + public void apply(Project project) { + PluginManager pluginManager = project.getPluginManager(); + pluginManager.apply(SpringMavenPlugin.class); + pluginManager.apply(JavaPlatformPlugin.class); + new ArtifactoryConventions().apply(project); + + // bom should have main modules user can consume + DependencyConstraintHandler constraints = project.getDependencies().getConstraints(); + project.getRootProject().getAllprojects().forEach(p -> { + p.getPlugins().withType(ModulePlugin.class, m -> { + constraints.add("api", p); + }); + p.getPlugins().withType(StarterPlugin.class, m -> { + constraints.add("api", p); + }); + }); + } +} diff --git a/buildSrc/src/main/java/org/springframework/statemachine/gradle/DocsPlugin.java b/buildSrc/src/main/java/org/springframework/statemachine/gradle/DocsPlugin.java new file mode 100644 index 00000000..08cf8980 --- /dev/null +++ b/buildSrc/src/main/java/org/springframework/statemachine/gradle/DocsPlugin.java @@ -0,0 +1,214 @@ +/* + * Copyright 2022-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 java.io.File; +import java.time.LocalDate; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.asciidoctor.gradle.base.AsciidoctorAttributeProvider; +import org.asciidoctor.gradle.jvm.AbstractAsciidoctorTask; +import org.asciidoctor.gradle.jvm.AsciidoctorJExtension; +import org.asciidoctor.gradle.jvm.AsciidoctorJPlugin; +import org.asciidoctor.gradle.jvm.AsciidoctorTask; +import org.gradle.api.Action; +import org.gradle.api.Plugin; +import org.gradle.api.Project; +import org.gradle.api.Task; +import org.gradle.api.plugins.JavaLibraryPlugin; +import org.gradle.api.plugins.JavaPlugin; +import org.gradle.api.plugins.PluginManager; +import org.gradle.api.publish.tasks.GenerateModuleMetadata; +import org.gradle.api.tasks.PathSensitivity; +import org.gradle.api.tasks.Sync; +import org.springframework.util.StringUtils; + +/** + * @author Janne Valkealahti + */ +class DocsPlugin implements Plugin { + + private static final String ASCIIDOCTORJ_VERSION = "2.4.3"; + private static final String EXTENSIONS_CONFIGURATION_NAME = "asciidoctorExtensions"; + + @Override + public void apply(Project project) { + PluginManager pluginManager = project.getPluginManager(); + pluginManager.apply(JavaPlugin.class); + pluginManager.apply(JavaLibraryPlugin.class); + pluginManager.apply(ManagementConfigurationPlugin.class); + pluginManager.apply(SpringMavenPlugin.class); + pluginManager.apply(AsciidoctorJPlugin.class); + + ExtractVersionConstraints dependencyVersions = project.getTasks().create("dependencyVersions", + ExtractVersionConstraints.class, task -> { + task.enforcedPlatform(":spring-statemachine-platform"); + }); + + project.getPlugins().withType(AsciidoctorJPlugin.class, (asciidoctorPlugin) -> { + // makeAllWarningsFatal(project); + upgradeAsciidoctorJVersion(project); + createAsciidoctorExtensionsConfiguration(project); + project.getTasks() + .withType(AbstractAsciidoctorTask.class, + (asciidoctorTask) -> configureAsciidoctorTask(project, asciidoctorTask, dependencyVersions)); + }); + project.getTasks().withType(GenerateModuleMetadata.class, metadata -> { + metadata.setEnabled(false); + }); + } + + private void upgradeAsciidoctorJVersion(Project project) { + project.getExtensions().getByType(AsciidoctorJExtension.class).setVersion(ASCIIDOCTORJ_VERSION); + } + + private void createAsciidoctorExtensionsConfiguration(Project project) { + project.getConfigurations().create(EXTENSIONS_CONFIGURATION_NAME, (configuration) -> { + configuration.getDependencies() + .add(project.getDependencies() + .create("io.spring.asciidoctor.backends:spring-asciidoctor-backends:0.0.5")); + }); + } + + private void configureAsciidoctorTask(Project project, AbstractAsciidoctorTask asciidoctorTask, ExtractVersionConstraints dependencyVersions) { + asciidoctorTask.configurations(EXTENSIONS_CONFIGURATION_NAME); + configureCommonAttributes(project, asciidoctorTask, dependencyVersions); + configureOptions(asciidoctorTask); + asciidoctorTask.baseDirFollowsSourceDir(); + createSyncDocumentationSourceTask(project, asciidoctorTask, dependencyVersions); + if (asciidoctorTask instanceof AsciidoctorTask) { + AsciidoctorTask task = (AsciidoctorTask)asciidoctorTask; + task.outputOptions((outputOptions) -> outputOptions.backends("spring-html")); + } + } + + private void configureOptions(AbstractAsciidoctorTask asciidoctorTask) { + asciidoctorTask.options(Collections.singletonMap("doctype", "book")); + } + + private Sync createSyncDocumentationSourceTask(Project project, AbstractAsciidoctorTask asciidoctorTask, ExtractVersionConstraints dependencyVersions) { + Sync syncDocumentationSource = project.getTasks() + .create("syncDocumentationSourceFor" + StringUtils.capitalize(asciidoctorTask.getName()), Sync.class); + syncDocumentationSource.preserve(filter -> { + filter.include("**/*"); + }); + File syncedSource = new File(project.getBuildDir(), "docs/src/" + asciidoctorTask.getName()); + syncDocumentationSource.setDestinationDir(syncedSource); + // syncDocumentationSource.from("src/main/"); + syncDocumentationSource.from("src/reference/"); + asciidoctorTask.dependsOn(syncDocumentationSource); + asciidoctorTask.dependsOn(dependencyVersions); + Sync snippetsResources = createSnippetsResourcesTask(project); + asciidoctorTask.dependsOn(snippetsResources); + asciidoctorTask.getInputs() + .dir(syncedSource) + .withPathSensitivity(PathSensitivity.RELATIVE) + .withPropertyName("synced source"); + asciidoctorTask.setSourceDir(project.relativePath(new File(syncedSource, "asciidoc/"))); + return syncDocumentationSource; + } + + private Sync createSnippetsResourcesTask(Project project) { + List sources = Arrays.asList( + "spring-statemachine-core/src/test/java/org/springframework/statemachine/docs", + "spring-statemachine-test/src/test/java/org/springframework/statemachine/test/docs", + "spring-statemachine-recipes/src/test/java/org/springframework/statemachine/recipes/docs", + "spring-statemachine-zookeeper/src/test/java/org/springframework/statemachine/zookeeper/docs", + "spring-statemachine-uml/src/test/java/org/springframework/statemachine/uml/docs", + "spring-statemachine-uml/src/test/resources/org/springframework/statemachine/uml/docs", + "spring-statemachine-data/jpa/src/test/java/org/springframework/statemachine/data/jpa/docs", + "spring-statemachine-data/redis/src/test/java/org/springframework/statemachine/data/redis/docs", + "spring-statemachine-data/mongodb/src/test/java/org/springframework/statemachine/data/mongodb/docs", + "spring-statemachine-samples/src/main/java/", + "spring-statemachine-samples/washer/src/main/java/", + "spring-statemachine-samples/tasks/src/main/java/", + "spring-statemachine-samples/turnstile/src/main/java/", + "spring-statemachine-samples/turnstilereactive/src/main/java/", + "spring-statemachine-samples/showcase/src/main/java/", + "spring-statemachine-samples/cdplayer/src/main/java/", + "spring-statemachine-samples/persist/src/main/java/", + "spring-statemachine-samples/zookeeper/src/main/java/", + "spring-statemachine-samples/security/src/main/java/", + "spring-statemachine-samples/eventservice/src/main/java/", + "spring-statemachine-samples/datajpa/src/main/java/", + "spring-statemachine-samples/datajpa/src/main/resources/", + "spring-statemachine-samples/datajpamultipersist/src/main/java/", + "spring-statemachine-samples/datajpamultipersist/src/main/resources/", + "spring-statemachine-samples/datapersist/src/main/java/", + "spring-statemachine-samples/monitoring/src/main/java/"); + Sync sync = project.getTasks().create("snippetResources", Sync.class, s -> { + for (String source : sources) { + s.from(new File(project.getRootProject().getRootDir(), source), spec -> { + spec.include("**/*.java", "**/*.uml", "**/*.json"); + }); + } + s.preserve(filter -> { + filter.include("**/*"); + }); + File destination = new File(project.getBuildDir(), "docs/src/asciidoctor/asciidoc/samples"); + s.into(destination); + }); + return sync; + } + + private void configureCommonAttributes(Project project, AbstractAsciidoctorTask asciidoctorTask, + ExtractVersionConstraints dependencyVersions) { + asciidoctorTask.doFirst(new Action() { + + @Override + public void execute(Task arg0) { + asciidoctorTask.getAttributeProviders().add(new AsciidoctorAttributeProvider() { + @Override + public Map getAttributes() { + Map versionConstraints = dependencyVersions.getVersionConstraints(); + Map attrs = new HashMap<>(); + attrs.put("spring-version", versionConstraints.get("org.springframework:spring-core")); + attrs.put("spring-boot-version", versionConstraints.get("org.springframework.boot:spring-boot")); + return attrs; + } + }); + } + }); + + Map attributes = new HashMap<>(); + attributes.put("toc", "left"); + attributes.put("icons", "font"); + attributes.put("idprefix", ""); + attributes.put("idseparator", "-"); + attributes.put("docinfo", "shared"); + attributes.put("sectanchors", ""); + attributes.put("sectnums", ""); + attributes.put("today-year", LocalDate.now().getYear()); + attributes.put("snippets", "docs"); + + asciidoctorTask.getAttributeProviders().add(new AsciidoctorAttributeProvider() { + @Override + public Map getAttributes() { + Object version = project.getVersion(); + Map attrs = new HashMap<>(); + if (version != null && version.toString() != Project.DEFAULT_VERSION) { + attrs.put("project-version", version); + } + return attrs; + } + }); + asciidoctorTask.attributes(attributes); + } +} diff --git a/buildSrc/src/main/java/org/springframework/statemachine/gradle/EclipseConventions.java b/buildSrc/src/main/java/org/springframework/statemachine/gradle/EclipseConventions.java new file mode 100644 index 00000000..4003825f --- /dev/null +++ b/buildSrc/src/main/java/org/springframework/statemachine/gradle/EclipseConventions.java @@ -0,0 +1,59 @@ +/* + * Copyright 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. + * 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.Project; +import org.gradle.plugins.ide.api.XmlFileContentMerger; +import org.gradle.plugins.ide.eclipse.EclipsePlugin; +import org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry; +import org.gradle.plugins.ide.eclipse.model.Classpath; +import org.gradle.plugins.ide.eclipse.model.ClasspathEntry; +import org.gradle.plugins.ide.eclipse.model.EclipseClasspath; +import org.gradle.plugins.ide.eclipse.model.EclipseModel; + +class EclipseConventions { + + void apply(Project project) { + project.getPlugins().withType(EclipsePlugin.class, (eclipse) -> { + EclipseModel eclipseModel = project.getExtensions().getByType(EclipseModel.class); + eclipseModel.classpath(this::configureClasspath); + }); + } + + private void configureClasspath(EclipseClasspath classpath) { + classpath.file(this::configureClasspathFile); + } + + private void configureClasspathFile(XmlFileContentMerger merger) { + merger.whenMerged((content) -> { + if (content instanceof Classpath) { + Classpath classpath = (Classpath) content; + for (ClasspathEntry entry : classpath.getEntries()) { + if (entry instanceof AbstractClasspathEntry) { + AbstractClasspathEntry ace = (AbstractClasspathEntry) entry; + Object value = ace.getEntryAttributes().get("test"); + if (value instanceof String) { + if (Boolean.parseBoolean((String) value)) { + ace.getEntryAttributes().put("test", "false"); + } + } + } + } + } + }); + } + +} diff --git a/buildSrc/src/main/java/org/springframework/statemachine/gradle/ExtractVersionConstraints.java b/buildSrc/src/main/java/org/springframework/statemachine/gradle/ExtractVersionConstraints.java new file mode 100644 index 00000000..0acb0a01 --- /dev/null +++ b/buildSrc/src/main/java/org/springframework/statemachine/gradle/ExtractVersionConstraints.java @@ -0,0 +1,154 @@ +package org.springframework.statemachine.gradle; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; +import java.util.TreeSet; + +import org.gradle.api.DefaultTask; +import org.gradle.api.artifacts.ComponentMetadataDetails; +import org.gradle.api.artifacts.Configuration; +import org.gradle.api.artifacts.DependencyConstraint; +import org.gradle.api.artifacts.DependencyConstraintMetadata; +import org.gradle.api.artifacts.dsl.DependencyHandler; +import org.gradle.api.tasks.Internal; +import org.gradle.api.tasks.TaskAction; + +/** + * @author Janne Valkealahti + */ +class ExtractVersionConstraints extends DefaultTask { + + private final Configuration configuration; + + private final Map versionConstraints = new TreeMap<>(); + + private final Set constrainedVersions = new TreeSet<>(); + + private final Set versionProperties = new TreeSet<>(); + + private final List projectPaths = new ArrayList<>(); + + public ExtractVersionConstraints() { + DependencyHandler dependencies = getProject().getDependencies(); + this.configuration = getProject().getConfigurations().create(getName()); + dependencies.getComponents().all(this::processMetadataDetails); + } + + public void enforcedPlatform(String projectPath) { + this.configuration.getDependencies().add(getProject().getDependencies().enforcedPlatform( + getProject().getDependencies().project(Collections.singletonMap("path", projectPath)))); + this.projectPaths.add(projectPath); + } + + @Internal + public Map getVersionConstraints() { + return Collections.unmodifiableMap(this.versionConstraints); + } + + @Internal + public Set getConstrainedVersions() { + return this.constrainedVersions; + } + + @Internal + public Set getVersionProperties() { + return this.versionProperties; + } + + @TaskAction + void extractVersionConstraints() { + this.configuration.resolve(); + for (String projectPath : this.projectPaths) { + for (DependencyConstraint constraint : getProject().project(projectPath).getConfigurations() + .getByName("apiElements").getAllDependencyConstraints()) { + this.versionConstraints.put(constraint.getGroup() + ":" + constraint.getName(), + constraint.getVersionConstraint().toString()); + this.constrainedVersions.add(new ConstrainedVersion(constraint.getGroup(), constraint.getName(), + constraint.getVersionConstraint().toString())); + } + } + } + + private void processMetadataDetails(ComponentMetadataDetails details) { + details.allVariants((variantMetadata) -> variantMetadata.withDependencyConstraints((dependencyConstraints) -> { + for (DependencyConstraintMetadata constraint : dependencyConstraints) { + this.versionConstraints.put(constraint.getGroup() + ":" + constraint.getName(), + constraint.getVersionConstraint().toString()); + this.constrainedVersions.add(new ConstrainedVersion(constraint.getGroup(), constraint.getName(), + constraint.getVersionConstraint().toString())); + } + })); + } + + public static final class ConstrainedVersion implements Comparable, Serializable { + + private final String group; + + private final String artifact; + + private final String version; + + private ConstrainedVersion(String group, String artifact, String version) { + this.group = group; + this.artifact = artifact; + this.version = version; + } + + public String getGroup() { + return this.group; + } + + public String getArtifact() { + return this.artifact; + } + + public String getVersion() { + return this.version; + } + + @Override + public int compareTo(ConstrainedVersion other) { + int groupComparison = this.group.compareTo(other.group); + if (groupComparison != 0) { + return groupComparison; + } + return this.artifact.compareTo(other.artifact); + } + + } + + public static final class VersionProperty implements Comparable, Serializable { + + private final String libraryName; + + private final String versionProperty; + + public VersionProperty(String libraryName, String versionProperty) { + this.libraryName = libraryName; + this.versionProperty = versionProperty; + } + + public String getLibraryName() { + return this.libraryName; + } + + public String getVersionProperty() { + return this.versionProperty; + } + + @Override + public int compareTo(VersionProperty other) { + int groupComparison = this.libraryName.compareToIgnoreCase(other.libraryName); + if (groupComparison != 0) { + return groupComparison; + } + return this.versionProperty.compareTo(other.versionProperty); + } + + } +} diff --git a/buildSrc/src/main/java/org/springframework/statemachine/gradle/JavaConventions.java b/buildSrc/src/main/java/org/springframework/statemachine/gradle/JavaConventions.java new file mode 100644 index 00000000..49bf8822 --- /dev/null +++ b/buildSrc/src/main/java/org/springframework/statemachine/gradle/JavaConventions.java @@ -0,0 +1,122 @@ +/* + * Copyright 2022 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 java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; +import java.util.stream.Collectors; + +import org.gradle.api.JavaVersion; +import org.gradle.api.Project; +import org.gradle.api.plugins.JavaBasePlugin; +import org.gradle.api.tasks.SourceSet; +import org.gradle.api.tasks.SourceSetContainer; +import org.gradle.api.tasks.bundling.Jar; +import org.gradle.api.tasks.compile.JavaCompile; +import org.gradle.api.tasks.javadoc.Javadoc; +import org.gradle.api.tasks.testing.Test; +import org.gradle.external.javadoc.CoreJavadocOptions; + +/** + * @author Janne Valkealahti + */ +class JavaConventions { + + private static final String SOURCE_AND_TARGET_COMPATIBILITY = "17"; + + void apply(Project project) { + project.getPlugins().withType(JavaBasePlugin.class, java -> { + configureJavaConventions(project); + configureJavadocConventions(project); + configureTestConventions(project); + configureJarManifestConventions(project); + }); + } + + private void configureJavadocConventions(Project project) { + project.getTasks().withType(Javadoc.class, (javadoc) -> { + CoreJavadocOptions options = (CoreJavadocOptions) javadoc.getOptions(); + options.source("17"); + options.encoding("UTF-8"); + options.addStringOption("Xdoclint:none", "-quiet"); + }); + } + + private void configureJavaConventions(Project project) { + project.getTasks().withType(JavaCompile.class, (compile) -> { + compile.getOptions().setEncoding("UTF-8"); + List args = compile.getOptions().getCompilerArgs(); + if (!args.contains("-parameters")) { + args.add("-parameters"); + } + if (project.hasProperty("toolchainVersion")) { + compile.setSourceCompatibility(SOURCE_AND_TARGET_COMPATIBILITY); + compile.setTargetCompatibility(SOURCE_AND_TARGET_COMPATIBILITY); + } + else if (buildingWithJava17(project)) { + args.addAll(Arrays.asList("-Xdoclint:none")); + // TODO: When we're without javadoc errors + // args.addAll(Arrays.asList("-Werror", "-Xlint:unchecked", "-Xlint:deprecation", "-Xlint:rawtypes", + // "-Xlint:varargs")); + } + }); + } + + private boolean buildingWithJava17(Project project) { + return JavaVersion.current() == JavaVersion.VERSION_17; + } + + private void configureTestConventions(Project project) { + project.getTasks().withType(Test.class, test -> { + test.useJUnitPlatform(); + }); + } + + private void configureJarManifestConventions(Project project) { + SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class); + Set sourceJarTaskNames = sourceSets.stream().map(SourceSet::getSourcesJarTaskName) + .collect(Collectors.toSet()); + Set javadocJarTaskNames = sourceSets.stream().map(SourceSet::getJavadocJarTaskName) + .collect(Collectors.toSet()); + + project.getTasks().withType(Jar.class, jar -> { + jar.manifest(manifest -> { + Map attributes = new TreeMap<>(); + attributes.put("Automatic-Module-Name", project.getName().replace("-", ".")); + attributes.put("Build-Jdk-Spec", SOURCE_AND_TARGET_COMPATIBILITY); + attributes.put("Built-By", "Spring"); + attributes.put("Implementation-Title", + determineImplementationTitle(project, sourceJarTaskNames, javadocJarTaskNames, jar)); + attributes.put("Implementation-Version", project.getVersion()); + manifest.attributes(attributes); + }); + }); + } + + private String determineImplementationTitle(Project project, Set sourceJarTaskNames, + Set javadocJarTaskNames, Jar jar) { + if (sourceJarTaskNames.contains(jar.getName())) { + return "Source for " + project.getName(); + } + if (javadocJarTaskNames.contains(jar.getName())) { + return "Javadoc for " + project.getName(); + } + return "Jar for " + project.getName(); + } +} diff --git a/buildSrc/src/main/java/org/springframework/statemachine/gradle/ManagementConfigurationPlugin.java b/buildSrc/src/main/java/org/springframework/statemachine/gradle/ManagementConfigurationPlugin.java new file mode 100644 index 00000000..bb6ccf7b --- /dev/null +++ b/buildSrc/src/main/java/org/springframework/statemachine/gradle/ManagementConfigurationPlugin.java @@ -0,0 +1,67 @@ +/* + * Copyright 2022 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.ConfigurationContainer; +import org.gradle.api.plugins.JavaPlugin; +import org.gradle.api.plugins.JavaTestFixturesPlugin; +import org.gradle.api.plugins.PluginContainer; +import org.gradle.api.publish.PublishingExtension; +import org.gradle.api.publish.maven.MavenPublication; +import org.gradle.api.publish.maven.plugins.MavenPublishPlugin; + +/** + * Creates a Management configuration that is appropriate for adding a platform + * to that is not exposed externally. If the JavaPlugin is applied, the + * compileClasspath, runtimeClasspath, testCompileClasspath, and + * testRuntimeClasspath will extend from it. + * + * @author Janne Valkealahti + */ +public class ManagementConfigurationPlugin implements Plugin { + + public static final String MANAGEMENT_CONFIGURATION_NAME = "management"; + + @Override + public void apply(Project project) { + ConfigurationContainer configurations = project.getConfigurations(); + configurations.create(MANAGEMENT_CONFIGURATION_NAME, (management) -> { + management.setVisible(false); + management.setCanBeConsumed(false); + management.setCanBeResolved(false); + PluginContainer plugins = project.getPlugins(); + plugins.withType(JavaPlugin.class, (javaPlugin) -> { + configurations.getByName(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME).extendsFrom(management); + }); + plugins.withType(JavaTestFixturesPlugin.class, (javaTestFixturesPlugin) -> { + configurations.getByName("testFixturesCompileClasspath").extendsFrom(management); + configurations.getByName("testFixturesRuntimeClasspath").extendsFrom(management); + }); + plugins.withType(OptionalDependenciesPlugin.class, (optionalDependencies) -> configurations + .getByName(OptionalDependenciesPlugin.OPTIONAL_CONFIGURATION_NAME).extendsFrom(management)); + plugins.withType(MavenPublishPlugin.class, (mavenPublish) -> { + PublishingExtension publishing = project.getExtensions().getByType(PublishingExtension.class); + publishing.getPublications().withType(MavenPublication.class, (mavenPublication -> { + mavenPublication.versionMapping((versions) -> + versions.allVariants(versionMapping -> versionMapping.fromResolutionResult()) + ); + })); + }); + }); + } +} diff --git a/buildSrc/src/main/java/org/springframework/statemachine/gradle/ModulePlugin.java b/buildSrc/src/main/java/org/springframework/statemachine/gradle/ModulePlugin.java new file mode 100644 index 00000000..baabef2b --- /dev/null +++ b/buildSrc/src/main/java/org/springframework/statemachine/gradle/ModulePlugin.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 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.plugins.JavaLibraryPlugin; +import org.gradle.api.plugins.JavaPlugin; +import org.gradle.api.plugins.JavaTestFixturesPlugin; +import org.gradle.api.plugins.PluginManager; + +/** + * @author Janne Valkealahti + */ +class ModulePlugin implements Plugin { + + @Override + public final void apply(Project project) { + PluginManager pluginManager = project.getPluginManager(); + pluginManager.apply(JavaPlugin.class); + pluginManager.apply(OptionalDependenciesPlugin.class); + pluginManager.apply(ManagementConfigurationPlugin.class); + pluginManager.apply(JavaLibraryPlugin.class); + pluginManager.apply(SpringMavenPlugin.class); + pluginManager.apply(JavaTestFixturesPlugin.class); + new ArtifactoryConventions().apply(project); + new JavaConventions().apply(project); + new EclipseConventions().apply(project); + } +} diff --git a/buildSrc/src/main/java/org/springframework/statemachine/gradle/OptionalDependenciesPlugin.java b/buildSrc/src/main/java/org/springframework/statemachine/gradle/OptionalDependenciesPlugin.java index dcac8c75..a5b83de2 100644 --- a/buildSrc/src/main/java/org/springframework/statemachine/gradle/OptionalDependenciesPlugin.java +++ b/buildSrc/src/main/java/org/springframework/statemachine/gradle/OptionalDependenciesPlugin.java @@ -1,5 +1,5 @@ /* - * Copyright 2023 the original author or authors. + * Copyright 2022 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. @@ -22,26 +22,13 @@ 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 { - /** - * 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"); + Configuration optional = project.getConfigurations().create(OPTIONAL_CONFIGURATION_NAME); optional.setCanBeConsumed(false); optional.setCanBeResolved(false); project.getPlugins().withType(JavaPlugin.class, (javaPlugin) -> { @@ -55,5 +42,4 @@ public class OptionalDependenciesPlugin implements Plugin { }); }); } - } diff --git a/buildSrc/src/main/java/org/springframework/statemachine/gradle/PublishAllJavaComponentsPlugin.java b/buildSrc/src/main/java/org/springframework/statemachine/gradle/PublishAllJavaComponentsPlugin.java new file mode 100644 index 00000000..03eba1a6 --- /dev/null +++ b/buildSrc/src/main/java/org/springframework/statemachine/gradle/PublishAllJavaComponentsPlugin.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 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.Action; +import org.gradle.api.Plugin; +import org.gradle.api.Project; +import org.gradle.api.plugins.JavaPlatformPlugin; +import org.gradle.api.plugins.JavaPlugin; +import org.gradle.api.publish.PublishingExtension; +import org.gradle.api.publish.maven.MavenPublication; +import org.gradle.api.publish.maven.plugins.MavenPublishPlugin; + +public class PublishAllJavaComponentsPlugin implements Plugin { + + @Override + public void apply(Project project) { + project.getPlugins().withType(MavenPublishPlugin.class).all((mavenPublish) -> { + PublishingExtension publishing = project.getExtensions().getByType(PublishingExtension.class); + publishing.getPublications().create("mavenJava", MavenPublication.class, new Action() { + @Override + public void execute(MavenPublication maven) { + project.getPlugins().withType(JavaPlugin.class, (plugin) -> { + maven.from(project.getComponents().getByName("java")); + }); + project.getPlugins().withType(JavaPlatformPlugin.class, (plugin) -> { + maven.from(project.getComponents().getByName("javaPlatform")); + }); + } + }); + }); + } +} diff --git a/buildSrc/src/main/java/org/springframework/statemachine/gradle/PublishLocalPlugin.java b/buildSrc/src/main/java/org/springframework/statemachine/gradle/PublishLocalPlugin.java new file mode 100644 index 00000000..8cd52ccb --- /dev/null +++ b/buildSrc/src/main/java/org/springframework/statemachine/gradle/PublishLocalPlugin.java @@ -0,0 +1,37 @@ +/* + * Copyright 2022 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 java.io.File; + +import org.gradle.api.Plugin; +import org.gradle.api.Project; +import org.gradle.api.publish.PublishingExtension; +import org.gradle.api.publish.maven.plugins.MavenPublishPlugin; + +public class PublishLocalPlugin implements Plugin { + + @Override + public void apply(Project project) { + + project.getPlugins().withType(MavenPublishPlugin.class).all(mavenPublish -> { + project.getExtensions().getByType(PublishingExtension.class).getRepositories().maven(maven -> { + maven.setName("local"); + maven.setUrl(new File(project.getRootProject().getBuildDir(), "publications/repos")); + }); + }); + } +} diff --git a/buildSrc/src/main/java/org/springframework/statemachine/gradle/RootPlugin.java b/buildSrc/src/main/java/org/springframework/statemachine/gradle/RootPlugin.java new file mode 100644 index 00000000..486e516f --- /dev/null +++ b/buildSrc/src/main/java/org/springframework/statemachine/gradle/RootPlugin.java @@ -0,0 +1,97 @@ +/* + * Copyright 2022 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 java.io.File; + +import org.asciidoctor.gradle.jvm.AsciidoctorJPlugin; +import org.gradle.api.Plugin; +import org.gradle.api.Project; +import org.gradle.api.plugins.JavaPluginConvention; +import org.gradle.api.plugins.PluginManager; +import org.gradle.api.publish.maven.plugins.MavenPublishPlugin; +import org.gradle.api.tasks.SourceSet; +import org.gradle.api.tasks.bundling.Zip; +import org.gradle.api.tasks.javadoc.Javadoc; +import org.gradle.external.javadoc.CoreJavadocOptions; + +/** + * Manages tasks creating zip file for docs and publishing it. + * + * @author Janne Valkealahti + */ +class RootPlugin implements Plugin { + + @Override + public void apply(Project project) { + PluginManager pluginManager = project.getPluginManager(); + pluginManager.apply(MavenPublishPlugin.class); + pluginManager.apply(PublishLocalPlugin.class); + new ArtifactoryConventions().apply(project); + Javadoc apiTask = createApiTask(project); + Zip zipTask = createZipTask(project); + zipTask.dependsOn(apiTask); + } + + private Zip createZipTask(Project project) { + Zip zipTask = project.getTasks().create("distZip", Zip.class, zip -> { + zip.setGroup("Distribution"); + zip.from("docs/build/docs/asciidoc/", copy -> { + copy.into("docs"); + }); + zip.from("build/api", copy -> { + copy.into("api"); + }); + }); + + project.getRootProject().getAllprojects().forEach(p -> { + p.getPlugins().withType(AsciidoctorJPlugin.class, a -> { + p.getTasksByName("asciidoctor", false).forEach(t -> { + zipTask.dependsOn(t); + });; + }); + }); + + project.getArtifacts().add("archives", zipTask); + return zipTask; + } + + private Javadoc createApiTask(Project project) { + Javadoc api = project.getTasks().create("api", Javadoc.class, a -> { + a.setGroup("Documentation"); + a.setDescription("Generates aggregated Javadoc API documentation."); + a.setDestinationDir(new File(project.getBuildDir(), "api")); + CoreJavadocOptions options = (CoreJavadocOptions) a.getOptions(); + options.source("17"); + options.encoding("UTF-8"); + options.addStringOption("Xdoclint:none", "-quiet"); + }); + + project.getRootProject().getSubprojects().forEach(p -> { + p.getPlugins().withType(ModulePlugin.class, m -> { + JavaPluginConvention java = p.getConvention().getPlugin(JavaPluginConvention.class); + SourceSet mainSourceSet = java.getSourceSets().getByName("main"); + + api.setSource(api.getSource().plus(mainSourceSet.getAllJava())); + + p.getTasks().withType(Javadoc.class, j -> { + api.setClasspath(api.getClasspath().plus(j.getClasspath())); + }); + }); + }); + return api; + } +} diff --git a/buildSrc/src/main/java/org/springframework/statemachine/gradle/SamplePlugin.java b/buildSrc/src/main/java/org/springframework/statemachine/gradle/SamplePlugin.java new file mode 100644 index 00000000..2ced68ba --- /dev/null +++ b/buildSrc/src/main/java/org/springframework/statemachine/gradle/SamplePlugin.java @@ -0,0 +1,36 @@ +/* + * Copyright 2022 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.plugins.JavaPlugin; +import org.gradle.api.plugins.PluginManager; + +/** + * @author Janne Valkealahti + */ +class SamplePlugin implements Plugin { + + @Override + public void apply(Project project) { + PluginManager pluginManager = project.getPluginManager(); + pluginManager.apply(JavaPlugin.class); + pluginManager.apply(ManagementConfigurationPlugin.class); + new JavaConventions().apply(project); + new EclipseConventions().apply(project); + } +} diff --git a/buildSrc/src/main/java/org/springframework/statemachine/gradle/SpringMavenPlugin.java b/buildSrc/src/main/java/org/springframework/statemachine/gradle/SpringMavenPlugin.java new file mode 100644 index 00000000..f52c9abd --- /dev/null +++ b/buildSrc/src/main/java/org/springframework/statemachine/gradle/SpringMavenPlugin.java @@ -0,0 +1,158 @@ +/* + * Copyright 2022 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 java.util.List; +import java.util.ListIterator; + +import org.gradle.api.Plugin; +import org.gradle.api.Project; +import org.gradle.api.attributes.Usage; +import org.gradle.api.component.AdhocComponentWithVariants; +import org.gradle.api.component.ConfigurationVariantDetails; +import org.gradle.api.plugins.JavaPlugin; +import org.gradle.api.plugins.JavaPluginExtension; +import org.gradle.api.plugins.PluginManager; +import org.gradle.api.publish.PublishingExtension; +import org.gradle.api.publish.VariantVersionMappingStrategy; +import org.gradle.api.publish.maven.MavenPom; +import org.gradle.api.publish.maven.MavenPomDeveloperSpec; +import org.gradle.api.publish.maven.MavenPomIssueManagement; +import org.gradle.api.publish.maven.MavenPomLicenseSpec; +import org.gradle.api.publish.maven.MavenPomOrganization; +import org.gradle.api.publish.maven.MavenPomScm; +import org.gradle.api.publish.maven.MavenPublication; +import org.gradle.api.publish.maven.plugins.MavenPublishPlugin; + +import groovy.util.Node; + +public class SpringMavenPlugin implements Plugin { + + @Override + public void apply(Project project) { + PluginManager pluginManager = project.getPluginManager(); + pluginManager.apply(MavenPublishPlugin.class); + pluginManager.apply(SpringSigningPlugin.class); + pluginManager.apply(PublishLocalPlugin.class); + pluginManager.apply(PublishAllJavaComponentsPlugin.class); + + project.getPlugins().withType(MavenPublishPlugin.class).all(mavenPublish -> { + PublishingExtension publishing = project.getExtensions().getByType(PublishingExtension.class); + publishing.getPublications().withType(MavenPublication.class) + .all(mavenPublication -> customizeMavenPublication(mavenPublication, project)); + project.getPlugins().withType(JavaPlugin.class).all(javaPlugin -> { + JavaPluginExtension extension = project.getExtensions().getByType(JavaPluginExtension.class); + extension.withJavadocJar(); + extension.withSourcesJar(); + }); + }); + } + + private void customizeMavenPublication(MavenPublication publication, Project project) { + customizePom(publication.getPom(), project); + project.getPlugins().withType(JavaPlugin.class) + .all((javaPlugin) -> customizeJavaMavenPublication(publication, project)); + suppressMavenOptionalFeatureWarnings(publication); + } + + private void customizeJavaMavenPublication(MavenPublication publication, Project project) { + addMavenOptionalFeature(project); + publication.versionMapping((strategy) -> strategy.usage(Usage.JAVA_API, (mappingStrategy) -> mappingStrategy + .fromResolutionOf(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME))); + publication.versionMapping( + (strategy) -> strategy.usage(Usage.JAVA_RUNTIME, VariantVersionMappingStrategy::fromResolutionResult)); + } + + private void suppressMavenOptionalFeatureWarnings(MavenPublication publication) { + publication.suppressPomMetadataWarningsFor("mavenOptionalApiElements"); + publication.suppressPomMetadataWarningsFor("mavenOptionalRuntimeElements"); + } + + private void addMavenOptionalFeature(Project project) { + JavaPluginExtension extension = project.getExtensions().getByType(JavaPluginExtension.class); + extension.registerFeature("mavenOptional", + (feature) -> feature.usingSourceSet(extension.getSourceSets().getByName("main"))); + AdhocComponentWithVariants javaComponent = (AdhocComponentWithVariants) project.getComponents() + .findByName("java"); + if (javaComponent != null) { + javaComponent.addVariantsFromConfiguration( + project.getConfigurations().findByName("mavenOptionalRuntimeElements"), + ConfigurationVariantDetails::mapToOptional); + } + } + + private void customizePom(MavenPom pom, Project project) { + pom.getUrl().set("https://spring.io/projects/spring-statemachine"); + pom.getName().set(project.provider(project::getName)); + pom.getDescription().set(project.provider(project::getDescription)); + pom.organization(this::customizeOrganization); + pom.licenses(this::customizeLicences); + pom.developers(this::customizeDevelopers); + pom.scm(scm -> customizeScm(scm, project)); + pom.issueManagement(this::customizeIssueManagement); + + // TODO: find something better not to add dependencyManagement in pom + // which result spring-statemachine-platform in it. spring-statemachine-bom + // has its own dependencyManagement which we need to keep + if (!project.getName().equals("spring-statemachine-bom")) { + pom.withXml(xxx -> { + Node pomNode = xxx.asNode(); + List childs = pomNode.children(); + ListIterator iter = childs.listIterator(); + while (iter.hasNext()) { + Object next = iter.next(); + if (next instanceof Node) { + if (((Node)next).name().toString().equals("{http://maven.apache.org/POM/4.0.0}dependencyManagement")) { + iter.remove(); + } + } + } + }); + } + } + + private void customizeOrganization(MavenPomOrganization organization) { + organization.getName().set("Pivotal Software, Inc."); + organization.getUrl().set("https://spring.io"); + } + + private void customizeLicences(MavenPomLicenseSpec licences) { + licences.license(licence -> { + licence.getName().set("Apache License, Version 2.0"); + licence.getUrl().set("https://www.apache.org/licenses/LICENSE-2.0"); + }); + } + + private void customizeDevelopers(MavenPomDeveloperSpec developers) { + developers.developer((developer) -> { + developer.getName().set("Pivotal"); + developer.getEmail().set("info@pivotal.io"); + developer.getOrganization().set("Pivotal Software, Inc."); + developer.getOrganizationUrl().set("https://www.spring.io"); + }); + } + + private void customizeScm(MavenPomScm scm, Project project) { + scm.getConnection().set("scm:git:git://github.com/spring-projects/spring-statemachine.git"); + scm.getDeveloperConnection().set("scm:git:ssh://git@github.com/spring-projects/spring-statemachine.git"); + scm.getUrl().set("https://github.com/spring-projects/spring-statemachine"); + } + + private void customizeIssueManagement(MavenPomIssueManagement issueManagement) { + issueManagement.getSystem().set("GitHub"); + issueManagement.getUrl().set("https://github.com/spring-projects/spring-statemachine/issues"); + } +} diff --git a/buildSrc/src/main/java/org/springframework/statemachine/gradle/SpringSigningPlugin.java b/buildSrc/src/main/java/org/springframework/statemachine/gradle/SpringSigningPlugin.java new file mode 100644 index 00000000..e393f5a6 --- /dev/null +++ b/buildSrc/src/main/java/org/springframework/statemachine/gradle/SpringSigningPlugin.java @@ -0,0 +1,70 @@ +/* + * Copyright 2016-2019 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 java.util.concurrent.Callable; + +import org.gradle.api.Action; +import org.gradle.api.Plugin; +import org.gradle.api.Project; +import org.gradle.api.publish.Publication; +import org.gradle.api.publish.PublishingExtension; +import org.gradle.plugins.signing.SigningExtension; +import org.gradle.plugins.signing.SigningPlugin; + +public class SpringSigningPlugin implements Plugin { + @Override + public void apply(Project project) { + project.getPluginManager().apply(SigningPlugin.class); + project.getPlugins().withType(SigningPlugin.class).all(new Action() { + @Override + public void execute(SigningPlugin signingPlugin) { + boolean hasSigningKey = project.hasProperty("signingKey"); + if (hasSigningKey) { + sign(project); + } + } + }); + } + + private void sign(Project project) { + SigningExtension signing = project.getExtensions().findByType(SigningExtension.class); + signing.setRequired(new Callable() { + @Override + public Boolean call() throws Exception { + return project.getGradle().getTaskGraph().hasTask("publishArtifacts"); + } + }); + String signingKeyId = (String) project.findProperty("signingKeyId"); + String signingKey = (String) project.findProperty("signingKey"); + String signingPassword = (String) project.findProperty("signingPassword"); + if (signingKeyId != null) { + signing.useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword); + } else { + signing.useInMemoryPgpKeys(signingKey, signingPassword); + } + project.getPlugins().withType(PublishAllJavaComponentsPlugin.class) + .all(new Action() { + @Override + public void execute(PublishAllJavaComponentsPlugin publishingPlugin) { + PublishingExtension publishing = project.getExtensions().findByType(PublishingExtension.class); + Publication maven = publishing.getPublications().getByName("mavenJava"); + signing.sign(maven); + } + }); + } +} diff --git a/buildSrc/src/main/java/org/springframework/statemachine/gradle/StarterPlugin.java b/buildSrc/src/main/java/org/springframework/statemachine/gradle/StarterPlugin.java new file mode 100644 index 00000000..d6b1dbf5 --- /dev/null +++ b/buildSrc/src/main/java/org/springframework/statemachine/gradle/StarterPlugin.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 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.plugins.JavaLibraryPlugin; +import org.gradle.api.plugins.PluginContainer; +import org.gradle.api.plugins.PluginManager; + +/** + * @author Janne Valkealahti + */ +class StarterPlugin implements Plugin { + + @Override + public void apply(Project project) { + PluginManager pluginManager = project.getPluginManager(); + pluginManager.apply(ManagementConfigurationPlugin.class); + PluginContainer plugins = project.getPlugins(); + plugins.apply(JavaLibraryPlugin.class); + pluginManager.apply(SpringMavenPlugin.class); + + new ArtifactoryConventions().apply(project); + new JavaConventions().apply(project); + } +} diff --git a/docs/docs.gradle b/docs/docs.gradle new file mode 100644 index 00000000..c04a8dec --- /dev/null +++ b/docs/docs.gradle @@ -0,0 +1,9 @@ +plugins { + id 'org.springframework.statemachine.docs' +} + +description = 'Spring Statemachine Documentation' + +asciidoctorj { + version = '2.5.4' +} diff --git a/gradle.properties b/gradle.properties index b707d5c3..eed46114 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,21 @@ -#Mon Dec 04 13:47:56 GMT 2023 +#Mon Jun 19 10:33:34 UTC 2023 version=4.0.1-SNAPSHOT +springBootVersion=3.1.6 +jakartaPersistenceVersion=3.1.0 +kryoVersion=4.0.2 +springCloudClusterVersion=1.0.2.RELEASE +springShellVersion=1.1.0.RELEASE +eclipseEmfXmiVersion=2.11.1-v20150805-0538 +eclipseUml2CommonVersion=2.0.0-v20140602-0749 +eclipseEmfCommonVersion=2.11.0-v20150805-0538 +eclipseUml2TypesVersion=2.0.0-v20140602-0749 +eclipseEmfEcoreVersion=2.11.1-v20150805-0538 +eclipseUml2UmlVersion=5.0.0-v20140602-0749 +xcuratorVersion=2.11.1 +curatorVersion=5.5.0 +springAsciidoctorBackends=0.0.5 +awaitilityVersion=3.1.6 +reactorBlockHoundVersion=1.0.4.RELEASE +findbugsVersion=3.0.2 +gradleEnterpriseVersion=3.10.3 +springGeConventionsVersion=0.0.13 diff --git a/gradle/java-test-fixtures.gradle b/gradle/java-test-fixtures.gradle deleted file mode 100644 index 06cfafd1..00000000 --- a/gradle/java-test-fixtures.gradle +++ /dev/null @@ -1,16 +0,0 @@ -apply plugin: 'java-test-fixtures' - -compileTestFixturesJava { - sourceCompatibility = 17 - targetCompatibility = 17 -} - -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() } diff --git a/gradle/publications.gradle b/gradle/publications.gradle deleted file mode 100644 index 5193ed51..00000000 --- a/gradle/publications.gradle +++ /dev/null @@ -1,50 +0,0 @@ -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 = 'janne.valkealahti@gmail.com' - } - } - issueManagement { - system = "GitHub" - url = "https://github.com/spring-projects/spring-statemachine/issues" - } - } - versionMapping { - usage('java-api') { - fromResolutionResult() - } - usage('java-runtime') { - fromResolutionResult() - } - } - } - } -} diff --git a/settings.gradle b/settings.gradle index be5c5f75..e1bba595 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,5 +1,6 @@ pluginManagement { repositories { + mavenCentral() gradlePluginPortal() maven { url 'https://repo.spring.io/release' } if (version.contains('-')) { @@ -9,15 +10,34 @@ pluginManagement { maven { url 'https://repo.spring.io/snapshot' } } } + plugins { + id 'org.springframework.boot' version "$springBootVersion" + id 'com.gradle.enterprise' version "$gradleEnterpriseVersion" + id 'io.spring.ge.conventions' version "$springGeConventionsVersion" + } } plugins { - id 'com.gradle.enterprise' version '3.14.1' - id 'io.spring.ge.conventions' version '0.0.14' + id "com.gradle.enterprise" + id "io.spring.ge.conventions" } rootProject.name = 'spring-statemachine' +settings.gradle.projectsLoaded { + gradleEnterprise { + buildScan { + def buildDir = settings.gradle.rootProject.getBuildDir() + buildDir.mkdirs() + new File(buildDir, "build-scan-uri.txt").text = "build scan not generated" + buildScanPublished { scan -> + buildDir.mkdirs() + new File(buildDir, "build-scan-uri.txt").text = "<${scan.buildScanUri}|build scan>\n" + } + } + } +} + include 'spring-statemachine-platform' include 'spring-statemachine-core' include 'spring-statemachine-test' @@ -56,21 +76,27 @@ include 'spring-statemachine-data:jpa' include 'spring-statemachine-data:redis' include 'spring-statemachine-data:mongodb' -rootProject.children.find { - if (it.name == 'spring-statemachine-recipes') { - it.name = 'spring-statemachine-recipes-common' - } - if (it.name == 'spring-statemachine-samples') { - it.name = 'spring-statemachine-samples-common' - it.children.each { - it.name = 'spring-statemachine-samples-' + it.name +include 'docs' + +rootProject.children.each { project -> + if (project.name == 'spring-statemachine-data') { + project.name = 'spring-statemachine-data-common' + project.buildFileName = 'spring-statemachine-data.gradle' + project.children.each { subproject -> + subproject.buildFileName = "spring-statemachine-data-${subproject.name}.gradle" + subproject.name = 'spring-statemachine-data-' + subproject.name } - } - if (it.name == 'spring-statemachine-data') { - it.name = 'spring-statemachine-data-common' - it.children.each { - it.name = 'spring-statemachine-data-' + it.name + } else if (project.name == 'spring-statemachine-recipes') { + project.name = 'spring-statemachine-recipes-common' + project.buildFileName = 'spring-statemachine-recipes.gradle' + } else if (project.name == 'spring-statemachine-samples') { + project.name = 'spring-statemachine-samples-common' + project.buildFileName = 'spring-statemachine-samples.gradle' + project.children.each { subproject -> + subproject.buildFileName = "spring-statemachine-samples-${subproject.name}.gradle" + subproject.name = 'spring-statemachine-samples-' + subproject.name } + } else { + project.buildFileName = "${project.name}.gradle" } } - diff --git a/spring-statemachine-autoconfigure/spring-statemachine-autoconfigure.gradle b/spring-statemachine-autoconfigure/spring-statemachine-autoconfigure.gradle new file mode 100644 index 00000000..a0410b5a --- /dev/null +++ b/spring-statemachine-autoconfigure/spring-statemachine-autoconfigure.gradle @@ -0,0 +1,23 @@ +plugins { + id 'org.springframework.statemachine.module' +} + +description = 'Spring Statemachine Autoconfigure' + +dependencies { + management platform(project(":spring-statemachine-platform")) + api project(':spring-statemachine-core') + optional project(':spring-statemachine-data-common:spring-statemachine-data-jpa') + optional project(':spring-statemachine-data-common:spring-statemachine-data-redis') + optional project(':spring-statemachine-data-common:spring-statemachine-data-mongodb') + api 'org.springframework.boot:spring-boot-autoconfigure' + api 'org.springframework.boot:spring-boot-actuator-autoconfigure' + api 'org.springframework.boot:spring-boot-actuator' + optional 'io.micrometer:micrometer-core' + optional 'org.springframework.boot:spring-boot-starter-data-jpa' + optional 'org.springframework.boot:spring-boot-starter-data-redis' + optional 'org.springframework.boot:spring-boot-starter-data-mongodb' + testImplementation 'org.springframework.boot:spring-boot-test' + testImplementation 'org.springframework.boot:spring-boot-starter-test' + testRuntimeOnly 'com.h2database:h2' +} diff --git a/spring-statemachine-bom/spring-statemachine-bom.gradle b/spring-statemachine-bom/spring-statemachine-bom.gradle new file mode 100644 index 00000000..8db272f8 --- /dev/null +++ b/spring-statemachine-bom/spring-statemachine-bom.gradle @@ -0,0 +1,5 @@ +plugins { + id 'org.springframework.statemachine.bom' +} + +description = 'Spring Statemachine (Bill of Materials)' diff --git a/spring-statemachine-build-tests/spring-statemachine-build-tests.gradle b/spring-statemachine-build-tests/spring-statemachine-build-tests.gradle new file mode 100644 index 00000000..1994d5c2 --- /dev/null +++ b/spring-statemachine-build-tests/spring-statemachine-build-tests.gradle @@ -0,0 +1,27 @@ +plugins { + id 'org.springframework.statemachine.module' +} + +description = 'Spring State Machine Build Tests' + +dependencies { + management platform(project(":spring-statemachine-platform")) + testImplementation project(':spring-statemachine-uml') + testImplementation project(':spring-statemachine-test') + testImplementation project(':spring-statemachine-data-common:spring-statemachine-data-jpa') + testImplementation project(':spring-statemachine-data-common:spring-statemachine-data-redis') + testImplementation project(':spring-statemachine-data-common:spring-statemachine-data-mongodb') + testImplementation(testFixtures(project(":spring-statemachine-core"))) + testImplementation 'io.projectreactor:reactor-test' + testImplementation 'org.apache.commons:commons-pool2' + testRuntimeOnly 'org.springframework.boot:spring-boot-starter-data-mongodb' + testRuntimeOnly 'org.springframework.boot:spring-boot-starter-data-redis' + testRuntimeOnly 'redis.clients:jedis' + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.junit.jupiter:junit-jupiter-engine' + testImplementation 'org.springframework.boot:spring-boot-starter-data-jpa' + testImplementation 'com.h2database:h2' + testImplementation 'org.springframework.boot:spring-boot-starter' + testImplementation 'org.springframework:spring-test' + testImplementation 'io.projectreactor.tools:blockhound' +} diff --git a/spring-statemachine-cluster/spring-statemachine-cluster.gradle b/spring-statemachine-cluster/spring-statemachine-cluster.gradle new file mode 100644 index 00000000..8e50c4ac --- /dev/null +++ b/spring-statemachine-cluster/spring-statemachine-cluster.gradle @@ -0,0 +1,15 @@ +plugins { + id 'org.springframework.statemachine.module' +} + +description = 'Spring State Machine Cluster' + +dependencies { + management platform(project(":spring-statemachine-platform")) + api project(':spring-statemachine-zookeeper') + api 'org.springframework.integration:spring-integration-zookeeper' + testImplementation 'org.apache.curator:curator-test' + testImplementation 'org.assertj:assertj-core' + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.junit.jupiter:junit-jupiter-engine' +} diff --git a/spring-statemachine-core/spring-statemachine-core.gradle b/spring-statemachine-core/spring-statemachine-core.gradle new file mode 100644 index 00000000..c8739ca1 --- /dev/null +++ b/spring-statemachine-core/spring-statemachine-core.gradle @@ -0,0 +1,27 @@ +plugins { + id 'org.springframework.statemachine.module' +} + +description = 'Spring Statemachine Core' + +dependencies { + management platform(project(":spring-statemachine-platform")) + api('org.springframework:spring-tx') + api('org.springframework:spring-messaging') + api('org.springframework:spring-context') + api('io.projectreactor:reactor-core') + optional 'org.springframework.security:spring-security-core' + compileOnly 'com.google.code.findbugs:jsr305' + testImplementation 'org.springframework:spring-web' + testImplementation 'org.springframework:spring-webmvc' + testImplementation 'org.springframework.boot:spring-boot-starter-test' + testImplementation 'io.projectreactor:reactor-test' + testImplementation 'org.awaitility:awaitility' + testImplementation 'org.springframework.security:spring-security-config' + testImplementation 'org.springframework.security:spring-security-test' + testImplementation 'io.projectreactor.tools:blockhound' + testImplementation 'jakarta.servlet:jakarta.servlet-api' + testImplementation 'org.assertj:assertj-core' + testFixturesImplementation 'org.assertj:assertj-core' + testFixturesImplementation 'io.projectreactor:reactor-test' +} diff --git a/spring-statemachine-data/build.gradle b/spring-statemachine-data/build.gradle deleted file mode 100644 index f49f1fc4..00000000 --- a/spring-statemachine-data/build.gradle +++ /dev/null @@ -1,58 +0,0 @@ -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 { - 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 'jakarta.persistence:jakarta.persistence-api' - 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 { - api project(':spring-statemachine-data-common') - api 'org.springframework.data:spring-data-redis' - testImplementation project(':spring-statemachine-test') - optional 'jakarta.persistence:jakarta.persistence-api' - 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 { - api project(':spring-statemachine-data-common') - api 'org.springframework.data:spring-data-mongodb' - testImplementation project(':spring-statemachine-test') - optional 'jakarta.persistence:jakarta.persistence-api' - 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' - } -} diff --git a/spring-statemachine-data/jpa/spring-statemachine-data-jpa.gradle b/spring-statemachine-data/jpa/spring-statemachine-data-jpa.gradle new file mode 100644 index 00000000..0644f30e --- /dev/null +++ b/spring-statemachine-data/jpa/spring-statemachine-data-jpa.gradle @@ -0,0 +1,20 @@ +plugins { + id 'org.springframework.statemachine.module' +} + +description = 'Spring State Machine Data Jpa' + +dependencies { + management platform(project(":spring-statemachine-platform")) + api project(':spring-statemachine-data-common') + api('org.springframework:spring-orm') + optional 'jakarta.persistence:jakarta.persistence-api' + testImplementation project(':spring-statemachine-test') + testImplementation(testFixtures(project(':spring-statemachine-data-common'))) + testImplementation(testFixtures(project(':spring-statemachine-core'))) + testImplementation 'io.projectreactor:reactor-test' + 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' +} diff --git a/spring-statemachine-data/mongodb/spring-statemachine-data-mongodb.gradle b/spring-statemachine-data/mongodb/spring-statemachine-data-mongodb.gradle new file mode 100644 index 00000000..da647705 --- /dev/null +++ b/spring-statemachine-data/mongodb/spring-statemachine-data-mongodb.gradle @@ -0,0 +1,18 @@ +plugins { + id 'org.springframework.statemachine.module' +} + +description = 'Spring State Machine Data MongoDB' + +dependencies { + management platform(project(":spring-statemachine-platform")) + api project(':spring-statemachine-data-common') + api 'org.springframework.data:spring-data-mongodb' + testImplementation project(':spring-statemachine-test') + 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' +} diff --git a/spring-statemachine-data/redis/spring-statemachine-data-redis.gradle b/spring-statemachine-data/redis/spring-statemachine-data-redis.gradle new file mode 100644 index 00000000..81ecb33a --- /dev/null +++ b/spring-statemachine-data/redis/spring-statemachine-data-redis.gradle @@ -0,0 +1,21 @@ +plugins { + id 'org.springframework.statemachine.module' +} + +description = 'Spring State Machine Data Redis' + +dependencies { + management platform(project(":spring-statemachine-platform")) + api project(':spring-statemachine-data-common') + api 'org.springframework.data:spring-data-redis' + testImplementation project(':spring-statemachine-test') + 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' + testImplementation 'io.projectreactor.tools:blockhound' +} diff --git a/spring-statemachine-data/spring-statemachine-data.gradle b/spring-statemachine-data/spring-statemachine-data.gradle new file mode 100644 index 00000000..c46edfad --- /dev/null +++ b/spring-statemachine-data/spring-statemachine-data.gradle @@ -0,0 +1,21 @@ +plugins { + id 'org.springframework.statemachine.module' +} + +description = 'Spring State Machine Data Common' + +dependencies { + management platform(project(":spring-statemachine-platform")) + api project(':spring-statemachine-core') + api project(':spring-statemachine-kryo') + api 'org.springframework.data:spring-data-commons' + api 'com.fasterxml.jackson.core:jackson-core' + api 'com.fasterxml.jackson.core:jackson-databind' + testImplementation (project(':spring-statemachine-test')) + testFixturesImplementation (project(':spring-statemachine-test')) + testImplementation(testFixtures(project(':spring-statemachine-core'))) + testImplementation 'io.projectreactor:reactor-test' + testImplementation 'org.springframework.boot:spring-boot-starter-test' + testFixturesImplementation 'org.springframework.boot:spring-boot-starter-test' + testRuntimeOnly 'org.springframework.boot:spring-boot-starter-web' +} diff --git a/spring-statemachine-kryo/spring-statemachine-kryo.gradle b/spring-statemachine-kryo/spring-statemachine-kryo.gradle new file mode 100644 index 00000000..3a871406 --- /dev/null +++ b/spring-statemachine-kryo/spring-statemachine-kryo.gradle @@ -0,0 +1,14 @@ +plugins { + id 'org.springframework.statemachine.module' +} + +description = 'Spring State Machine Kryo' + +dependencies { + management platform(project(":spring-statemachine-platform")) + api project(':spring-statemachine-core') + api 'com.esotericsoftware:kryo-shaded' + testImplementation 'org.assertj:assertj-core' + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.junit.jupiter:junit-jupiter-engine' +} diff --git a/spring-statemachine-platform/spring-statemachine-platform.gradle b/spring-statemachine-platform/spring-statemachine-platform.gradle new file mode 100644 index 00000000..f8aa24f0 --- /dev/null +++ b/spring-statemachine-platform/spring-statemachine-platform.gradle @@ -0,0 +1,29 @@ +plugins { + id 'java-platform' +} + +javaPlatform { + allowDependencies() +} + +description = 'Spring Statemachine BOM' + +dependencies { + api platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion") + constraints { + api "com.google.code.findbugs:jsr305:$findbugsVersion" + api "com.esotericsoftware:kryo-shaded:$kryoVersion" + api "org.springframework.shell:spring-shell:$springShellVersion" + api "jakarta.persistence:jakarta.persistence-api:$jakartaPersistenceVersion" + 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 "io.projectreactor.tools:blockhound:$reactorBlockHoundVersion" + api "io.projectreactor.tools:blockhound-junit-platform:$reactorBlockHoundVersion" + } +} diff --git a/spring-statemachine-recipes/build.gradle b/spring-statemachine-recipes/build.gradle deleted file mode 100644 index 76e7c766..00000000 --- a/spring-statemachine-recipes/build.gradle +++ /dev/null @@ -1,2 +0,0 @@ -description = 'Spring State Machine Recipes Common' - diff --git a/spring-statemachine-recipes/spring-statemachine-recipes.gradle b/spring-statemachine-recipes/spring-statemachine-recipes.gradle new file mode 100644 index 00000000..208e2c56 --- /dev/null +++ b/spring-statemachine-recipes/spring-statemachine-recipes.gradle @@ -0,0 +1,17 @@ +plugins { + id 'org.springframework.statemachine.module' +} + +description = 'Spring State Machine Recipes Common' + +dependencies { + management platform(project(":spring-statemachine-platform")) + api project(':spring-statemachine-core') + testImplementation(testFixtures(project(':spring-statemachine-core'))) + testImplementation 'io.projectreactor:reactor-test' + testImplementation 'org.springframework:spring-test' + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.junit.jupiter:junit-jupiter-engine' + testImplementation 'io.projectreactor.tools:blockhound' + testImplementation 'org.assertj:assertj-core' +} diff --git a/spring-statemachine-samples/cdplayer/spring-statemachine-samples-cdplayer.gradle b/spring-statemachine-samples/cdplayer/spring-statemachine-samples-cdplayer.gradle new file mode 100644 index 00000000..7d99978a --- /dev/null +++ b/spring-statemachine-samples/cdplayer/spring-statemachine-samples-cdplayer.gradle @@ -0,0 +1,17 @@ +plugins { + id 'org.springframework.statemachine.sample' +} + +description = 'Spring State Machine CD Player Sample' + +dependencies { + management platform(project(":spring-statemachine-platform")) + implementation project(':spring-statemachine-samples-common') + implementation project(':spring-statemachine-core') + implementation 'org.springframework.shell:spring-shell' + testImplementation(testFixtures(project(':spring-statemachine-core'))) + testImplementation 'io.projectreactor:reactor-test' + testImplementation 'org.assertj:assertj-core' + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.junit.jupiter:junit-jupiter-engine' +} diff --git a/spring-statemachine-samples/datajpa/spring-statemachine-samples-datajpa.gradle b/spring-statemachine-samples/datajpa/spring-statemachine-samples-datajpa.gradle new file mode 100644 index 00000000..89a91225 --- /dev/null +++ b/spring-statemachine-samples/datajpa/spring-statemachine-samples-datajpa.gradle @@ -0,0 +1,26 @@ +plugins { + id 'org.springframework.statemachine.sample' +} + +description = 'Spring State Machine Data Jpa Sample' + +dependencies { + management platform(project(":spring-statemachine-platform")) + implementation project(':spring-statemachine-samples-common') + implementation project(':spring-statemachine-autoconfigure') + implementation project(':spring-statemachine-data-common:spring-statemachine-data-jpa') + implementation('org.springframework.boot:spring-boot-starter-web') + implementation('org.springframework.boot:spring-boot-starter-thymeleaf') + implementation('org.springframework.boot:spring-boot-starter-data-jpa') + implementation('org.springframework.boot:spring-boot-devtools') + implementation('com.h2database:h2') + testImplementation(testFixtures(project(':spring-statemachine-core'))) + testImplementation 'org.hamcrest:hamcrest-core' + testImplementation 'org.hamcrest:hamcrest-library' + testImplementation 'org.springframework.boot:spring-boot-test' + testImplementation 'org.springframework:spring-test' + testImplementation 'io.projectreactor:reactor-test' + testImplementation 'org.assertj:assertj-core' + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.junit.jupiter:junit-jupiter-engine' +} diff --git a/spring-statemachine-samples/datajpamultipersist/spring-statemachine-samples-datajpamultipersist.gradle b/spring-statemachine-samples/datajpamultipersist/spring-statemachine-samples-datajpamultipersist.gradle new file mode 100644 index 00000000..8672d649 --- /dev/null +++ b/spring-statemachine-samples/datajpamultipersist/spring-statemachine-samples-datajpamultipersist.gradle @@ -0,0 +1,26 @@ +plugins { + id 'org.springframework.statemachine.sample' +} + +description = 'Spring State Machine Data Jpa Multi Persist Sample' + +dependencies { + management platform(project(":spring-statemachine-platform")) + implementation project(':spring-statemachine-samples-common') + implementation project(':spring-statemachine-autoconfigure') + implementation project(':spring-statemachine-data-common:spring-statemachine-data-jpa') + implementation('org.springframework.boot:spring-boot-starter-web') + implementation('org.springframework.boot:spring-boot-starter-thymeleaf') + implementation('org.springframework.boot:spring-boot-starter-data-jpa') + implementation('org.springframework.boot:spring-boot-devtools') + implementation('com.h2database:h2') + testImplementation(testFixtures(project(':spring-statemachine-core'))) + testImplementation 'org.hamcrest:hamcrest-core' + testImplementation 'org.hamcrest:hamcrest-library' + testImplementation 'org.springframework.boot:spring-boot-test' + testImplementation 'org.springframework:spring-test' + testImplementation 'io.projectreactor:reactor-test' + testImplementation 'org.assertj:assertj-core' + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.junit.jupiter:junit-jupiter-engine' +} diff --git a/spring-statemachine-samples/datapersist/spring-statemachine-samples-datapersist.gradle b/spring-statemachine-samples/datapersist/spring-statemachine-samples-datapersist.gradle new file mode 100644 index 00000000..c0006944 --- /dev/null +++ b/spring-statemachine-samples/datapersist/spring-statemachine-samples-datapersist.gradle @@ -0,0 +1,30 @@ +plugins { + id 'org.springframework.statemachine.sample' +} + +description = 'Spring State Machine Data Persist Sample' + +dependencies { + management platform(project(":spring-statemachine-platform")) + implementation project(':spring-statemachine-samples-common') + implementation project(':spring-statemachine-autoconfigure') + implementation project(':spring-statemachine-data-common:spring-statemachine-data-jpa') + implementation project(':spring-statemachine-data-common:spring-statemachine-data-redis') + implementation project(':spring-statemachine-data-common:spring-statemachine-data-mongodb') + implementation('org.springframework.boot:spring-boot-starter-web') + implementation('org.springframework.boot:spring-boot-starter-thymeleaf') + implementation('org.springframework.boot:spring-boot-starter-data-jpa') + implementation('org.springframework.boot:spring-boot-starter-data-redis') + implementation('org.springframework.boot:spring-boot-starter-data-mongodb') + implementation('org.springframework.boot:spring-boot-devtools') + implementation('com.h2database:h2') + testImplementation(testFixtures(project(':spring-statemachine-core'))) + testImplementation 'org.hamcrest:hamcrest-core' + testImplementation 'org.hamcrest:hamcrest-library' + testImplementation 'org.springframework.boot:spring-boot-test' + testImplementation 'org.springframework:spring-test' + testImplementation 'io.projectreactor:reactor-test' + testImplementation 'org.assertj:assertj-core' + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.junit.jupiter:junit-jupiter-engine' +} diff --git a/spring-statemachine-samples/deploy/spring-statemachine-samples-deploy.gradle b/spring-statemachine-samples/deploy/spring-statemachine-samples-deploy.gradle new file mode 100644 index 00000000..e4d3f5ea --- /dev/null +++ b/spring-statemachine-samples/deploy/spring-statemachine-samples-deploy.gradle @@ -0,0 +1,23 @@ +plugins { + id 'org.springframework.statemachine.sample' +} + +description = 'Spring State Machine Deploy Sample' + +dependencies { + management platform(project(":spring-statemachine-platform")) + implementation project(':spring-statemachine-samples-common') + implementation project(':spring-statemachine-uml') + implementation('org.springframework.boot:spring-boot-starter-web') + implementation('org.springframework.boot:spring-boot-starter-thymeleaf') + testImplementation(testFixtures(project(':spring-statemachine-core'))) + testImplementation (project(':spring-statemachine-test')) + testImplementation 'org.hamcrest:hamcrest-core' + testImplementation 'org.hamcrest:hamcrest-library' + testImplementation 'org.springframework.boot:spring-boot-test' + testImplementation 'org.springframework:spring-test' + testImplementation 'io.projectreactor:reactor-test' + testImplementation 'org.assertj:assertj-core' + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.junit.jupiter:junit-jupiter-engine' +} diff --git a/spring-statemachine-samples/eventservice/spring-statemachine-samples-eventservice.gradle b/spring-statemachine-samples/eventservice/spring-statemachine-samples-eventservice.gradle new file mode 100644 index 00000000..4d7ed57a --- /dev/null +++ b/spring-statemachine-samples/eventservice/spring-statemachine-samples-eventservice.gradle @@ -0,0 +1,25 @@ +plugins { + id 'org.springframework.statemachine.sample' +} + +description = 'Spring State Machine Event Service Sample' + +dependencies { + management platform(project(":spring-statemachine-platform")) + implementation project(':spring-statemachine-samples-common') + implementation project(':spring-statemachine-data-common:spring-statemachine-data-redis') + implementation('org.springframework.boot:spring-boot-starter-web') + implementation('org.springframework.boot:spring-boot-starter-thymeleaf') + implementation('org.apache.commons:commons-pool2') + implementation('redis.clients:jedis') + testImplementation(testFixtures(project(':spring-statemachine-core'))) + testImplementation (project(':spring-statemachine-test')) + testImplementation 'org.hamcrest:hamcrest-core' + testImplementation 'org.hamcrest:hamcrest-library' + testImplementation 'org.springframework.boot:spring-boot-test' + testImplementation 'org.springframework:spring-test' + testImplementation 'io.projectreactor:reactor-test' + testImplementation 'org.assertj:assertj-core' + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.junit.jupiter:junit-jupiter-engine' +} diff --git a/spring-statemachine-samples/monitoring/spring-statemachine-samples-monitoring.gradle b/spring-statemachine-samples/monitoring/spring-statemachine-samples-monitoring.gradle new file mode 100644 index 00000000..00c00f10 --- /dev/null +++ b/spring-statemachine-samples/monitoring/spring-statemachine-samples-monitoring.gradle @@ -0,0 +1,26 @@ +plugins { + id 'org.springframework.statemachine.sample' +} + +description = 'Spring State Machine Monitoring Sample' + +dependencies { + management platform(project(":spring-statemachine-platform")) + implementation project(':spring-statemachine-samples-common') + implementation project(':spring-statemachine-autoconfigure') + implementation('org.springframework.boot:spring-boot-starter-actuator') + implementation('org.springframework.boot:spring-boot-starter-web') + implementation('org.springframework.boot:spring-boot-starter-thymeleaf') + testImplementation(testFixtures(project(':spring-statemachine-core'))) + testImplementation (project(':spring-statemachine-test')) + testImplementation('com.jayway.jsonpath:json-path') + testImplementation('com.jayway.jsonpath:json-path-assert') + testImplementation 'org.hamcrest:hamcrest-core' + testImplementation 'org.hamcrest:hamcrest-library' + testImplementation 'org.springframework.boot:spring-boot-test' + testImplementation 'org.springframework:spring-test' + testImplementation 'io.projectreactor:reactor-test' + testImplementation 'org.assertj:assertj-core' + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.junit.jupiter:junit-jupiter-engine' +} diff --git a/spring-statemachine-samples/ordershipping/spring-statemachine-samples-ordershipping.gradle b/spring-statemachine-samples/ordershipping/spring-statemachine-samples-ordershipping.gradle new file mode 100644 index 00000000..1ee21293 --- /dev/null +++ b/spring-statemachine-samples/ordershipping/spring-statemachine-samples-ordershipping.gradle @@ -0,0 +1,23 @@ +plugins { + id 'org.springframework.statemachine.sample' +} + +description = 'Spring State Machine Order Shipping Sample' + +dependencies { + management platform(project(":spring-statemachine-platform")) + implementation project(':spring-statemachine-samples-common') + implementation project(':spring-statemachine-uml') + implementation('org.springframework.boot:spring-boot-starter-web') + implementation('org.springframework.boot:spring-boot-starter-thymeleaf') + testImplementation(testFixtures(project(':spring-statemachine-core'))) + testImplementation (project(':spring-statemachine-test')) + testImplementation 'org.hamcrest:hamcrest-core' + testImplementation 'org.hamcrest:hamcrest-library' + testImplementation 'org.springframework.boot:spring-boot-test' + testImplementation 'org.springframework:spring-test' + testImplementation 'io.projectreactor:reactor-test' + testImplementation 'org.assertj:assertj-core' + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.junit.jupiter:junit-jupiter-engine' +} diff --git a/spring-statemachine-samples/persist/spring-statemachine-samples-persist.gradle b/spring-statemachine-samples/persist/spring-statemachine-samples-persist.gradle new file mode 100644 index 00000000..2b0ab597 --- /dev/null +++ b/spring-statemachine-samples/persist/spring-statemachine-samples-persist.gradle @@ -0,0 +1,25 @@ +plugins { + id 'org.springframework.statemachine.sample' +} + +description = 'Spring State Machine Persist Sample' + +dependencies { + management platform(project(":spring-statemachine-platform")) + implementation project(':spring-statemachine-samples-common') + implementation project(':spring-statemachine-recipes-common') + implementation 'org.springframework.boot:spring-boot-starter' + implementation 'org.springframework.shell:spring-shell' + implementation ('org.hsqldb:hsqldb') + implementation ('org.springframework:spring-jdbc') + testImplementation(testFixtures(project(':spring-statemachine-core'))) + testImplementation (project(':spring-statemachine-test')) + testImplementation 'org.hamcrest:hamcrest-core' + testImplementation 'org.hamcrest:hamcrest-library' + testImplementation 'org.springframework.boot:spring-boot-test' + testImplementation 'org.springframework:spring-test' + testImplementation 'io.projectreactor:reactor-test' + testImplementation 'org.assertj:assertj-core' + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.junit.jupiter:junit-jupiter-engine' +} diff --git a/spring-statemachine-samples/scope/spring-statemachine-samples-scope.gradle b/spring-statemachine-samples/scope/spring-statemachine-samples-scope.gradle new file mode 100644 index 00000000..7ad80638 --- /dev/null +++ b/spring-statemachine-samples/scope/spring-statemachine-samples-scope.gradle @@ -0,0 +1,15 @@ +plugins { + id 'org.springframework.statemachine.sample' +} + +description = 'Spring State Machine Web Scope Sample' + +dependencies { + management platform(project(":spring-statemachine-platform")) + implementation project(':spring-statemachine-samples-common') + implementation project(':spring-statemachine-core') + implementation 'org.springframework:spring-messaging' + implementation 'io.projectreactor:reactor-core' + implementation('org.springframework.boot:spring-boot-starter-web') + implementation('org.springframework.boot:spring-boot-starter-thymeleaf') +} diff --git a/spring-statemachine-samples/security/spring-statemachine-samples-security.gradle b/spring-statemachine-samples/security/spring-statemachine-samples-security.gradle new file mode 100644 index 00000000..d12726f9 --- /dev/null +++ b/spring-statemachine-samples/security/spring-statemachine-samples-security.gradle @@ -0,0 +1,17 @@ +plugins { + id 'org.springframework.statemachine.sample' +} + +description = 'Spring State Machine Web Security Sample' + +dependencies { + management platform(project(":spring-statemachine-platform")) + implementation project(':spring-statemachine-samples-common') + implementation project(':spring-statemachine-core') + implementation 'org.springframework:spring-messaging' + implementation('org.springframework.boot:spring-boot-starter-web') + implementation('org.springframework.boot:spring-boot-starter-thymeleaf') + implementation('org.springframework.boot:spring-boot-starter-security') + implementation('org.springframework.security:spring-security-config') + implementation('org.springframework.security:spring-security-web') +} diff --git a/spring-statemachine-samples/showcase/spring-statemachine-samples-showcase.gradle b/spring-statemachine-samples/showcase/spring-statemachine-samples-showcase.gradle new file mode 100644 index 00000000..42eea4c1 --- /dev/null +++ b/spring-statemachine-samples/showcase/spring-statemachine-samples-showcase.gradle @@ -0,0 +1,22 @@ +plugins { + id 'org.springframework.statemachine.sample' +} + +description = 'Spring State Machine Showcase Sample' + +dependencies { + management platform(project(":spring-statemachine-platform")) + implementation project(':spring-statemachine-samples-common') + implementation project(':spring-statemachine-core') + implementation 'org.springframework.shell:spring-shell' + testImplementation(testFixtures(project(':spring-statemachine-core'))) + testImplementation (project(':spring-statemachine-test')) + testImplementation 'org.hamcrest:hamcrest-core' + testImplementation 'org.hamcrest:hamcrest-library' + testImplementation 'org.springframework.boot:spring-boot-test' + testImplementation 'org.springframework:spring-test' + testImplementation 'io.projectreactor:reactor-test' + testImplementation 'org.assertj:assertj-core' + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.junit.jupiter:junit-jupiter-engine' +} diff --git a/spring-statemachine-samples/spring-statemachine-samples.gradle b/spring-statemachine-samples/spring-statemachine-samples.gradle new file mode 100644 index 00000000..7fb33726 --- /dev/null +++ b/spring-statemachine-samples/spring-statemachine-samples.gradle @@ -0,0 +1,12 @@ +plugins { + id 'org.springframework.statemachine.sample' +} + +description = 'Spring State Machine Samples Common' + +dependencies { + management platform(project(":spring-statemachine-platform")) + implementation project(':spring-statemachine-core') + implementation 'org.springframework.shell:spring-shell' + implementation 'org.springframework.boot:spring-boot-starter' +} diff --git a/spring-statemachine-samples/tasks/spring-statemachine-samples-tasks.gradle b/spring-statemachine-samples/tasks/spring-statemachine-samples-tasks.gradle new file mode 100644 index 00000000..101a30f0 --- /dev/null +++ b/spring-statemachine-samples/tasks/spring-statemachine-samples-tasks.gradle @@ -0,0 +1,23 @@ +plugins { + id 'org.springframework.statemachine.sample' +} + +description = 'Spring State Machine Parallel Regions Sample' + +dependencies { + management platform(project(":spring-statemachine-platform")) + implementation project(':spring-statemachine-samples-common') + implementation project(':spring-statemachine-core') + implementation 'org.springframework.shell:spring-shell' + testImplementation(testFixtures(project(':spring-statemachine-core'))) + testImplementation (project(':spring-statemachine-test')) + testImplementation 'org.hamcrest:hamcrest-core' + testImplementation 'org.hamcrest:hamcrest-library' + testImplementation 'org.springframework.boot:spring-boot-test' + testImplementation 'org.springframework:spring-test' + testImplementation 'io.projectreactor:reactor-test' + testImplementation 'org.assertj:assertj-core' + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.junit.jupiter:junit-jupiter-engine' + testImplementation 'io.projectreactor.tools:blockhound' +} diff --git a/spring-statemachine-samples/turnstile/spring-statemachine-samples-turnstile.gradle b/spring-statemachine-samples/turnstile/spring-statemachine-samples-turnstile.gradle new file mode 100644 index 00000000..f98dcdd4 --- /dev/null +++ b/spring-statemachine-samples/turnstile/spring-statemachine-samples-turnstile.gradle @@ -0,0 +1,22 @@ +plugins { + id 'org.springframework.statemachine.sample' +} + +description = 'Spring State Machine Turnstile Sample' + +dependencies { + management platform(project(":spring-statemachine-platform")) + implementation project(':spring-statemachine-samples-common') + implementation project(':spring-statemachine-core') + implementation 'org.springframework.shell:spring-shell' + testImplementation(testFixtures(project(':spring-statemachine-core'))) + testImplementation (project(':spring-statemachine-test')) + testImplementation 'org.hamcrest:hamcrest-core' + testImplementation 'org.hamcrest:hamcrest-library' + testImplementation 'org.springframework.boot:spring-boot-test' + testImplementation 'org.springframework:spring-test' + testImplementation 'io.projectreactor:reactor-test' + testImplementation 'org.assertj:assertj-core' + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.junit.jupiter:junit-jupiter-engine' +} diff --git a/spring-statemachine-samples/turnstilereactive/spring-statemachine-samples-turnstilereactive.gradle b/spring-statemachine-samples/turnstilereactive/spring-statemachine-samples-turnstilereactive.gradle new file mode 100644 index 00000000..cc18f48b --- /dev/null +++ b/spring-statemachine-samples/turnstilereactive/spring-statemachine-samples-turnstilereactive.gradle @@ -0,0 +1,26 @@ +plugins { + id 'org.springframework.statemachine.sample' +} + +description = 'Spring State Machine Turnstile Reactive Sample' + +dependencies { + management platform(project(":spring-statemachine-platform")) + implementation project(':spring-statemachine-samples-common') + implementation project(':spring-statemachine-core') + implementation 'org.springframework.boot:spring-boot-starter-webflux' + implementation 'org.springframework:spring-messaging' + testImplementation(testFixtures(project(':spring-statemachine-core'))) + testImplementation (project(':spring-statemachine-test')) + testImplementation('com.jayway.jsonpath:json-path') + testImplementation('com.jayway.jsonpath:json-path-assert') + testImplementation 'org.hamcrest:hamcrest-core' + testImplementation 'org.hamcrest:hamcrest-library' + testImplementation 'org.springframework.boot:spring-boot-test' + testImplementation 'org.springframework:spring-test' + testImplementation 'io.projectreactor:reactor-test' + testImplementation 'org.assertj:assertj-core' + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.junit.jupiter:junit-jupiter-engine' + testImplementation 'io.projectreactor.tools:blockhound' +} diff --git a/spring-statemachine-samples/washer/spring-statemachine-samples-washer.gradle b/spring-statemachine-samples/washer/spring-statemachine-samples-washer.gradle new file mode 100644 index 00000000..50f5e8eb --- /dev/null +++ b/spring-statemachine-samples/washer/spring-statemachine-samples-washer.gradle @@ -0,0 +1,22 @@ +plugins { + id 'org.springframework.statemachine.sample' +} + +description = 'Spring State Machine History State Sample' + +dependencies { + management platform(project(":spring-statemachine-platform")) + implementation project(':spring-statemachine-samples-common') + implementation project(':spring-statemachine-core') + implementation 'org.springframework.shell:spring-shell' + testImplementation(testFixtures(project(':spring-statemachine-core'))) + testImplementation (project(':spring-statemachine-test')) + testImplementation 'org.hamcrest:hamcrest-core' + testImplementation 'org.hamcrest:hamcrest-library' + testImplementation 'org.springframework.boot:spring-boot-test' + testImplementation 'org.springframework:spring-test' + testImplementation 'io.projectreactor:reactor-test' + testImplementation 'org.assertj:assertj-core' + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.junit.jupiter:junit-jupiter-engine' +} diff --git a/spring-statemachine-samples/web/spring-statemachine-samples-web.gradle b/spring-statemachine-samples/web/spring-statemachine-samples-web.gradle new file mode 100644 index 00000000..78ff2ecd --- /dev/null +++ b/spring-statemachine-samples/web/spring-statemachine-samples-web.gradle @@ -0,0 +1,18 @@ +plugins { + id 'org.springframework.statemachine.sample' +} + +description = 'Spring State Machine Web Sample' + +dependencies { + management platform(project(":spring-statemachine-platform")) + implementation project(':spring-statemachine-samples-common') + implementation project(':spring-statemachine-cluster') + implementation('org.springframework.boot:spring-boot-starter-security') + implementation('org.springframework.boot:spring-boot-starter-web') + implementation('org.springframework.boot:spring-boot-starter-websocket') + implementation('org.springframework:spring-webmvc') + implementation('org.springframework:spring-websocket') + implementation('org.springframework.security:spring-security-messaging') + implementation('org.springframework.session:spring-session-core') +} diff --git a/spring-statemachine-samples/zookeeper/spring-statemachine-samples-zookeeper.gradle b/spring-statemachine-samples/zookeeper/spring-statemachine-samples-zookeeper.gradle new file mode 100644 index 00000000..a13d02d4 --- /dev/null +++ b/spring-statemachine-samples/zookeeper/spring-statemachine-samples-zookeeper.gradle @@ -0,0 +1,13 @@ +plugins { + id 'org.springframework.statemachine.sample' +} + +description = 'Spring State Machine Distributed Sample' + +dependencies { + management platform(project(":spring-statemachine-platform")) + implementation project(':spring-statemachine-zookeeper') + implementation project(':spring-statemachine-samples-common') + implementation project(':spring-statemachine-core') + implementation 'org.springframework.shell:spring-shell' +} diff --git a/spring-statemachine-starter/spring-statemachine-starter.gradle b/spring-statemachine-starter/spring-statemachine-starter.gradle new file mode 100644 index 00000000..c9a83cec --- /dev/null +++ b/spring-statemachine-starter/spring-statemachine-starter.gradle @@ -0,0 +1,11 @@ +plugins { + id 'org.springframework.statemachine.starter' +} + +description = 'Spring Statemachine Starter' + +dependencies { + management platform(project(":spring-statemachine-platform")) + api(project(":spring-statemachine-autoconfigure")) + api 'org.springframework.boot:spring-boot-starter' +} diff --git a/spring-statemachine-test/spring-statemachine-test.gradle b/spring-statemachine-test/spring-statemachine-test.gradle new file mode 100644 index 00000000..bb2032e9 --- /dev/null +++ b/spring-statemachine-test/spring-statemachine-test.gradle @@ -0,0 +1,19 @@ +plugins { + id 'org.springframework.statemachine.module' +} + +description = 'Spring State Machine Test' + +dependencies { + management platform(project(":spring-statemachine-platform")) + api project(':spring-statemachine-core') + api 'org.springframework:spring-test' + api 'org.hamcrest:hamcrest-core' + api 'org.hamcrest:hamcrest-library' + api 'org.assertj:assertj-core' + optional 'junit:junit' + optional 'org.junit.jupiter:junit-jupiter-api' + optional 'org.junit.vintage:junit-vintage-engine' + testImplementation(testFixtures(project(':spring-statemachine-core'))) + testImplementation 'org.mockito:mockito-core' +} diff --git a/spring-statemachine-uml/spring-statemachine-uml.gradle b/spring-statemachine-uml/spring-statemachine-uml.gradle new file mode 100644 index 00000000..da00a62b --- /dev/null +++ b/spring-statemachine-uml/spring-statemachine-uml.gradle @@ -0,0 +1,37 @@ +plugins { + id 'org.springframework.statemachine.module' +} + +description = 'Spring State Machine Uml' + +dependencies { + management platform(project(":spring-statemachine-platform")) + api project(':spring-statemachine-core') + api ("org.eclipse.uml2:uml:$eclipseUml2UmlVersion") { + exclude group: 'org.eclipse.core', module: 'runtime' + exclude group: 'org.eclipse.emf', module: 'ecore' + exclude group: 'org.eclipse.emf.ecore', module: 'xmi' + exclude group: 'org.eclipse.emf.mapping', module: 'ecore2xml' + exclude group: 'org.eclipse.uml2', module: 'common' + exclude group: 'org.eclipse.uml2', module: 'types' + } + api ('org.eclipse.uml2:types') { + exclude group: 'org.eclipse.core', module: 'runtime' + exclude group: 'org.eclipse.emf', module: 'ecore' + exclude group: 'org.eclipse.uml2', module: 'common' + } + api ('org.eclipse.uml2:common') { + exclude group: 'org.eclipse.core', module: 'runtime' + exclude group: 'org.eclipse.emf', module: 'ecore' + } + api 'org.eclipse.emf:org.eclipse.emf.ecore.xmi' + api 'org.eclipse.emf:org.eclipse.emf.ecore' + api 'org.eclipse.emf:org.eclipse.emf.common' + testImplementation(testFixtures(project(":spring-statemachine-core"))) + testImplementation 'org.assertj:assertj-core' + testImplementation 'io.projectreactor:reactor-test' + testImplementation 'org.springframework:spring-test' + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.junit.jupiter:junit-jupiter-engine' + testImplementation 'org.awaitility:awaitility' +} diff --git a/spring-statemachine-zookeeper/spring-statemachine-zookeeper.gradle b/spring-statemachine-zookeeper/spring-statemachine-zookeeper.gradle new file mode 100644 index 00000000..8a53368b --- /dev/null +++ b/spring-statemachine-zookeeper/spring-statemachine-zookeeper.gradle @@ -0,0 +1,17 @@ +plugins { + id 'org.springframework.statemachine.module' +} + +description = 'Spring State Machine Zookeeper' + +dependencies { + management platform(project(":spring-statemachine-platform")) + api project(':spring-statemachine-core') + api project(':spring-statemachine-kryo') + api 'org.apache.curator:curator-recipes' + testImplementation (project(':spring-statemachine-test')) + testImplementation 'org.apache.curator:curator-test' + testImplementation 'org.assertj:assertj-core' + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.junit.jupiter:junit-jupiter-engine' +}