diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..965ca9df --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +version: 2 +updates: + - package-ecosystem: gradle + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 + target-branch: 5.0.x + labels: + - "type: dependency upgrade" + ignore: + - dependency-name: "*" + update-types: ["version-update:semver-patch", "version-update:semver-minor"] \ No newline at end of file diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000..f5ba56fd --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,41 @@ +name-template: $RESOLVED_VERSION +tag-template: v$RESOLVED_VERSION +categories: + - title: ✨ Features + labels: + - "type: enhancement" + - "type: new feature" + - "type: major" + - title: 🐛 Bug Fixes/Improvements + labels: + - "type: improvement" + - "type: bug" + - "type: minor" + - title: 🛠 Dependency upgrades + labels: + - "type: dependency upgrade" + - "dependencies" + - title: ⚙️ Build/CI + labels: + - "type: ci" + - "type: build" +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +version-resolver: + major: + labels: + - 'type: major' + minor: + labels: + - 'type: minor' + patch: + labels: + - 'type: patch' + default: patch +template: | + ## What's Changed + + $CHANGES + + ## Contributors + + $CONTRIBUTORS \ No newline at end of file diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 00000000..30740f84 --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,61 @@ +{ + "extends": [ + "config:base" + ], + "labels": ["type: dependency upgrade"], + "packageRules": [ + { + "matchUpdateTypes": ["major"], + "enabled": false + }, + { + "matchPackagePatterns": ["*"], + "allowedVersions": "!/SNAPSHOT$/" + }, + { + "matchPackagePatterns": [ + "^org\\.codehaus\\.groovy" + ], + "groupName": "groovy monorepo" + }, + { + "matchPackageNames": [ + "org.grails:grails-bom", + "org.grails:grails-bootstrap", + "org.grails:grails-codecs", + "org.grails:grails-console", + "org.grails:grails-core", + "org.grails:grails-databinding", + "org.grails:grails-dependencies", + "org.grails:grails-docs", + "org.grails:grails-encoder", + "org.grails:grails-gradle-model", + "org.grails:grails-logging", + "org.grails:grails-plugin-codecs", + "org.grails:grails-plugin-controllers", + "org.grails:grails-plugin-databinding", + "org.grails:grails-plugin-datasource", + "org.grails:grails-plugin-domain-class", + "org.grails:grails-plugin-i18n", + "org.grails:grails-plugin-interceptors", + "org.grails:grails-plugin-mimetypes", + "org.grails:grails-plugin-rest", + "org.grails:grails-plugin-services", + "org.grails:grails-plugin-url-mappings", + "org.grails:grails-plugin-url-validation", + "org.grails:grails-shell", + "org.grails:grails-spring", + "org.grails:grails-test", + "org.grails:grails-validation", + "org.grails:grails-web", + "org.grails:grails-web-boot", + "org.grails:grails-web-common", + "org.grails:grails-web-databinding", + "org.grails:grails-web-fileupload", + "org.grails:grails-web-mvc", + "org.grails:grails-web-url-mappings" + ], + "groupName": "grails monorepo" + } + ] +} \ No newline at end of file diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 00000000..ac3885c3 --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,56 @@ +name: Java CI +on: + push: + branches: + - '[5-9]+.[0-9]+.x' + pull_request: + branches: + - '[5-9]+.[0-9]+.x' +jobs: + build: + name: build + runs-on: ubuntu-latest + strategy: + matrix: + java: ['11', '14'] + env: + WORKSPACE: ${{ github.workspace }} + GRADLE_OPTS: -Xmx1500m -Dfile.encoding=UTF-8 + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v3 + with: + distribution: 'adopt' + java-version: ${{ matrix.java }} + - name: Run Build + id: build + uses: gradle/gradle-build-action@v2 + env: + GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} + GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} + with: + arguments: build + publish: + name: Publish Snapshot release + if: github.event_name == 'push' + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v3 + with: + distribution: 'adopt' + java-version: '11' + - name: Publish to Artifactory (repo.grails.org) + uses: gradle/gradle-build-action@v2 + env: + GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} + GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} + ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} + ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} + with: + arguments: -Dorg.gradle.internal.publish.checksums.insecure=true publish \ No newline at end of file diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml new file mode 100644 index 00000000..2807f6a5 --- /dev/null +++ b/.github/workflows/release-notes.yml @@ -0,0 +1,48 @@ +name: Changelog +on: + issues: + types: [closed,reopened] + push: + branches: + - master + - '[5-9]+.[0-9]+.x' + workflow_dispatch: +jobs: + release_notes: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Check if it has release drafter config file + id: check_release_drafter + run: | + has_release_drafter=$([ -f .github/release-drafter.yml ] && echo "true" || echo "false") + echo "has_release_drafter=${has_release_drafter}" >> $GITHUB_OUTPUT + - name: Extract branch name + id: extract_branch + run: echo "value=${GITHUB_REF:11}" >> $GITHUB_OUTPUT + # If it has release drafter: + - uses: release-drafter/release-drafter@v5 + if: steps.check_release_drafter.outputs.has_release_drafter == 'true' + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + with: + commitish: ${{ steps.extract_branch.outputs.value }} + # Otherwise: + - name: Export Gradle Properties + if: steps.check_release_drafter.outputs.has_release_drafter == 'false' + uses: micronaut-projects/github-actions/export-gradle-properties@master + - uses: micronaut-projects/github-actions/release-notes@master + if: steps.check_release_drafter.outputs.has_release_drafter == 'false' + id: release_notes + with: + token: ${{ secrets.GH_TOKEN }} + - uses: ncipollo/release-action@v1 + if: steps.check_release_drafter.outputs.has_release_drafter == 'false' && steps.release_notes.outputs.generated_changelog == 'true' + with: + allowUpdates: true + commit: ${{ steps.release_notes.outputs.current_branch }} + draft: true + name: ${{ env.title }} ${{ steps.release_notes.outputs.next_version }} + tag: v${{ steps.release_notes.outputs.next_version }} + bodyFile: CHANGELOG.md + token: ${{ secrets.GH_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..4a058bd8 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,69 @@ +name: Release +on: + release: + types: [published] +jobs: + release: + runs-on: ubuntu-latest + strategy: + matrix: + java: ['11'] + env: + GIT_USER_NAME: puneetbehl + GIT_USER_EMAIL: behlp@objectcomputing.com + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + token: ${{ secrets.GH_TOKEN }} + - uses: gradle/wrapper-validation-action@v1 + - name: Set up JDK + uses: actions/setup-java@v3 + with: + distribution: 'adopt' + java-version: ${{ matrix.java }} + - name: Extract Target Branch + id: extract_branch + run: | + echo "Determining Target Branch" + TARGET_BRANCH=`cat $GITHUB_EVENT_PATH | jq '.release.target_commitish' | sed -e 's/^"\(.*\)"$/\1/g'` + echo $TARGET_BRANCH + echo "value=${TARGET_BRANCH}" >> $GITHUB_OUTPUT + - name: Set the current release version + id: release_version + run: echo "release_version=${GITHUB_REF:11}" >> $GITHUB_OUTPUT + - name: Run pre-release + uses: micronaut-projects/github-actions/pre-release@master + with: + token: ${{ secrets.GITHUB_TOKEN }} + - name: Generate secring file + env: + SECRING_FILE: ${{ secrets.SECRING_FILE }} + run: echo $SECRING_FILE | base64 -d > ${{ github.workspace }}/secring.gpg + - name: Publish to Sonatype OSSRH + id: publish + uses: gradle/gradle-build-action@v2 + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} + SIGNING_KEY: ${{ secrets.SIGNING_KEY }} + SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} + SECRING_FILE: ${{ secrets.SECRING_FILE }} + with: + arguments: -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg publishToSonatype closeAndReleaseSonatypeStagingRepository + - name: Run Assemble + if: steps.publish.outcome == 'success' + id: assemble + uses: gradle/gradle-build-action@v2 + with: + arguments: assemble + - name: Export Gradle Properties + uses: micronaut-projects/github-actions/export-gradle-properties@master + - name: Run post-release + if: steps.publish.outcome == 'success' + uses: micronaut-projects/github-actions/post-release@master + with: + token: ${{ secrets.GITHUB_TOKEN }} + env: + SNAPSHOT_SUFFIX: -SNAPSHOT \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index dedd2f23..00000000 --- a/.travis.yml +++ /dev/null @@ -1,34 +0,0 @@ -language: groovy -jdk: -- oraclejdk8 -- openjdk11 -dist: trusty -env: - global: - - TERM=dumb - - MALLOC_ARENA_MAX=1 - - GRADLE_OPTS="-Xmx1024m -Xms256m -XX:MaxPermSize=372m -XX:+CMSClassUnloadingEnabled" - - GIT_NAME="Graeme Rocher" - - GIT_EMAIL="graeme.rocher@gmail.com" - - secure: gr+BVcVJ6wkFpBBNM0vn03V0AgcxJ+RbE8kHem5XR7jMwskVaPsrPnN1G2C6xzc+8SuA6uliSMH65gokSybTYEU8lWlgt87tsY+wQoufHhvi5YsKSfUMAXK8PdA+Yl9JOEz7UiyDdAq6lyu0AxrSO0IL+pORqBkzKyJ5p5jZoyjqW0fq3NkLKnXnJM5nsG6Vno2eKwvy8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l9Lquf46b/d99BN9q+G18wrSmYtJueS4bLqjfkS9hhj3wPlBA25gBXI4J6b1U0ge6OciapmsCj4NZKCaMXcSGqhsKNFHZOe3PgeA35NBeXLeD9hwNXPqQHIY7Hniajp9Uuab3wgJ1MVKulE= -install: true -script: "./travis-build.sh" -before_cache: -- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock -- rm -fr $HOME/.gradle/caches/*/plugin-resolution/ -cache: - directories: - - "$HOME/.gradle/caches/" - - "$HOME/.gradle/wrapper/" diff --git a/build.gradle b/build.gradle index c1445c24..6f1f1b8b 100644 --- a/build.gradle +++ b/build.gradle @@ -1,64 +1,57 @@ -buildscript { - repositories { - mavenLocal() - maven { url "https://repo.grails.org/grails/core" } - } - dependencies { - classpath "org.grails:grails-gradle-plugin:$grailsVersion" - classpath "org.grails:grails-docs:$grailsVersion" - classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' - classpath 'com.bmuschko:gradle-nexus-plugin:2.3.1' - classpath 'io.github.groovylang.groovydoc:groovydoc-gradle-plugin:1.0.1' - } +plugins { + id 'groovy' + id 'io.github.gradle-nexus.publish-plugin' } +version = projectVersion + repositories { mavenLocal() - maven { url "https://repo.grails.org/grails/core" } + mavenCentral() + maven { url 'https://repo.grails.org/grails/core' } } -version project.projectVersion -ext { - commonBuild = 'https://raw.githubusercontent.com/grails/grails-common-build/1549696f8d1a6bce3d84db9c4c1bfde61eddf175' +ext['isSnapshot'] = projectVersion.endsWith('-SNAPSHOT') +ext['isReleaseVersion'] = !isSnapshot + +if(isReleaseVersion) { + nexusPublishing { + String nexusUser = System.getenv('SONATYPE_USERNAME') ?: project.findProperty('sonatypeOssUsername') ?: '' + String nexusPass = System.getenv('SONATYPE_PASSWORD') ?: project.findProperty('sonatypeOssPassword') ?: '' + String nexusStagingProfileId = System.getenv('SONATYPE_STAGING_PROFILE_ID') ?: project.findProperty('sonatypeOssStagingProfileId') ?: '' + repositories { + sonatype { + nexusUrl = uri 'https://s01.oss.sonatype.org/service/local/' + username = nexusUser + password = nexusPass + stagingProfileId = nexusStagingProfileId + } + } + transitionCheckOptions { + maxRetries = 40 + delayBetween = java.time.Duration.ofSeconds 2 + } + } } subprojects { - version project.projectVersion - - ext { - userOrg = "grails" - isGrailsPlugin = name.startsWith('grails-plugin') - isBuildSnapshot = version.toString().endsWith("-SNAPSHOT") - } - - if(isGrailsPlugin) { - group "org.grails.plugins" - } - else { - group "org.grails" - } + version = rootProject.version repositories { - mavenLocal() - maven { url "https://repo.grails.org/grails/core" } - } - - if(it.projectDir.path.endsWith("examples/${it.name}".toString())) { - apply plugin:"org.grails.grails-web" - } - else if(isGrailsPlugin) { - apply from:"${commonBuild}/common-project.gradle" - apply from:"${commonBuild}/common-publishing.gradle" - } - else { - apply from:"${commonBuild}/common-project.gradle" - apply from:"${commonBuild}/common-publishing.gradle" + mavenCentral() + maven { url 'https://repo.grails.org/grails/core' } } - dependencies { - compile 'javax.annotation:javax.annotation-api:1.3.2' + tasks.withType(Test).configureEach { + useJUnitPlatform() + testLogging { + events 'passed', 'skipped', 'failed', 'standardOut', 'standardError' + } } } -apply from:"${commonBuild}/common-docs.gradle" +//do not generate extra load on Nexus with new staging repository if signing fails +tasks.withType(io.github.gradlenexus.publishplugin.InitializeNexusStagingRepository).configureEach { + shouldRunAfter tasks.withType(Sign) +} \ No newline at end of file diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle new file mode 100644 index 00000000..449d446f --- /dev/null +++ b/buildSrc/build.gradle @@ -0,0 +1,20 @@ +plugins { + + id 'groovy-gradle-plugin' + id 'maven-publish' + +} + +repositories { + mavenCentral() + maven { url 'https://repo.grails.org/grails/core' } +} + +dependencies { + + implementation libs.nexus.publish.gradle.plugin + implementation libs.grails.gradle.plugin + implementation libs.grails.views.gradle.plugin + implementation libs.groovydoc.gradle.plugin + +} \ No newline at end of file diff --git a/buildSrc/settings.gradle b/buildSrc/settings.gradle new file mode 100644 index 00000000..4194f6d4 --- /dev/null +++ b/buildSrc/settings.gradle @@ -0,0 +1,9 @@ +rootProject.name = 'grails-async' + +dependencyResolutionManagement { + versionCatalogs { + libs { + from(files('../gradle/libs.versions.toml')) + } + } +} \ No newline at end of file diff --git a/examples/pubsub-demo/build.gradle b/examples/pubsub-demo/build.gradle index b3cc0ddc..843aaccb 100644 --- a/examples/pubsub-demo/build.gradle +++ b/examples/pubsub-demo/build.gradle @@ -1,41 +1,50 @@ -dependencies { - compile "org.springframework.boot:spring-boot-starter-logging" - compile "org.springframework.boot:spring-boot-autoconfigure" - compile "org.grails:grails-core" - compile "org.springframework.boot:spring-boot-starter-actuator" - compile "org.springframework.boot:spring-boot-starter-tomcat" - compile "org.grails:grails-plugin-url-mappings" - compile "org.grails:grails-plugin-rest" - compile "org.grails:grails-plugin-codecs" - compile "org.grails:grails-plugin-interceptors" - compile "org.grails:grails-plugin-services" - compile "org.grails:grails-plugin-datasource" - compile "org.grails:grails-plugin-databinding" - compile project(":grails-plugin-async") - runtime project(":grails-events-rxjava") -// runtime project(":grails-async-rxjava") - compile "org.grails:grails-web-boot" - compile "org.grails:grails-logging" - compile "org.grails.plugins:cache", { - exclude module:'asset-pipeline-grails' - } - compile "org.grails.plugins:hibernate5" - compile "org.hibernate:hibernate-core:$hibernateCoreVersion" - compile "org.hibernate:hibernate-ehcache:$hibernateCoreVersion" - compile "org.grails.plugins:views-json" - compile "org.grails.plugins:views-json-templates" - console "org.grails:grails-console" - profile "org.grails.profiles:rest-api" - runtime "com.h2database:h2" - runtime "org.apache.tomcat:tomcat-jdbc" - - testCompile "org.grails:grails-plugin-testing" - testCompile "org.grails:grails-gorm-testing-support" - testCompile "org.grails:grails-web-testing-support" - testCompile "io.micronaut:micronaut-http-client:$micronautVersion" -} +plugins { + + id 'application' + id 'groovy' + + id 'org.grails.grails-web' + id 'org.grails.plugins.views-json' -bootRun { - jvmArgs('-Dspring.output.ansi.enabled=always') - sourceResources sourceSets.main } + +group = 'pubsub.demo' + +dependencies { + + implementation project(':grails-plugin-async') + implementation project(':grails-plugin-events') + + implementation 'org.grails:grails-core' + implementation 'org.grails:grails-logging' + implementation 'org.grails:grails-plugin-databinding' + implementation 'org.grails:grails-plugin-interceptors' + implementation 'org.grails:grails-plugin-rest' + implementation 'org.grails:grails-plugin-services' + implementation 'org.grails:grails-plugin-url-mappings' + implementation 'org.grails:grails-web-boot' + + implementation 'org.grails.plugins:cache', { exclude module: 'asset-pipeline-grails' } + implementation 'org.grails.plugins:hibernate5' + implementation 'org.grails.plugins:views-json' + implementation 'org.grails.plugins:views-json-templates' + + implementation 'org.springframework.boot:spring-boot-autoconfigure' + implementation 'org.springframework.boot:spring-boot-starter' + implementation 'org.springframework.boot:spring-boot-starter-logging' + implementation 'org.springframework.boot:spring-boot-starter-tomcat' + + implementation 'org.hibernate:hibernate-core' + implementation 'org.hibernate:hibernate-ehcache' + + console 'org.grails:grails-console' + + runtimeOnly 'com.h2database:h2' + runtimeOnly 'org.apache.tomcat:tomcat-jdbc' + + testImplementation 'io.micronaut:micronaut-http-client' + testImplementation 'io.micronaut:micronaut-inject-groovy' + testImplementation 'org.grails:grails-gorm-testing-support' + testImplementation 'org.grails:grails-web-testing-support' + +} \ No newline at end of file diff --git a/examples/pubsub-demo/gradle.properties b/examples/pubsub-demo/gradle.properties index 545ab7eb..e69de29b 100644 --- a/examples/pubsub-demo/gradle.properties +++ b/examples/pubsub-demo/gradle.properties @@ -1 +0,0 @@ -grailsVersion=4.0.0.BUILD-SNAPSHOT \ No newline at end of file diff --git a/examples/pubsub-demo/grails-app/conf/application.yml b/examples/pubsub-demo/grails-app/conf/application.yml index 2492aa99..cbae1f92 100644 --- a/examples/pubsub-demo/grails-app/conf/application.yml +++ b/examples/pubsub-demo/grails-app/conf/application.yml @@ -87,15 +87,15 @@ environments: development: dataSource: dbCreate: create-drop - url: jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE + url: jdbc:h2:mem:devDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE test: dataSource: dbCreate: update - url: jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE + url: jdbc:h2:mem:testDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE production: dataSource: dbCreate: none - url: jdbc:h2:./prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE + url: jdbc:h2:./prodDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE properties: jmxEnabled: true initialSize: 5 diff --git a/examples/pubsub-demo/grails-app/conf/logback.groovy b/examples/pubsub-demo/grails-app/conf/logback.groovy deleted file mode 100644 index 20f85e19..00000000 --- a/examples/pubsub-demo/grails-app/conf/logback.groovy +++ /dev/null @@ -1,36 +0,0 @@ -import grails.util.BuildSettings -import grails.util.Environment -import org.springframework.boot.logging.logback.ColorConverter -import org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter - -import java.nio.charset.Charset - -conversionRule 'clr', ColorConverter -conversionRule 'wex', WhitespaceThrowableProxyConverter - -// See http://logback.qos.ch/manual/groovy.html for details on configuration -appender('STDOUT', ConsoleAppender) { - encoder(PatternLayoutEncoder) { - charset = Charset.forName('UTF-8') - - pattern = - '%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} ' + // Date - '%clr(%5p) ' + // Log level - '%clr(---){faint} %clr([%15.15t]){faint} ' + // Thread - '%clr(%-40.40logger{39}){cyan} %clr(:){faint} ' + // Logger - '%m%n%wex' // Message - } -} - -def targetDir = BuildSettings.TARGET_DIR -if (Environment.isDevelopmentMode() && targetDir != null) { - appender("FULL_STACKTRACE", FileAppender) { - file = "${targetDir}/stacktrace.log" - append = true - encoder(PatternLayoutEncoder) { - pattern = "%level %logger - %msg%n" - } - } - logger("StackTrace", ERROR, ['FULL_STACKTRACE'], false) -} -root(ERROR, ['STDOUT']) diff --git a/examples/pubsub-demo/grails-app/conf/logback.xml b/examples/pubsub-demo/grails-app/conf/logback.xml new file mode 100644 index 00000000..a163180e --- /dev/null +++ b/examples/pubsub-demo/grails-app/conf/logback.xml @@ -0,0 +1,19 @@ + + + + + + + + true + + UTF-8 + %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex + + + + + + + + \ No newline at end of file diff --git a/examples/pubsub-demo/src/integration-test/groovy/pubsub/demo/PubSubSpec.groovy b/examples/pubsub-demo/src/integration-test/groovy/pubsub/demo/PubSubSpec.groovy index 39210d9c..bb219102 100644 --- a/examples/pubsub-demo/src/integration-test/groovy/pubsub/demo/PubSubSpec.groovy +++ b/examples/pubsub-demo/src/integration-test/groovy/pubsub/demo/PubSubSpec.groovy @@ -2,7 +2,7 @@ package pubsub.demo import grails.gorm.transactions.Rollback import grails.testing.mixin.integration.Integration -import org.springframework.beans.factory.annotation.Autowired +import jakarta.inject.Inject import spock.lang.Specification /** @@ -11,10 +11,10 @@ import spock.lang.Specification @Integration class PubSubSpec extends Specification { - @Autowired SumService sumService - @Autowired TotalService totalService - @Autowired BookService bookService - @Autowired BookSubscriber bookSubscriber + @Inject SumService sumService + @Inject TotalService totalService + @Inject BookService bookService + @Inject BookSubscriber bookSubscriber void "test event bus within Grails"() { when: diff --git a/examples/pubsub-demo/src/main/groovy/pubsub/demo/BookSubscriber.groovy b/examples/pubsub-demo/src/main/groovy/pubsub/demo/BookSubscriber.groovy index 77e8418c..eadaa81a 100644 --- a/examples/pubsub-demo/src/main/groovy/pubsub/demo/BookSubscriber.groovy +++ b/examples/pubsub-demo/src/main/groovy/pubsub/demo/BookSubscriber.groovy @@ -9,7 +9,8 @@ import java.util.concurrent.ConcurrentLinkedDeque @Component class BookSubscriber { - List newBooks =[] + List newBooks = [] + @Subscriber("newBook") void withBook(Book book) { newBooks.add(book.title) diff --git a/gradle.properties b/gradle.properties index 7a8a4655..f5f783b0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,24 +1,25 @@ +projectVersion=5.0.0-SNAPSHOT + +# These versions have to be defined here for usage in settings.gradle +# (versions in settings.gradle cannot be set from the version catalog) +grailsVersion=6.1.0 +viewsVersion=3.1.0 + +# This prevents the Grails Gradle Plugin from unnecessarily excluding slf4j-simple in the generated POMs +# https://github.com/grails/grails-gradle-plugin/issues/222 +slf4jPreventExclusion=true + title=Grails Async Framework authors=Graeme Rocher -projectVersion=4.0.1.BUILD-SNAPSHOT projectDesc=Grails Async Libraries projectUrl=https://github.com/grails/grails-async githubSlug=grails/grails-async githubBranch=master -developers=Graeme Rocher -grailsVersion=4.0.0 -grailsDocsVersion=4.0.0.M1 -groovyVersion=2.5.6 -gormVersion=7.0.2.RELEASE -servletApiVersion=4.0.1 -spockVersion=1.2-groovy-2.5 -springVersion=5.1.8.RELEASE -slf4jVersion=1.7.22 -rxJavaVersion=1.3.0 -rxJava2Version=2.1.3 -rxjavadocs=http://reactivex.io/RxJava/javadoc -rxjava2docs=http://reactivex.io/RxJava/2.x/javadoc -gparsdocs=http://gpars.org/1.2.0/groovydoc/ -mavenCentralSync=false -micronautVersion=1.0.4 -hibernateCoreVersion=5.4.0.Final +developers=Graeme Rocher, Mattias Reichel + +#gpars docs is currently not available with https +gparsdocs=http://gpars.org/1.2.1/groovydoc +rxjavadocs=https://reactivex.io/RxJava/1.x/javadoc +rxjava2docs=https://reactivex.io/RxJava/2.x/javadoc + +org.gradle.caching=true \ No newline at end of file diff --git a/gradle/documentation.gradle b/gradle/documentation.gradle new file mode 100644 index 00000000..8f62ecf1 --- /dev/null +++ b/gradle/documentation.gradle @@ -0,0 +1,137 @@ +/* + README + ====== + This file is not used at the moment. Should Guide/API-docs generation be moved to its on project? + (Like the grails/gorm-docs project for grails/grails-data-mapping) +*/ + +def DOCUMENTATION_GROUP = 'Documentation' + +def commonGithubOrg = 'grails' +def commonGithubSlug = 'grails-common-build' +def commonBranch = 'master' +def docResourcesDir = "${buildDir}/resources/${commonGithubSlug}-${commonBranch}/src/main/resources" + +tasks.register('remoteDocResources', Copy) { + + group = DOCUMENTATION_GROUP + description = 'Downloads common documentation resources and unzips them to build folder' + + from zipTree("https://github.com/${commonGithubOrg}/${commonGithubSlug}/archive/${commonBranch}.zip") + into docResourcesDir +} + +tasks.register('localDocResources', Copy) { + + group = DOCUMENTATION_GROUP + description = 'Copy local resources to build folder' + + from 'src/main/docs/resources' + into docResourcesDir + onlyIf { project.file('src/main/docs/resources').exists() } +} + +configurations { + documentation +} + +dependencies { + if (configurations.find { it.name == 'documentation' }) { + documentation libs.picocli + documentation libs.jansi + documentation libs.jline2 + documentation libs.javaparser.core + documentation libs.groovy + documentation libs.groovy.ant + documentation libs.groovy.cli.picocli + } +} + +//groovydoc.classpath += configurations.documentation + +tasks.withType(Groovydoc).configureEach { + + group = DOCUMENTATION_GROUP + + docTitle = "${project.title} - ${project.version}" + destinationDir = project.file('build/docs/api') + + // Add the sources of all subprojects (except from the examples directory) + def files = [] + rootProject.subprojects + .findAll { it.projectDir.parentFile.name != 'examples' && it.file('src/main/groovy').exists() } + .each { sp -> source = sp.files('src/main/groovy') } + + classpath += configurations.documentation +} + +tasks.register('copyHtmlIndex', Copy) { + + group = DOCUMENTATION_GROUP + description = 'Copy index.html to build folder' + + from "$buildDir/docs/guide/single.html" + into "$buildDir/docs/guide/" + rename 'single.html', 'index.html' + //overwrite true + +/* + dependsOn tasks.named('prepareDocResources') + source file(project.buildDir, 'docs/guide/single.html') + destinationDirectory file(project.buildDir, 'docs/guide/') + include 'index.html' + rename 'index.html', 'single.html' +*/ +} + +tasks.register('guide', grails.doc.gradle.PublishGuide) { + + group = DOCUMENTATION_GROUP + description = 'Generate Guide' + + targetDir = project.file("${buildDir}/docs") + sourceRepo = "https://github.com/${githubSlug}/edit/${githubBranch}/src/main/docs" + sourceDir = new File(rootProject.projectDir, 'src/main/docs') + propertiesFiles = [ new File(rootProject.projectDir, 'gradle.properties') ] + asciidoc = true + resourcesDir = project.file(docResourcesDir) + properties = [ + 'safe': 'UNSAFE', + 'version': project.version, + 'subtitle': project.projectDesc, + 'api': '../api', + 'sourceDir': rootProject.projectDir.absolutePath, + 'sourcedir': rootProject.projectDir.absolutePath, + 'javaee': 'https://docs.oracle.com/javaee/7/api/', + 'javase': 'https://docs.oracle.com/en/java/javase/11/docs/api/', + 'groovyapi': "https://docs.groovy-lang.org/${libs.versions.groovy}/html/gapi/", + 'grailsapi': "https://docs.grails.org/${libs.versions.grails}/api/", + 'gormapi': "https://gorm.grails.org/${libs.versions.gorm}/api/", + 'springapi': "https://docs.spring.io/spring/docs/${libs.versions.spring}/javadoc-api/" + ] + doLast { + ant.move(file: "${project.buildDir}/docs/guide/single.html", + tofile: "${project.buildDir}/docs/guide/index.html", overwrite: true) + new File(project.buildDir, 'docs/index.html').text = '' + } +} + +/* +tasks.register('docs') { + + group = DOCUMENTATION_GROUP + from ['groovydoc', 'guide'] +} +*/ + +def assembleTask = project.tasks.findByName("assemble") +if(assembleTask == null) { + tasks.register('assemble', Zip) { + + from groovydoc + from guide + + archiveBaseName = "${project.name}-${project.version}" + destinationDirectory = new File(project.buildDir, 'distributions') + } +} \ No newline at end of file diff --git a/gradle/grails-plugin-config.gradle b/gradle/grails-plugin-config.gradle new file mode 100644 index 00000000..2efa468a --- /dev/null +++ b/gradle/grails-plugin-config.gradle @@ -0,0 +1,9 @@ +group = 'org.grails.plugins' + +tasks.named('bootJar').configure { + enabled = false // Grails plugins shouldn't produce a boot jar +} +tasks.named('jar').configure { + enabled = true + archiveClassifier = '' // Skip the '-plain' suffix on the jar file name +} diff --git a/gradle/java-config.gradle b/gradle/java-config.gradle new file mode 100644 index 00000000..f5363192 --- /dev/null +++ b/gradle/java-config.gradle @@ -0,0 +1,5 @@ +java { + sourceCompatibility = JavaVersion.VERSION_11 + withSourcesJar() + withJavadocJar() +} \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..ee781d20 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,46 @@ +[versions] +gpars = '1.2.1' +grails = '6.1.0' +grails-gradle-plugin = '6.1.0' +grails-views = '3.1.0' +groovy = '3.0.19' +groovy-doc = '1.0.1' +gorm = '8.0.2' +jansi = '2.4.1' +javaparser = '3.25.6' +javax-annotation = '1.3.2' +jline2 = '2.14.6' +nexus-publish-gradle-plugin = '1.3.0' +picocli = '4.7.5' +rxjava = '1.3.8' +rxjava2 = '2.2.21' +slf4j = '1.7.36' +spock = '2.1-groovy-3.0' +spring = '5.3.30' + +[libraries] +gpars = { module = 'org.codehaus.gpars:gpars', version.ref = 'gpars' } +gorm = { module = 'org.grails:grails-datastore-gorm', version.ref = 'gorm' } +gorm-test = { module = 'org.grails:grails-datastore-gorm-test', version.ref = 'gorm' } +groovy = { module = 'org.codehaus.groovy:groovy', version.ref = 'groovy' } +#groovy-ant = { module = 'org.codehaus.groovy:groovy-ant', version.ref = 'groovy' } +#groovy-cli-picocli = { module = 'org.codehaus.groovy:groovy-cli-picocli', version.ref = 'groovy' } +jansi = { module = 'org.fusesource.jansi:jansi', version.ref = 'jansi' } +javaparser-core = { module = 'com.github.javaparser:javaparser-core', version.ref = 'javaparser' } +javax-annotation-api = { module = 'javax.annotation:javax.annotation-api', version.ref = 'javax-annotation' } +jline2 = { module = 'jline:jline', version.ref = 'jline2' } +picocli = { module = 'info.picocli:picocli', version.ref = 'picocli' } +rxjava = { module = 'io.reactivex:rxjava', version.ref = 'rxjava' } +rxjava2 = { module = 'io.reactivex.rxjava2:rxjava', version.ref = 'rxjava2' } +slf4j-api = { module = 'org.slf4j:slf4j-api', version.ref = 'slf4j' } +spock-core = { module = 'org.spockframework:spock-core', version.ref = 'spock' } +spring-aop = { module = 'org.springframework:spring-aop', version.ref = 'spring' } +spring-context = { module = 'org.springframework:spring-context', version.ref = 'spring' } +spring-expression = { module = 'org.springframework:spring-expression', version.ref = 'spring' } +spring-tx = { module = 'org.springframework:spring-tx', version.ref = 'spring' } + +#plugins +grails-gradle-plugin = { module = 'org.grails:grails-gradle-plugin', version.ref = 'grails-gradle-plugin' } +grails-views-gradle-plugin = { module = 'org.grails.plugins:views-gradle', version.ref = 'grails-views' } +nexus-publish-gradle-plugin = { module = 'io.github.gradle-nexus:publish-plugin', version.ref = 'nexus-publish-gradle-plugin' } +groovydoc-gradle-plugin = { module = 'io.github.groovylang.groovydoc:groovydoc-gradle-plugin', version.ref = 'groovy-doc' } diff --git a/gradle/publishing.gradle b/gradle/publishing.gradle new file mode 100644 index 00000000..76962ef2 --- /dev/null +++ b/gradle/publishing.gradle @@ -0,0 +1,94 @@ +ext['signing.keyId'] = project.findProperty("signing.keyId") ?: System.getenv('SIGNING_KEY') +ext['signing.secretKeyRingFile'] = project.findProperty("signing.secretKeyRingFile") ?: "${System.properties['user.home']}${File.separator}.gnupg${File.separator}secring.gpg" +ext['signing.password'] = project.findProperty("signing.password") ?: System.getenv('SIGNING_PASSPHRASE') + +def isExample = project.projectDir.parentFile.name == 'examples' +def isGrailsPlugin = project.group == 'org.grails.plugins' +def isCoreModule = project.name.endsWith('-core') + +def pomInfo = { + delegate.name project.title + delegate.description project.projectDesc + delegate.url projectUrl + + delegate.licenses { + delegate.license { + delegate.name 'The Apache Software License, Version 2.0' + delegate.url 'http://www.apache.org/licenses/LICENSE-2.0.txt' + delegate.distribution 'repo' + } + } + + delegate.scm { + delegate.url "scm:git@github.com:${githubSlug}.git" + delegate.connection "scm:git@github.com:${githubSlug}.git" + delegate.developerConnection "scm:git@github.com:${githubSlug}.git" + } + + if (developers) { + delegate.developers { + for (dev in developers.split(',')) { + delegate.developer { + delegate.id dev.toLowerCase().replace(' ', '') + delegate.name dev.strip() + } + } + } + } +} + +if (!isExample) { // don't publish examples + + publishing { + + if (isSnapshot) { + repositories { + maven { + credentials { + username = System.getenv('ARTIFACTORY_USERNAME') ?: project.findProperty('artifactoryPublishUsername') ?: '' + password = System.getenv('ARTIFACTORY_PASSWORD') ?: project.findProperty('artifactoryPublishPassword') ?: '' + } + url = isGrailsPlugin ? + uri('https://repo.grails.org/grails/plugins3-snapshots-local') : + uri('https://repo.grails.org/grails/libs-snapshots-local') + + } + } + } + + publications { + + maven(MavenPublication) { + + if (isGrailsPlugin) artifactId = project.name - 'grails-plugin-' + if (isCoreModule) artifactId = project.name - '-core' + + from components.java + + versionMapping { + usage('java-api') { fromResolutionOf('runtimeClasspath') } + usage('java-runtime') { fromResolutionResult() } + } + + pom.withXml { + def xml = asNode() + xml.children().last() + pomInfo + // dependency management shouldn't be included + def n = xml.get('dependencyManagement') + if (n) xml.remove(n) + } + } + } + } + + afterEvaluate { + signing { + required { isReleaseVersion } + sign publishing.publications.maven + } + } + + tasks.withType(Sign).configureEach { + onlyIf { isReleaseVersion } + } +} \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 29953ea1..7f93135c 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e0b3fb8d..878fe049 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index cccdd3d5..1aa94a42 100755 --- a/gradlew +++ b/gradlew @@ -1,78 +1,127 @@ -#!/usr/bin/env sh +#!/bin/sh + +# +# Copyright © 2015-2021 the original 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. +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -81,92 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=$((i+1)) + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" fi +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index e95643d6..6689b85b 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,4 +1,20 @@ -@if "%DEBUG%" == "" @echo off +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -9,19 +25,23 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -35,7 +55,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -45,38 +65,26 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/grails-async/README.md b/grails-async-core/README.md similarity index 100% rename from grails-async/README.md rename to grails-async-core/README.md diff --git a/grails-async-core/build.gradle b/grails-async-core/build.gradle new file mode 100644 index 00000000..2f2bc18c --- /dev/null +++ b/grails-async-core/build.gradle @@ -0,0 +1,26 @@ +plugins { + + id 'groovy' + id 'java-library' + + id 'maven-publish' + id 'signing' + +} + +group = 'org.grails' + +dependencies { + + implementation libs.groovy + + implementation libs.javax.annotation.api + implementation libs.slf4j.api + + testImplementation libs.spock.core + +} + +apply from: file("$rootProject.projectDir/gradle/java-config.gradle") +apply from: file("$rootProject.projectDir/gradle/publishing.gradle") + diff --git a/grails-async/src/main/groovy/grails/async/DelegateAsync.groovy b/grails-async-core/src/main/groovy/grails/async/DelegateAsync.groovy similarity index 100% rename from grails-async/src/main/groovy/grails/async/DelegateAsync.groovy rename to grails-async-core/src/main/groovy/grails/async/DelegateAsync.groovy diff --git a/grails-async/src/main/groovy/grails/async/Promise.groovy b/grails-async-core/src/main/groovy/grails/async/Promise.groovy similarity index 100% rename from grails-async/src/main/groovy/grails/async/Promise.groovy rename to grails-async-core/src/main/groovy/grails/async/Promise.groovy diff --git a/grails-async/src/main/groovy/grails/async/PromiseFactory.groovy b/grails-async-core/src/main/groovy/grails/async/PromiseFactory.groovy similarity index 100% rename from grails-async/src/main/groovy/grails/async/PromiseFactory.groovy rename to grails-async-core/src/main/groovy/grails/async/PromiseFactory.groovy diff --git a/grails-async/src/main/groovy/grails/async/PromiseList.groovy b/grails-async-core/src/main/groovy/grails/async/PromiseList.groovy similarity index 100% rename from grails-async/src/main/groovy/grails/async/PromiseList.groovy rename to grails-async-core/src/main/groovy/grails/async/PromiseList.groovy diff --git a/grails-async/src/main/groovy/grails/async/PromiseMap.groovy b/grails-async-core/src/main/groovy/grails/async/PromiseMap.groovy similarity index 100% rename from grails-async/src/main/groovy/grails/async/PromiseMap.groovy rename to grails-async-core/src/main/groovy/grails/async/PromiseMap.groovy diff --git a/grails-async/src/main/groovy/grails/async/Promises.groovy b/grails-async-core/src/main/groovy/grails/async/Promises.groovy similarity index 100% rename from grails-async/src/main/groovy/grails/async/Promises.groovy rename to grails-async-core/src/main/groovy/grails/async/Promises.groovy diff --git a/grails-async/src/main/groovy/grails/async/decorator/PromiseDecorator.groovy b/grails-async-core/src/main/groovy/grails/async/decorator/PromiseDecorator.groovy similarity index 100% rename from grails-async/src/main/groovy/grails/async/decorator/PromiseDecorator.groovy rename to grails-async-core/src/main/groovy/grails/async/decorator/PromiseDecorator.groovy diff --git a/grails-async/src/main/groovy/grails/async/decorator/PromiseDecoratorLookupStrategy.groovy b/grails-async-core/src/main/groovy/grails/async/decorator/PromiseDecoratorLookupStrategy.groovy similarity index 100% rename from grails-async/src/main/groovy/grails/async/decorator/PromiseDecoratorLookupStrategy.groovy rename to grails-async-core/src/main/groovy/grails/async/decorator/PromiseDecoratorLookupStrategy.groovy diff --git a/grails-async/src/main/groovy/grails/async/decorator/PromiseDecoratorProvider.groovy b/grails-async-core/src/main/groovy/grails/async/decorator/PromiseDecoratorProvider.groovy similarity index 100% rename from grails-async/src/main/groovy/grails/async/decorator/PromiseDecoratorProvider.groovy rename to grails-async-core/src/main/groovy/grails/async/decorator/PromiseDecoratorProvider.groovy diff --git a/grails-async/src/main/groovy/grails/async/factory/AbstractPromiseFactory.groovy b/grails-async-core/src/main/groovy/grails/async/factory/AbstractPromiseFactory.groovy similarity index 100% rename from grails-async/src/main/groovy/grails/async/factory/AbstractPromiseFactory.groovy rename to grails-async-core/src/main/groovy/grails/async/factory/AbstractPromiseFactory.groovy diff --git a/grails-async/src/main/groovy/org/grails/async/factory/BoundPromise.groovy b/grails-async-core/src/main/groovy/org/grails/async/factory/BoundPromise.groovy similarity index 100% rename from grails-async/src/main/groovy/org/grails/async/factory/BoundPromise.groovy rename to grails-async-core/src/main/groovy/org/grails/async/factory/BoundPromise.groovy diff --git a/grails-async/src/main/groovy/org/grails/async/factory/PromiseFactoryBuilder.groovy b/grails-async-core/src/main/groovy/org/grails/async/factory/PromiseFactoryBuilder.groovy similarity index 100% rename from grails-async/src/main/groovy/org/grails/async/factory/PromiseFactoryBuilder.groovy rename to grails-async-core/src/main/groovy/org/grails/async/factory/PromiseFactoryBuilder.groovy diff --git a/grails-async/src/main/groovy/org/grails/async/factory/SynchronousPromise.groovy b/grails-async-core/src/main/groovy/org/grails/async/factory/SynchronousPromise.groovy similarity index 100% rename from grails-async/src/main/groovy/org/grails/async/factory/SynchronousPromise.groovy rename to grails-async-core/src/main/groovy/org/grails/async/factory/SynchronousPromise.groovy diff --git a/grails-async/src/main/groovy/org/grails/async/factory/SynchronousPromiseFactory.groovy b/grails-async-core/src/main/groovy/org/grails/async/factory/SynchronousPromiseFactory.groovy similarity index 100% rename from grails-async/src/main/groovy/org/grails/async/factory/SynchronousPromiseFactory.groovy rename to grails-async-core/src/main/groovy/org/grails/async/factory/SynchronousPromiseFactory.groovy diff --git a/grails-async/src/main/groovy/org/grails/async/factory/future/CachedThreadPoolPromiseFactory.groovy b/grails-async-core/src/main/groovy/org/grails/async/factory/future/CachedThreadPoolPromiseFactory.groovy similarity index 67% rename from grails-async/src/main/groovy/org/grails/async/factory/future/CachedThreadPoolPromiseFactory.groovy rename to grails-async-core/src/main/groovy/org/grails/async/factory/future/CachedThreadPoolPromiseFactory.groovy index c8ad4dea..d9bffe76 100644 --- a/grails-async/src/main/groovy/org/grails/async/factory/future/CachedThreadPoolPromiseFactory.groovy +++ b/grails-async-core/src/main/groovy/org/grails/async/factory/future/CachedThreadPoolPromiseFactory.groovy @@ -7,13 +7,7 @@ import groovy.transform.CompileStatic import org.grails.async.factory.BoundPromise import javax.annotation.PreDestroy -import java.util.concurrent.Callable -import java.util.concurrent.Executor -import java.util.concurrent.ExecutorService -import java.util.concurrent.RunnableFuture -import java.util.concurrent.SynchronousQueue -import java.util.concurrent.ThreadPoolExecutor -import java.util.concurrent.TimeUnit +import java.util.concurrent.* /** * A promise factory that uses an ExecutorService by default @@ -31,18 +25,18 @@ class CachedThreadPoolPromiseFactory extends AbstractPromiseFactory implements C this.executorService = new ThreadPoolExecutor(0, maxPoolSize, timeout, unit, new SynchronousQueue()) { @Override protected RunnableFuture newTaskFor(Callable callable) { - return new FutureTaskPromise(pf,callable) + new FutureTaskPromise(pf,callable) } @Override protected RunnableFuture newTaskFor(Runnable runnable, T value) { - return new FutureTaskPromise(pf,runnable, value) + new FutureTaskPromise(pf,runnable, value) } } } @Override - def Promise createPromise(Class returnType) { + Promise createPromise(Class returnType) { return new BoundPromise(null) } @@ -52,45 +46,45 @@ class CachedThreadPoolPromiseFactory extends AbstractPromiseFactory implements C } @Override - def Promise createPromise(Closure... closures) { + Promise createPromise(Closure... closures) { if(closures.length == 1) { def callable = closures[0] applyDecorators(callable, null) (Promise)executorService.submit((Callable)callable) } else { - def list = new PromiseList<>() + PromiseList list = new PromiseList<>() for(c in closures) { list.add(c) } - return list + return list as Promise } } @Override - def List waitAll(List> promises) { + List waitAll(List> promises) { return promises.collect() { Promise p -> p.get() } } @Override - def List waitAll(List> promises, long timeout, TimeUnit units) { + List waitAll(List> promises, long timeout, TimeUnit units) { return promises.collect() { Promise p -> p.get(timeout, units) } } @Override - def Promise> onComplete(List> promises, Closure callable) { - return (Promise>)executorService.submit( (Callable) { + Promise> onComplete(List> promises, Closure callable) { + executorService.submit((Callable) { while(promises.every() { Promise p -> !p.isDone() }) { // wait } - def values = promises.collect() { Promise p -> p.get() } + List values = promises.collect { Promise p -> p.get() } callable.call(values) - }) + }) as Promise> } @Override - def Promise> onError(List> promises, Closure callable) { - return (Promise>)executorService.submit((Callable) { + Promise> onError(List> promises, Closure callable) { + executorService.submit((Callable) { while(promises.every() { Promise p -> !p.isDone() }) { // wait } @@ -100,7 +94,7 @@ class CachedThreadPoolPromiseFactory extends AbstractPromiseFactory implements C callable.call(e) return e } - }) + }) as Promise> } @Override @@ -110,5 +104,4 @@ class CachedThreadPoolPromiseFactory extends AbstractPromiseFactory implements C executorService.shutdown() } } - } diff --git a/grails-async/src/main/groovy/org/grails/async/factory/future/ExecutorPromiseFactory.groovy b/grails-async-core/src/main/groovy/org/grails/async/factory/future/ExecutorPromiseFactory.groovy similarity index 100% rename from grails-async/src/main/groovy/org/grails/async/factory/future/ExecutorPromiseFactory.groovy rename to grails-async-core/src/main/groovy/org/grails/async/factory/future/ExecutorPromiseFactory.groovy diff --git a/grails-async/src/main/groovy/org/grails/async/factory/future/FutureTaskChildPromise.groovy b/grails-async-core/src/main/groovy/org/grails/async/factory/future/FutureTaskChildPromise.groovy similarity index 100% rename from grails-async/src/main/groovy/org/grails/async/factory/future/FutureTaskChildPromise.groovy rename to grails-async-core/src/main/groovy/org/grails/async/factory/future/FutureTaskChildPromise.groovy diff --git a/grails-async/src/main/groovy/org/grails/async/factory/future/FutureTaskPromise.groovy b/grails-async-core/src/main/groovy/org/grails/async/factory/future/FutureTaskPromise.groovy similarity index 100% rename from grails-async/src/main/groovy/org/grails/async/factory/future/FutureTaskPromise.groovy rename to grails-async-core/src/main/groovy/org/grails/async/factory/future/FutureTaskPromise.groovy diff --git a/grails-async/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncTransactionalMethodTransformer.java b/grails-async-core/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncTransactionalMethodTransformer.java similarity index 100% rename from grails-async/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncTransactionalMethodTransformer.java rename to grails-async-core/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncTransactionalMethodTransformer.java diff --git a/grails-async/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncTransformation.java b/grails-async-core/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncTransformation.java similarity index 93% rename from grails-async/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncTransformation.java rename to grails-async-core/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncTransformation.java index 773e97b8..c3d3fcb5 100644 --- a/grails-async/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncTransformation.java +++ b/grails-async-core/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncTransformation.java @@ -49,7 +49,6 @@ import org.codehaus.groovy.ast.stmt.BlockStatement; import org.codehaus.groovy.ast.stmt.ExpressionStatement; import org.codehaus.groovy.ast.tools.GenericsUtils; -import org.codehaus.groovy.control.CompilePhase; import org.codehaus.groovy.control.SourceUnit; import org.codehaus.groovy.transform.ASTTransformation; import org.codehaus.groovy.transform.GroovyASTTransformation; @@ -61,7 +60,7 @@ * @author Graeme Rocher * @since 2.3 */ -@GroovyASTTransformation(phase = CompilePhase.CANONICALIZATION) +@GroovyASTTransformation public class DelegateAsyncTransformation implements ASTTransformation { private static final ArgumentListExpression NO_ARGS = new ArgumentListExpression(); private static final String VOID = "void"; @@ -171,15 +170,14 @@ private void applyDelegateAsyncTransform(ClassNode classNode, ClassNode targetAp private static ClassNode alignReturnType(final ClassNode receiver, final ClassNode originalReturnType) { ClassNode copiedReturnType = originalReturnType.getPlainNodeReference(); - ClassNode actualReceiver = receiver; - List redirectTypes = new ArrayList(); - if (actualReceiver.redirect().getGenericsTypes()!=null) { - Collections.addAll(redirectTypes,actualReceiver.redirect().getGenericsTypes()); + List redirectTypes = new ArrayList<>(); + if (receiver.redirect().getGenericsTypes() != null) { + Collections.addAll(redirectTypes, receiver.redirect().getGenericsTypes()); } if (!redirectTypes.isEmpty()) { - GenericsType[] redirectReceiverTypes = redirectTypes.toArray(new GenericsType[redirectTypes.size()]); + GenericsType[] redirectReceiverTypes = redirectTypes.toArray(new GenericsType[0]); - GenericsType[] receiverParameterizedTypes = actualReceiver.getGenericsTypes(); + GenericsType[] receiverParameterizedTypes = receiver.getGenericsTypes(); if (receiverParameterizedTypes==null) { receiverParameterizedTypes = redirectReceiverTypes; } @@ -197,7 +195,7 @@ private static ClassNode alignReturnType(final ClassNode receiver, final ClassNo protected DelegateAsyncTransactionalMethodTransformer lookupAsyncTransactionalMethodTransformer() { try { Class transformerClass = getClass().getClassLoader().loadClass("org.grails.async.transform.internal.DefaultDelegateAsyncTransactionalMethodTransformer"); - return (DelegateAsyncTransactionalMethodTransformer) transformerClass.newInstance(); + return (DelegateAsyncTransactionalMethodTransformer) transformerClass.getDeclaredConstructor().newInstance(); } catch (Throwable e) { // ignore } @@ -205,12 +203,11 @@ protected DelegateAsyncTransactionalMethodTransformer lookupAsyncTransactionalMe } private static boolean isCandidateMethod(MethodNode declaredMethod) { - ClassNode groovyMethods = GROOVY_OBJECT_CLASS_NODE; String methodName = declaredMethod.getName(); return !declaredMethod.isSynthetic() && !methodName.contains("$") && Modifier.isPublic(declaredMethod.getModifiers()) && - !groovyMethods.hasMethod(declaredMethod.getName(), declaredMethod.getParameters()); + !GROOVY_OBJECT_CLASS_NODE.hasMethod(declaredMethod.getName(), declaredMethod.getParameters()); } private static Parameter[] copyParameters(Parameter[] parameterTypes) { @@ -229,7 +226,7 @@ private static Parameter[] copyParameters(Parameter[] parameterTypes) { return newParameterTypes; } - private class NoopDelegateAsyncTransactionalMethodTransformer implements DelegateAsyncTransactionalMethodTransformer { + private static class NoopDelegateAsyncTransactionalMethodTransformer implements DelegateAsyncTransactionalMethodTransformer { public void transformTransactionalMethod(ClassNode classNode,ClassNode delegateClassNode, MethodNode methodNode, ListExpression promiseDecoratorLookupArguments) { // noop } diff --git a/grails-async/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncUtils.groovy b/grails-async-core/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncUtils.groovy similarity index 100% rename from grails-async/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncUtils.groovy rename to grails-async-core/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncUtils.groovy diff --git a/grails-async/src/test/groovy/grails/async/DelegateAsyncSpec.groovy b/grails-async-core/src/test/groovy/grails/async/DelegateAsyncSpec.groovy similarity index 100% rename from grails-async/src/test/groovy/grails/async/DelegateAsyncSpec.groovy rename to grails-async-core/src/test/groovy/grails/async/DelegateAsyncSpec.groovy diff --git a/grails-async/src/test/groovy/grails/async/FutureTaskPromiseFactorySpec.groovy b/grails-async-core/src/test/groovy/grails/async/FutureTaskPromiseFactorySpec.groovy similarity index 100% rename from grails-async/src/test/groovy/grails/async/FutureTaskPromiseFactorySpec.groovy rename to grails-async-core/src/test/groovy/grails/async/FutureTaskPromiseFactorySpec.groovy diff --git a/grails-async/src/test/groovy/grails/async/PromiseListSpec.groovy b/grails-async-core/src/test/groovy/grails/async/PromiseListSpec.groovy similarity index 100% rename from grails-async/src/test/groovy/grails/async/PromiseListSpec.groovy rename to grails-async-core/src/test/groovy/grails/async/PromiseListSpec.groovy diff --git a/grails-async/src/test/groovy/grails/async/PromiseMapSpec.groovy b/grails-async-core/src/test/groovy/grails/async/PromiseMapSpec.groovy similarity index 100% rename from grails-async/src/test/groovy/grails/async/PromiseMapSpec.groovy rename to grails-async-core/src/test/groovy/grails/async/PromiseMapSpec.groovy diff --git a/grails-async/src/test/groovy/grails/async/PromiseSpec.groovy b/grails-async-core/src/test/groovy/grails/async/PromiseSpec.groovy similarity index 100% rename from grails-async/src/test/groovy/grails/async/PromiseSpec.groovy rename to grails-async-core/src/test/groovy/grails/async/PromiseSpec.groovy diff --git a/grails-async/src/test/groovy/grails/async/SynchronousPromiseFactorySpec.groovy b/grails-async-core/src/test/groovy/grails/async/SynchronousPromiseFactorySpec.groovy similarity index 100% rename from grails-async/src/test/groovy/grails/async/SynchronousPromiseFactorySpec.groovy rename to grails-async-core/src/test/groovy/grails/async/SynchronousPromiseFactorySpec.groovy diff --git a/grails-async-gpars/build.gradle b/grails-async-gpars/build.gradle index 0c73ce24..bebe29fc 100644 --- a/grails-async-gpars/build.gradle +++ b/grails-async-gpars/build.gradle @@ -1,10 +1,34 @@ +plugins { + + id 'groovy' + id 'java-library' + + id 'maven-publish' + id 'signing' + +} + +group = 'org.grails' + dependencies { - compile project(":grails-async") - compile 'org.codehaus.gpars:gpars:1.2.1', { - exclude group:'org.multiverse', module:'multiverse-core' - exclude group:'org.codehaus.groovy', module: 'groovy-all' + + implementation project(':grails-async-core') + + implementation libs.groovy + + implementation libs.gpars, { + exclude group: 'org.multiverse', module: 'multiverse-core' + exclude group: 'org.codehaus.groovy', module: 'groovy-all' } + implementation libs.slf4j.api + + testImplementation libs.spock.core + } +apply from: file("$rootProject.projectDir/gradle/java-config.gradle") +apply from: file("$rootProject.projectDir/gradle/publishing.gradle") + + diff --git a/grails-async-rxjava/build.gradle b/grails-async-rxjava/build.gradle index a3d5094a..ff54da1f 100644 --- a/grails-async-rxjava/build.gradle +++ b/grails-async-rxjava/build.gradle @@ -1,7 +1,29 @@ +plugins { + + id 'groovy' + id 'java-library' + + id 'maven-publish' + id 'signing' + +} + +group = 'org.grails' + dependencies { - compile project(":grails-async") - compile "io.reactivex:rxjava:$rxJavaVersion" + + implementation project(':grails-async-core') + + implementation libs.groovy + + implementation libs.rxjava + implementation libs.slf4j.api + + testImplementation libs.spock.core + } +apply from: file("$rootProject.projectDir/gradle/java-config.gradle") +apply from: file("$rootProject.projectDir/gradle/publishing.gradle") diff --git a/grails-async-rxjava/src/main/groovy/org/grails/async/factory/rxjava/RxPromiseFactory.groovy b/grails-async-rxjava/src/main/groovy/org/grails/async/factory/rxjava/RxPromiseFactory.groovy index 0cea266c..82d08401 100644 --- a/grails-async-rxjava/src/main/groovy/org/grails/async/factory/rxjava/RxPromiseFactory.groovy +++ b/grails-async-rxjava/src/main/groovy/org/grails/async/factory/rxjava/RxPromiseFactory.groovy @@ -20,17 +20,17 @@ import java.util.concurrent.TimeUnit @CompileStatic class RxPromiseFactory extends AbstractPromiseFactory { @Override - def Promise createPromise(Class returnType) { - return new RxPromise(this, Single.just(null)) + Promise createPromise(Class returnType) { + new RxPromise(this, Single.just(null)) } @Override Promise createPromise() { - return new RxPromise(this, Single.just(null)) + new RxPromise(this, Single.just(null)) } @Override - def Promise createPromise(Closure[] closures) { + Promise createPromise(Closure[] closures) { if(closures.length == 1) { return new RxPromise(this,closures[0], Schedulers.io()) } @@ -44,35 +44,35 @@ class RxPromiseFactory extends AbstractPromiseFactory { } @Override - def List waitAll(List> promises) { - return promises.collect() { Promise p -> p.get( )} + List waitAll(List> promises) { + promises.collect() { Promise p -> p.get() } } @Override - def List waitAll(List> promises, long timeout, TimeUnit units) { - return promises.collect() { Promise p -> p.get( timeout, units ) } + List waitAll(List> promises, long timeout, TimeUnit units) { + promises.collect() { Promise p -> p.get(timeout, units) } } @Override - def Promise> onComplete(List> promises, Closure callable) { + Promise> onComplete(List> promises, Closure callable) { new RxPromise<>(this, Observable.concat( promises.collect() { Promise p -> if(p instanceof BoundPromise) { return Observable.just(((BoundPromise)p).value) } else { - return ((RxPromise)p).subject + return ((RxPromise)p).subject as Observable } } ).toList()) - .onComplete(callable) + .onComplete(callable) as Promise> } @Override - def Promise> onError(List> promises, Closure callable) { + Promise> onError(List> promises, Closure callable) { new RxPromise<>(this, Observable.concat( - promises.collect() { Promise p-> ((RxPromise)p).subject } + promises.collect() { Promise p -> ((RxPromise)p).subject as Observable } ).toList()) - .onError(callable) + .onError(callable) as Promise> } } diff --git a/grails-async-rxjava2/build.gradle b/grails-async-rxjava2/build.gradle index 64922fe5..8ebc4538 100644 --- a/grails-async-rxjava2/build.gradle +++ b/grails-async-rxjava2/build.gradle @@ -1,4 +1,26 @@ +plugins { + + id 'groovy' + id 'java-library' + id 'maven-publish' + id 'signing' + +} + +group = 'org.grails' + dependencies { - compile project(":grails-async") - compile "io.reactivex.rxjava2:rxjava:$rxJava2Version" -} \ No newline at end of file + + implementation project(':grails-async-core') + + implementation libs.groovy + + implementation libs.rxjava2 + implementation libs.slf4j.api + + testImplementation libs.spock.core + +} + +apply from: file("$rootProject.projectDir/gradle/java-config.gradle") +apply from: file("$rootProject.projectDir/gradle/publishing.gradle") diff --git a/grails-async-rxjava2/src/main/groovy/org/grails/async/factory/rxjava2/RxPromiseFactory.groovy b/grails-async-rxjava2/src/main/groovy/org/grails/async/factory/rxjava2/RxPromiseFactory.groovy index 99598f8c..09443917 100644 --- a/grails-async-rxjava2/src/main/groovy/org/grails/async/factory/rxjava2/RxPromiseFactory.groovy +++ b/grails-async-rxjava2/src/main/groovy/org/grails/async/factory/rxjava2/RxPromiseFactory.groovy @@ -20,17 +20,17 @@ import java.util.concurrent.TimeUnit @CompileStatic class RxPromiseFactory extends AbstractPromiseFactory { @Override - def Promise createPromise(Class returnType) { - return new RxPromise(this, Single.just(null)) + Promise createPromise(Class returnType) { + new RxPromise(this, Single.just(null)) } @Override Promise createPromise() { - return new RxPromise(this, Single.just(null)) + new RxPromise(this, Single.just(null)) } @Override - def Promise createPromise(Closure[] closures) { + Promise createPromise(Closure[] closures) { if(closures.length == 1) { return new RxPromise(this, closures[0], Schedulers.io()) } @@ -44,35 +44,35 @@ class RxPromiseFactory extends AbstractPromiseFactory { } @Override - def List waitAll(List> promises) { - return promises.collect() { Promise p -> p.get( )} + List waitAll(List> promises) { + return promises.collect() { Promise p -> p.get() } } @Override - def List waitAll(List> promises, long timeout, TimeUnit units) { - return promises.collect() { Promise p -> p.get( timeout, units ) } + List waitAll(List> promises, long timeout, TimeUnit units) { + promises.collect() { Promise p -> p.get(timeout, units) } } @Override - def Promise> onComplete(List> promises, Closure callable) { + Promise> onComplete(List> promises, Closure callable) { new RxPromise<>(this, Observable.concat( promises.collect() { Promise p -> if(p instanceof BoundPromise) { - return Observable.just(((BoundPromise)p).value) + return Observable.just(((BoundPromise)p).value) as Observable } else { - return ((RxPromise)p).toObservable() + return ((RxPromise)p).toObservable() as Observable } } ).toList()) - .onComplete(callable) + .onComplete(callable) as Promise> } @Override - def Promise> onError(List> promises, Closure callable) { + Promise> onError(List> promises, Closure callable) { new RxPromise<>(this, Observable.concat( - promises.collect() { Promise p-> ((RxPromise)p).toObservable() } + promises.collect() { Promise p -> ((RxPromise)p).toObservable() as Observable } ).toList()) - .onError(callable) + .onError(callable) as Promise> } } diff --git a/grails-events-compat/build.gradle b/grails-events-compat/build.gradle index 9cdd4caa..e1f74c07 100644 --- a/grails-events-compat/build.gradle +++ b/grails-events-compat/build.gradle @@ -1,3 +1,26 @@ +plugins { + + id 'groovy' + id 'java-library' + + id 'maven-publish' + id 'signing' + +} + +group = 'org.grails' + dependencies { - compile project(":grails-events"), project(":grails-events-transform") -} \ No newline at end of file + + implementation project(':grails-events-core') + implementation project(':grails-events-transform') + + implementation libs.groovy + + implementation libs.slf4j.api + implementation libs.spring.tx + +} + +apply from: file("$rootProject.projectDir/gradle/java-config.gradle") +apply from: file("$rootProject.projectDir/gradle/publishing.gradle") diff --git a/grails-events-compat/src/main/groovy/grails/events/Events.groovy b/grails-events-compat/src/main/groovy/grails/events/Events.groovy index 46479fa0..b519b875 100644 --- a/grails-events-compat/src/main/groovy/grails/events/Events.groovy +++ b/grails-events-compat/src/main/groovy/grails/events/Events.groovy @@ -54,7 +54,7 @@ trait Events { key = key.toString() } on(key) { - consumer.accept(it) + consumer.accept(it as E) } } diff --git a/grails-events/README.md b/grails-events-core/README.md similarity index 100% rename from grails-events/README.md rename to grails-events-core/README.md diff --git a/grails-events-core/build.gradle b/grails-events-core/build.gradle new file mode 100644 index 00000000..c984eac5 --- /dev/null +++ b/grails-events-core/build.gradle @@ -0,0 +1,26 @@ +plugins { + + id 'groovy' + id 'java-library' + + id 'maven-publish' + id 'signing' + +} + +group = 'org.grails' + +dependencies { + + implementation libs.groovy + + implementation libs.slf4j.api + implementation libs.spring.context + implementation libs.spring.tx + + testImplementation libs.spock.core + +} + +apply from: file("$rootProject.projectDir/gradle/java-config.gradle") +apply from: file("$rootProject.projectDir/gradle/publishing.gradle") diff --git a/grails-events/src/main/groovy/grails/events/Event.groovy b/grails-events-core/src/main/groovy/grails/events/Event.groovy similarity index 95% rename from grails-events/src/main/groovy/grails/events/Event.groovy rename to grails-events-core/src/main/groovy/grails/events/Event.groovy index f2fb2d97..df23a54c 100644 --- a/grails-events/src/main/groovy/grails/events/Event.groovy +++ b/grails-events-core/src/main/groovy/grails/events/Event.groovy @@ -28,7 +28,7 @@ class Event extends EventObject { final Map parameters Event(String id, T data) { - this(id, Collections.emptyMap(), data) + this(id, Collections.emptyMap() as Map, data) } Event(String id, Map parameters, T data) { diff --git a/grails-events/src/main/groovy/grails/events/EventPublisher.groovy b/grails-events-core/src/main/groovy/grails/events/EventPublisher.groovy similarity index 100% rename from grails-events/src/main/groovy/grails/events/EventPublisher.groovy rename to grails-events-core/src/main/groovy/grails/events/EventPublisher.groovy diff --git a/grails-events/src/main/groovy/grails/events/bus/EventBus.groovy b/grails-events-core/src/main/groovy/grails/events/bus/EventBus.groovy similarity index 100% rename from grails-events/src/main/groovy/grails/events/bus/EventBus.groovy rename to grails-events-core/src/main/groovy/grails/events/bus/EventBus.groovy diff --git a/grails-events/src/main/groovy/grails/events/bus/EventBusAware.groovy b/grails-events-core/src/main/groovy/grails/events/bus/EventBusAware.groovy similarity index 100% rename from grails-events/src/main/groovy/grails/events/bus/EventBusAware.groovy rename to grails-events-core/src/main/groovy/grails/events/bus/EventBusAware.groovy diff --git a/grails-events/src/main/groovy/grails/events/bus/EventBusBuilder.groovy b/grails-events-core/src/main/groovy/grails/events/bus/EventBusBuilder.groovy similarity index 100% rename from grails-events/src/main/groovy/grails/events/bus/EventBusBuilder.groovy rename to grails-events-core/src/main/groovy/grails/events/bus/EventBusBuilder.groovy diff --git a/grails-events/src/main/groovy/grails/events/emitter/EventEmitter.groovy b/grails-events-core/src/main/groovy/grails/events/emitter/EventEmitter.groovy similarity index 100% rename from grails-events/src/main/groovy/grails/events/emitter/EventEmitter.groovy rename to grails-events-core/src/main/groovy/grails/events/emitter/EventEmitter.groovy diff --git a/grails-events/src/main/groovy/grails/events/subscriber/EventSubscriber.groovy b/grails-events-core/src/main/groovy/grails/events/subscriber/EventSubscriber.groovy similarity index 100% rename from grails-events/src/main/groovy/grails/events/subscriber/EventSubscriber.groovy rename to grails-events-core/src/main/groovy/grails/events/subscriber/EventSubscriber.groovy diff --git a/grails-events/src/main/groovy/grails/events/subscriber/MethodEventSubscriber.groovy b/grails-events-core/src/main/groovy/grails/events/subscriber/MethodEventSubscriber.groovy similarity index 100% rename from grails-events/src/main/groovy/grails/events/subscriber/MethodEventSubscriber.groovy rename to grails-events-core/src/main/groovy/grails/events/subscriber/MethodEventSubscriber.groovy diff --git a/grails-events/src/main/groovy/grails/events/subscriber/MethodSubscriber.groovy b/grails-events-core/src/main/groovy/grails/events/subscriber/MethodSubscriber.groovy similarity index 100% rename from grails-events/src/main/groovy/grails/events/subscriber/MethodSubscriber.groovy rename to grails-events-core/src/main/groovy/grails/events/subscriber/MethodSubscriber.groovy diff --git a/grails-events/src/main/groovy/grails/events/subscriber/Subjects.groovy b/grails-events-core/src/main/groovy/grails/events/subscriber/Subjects.groovy similarity index 100% rename from grails-events/src/main/groovy/grails/events/subscriber/Subjects.groovy rename to grails-events-core/src/main/groovy/grails/events/subscriber/Subjects.groovy diff --git a/grails-events/src/main/groovy/grails/events/subscriber/Subscriber.groovy b/grails-events-core/src/main/groovy/grails/events/subscriber/Subscriber.groovy similarity index 100% rename from grails-events/src/main/groovy/grails/events/subscriber/Subscriber.groovy rename to grails-events-core/src/main/groovy/grails/events/subscriber/Subscriber.groovy diff --git a/grails-events/src/main/groovy/grails/events/subscriber/Subscription.groovy b/grails-events-core/src/main/groovy/grails/events/subscriber/Subscription.groovy similarity index 100% rename from grails-events/src/main/groovy/grails/events/subscriber/Subscription.groovy rename to grails-events-core/src/main/groovy/grails/events/subscriber/Subscription.groovy diff --git a/grails-events/src/main/groovy/grails/events/trigger/EventTrigger.groovy b/grails-events-core/src/main/groovy/grails/events/trigger/EventTrigger.groovy similarity index 100% rename from grails-events/src/main/groovy/grails/events/trigger/EventTrigger.groovy rename to grails-events-core/src/main/groovy/grails/events/trigger/EventTrigger.groovy diff --git a/grails-events/src/main/groovy/org/grails/events/ClosureEventTrigger.groovy b/grails-events-core/src/main/groovy/org/grails/events/ClosureEventTrigger.groovy similarity index 100% rename from grails-events/src/main/groovy/org/grails/events/ClosureEventTrigger.groovy rename to grails-events-core/src/main/groovy/org/grails/events/ClosureEventTrigger.groovy diff --git a/grails-events/src/main/groovy/org/grails/events/EventSubscriberTrigger.groovy b/grails-events-core/src/main/groovy/org/grails/events/EventSubscriberTrigger.groovy similarity index 100% rename from grails-events/src/main/groovy/org/grails/events/EventSubscriberTrigger.groovy rename to grails-events-core/src/main/groovy/org/grails/events/EventSubscriberTrigger.groovy diff --git a/grails-events/src/main/groovy/org/grails/events/bus/AbstractEventBus.groovy b/grails-events-core/src/main/groovy/org/grails/events/bus/AbstractEventBus.groovy similarity index 88% rename from grails-events/src/main/groovy/org/grails/events/bus/AbstractEventBus.groovy rename to grails-events-core/src/main/groovy/org/grails/events/bus/AbstractEventBus.groovy index 5a0b78e3..95138f1f 100644 --- a/grails-events/src/main/groovy/org/grails/events/bus/AbstractEventBus.groovy +++ b/grails-events-core/src/main/groovy/org/grails/events/bus/AbstractEventBus.groovy @@ -7,10 +7,10 @@ import grails.events.subscriber.Subjects import grails.events.subscriber.Subscriber import grails.events.subscriber.Subscription import groovy.transform.CompileStatic -import org.grails.events.registry.EventSubscriberSubscription import org.grails.events.registry.ClosureSubscription +import org.grails.events.registry.EventSubscriberSubscription import org.springframework.transaction.event.TransactionPhase -import org.springframework.transaction.support.TransactionSynchronizationAdapter +import org.springframework.transaction.support.TransactionSynchronization import org.springframework.transaction.support.TransactionSynchronizationManager import java.util.concurrent.Callable @@ -25,53 +25,54 @@ import java.util.concurrent.ConcurrentLinkedQueue */ @CompileStatic abstract class AbstractEventBus implements EventBus { + protected final Map> subscriptions = new ConcurrentHashMap>().withDefault { - new ConcurrentLinkedQueue() + new ConcurrentLinkedQueue() as Collection } @Override boolean isActive() { - return true + true } @Override final EventEmitter notify(CharSequence eventId, Object... data) { - return notify(new Event(eventId.toString(), data.length == 1 ? data[0] : data)) + notify(new Event(eventId.toString(), data.length == 1 ? data[0] : data)) } @Override final EventEmitter publish(CharSequence eventId, Object... data) { - return notify(eventId, data) + notify(eventId, data) } @Override final EventEmitter publish(Event event) { - return notify(event) + notify(event) } @Override final EventEmitter sendAndReceive(CharSequence eventId, Object data, Closure reply) { - return sendAndReceive(new Event(eventId.toString(), data), reply) + sendAndReceive(new Event(eventId.toString(), data), reply) } @Override final Subscription subscribe(CharSequence event, Closure subscriber) { - return on(event, subscriber) + on(event, subscriber) } @Override EventEmitter publish(Event event, TransactionPhase transactionPhase) { - return notify(event, transactionPhase) + notify(event, transactionPhase) } @Override Subscription on(CharSequence event, Closure subscriber) { - return buildClosureSubscription(event, subscriber) + buildClosureSubscription(event, subscriber) } @Override Subscription subscribe(CharSequence event, Subscriber subscriber) { - return buildSubscriberSubscription(event, subscriber) + buildSubscriberSubscription(event, subscriber) } @Override @@ -83,7 +84,7 @@ abstract class AbstractEventBus implements EventBus { } } subs.clear() - return this + this } EventEmitter notify(Event event) { @@ -100,7 +101,7 @@ abstract class AbstractEventBus implements EventBus { } } } - return this + this } @Override @@ -115,7 +116,7 @@ abstract class AbstractEventBus implements EventBus { .run() } } - return this + this } @Override @@ -144,8 +145,10 @@ abstract class AbstractEventBus implements EventBus { * @return */ protected final NotificationTrigger buildNotificationTrigger(Event event, Collection eventSubscriptions, Closure reply = null) { + final Callable callable = buildNotificationCallable(event, eventSubscriptions, reply) - return new AbstractEventBus.NotificationTrigger(event, eventSubscriptions, reply) { + + new NotificationTrigger(event, eventSubscriptions, reply) { @Override void run() { callable.call() @@ -164,6 +167,7 @@ abstract class AbstractEventBus implements EventBus { protected abstract Callable buildNotificationCallable(Event event, Collection eventSubscriptions, Closure reply = null) protected static abstract class NotificationTrigger implements Runnable { + final Event event final Collection subscriptions final Closure reply @@ -175,7 +179,7 @@ abstract class AbstractEventBus implements EventBus { } } - protected static class EventTriggerTransactionSynchronization extends TransactionSynchronizationAdapter{ + protected static class EventTriggerTransactionSynchronization implements TransactionSynchronization { final NotificationTrigger notificationTrigger final TransactionPhase transactionPhase @@ -212,10 +216,10 @@ abstract class AbstractEventBus implements EventBus { protected EventSubscriberSubscription buildSubscriberSubscription(CharSequence eventId, Subscriber subscriber) { - return new EventSubscriberSubscription(eventId, subscriptions, subscriber) + new EventSubscriberSubscription(eventId, subscriptions, subscriber) } protected ClosureSubscription buildClosureSubscription(CharSequence eventId, Closure subscriber) { - return new ClosureSubscription(eventId, subscriptions, subscriber) + new ClosureSubscription(eventId, subscriptions, subscriber) } } diff --git a/grails-events/src/main/groovy/org/grails/events/bus/ExecutorEventBus.groovy b/grails-events-core/src/main/groovy/org/grails/events/bus/ExecutorEventBus.groovy similarity index 100% rename from grails-events/src/main/groovy/org/grails/events/bus/ExecutorEventBus.groovy rename to grails-events-core/src/main/groovy/org/grails/events/bus/ExecutorEventBus.groovy diff --git a/grails-events/src/main/groovy/org/grails/events/bus/SynchronousEventBus.groovy b/grails-events-core/src/main/groovy/org/grails/events/bus/SynchronousEventBus.groovy similarity index 100% rename from grails-events/src/main/groovy/org/grails/events/bus/SynchronousEventBus.groovy rename to grails-events-core/src/main/groovy/org/grails/events/bus/SynchronousEventBus.groovy diff --git a/grails-events/src/main/groovy/org/grails/events/bus/spring/EventBusFactoryBean.groovy b/grails-events-core/src/main/groovy/org/grails/events/bus/spring/EventBusFactoryBean.groovy similarity index 100% rename from grails-events/src/main/groovy/org/grails/events/bus/spring/EventBusFactoryBean.groovy rename to grails-events-core/src/main/groovy/org/grails/events/bus/spring/EventBusFactoryBean.groovy diff --git a/grails-events/src/main/groovy/org/grails/events/registry/AbstractSubscription.groovy b/grails-events-core/src/main/groovy/org/grails/events/registry/AbstractSubscription.groovy similarity index 100% rename from grails-events/src/main/groovy/org/grails/events/registry/AbstractSubscription.groovy rename to grails-events-core/src/main/groovy/org/grails/events/registry/AbstractSubscription.groovy diff --git a/grails-events/src/main/groovy/org/grails/events/registry/ClosureSubscription.groovy b/grails-events-core/src/main/groovy/org/grails/events/registry/ClosureSubscription.groovy similarity index 100% rename from grails-events/src/main/groovy/org/grails/events/registry/ClosureSubscription.groovy rename to grails-events-core/src/main/groovy/org/grails/events/registry/ClosureSubscription.groovy diff --git a/grails-events/src/main/groovy/org/grails/events/registry/EventSubscriberSubscription.groovy b/grails-events-core/src/main/groovy/org/grails/events/registry/EventSubscriberSubscription.groovy similarity index 87% rename from grails-events/src/main/groovy/org/grails/events/registry/EventSubscriberSubscription.groovy rename to grails-events-core/src/main/groovy/org/grails/events/registry/EventSubscriberSubscription.groovy index 3128a379..36b14335 100644 --- a/grails-events/src/main/groovy/org/grails/events/registry/EventSubscriberSubscription.groovy +++ b/grails-events-core/src/main/groovy/org/grails/events/registry/EventSubscriberSubscription.groovy @@ -15,6 +15,7 @@ import org.grails.events.EventSubscriberTrigger */ @CompileStatic class EventSubscriberSubscription extends AbstractSubscription { + final Subscriber subscriber EventSubscriberSubscription(CharSequence eventKey, Map> subscriptions, Subscriber subscriber) { @@ -24,11 +25,11 @@ class EventSubscriberSubscription extends AbstractSubscription { @Override EventTrigger buildTrigger(Event event) { - return new EventSubscriberTrigger(event, subscriber) + new EventSubscriberTrigger(event, subscriber) } @Override EventTrigger buildTrigger(Event event, Closure reply) { - return new EventSubscriberTrigger(event, subscriber) + new EventSubscriberTrigger(event, subscriber) } } diff --git a/grails-events/src/test/groovy/org/grails/events/SynchronousEventBusSpec.groovy b/grails-events-core/src/test/groovy/org/grails/events/SynchronousEventBusSpec.groovy similarity index 100% rename from grails-events/src/test/groovy/org/grails/events/SynchronousEventBusSpec.groovy rename to grails-events-core/src/test/groovy/org/grails/events/SynchronousEventBusSpec.groovy diff --git a/grails-events/src/test/groovy/org/grails/events/TaskExecuterEventBusSpec.groovy b/grails-events-core/src/test/groovy/org/grails/events/TaskExecuterEventBusSpec.groovy similarity index 100% rename from grails-events/src/test/groovy/org/grails/events/TaskExecuterEventBusSpec.groovy rename to grails-events-core/src/test/groovy/org/grails/events/TaskExecuterEventBusSpec.groovy diff --git a/grails-events/src/test/groovy/org/grails/events/TransactionAwareEventSpec.groovy b/grails-events-core/src/test/groovy/org/grails/events/TransactionAwareEventSpec.groovy similarity index 100% rename from grails-events/src/test/groovy/org/grails/events/TransactionAwareEventSpec.groovy rename to grails-events-core/src/test/groovy/org/grails/events/TransactionAwareEventSpec.groovy diff --git a/grails-events/src/test/groovy/org/grails/events/subscriber/MethodEventSubscriberSpec.groovy b/grails-events-core/src/test/groovy/org/grails/events/subscriber/MethodEventSubscriberSpec.groovy similarity index 100% rename from grails-events/src/test/groovy/org/grails/events/subscriber/MethodEventSubscriberSpec.groovy rename to grails-events-core/src/test/groovy/org/grails/events/subscriber/MethodEventSubscriberSpec.groovy diff --git a/grails-events-gpars/build.gradle b/grails-events-gpars/build.gradle index 4c323e3f..916c1ebd 100644 --- a/grails-events-gpars/build.gradle +++ b/grails-events-gpars/build.gradle @@ -1,7 +1,31 @@ +plugins { + + id 'groovy' + id 'java-library' + + id 'maven-publish' + id 'signing' + +} + +group = 'org.grails' + dependencies { - compile project(":grails-events") - compile 'org.codehaus.gpars:gpars:1.2.1', { - exclude group:'org.multiverse', module:'multiverse-core' - exclude group:'org.codehaus.groovy', module: 'groovy-all' + + implementation project(':grails-events-core') + + implementation libs.groovy + + implementation libs.gpars, { + exclude group: 'org.multiverse', module: 'multiverse-core' + exclude group: 'org.codehaus.groovy', module: 'groovy-all' } -} \ No newline at end of file + implementation libs.slf4j.api + implementation libs.spring.tx + + testImplementation libs.spock.core + +} + +apply from: file("$rootProject.projectDir/gradle/java-config.gradle") +apply from: file("$rootProject.projectDir/gradle/publishing.gradle") diff --git a/grails-events-rxjava/build.gradle b/grails-events-rxjava/build.gradle index f2c0f096..44d7a35c 100644 --- a/grails-events-rxjava/build.gradle +++ b/grails-events-rxjava/build.gradle @@ -1,9 +1,32 @@ +plugins { + + id 'groovy' + id 'java-library' + + id 'maven-publish' + id 'signing' + +} + +group = 'org.grails' + dependencies { - compile project(":grails-events") - compile "io.reactivex:rxjava:$rxJavaVersion" - testCompile project(":grails-events-transform") - testCompile "org.grails:grails-datastore-gorm-test:$gormVersion", { - exclude group:'org.grails', module:'grails-datastore-gorm-validation' + implementation project(':grails-events-core') + testImplementation project(':grails-events-transform') + + implementation libs.groovy + + implementation libs.rxjava + implementation libs.slf4j.api + implementation libs.spring.tx + + testImplementation libs.gorm.test, { + exclude group:'org.grails', module: 'grails-datastore-gorm-validation' } -} \ No newline at end of file + testImplementation libs.spock.core + +} + +apply from: file("$rootProject.projectDir/gradle/java-config.gradle") +apply from: file("$rootProject.projectDir/gradle/publishing.gradle") diff --git a/grails-events-rxjava/src/main/groovy/org/grails/events/rxjava/RxEventBus.groovy b/grails-events-rxjava/src/main/groovy/org/grails/events/rxjava/RxEventBus.groovy index 8c6d3868..8921ab33 100644 --- a/grails-events-rxjava/src/main/groovy/org/grails/events/rxjava/RxEventBus.groovy +++ b/grails-events-rxjava/src/main/groovy/org/grails/events/rxjava/RxEventBus.groovy @@ -28,6 +28,7 @@ import java.util.concurrent.ConcurrentHashMap @CompileStatic @Slf4j class RxEventBus extends AbstractEventBus { + protected final Map subjects = new ConcurrentHashMap().withDefault { PublishSubject.create() } @@ -40,17 +41,20 @@ class RxEventBus extends AbstractEventBus { @Override protected EventSubscriberSubscription buildSubscriberSubscription(CharSequence eventId, Subscriber subscriber) { + String eventKey = eventId.toString() Subject subject = subjects.get(eventKey) - return new RxEventSubscriberSubscription(eventId, subscriptions, subscriber, subject, scheduler) + new RxEventSubscriberSubscription(eventId, subscriptions, subscriber, subject, scheduler) } @Override protected ClosureSubscription buildClosureSubscription(CharSequence eventId, Closure subscriber) { + String eventKey = eventId.toString() Subject subject = subjects.get(eventKey) - return new RxClosureSubscription(eventId, subscriptions, subscriber, subject, scheduler) + + new RxClosureSubscription(eventId, subscriptions, subscriber, subject, scheduler) } @Override @@ -69,13 +73,12 @@ class RxEventBus extends AbstractEventBus { } private static class RxClosureSubscription extends ClosureSubscription { + final rx.Subscription subscription RxClosureSubscription(CharSequence eventId, Map> subscriptions, Closure subscriber, Subject subject, Scheduler scheduler) { super(eventId, subscriptions, subscriber) - this.subscription = subject.observeOn(scheduler) - .subscribe( { eventObject -> - + this.subscription = subject.observeOn(scheduler).subscribe( { eventObject -> Event event Closure reply = null if(eventObject instanceof EventWithReply) { @@ -84,10 +87,10 @@ class RxEventBus extends AbstractEventBus { reply = eventWithReply.reply } else { - event = (Event)eventObject + event = (Event) eventObject } - EventTrigger trigger = buildTrigger(event, reply) + EventTrigger trigger = buildTrigger(event as Event, reply) trigger.proceed() } as Action1, { Throwable t -> log.error("Error occurred triggering event listener for event [$eventId]: ${t.message}", t) @@ -96,43 +99,43 @@ class RxEventBus extends AbstractEventBus { @Override Subscription cancel() { - if(!subscription.isUnsubscribed()) { + if(!subscription.unsubscribed) { subscription.unsubscribe() } - return super.cancel() + super.cancel() } @Override boolean isCancelled() { - return subscription.isUnsubscribed() + subscription.unsubscribed } } private static class RxEventSubscriberSubscription extends EventSubscriberSubscription { + final rx.Subscription subscription RxEventSubscriberSubscription(CharSequence eventId, Map> subscriptions, Subscriber subscriber, Subject subject, Scheduler scheduler) { super(eventId, subscriptions, subscriber) - this.subscription = subject.observeOn(scheduler) - .subscribe( { Event event -> - EventTrigger trigger = buildTrigger(event) + this.subscription = subject.observeOn(scheduler).subscribe({ event -> + EventTrigger trigger = buildTrigger(event as Event) trigger.proceed() - } as Action1, { Throwable t -> + } as Action1, { Throwable t -> log.error("Error occurred triggering event listener for event [$eventId]: ${t.message}", t) } as Action1) } @Override Subscription cancel() { - if(!subscription.isUnsubscribed()) { + if(!subscription.unsubscribed) { subscription.unsubscribe() } - return super.cancel() + super.cancel() } @Override boolean isCancelled() { - return subscription.isUnsubscribed() + subscription.unsubscribed } } } diff --git a/grails-events-rxjava2/build.gradle b/grails-events-rxjava2/build.gradle index 4db5cb36..dc22daa1 100644 --- a/grails-events-rxjava2/build.gradle +++ b/grails-events-rxjava2/build.gradle @@ -1,4 +1,28 @@ +plugins { + + id 'groovy' + id 'java-library' + + id 'maven-publish' + id 'signing' + +} + +group = 'org.grails' + dependencies { - compile project(":grails-events") - compile "io.reactivex.rxjava2:rxjava:$rxJava2Version" -} \ No newline at end of file + + implementation project(':grails-events-core') + + implementation libs.groovy + + implementation libs.rxjava2 + implementation libs.slf4j.api + implementation libs.spring.tx + + testImplementation libs.spock.core + +} + +apply from: file("$rootProject.projectDir/gradle/java-config.gradle") +apply from: file("$rootProject.projectDir/gradle/publishing.gradle") diff --git a/grails-events-rxjava2/src/main/groovy/org/grails/events/rxjava2/RxEventBus.groovy b/grails-events-rxjava2/src/main/groovy/org/grails/events/rxjava2/RxEventBus.groovy index 7a9f4cc9..dbd40dac 100644 --- a/grails-events-rxjava2/src/main/groovy/org/grails/events/rxjava2/RxEventBus.groovy +++ b/grails-events-rxjava2/src/main/groovy/org/grails/events/rxjava2/RxEventBus.groovy @@ -29,6 +29,7 @@ import java.util.concurrent.ConcurrentHashMap @CompileStatic @Slf4j class RxEventBus extends AbstractEventBus { + protected final Map subjects = new ConcurrentHashMap().withDefault { PublishSubject.create() } @@ -56,27 +57,29 @@ class RxEventBus extends AbstractEventBus { @Override protected EventSubscriberSubscription buildSubscriberSubscription(CharSequence eventId, Subscriber subscriber) { + String eventKey = eventId.toString() Subject subject = subjects.get(eventKey) - return new RxEventSubscriberSubscription(eventId, subscriptions, subscriber, subject, scheduler) + new RxEventSubscriberSubscription(eventId, subscriptions, subscriber, subject, scheduler) } @Override protected ClosureSubscription buildClosureSubscription(CharSequence eventId, Closure subscriber) { + String eventKey = eventId.toString() Subject subject = subjects.get(eventKey) - return new RxClosureSubscription(eventId, subscriptions, subscriber, subject, scheduler) + + new RxClosureSubscription(eventId, subscriptions, subscriber, subject, scheduler) } private static class RxClosureSubscription extends ClosureSubscription { + final Disposable subscription RxClosureSubscription(CharSequence eventId, Map> subscriptions, Closure subscriber, Subject subject, Scheduler scheduler) { super(eventId, subscriptions, subscriber) - this.subscription = subject.observeOn(scheduler) - .subscribe( { eventObject -> - + this.subscription = subject.observeOn(scheduler).subscribe( { eventObject -> Event event Closure reply = null if(eventObject instanceof EventWithReply) { @@ -85,10 +88,10 @@ class RxEventBus extends AbstractEventBus { reply = eventWithReply.reply } else { - event = (Event)eventObject + event = (Event) eventObject } - EventTrigger trigger = buildTrigger(event, reply) + EventTrigger trigger = buildTrigger(event as Event, reply) trigger.proceed() } as Consumer, { Throwable t -> log.error("Error occurred triggering event listener for event [$eventId]: ${t.message}", t) @@ -97,26 +100,26 @@ class RxEventBus extends AbstractEventBus { @Override Subscription cancel() { - if(!subscription.isDisposed()) { + if(!subscription.disposed) { subscription.dispose() } - return super.cancel() + super.cancel() } @Override boolean isCancelled() { - return subscription.isDisposed() + subscription.disposed } } private static class RxEventSubscriberSubscription extends EventSubscriberSubscription { + final Disposable subscription RxEventSubscriberSubscription(CharSequence eventId, Map> subscriptions, Subscriber subscriber, Subject subject, Scheduler scheduler) { super(eventId, subscriptions, subscriber) - this.subscription = subject.observeOn(scheduler) - .subscribe( { Event event -> - EventTrigger trigger = buildTrigger(event) + this.subscription = subject.observeOn(scheduler).subscribe( { event -> + EventTrigger trigger = buildTrigger(event as Event) trigger.proceed() } as Consumer, { Throwable t -> log.error("Error occurred triggering event listener for event [$eventId]: ${t.message}", t) @@ -125,15 +128,15 @@ class RxEventBus extends AbstractEventBus { @Override Subscription cancel() { - if(!subscription.isDisposed()) { + if(!subscription.disposed) { subscription.dispose() } - return super.cancel() + super.cancel() } @Override boolean isCancelled() { - return subscription.isDisposed() + subscription.disposed } } } diff --git a/grails-events-spring/build.gradle b/grails-events-spring/build.gradle index 8a39b969..688f1882 100644 --- a/grails-events-spring/build.gradle +++ b/grails-events-spring/build.gradle @@ -1,4 +1,28 @@ +plugins { + + id 'groovy' + id 'java-library' + + id 'maven-publish' + id 'signing' + +} + +group = 'org.grails' + dependencies { - compile project(":grails-events") - compile "org.springframework:spring-context:$springVersion" -} \ No newline at end of file + + implementation project(':grails-events-core') + + implementation libs.groovy + + implementation libs.slf4j.api + implementation libs.spring.context + implementation libs.spring.tx + + testImplementation libs.spock.core + +} + +apply from: file("$rootProject.projectDir/gradle/java-config.gradle") +apply from: file("$rootProject.projectDir/gradle/publishing.gradle") diff --git a/grails-events-transform/build.gradle b/grails-events-transform/build.gradle index 9262325b..479f2694 100644 --- a/grails-events-transform/build.gradle +++ b/grails-events-transform/build.gradle @@ -1,12 +1,32 @@ +plugins { + + id 'groovy' + id 'java-library' + + id 'maven-publish' + id 'signing' + +} + +group = 'org.grails' + dependencies { - compile project(":grails-events") - compile "org.grails:grails-datastore-gorm:$gormVersion", { - exclude group:'org.grails', module:'grails-datastore-gorm-validation' + + implementation project(':grails-events-core') + + implementation libs.gorm, { + exclude group: 'org.grails', module: 'grails-datastore-gorm-validation' } - testRuntime "org.springframework:spring-aop:$springVersion" - testRuntime "org.springframework:spring-expression:$springVersion" - testCompile "org.grails:grails-datastore-gorm-test:$gormVersion", { - exclude group:'org.grails', module:'grails-datastore-gorm-validation' + testImplementation libs.spock.core + testImplementation libs.gorm.test, { + exclude group: 'org.grails', module: 'grails-datastore-gorm-validation' } -} \ No newline at end of file + + testRuntimeOnly libs.spring.aop + testRuntimeOnly libs.spring.expression + +} + +apply from: file("$rootProject.projectDir/gradle/java-config.gradle") +apply from: file("$rootProject.projectDir/gradle/publishing.gradle") diff --git a/grails-events/build.gradle b/grails-events/build.gradle deleted file mode 100644 index 9b19f623..00000000 --- a/grails-events/build.gradle +++ /dev/null @@ -1,4 +0,0 @@ -dependencies { - compile "org.springframework:spring-context:$springVersion" - compile "org.springframework:spring-tx:$springVersion" -} \ No newline at end of file diff --git a/grails-plugin-async/build.gradle b/grails-plugin-async/build.gradle index b0500cbf..61223553 100644 --- a/grails-plugin-async/build.gradle +++ b/grails-plugin-async/build.gradle @@ -1,10 +1,29 @@ +plugins { + + id 'groovy' + id 'java-library' + + id 'org.grails.grails-web' + id 'org.grails.grails-plugin' + + id 'maven-publish' + id 'signing' + +} + dependencies { - compileOnly "javax.servlet:javax.servlet-api:$servletApiVersion" - compileOnly 'javax:javaee-web-api:6.0' - compile "org.grails:grails-plugin-controllers:$grailsVersion" - compile project(':grails-plugin-events') - compile project(':grails-async') - - testCompile "javax.servlet:javax.servlet-api:$servletApiVersion" - testCompile "org.springframework:spring-test:$springVersion" + + api project(':grails-async-core') + api project(':grails-events-compat') + api project(':grails-events-core') + + implementation 'org.grails:grails-core' + implementation 'org.grails:grails-plugin-controllers' + + testImplementation libs.spock.core + } + +apply from: file("$rootProject.projectDir/gradle/grails-plugin-config.gradle") +apply from: file("$rootProject.projectDir/gradle/java-config.gradle") +apply from: file("$rootProject.projectDir/gradle/publishing.gradle") diff --git a/grails-plugin-events/build.gradle b/grails-plugin-events/build.gradle index 9e3a7f62..7bc6f50e 100644 --- a/grails-plugin-events/build.gradle +++ b/grails-plugin-events/build.gradle @@ -1,5 +1,26 @@ +plugins { + + id 'groovy' + id 'java-library' + + id 'org.grails.grails-plugin' + + id 'maven-publish' + id 'signing' + +} + dependencies { - compile "org.grails:grails-core:$grailsVersion" - compile project(":grails-events"), project(":grails-events-transform") - compile project(":grails-events-compat") + + api project(':grails-events-core') + api project(':grails-events-compat') + api project(':grails-events-transform') + + implementation 'org.grails:grails-core' + + testImplementation libs.spock.core } + +apply from: file("$rootProject.projectDir/gradle/grails-plugin-config.gradle") +apply from: file("$rootProject.projectDir/gradle/java-config.gradle") +apply from: file("$rootProject.projectDir/gradle/publishing.gradle") \ No newline at end of file diff --git a/grails-plugin-events/src/main/groovy/org/grails/plugins/events/EventBusGrailsPlugin.groovy b/grails-plugin-events/src/main/groovy/org/grails/plugins/events/EventBusGrailsPlugin.groovy index 28079aa7..fab26277 100644 --- a/grails-plugin-events/src/main/groovy/org/grails/plugins/events/EventBusGrailsPlugin.groovy +++ b/grails-plugin-events/src/main/groovy/org/grails/plugins/events/EventBusGrailsPlugin.groovy @@ -18,23 +18,20 @@ package org.grails.plugins.events import grails.config.Config import grails.plugins.Plugin -import groovy.util.logging.Slf4j import org.grails.events.bus.spring.EventBusFactoryBean import org.grails.events.gorm.GormDispatcherRegistrar import org.grails.events.spring.SpringEventTranslator import reactor.bus.EventBus - /** * A plugin that integrates Reactor into Grails * * @author Graeme Rocher * @since 3.0 */ -@Slf4j class EventBusGrailsPlugin extends Plugin { - def grailsVersion = "3.3.0 > *" + def grailsVersion = "6.0.0 > *" /** * Whether to translate GORM events into reactor events diff --git a/settings.gradle b/settings.gradle index 30b48311..59def7bd 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,10 +1,21 @@ +pluginManagement { + repositories { + maven { url 'https://repo.grails.org/grails/core' } + gradlePluginPortal() + } + plugins { + id 'org.grails.grails-web' version "$grailsVersion" + id 'org.grails.plugins.views-json' version "$viewsVersion" + } +} + rootProject.name = 'grails-async' -include 'grails-async' +include 'grails-async-core' include 'grails-async-gpars' include 'grails-async-rxjava' include 'grails-async-rxjava2' -include 'grails-events' +include 'grails-events-core' include 'grails-events-compat' include 'grails-events-transform' include 'grails-events-gpars' @@ -15,5 +26,5 @@ include 'grails-plugin-async' include 'grails-plugin-events' // examples -// include 'pubsub-demo' -// project(":pubsub-demo").projectDir = new File(settingsDir, "examples/pubsub-demo") \ No newline at end of file +include 'pubsub-demo' +project(':pubsub-demo').projectDir = new File(settingsDir, 'examples/pubsub-demo') diff --git a/travis-build.sh b/travis-build.sh deleted file mode 100755 index ed439238..00000000 --- a/travis-build.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash -set -e - -EXIT_STATUS=0 - -echo "Check for branch $TRAVIS_BRANCH JDK: $TRAVIS_JDK_VERSION" - -./gradlew clean check || EXIT_STATUS=$? - -if [ $EXIT_STATUS -ne 0 ]; then - exit $EXIT_STATUS -fi - -if [ "${TRAVIS_JDK_VERSION}" == "openjdk11" ] ; then - exit $EXIT_STATUS -fi - -echo "Publishing archives for branch $TRAVIS_BRANCH JDK: $TRAVIS_JDK_VERSION" -if [[ -n $TRAVIS_TAG ]] || [[ $TRAVIS_BRANCH =~ ^master$ && $TRAVIS_PULL_REQUEST == 'false' ]]; then - - echo "Publishing archives" - if [[ -n $TRAVIS_TAG ]]; then - ./gradlew bintrayUpload --no-daemon --stacktrace || EXIT_STATUS=$? - else - ./gradlew publish --no-daemon --stacktrace || EXIT_STATUS=$? - fi - - ./gradlew --no-daemon docs || EXIT_STATUS=$? - - git config --global user.name "$GIT_NAME" - git config --global user.email "$GIT_EMAIL" - git config --global credential.helper "store --file=~/.git-credentials" - echo "https://$GH_TOKEN:@github.com" > ~/.git-credentials - - git clone https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git -b gh-pages gh-pages --single-branch > /dev/null - cd gh-pages - - # If this is the master branch then update the snapshot - if [[ $TRAVIS_BRANCH =~ ^master|[12]\..\.x$ ]]; then - mkdir -p snapshot - cp -r ../build/docs/. ./snapshot/ - - git add snapshot/* - fi - - # If there is a tag present then this becomes the latest - if [[ -n $TRAVIS_TAG ]]; then - mkdir -p latest - cp -r ../build/docs/. ./latest/ - git add latest/* - - version="$TRAVIS_TAG" - version=${version:1} - majorVersion=${version:0:4} - majorVersion="${majorVersion}x" - - mkdir -p "$version" - cp -r ../build/docs/. "./$version/" - git add "$version/*" - - mkdir -p "$majorVersion" - cp -r ../build/docs/. "./$majorVersion/" - git add "$majorVersion/*" - - fi - - git commit -a -m "Updating docs for Travis build: https://travis-ci.org/$TRAVIS_REPO_SLUG/builds/$TRAVIS_BUILD_ID" && { - git push origin HEAD || true - } - cd .. - rm -rf gh-pages -fi - -exit $EXIT_STATUS