diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000..38a91ce8 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,134 @@ +name-template: $RESOLVED_VERSION +tag-template: v$RESOLVED_VERSION +pull-request: + title-templates: + fix: '🐛 $TITLE (#$NUMBER)' + feat: '🚀 $TITLE (#$NUMBER)' + default: '$TITLE (#$NUMBER)' +autolabeler: + - label: 'bug' + branch: + - '/fix\/.+/' + title: + - '/fix/i' + - label: 'improvement' + branch: + - '/improv\/.+/' + title: + - '/improv/i' + - label: 'feature' + branch: + - '/feature\/.+/' + title: + - '/feat/i' + - label: 'documentation' + branch: + - '/docs\/.+/' + title: + - '/docs/i' + - label: 'maintenance' + branch: + - '/(chore|refactor|style|test|ci|perf|build)\/.+/' + title: + - '/(chore|refactor|style|test|ci|perf|build)/i' + - label: 'chore' + branch: + - '/chore\/.+/' + title: + - '/chore/i' + - label: 'refactor' + branch: + - '/refactor\/.+/' + title: + - '/refactor/i' + - label: 'style' + branch: + - '/style\/.+/' + title: + - '/style/i' + - label: 'test' + branch: + - '/test\/.+/' + title: + - '/test/i' + - label: 'ci' + branch: + - '/ci\/.+/' + title: + - '/ci/i' + - label: 'perf' + branch: + - '/perf\/.+/' + title: + - '/perf/i' + - label: 'build' + branch: + - '/build\/.+/' + title: + - '/build/i' + - label: 'deps' + branch: + - '/deps\/.+/' + title: + - '/deps/i' + - label: 'revert' + branch: + - '/revert\/.+/' + title: + - '/revert/i' +categories: + - title: '🚀 Features' + labels: + - 'feature' + - "type: enhancement" + - "type: new feature" + - "type: major" + - "type: minor" + - title: '💡 Improvements' + labels: + - 'improvement' + - "type: improvement" + + - title: '🐛 Bug Fixes' + labels: + - 'fix' + - 'bug' + - "type: bug" + - title: '📚 Documentation' + labels: + - 'docs' + - title: '🔧 Maintenance' + labels: + - 'maintenance' + - 'chore' + - 'refactor' + - 'style' + - 'test' + - 'ci' + - 'perf' + - 'build' + - "type: ci" + - "type: build" + - title: '⏪ Reverts' + labels: + - 'revert' +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..c73e4ec3 --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,83 @@ +name: Java CI +on: + push: + branches: + - '[3-9]+.[0-9]+.x' + pull_request: + branches: + - '[3-9]+.[0-9]+.x' +env: + GIT_USER_NAME: puneetbehl + GIT_USER_EMAIL: behlp@unityfoundation.io + +jobs: + + test_project: + name: Test Project + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + java: [11, 17] + + steps: + - uses: actions/checkout@v4 + - uses: gradle/wrapper-validation-action@v2 + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: ${{ matrix.java }} + - uses: gradle/actions/setup-gradle@v3 + env: + GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + with: + arguments: check + + publish_snapshot: + name: Build Project and Publish Snapshot release + runs-on: ubuntu-latest + if: github.event_name == 'push' + + steps: + - uses: actions/checkout@v4 + - uses: gradle/wrapper-validation-action@v2 + - uses: actions/setup-java@v4 + with: { java-version: 11, distribution: temurin } + + - name: Build Project + uses: gradle/actions/setup-gradle@v3 + env: + GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + with: + arguments: build + + - name: Publish Snapshot version to Artifactory (repo.grails.org) + if: success() + uses: gradle/actions/setup-gradle@v3 + env: + GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + ORG_GRADLE_PROJECT_artifactoryPublishUsername: ${{ secrets.ARTIFACTORY_USERNAME }} + ORG_GRADLE_PROJECT_artifactoryPublishPassword: ${{ secrets.ARTIFACTORY_PASSWORD }} + with: + arguments: | + -Dorg.gradle.internal.publish.checksums.insecure=true + publish + + - name: Generate Snapshot Documentation + if: success() + uses: gradle/actions/setup-gradle@v3 + env: + GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + with: + arguments: docs + + - name: Publish Snapshot Documentation to Github Pages + if: success() + uses: micronaut-projects/github-pages-deploy-action@grails + env: + BRANCH: gh-pages + COMMIT_EMAIL: ${{ env.GIT_USER_EMAIL }} + COMMIT_NAME: ${{ env.GIT_USER_NAME }} + FOLDER: build/docs/manual + GH_TOKEN: ${{ secrets.GH_TOKEN }} diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml new file mode 100644 index 00000000..abb40581 --- /dev/null +++ b/.github/workflows/release-notes.yml @@ -0,0 +1,51 @@ +name: Changelog +on: + issues: + types: [closed,reopened] + push: + branches: + - '[3-9]+.[0-9]+.x' + pull_request: + types: [opened, reopened, synchronize, labeled] + pull_request_target: + types: [opened, reopened, synchronize, labeled] + 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..d8682cdc --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,68 @@ +name: Release +on: + release: + types: [published] +env: + GIT_USER_NAME: puneetbehl + GIT_USER_EMAIL: behlp@unityfoundation.io + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: gradle/wrapper-validation-action@v2 + - uses: actions/setup-java@v4 + with: { java-version: 11, distribution: temurin } + + - name: Get 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 + + - name: Generate secring file + env: + SECRING_FILE: ${{ secrets.SECRING_FILE }} + run: echo $SECRING_FILE | base64 -d > ${{ github.workspace }}/secring.gpg + + - name: Publish artifacts to Sonatype + id: publish_to_sonatype + uses: gradle/actions/setup-gradle@v3 + env: + GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} + ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} + ORG_GRADLE_PROJECT_sonatypeStagingProfileId: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} + SIGNING_KEY: ${{ secrets.SIGNING_KEY }} + SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} + with: + arguments: | + -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg + publishToSonatype + closeAndReleaseSonatypeStagingRepository + + - name: Generate Documentation + if: success() + uses: gradle/actions/setup-gradle@v3 + env: + GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + with: + arguments: docs + + - name: Publish Documentation to Github Pages + if: success() + uses: micronaut-projects/github-pages-deploy-action@grails + env: + BRANCH: gh-pages + COMMIT_EMAIL: ${{ env.GIT_USER_EMAIL }} + COMMIT_NAME: ${{ env.GIT_USER_NAME }} + FOLDER: build/docs/manual + GH_TOKEN: ${{ secrets.GH_TOKEN }} + VERSION: ${{ steps.release_version.outputs.release_version }} + + - name: Run post-release + if: steps.publish_to_sonatype.outcome == 'success' + uses: micronaut-projects/github-actions/post-release@master \ No newline at end of file diff --git a/.gitignore b/.gitignore index 435c3f70..771469b3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ -.idea -/bin/ -/build/ -/.gradle/ +.gradle/ +.idea/ +build/ +classes/ .project .settings .classpath diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 885a94ce..00000000 --- a/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -language: groovy -jdk: -- openjdk8 -before_install: - - cat /etc/hosts # optionally check the content *before* - - sudo hostname "$(hostname | cut -c1-63)" - - sed -e "s/^\\(127\\.0\\.0\\.1.*\\)/\\1 $(hostname | cut -c1-63)/" /etc/hosts | sudo tee /etc/hosts - - cat /etc/hosts # optionally check the content *after* -before_script: -- rm -rf target -script: ./travis-build.sh -env: - global: - - GIT_NAME="Jeff Scott Brown" - - GIT_EMAIL="brownj@ociweb.com" - - secure: eky/foiB6CVSrsk/FelPA//+XfiPc4sHSa4W1q2dkpOKj44hwpFxbmoSQVg9Z7f4gpvh6jCrPHeMjkcB9iuKbmPVuZMctt5qBlmcHWathYhbsmyah2cfJFrQIehUD7FNQy41bhcDbjXRDvOGejCwXBJa8jtdmRGEVXaAGNNfTJM= - - secure: HKKPR42zo/AuGFCo7BkERKWsh0oUMKUleDP1KOR+ePf5jT/aliPM+EjrJJq3kP/kE5Z534SUwoX6ObRuET0bbBiz1CbqZ0dEBgPC6+sHaP0zmSo39DD5ONNN2OvUM4DXq6AR6/9JxjxyikBYtWSzSEGor+9vKZ24v+R/XYocxyc= - - secure: ZLA3ZB2eSh+dEsByMbymvcBx7UeSmNbWmIx9mHnAp/yULq/1jhIIznnB1H07geboS5pkAjbYj1NdZQ8h5MqxmCwOaGefUkN1N5TTV5ZfmD/rlzNzTKThpT7LfqfgPyfYUVOQfz9gkVFZ4t2NZ6yqf97hzASuEOcAUicR5nCi1Cw= - - secure: YjeQFp8EH2cDOF38uDc9Fp82f/i6jFEoNAcxmylhny9Md8p+rVTBFhiwHBJj6aFX1iStPbWaRdPzJ9Tggmb99W/kMCzV/sh1a2e7LIs6ekh7yPVojrZr7otyx/tKzZ8LZfQUKRNfdsuyHwLzHskwgJbcVber5ln9GtFK52Qxf8w= - - secure: ZbaeuQ557fSEic31Q4Qbn/cAo/5I/BIExpAfLmH0FYLLw8hPNTZkFZ7AD5ZdHK73a023bKvkwj519pWIXp68AqAgw9mG8NQIaHScJmvdGMNdoBEodaM1r87wT3iJQ33AH7u+yiAO6HyG2eaO37aZaBFVzK2sET8Hf8d8Ftl2cgM= - - secure: ZcK52XtVZwygxCmNXDDOfT9e0s98vvXe8InT+4tdW7UNbrgNYAwd5K+T3zLnCqJSsEisEYnWnFwxp9AXEJtgLVaA4wzHezXcEgGVsBaoNxknKftL3GvgE2u4q5ehpZ7VvSTr4j+IcH8pn1d360GaJVJi8ZMNqMERVOQEJ/JqGqI= - - secure: mLJaymC8mXL6xz9azUyNtZLMtWYAT6o7LbyJuytgAME91KXciTA83WkJKxqTZQeT/QWCkLwbGnvUUJRB4q2+hCjJ8nSDUmt/s4IBGU3E2Xdyz1ByZaxDszApvkzsURl63xYvxkZA457QJaAgRhpJYmRKefBaQW1Cv0BRRNSgzm0= - - secure: F+Nt8ZMSWB2f9o865whWMw+KmM2nZXxGqMVgVLM+yJ6avrIqePaIwubhcFh8xsGA9GSqVRH5K6bJfPgCqLO94kMZV68iYBmPClOpuytY7Nb0AFPQP3FNdppLOTr6RpK0PyRCJLfgniU9QjSyz31ydedmawx1eFaQbYt2IKx24fg= - - secure: JAOS1ZFUMLCbQiLBcC8vlB3xqO0f0AWGU+CPh3s1IIb5AoByD7aC5KJEA4r1Y623LGB3mVjvcn09xUb+IEmlq6IbGfMllWwrbnb0AZvobSMBKss82KjZErpRSNTWENipk1D/k7DX9mUaMlS2PS/qEPCOLq8QD3ZlJdBrXELzyUg= - - secure: Qx9/n92ljYSlLAsMhl9m0zpjxERyosIlgrkWheHy4XT4KdXZ4Jw1PflKrmncuW62SUSJPkbNdHBiauUl+ZDQvRh+c9YPiNYyUuMAkcfQuCUdsoKbQF9wVQ5xV8YHxtZMp72exBxYXDQ6Hf8lGz8XhpL6Q46KYneYG/R+55kH5M0= diff --git a/README.md b/README.md index f31d26b7..6254dcf9 100644 --- a/README.md +++ b/README.md @@ -1,66 +1,73 @@ # Grails Quartz Plugin -[Latest documentation](http://grails-plugins.github.io/grails-quartz/latest/) and [snapshots](http://grails-plugins.github.io/grails-quartz/snapshot/) are available. +[![Maven Central](https://img.shields.io/maven-central/v/org.grails.plugins/quartz.svg?label=Maven%20Central)](https://central.sonatype.com/artifact/org.grails.plugins/quartz) +[![Java CI](https://github.com/grails/grails-quartz/actions/workflows/gradle.yml/badge.svg?event=push)](https://github.com/grails/grails-quartz/actions/workflows/gradle.yml) + +## Documentation + +[Latest documentation](https://grails.github.io/grails-quartz/latest/) and [snapshots](https://grails.github.io/grails-quartz/snapshot/) are available. -# Build Status -[![Build Status](https://travis-ci.org/grails-plugins/grails-quartz.svg?branch=master)](https://travis-ci.org/grails-plugins/grails-quartz) ## Branches -The current master branch is for 2.x versions of the plugin compatible with Grails 3. There is a 1.x branch for on-going maintenance of 1.x versions of the plugin compatible with Grails 2. Please submit any pull requests to the appropriate branch. Changes to the 1.x branch will be merged into the master branch if appropriate. +| Branch | Grails Version | +|---------|----------------| +| 1.x | 2 | +| 2.0.x | 3-5 | +| 3.0.x | 6 | ## Using ### Quick start -To start using Quartz plugin just simply add ```compile 'org.grails.plugins:quartz:2.0.1'``` in your ```build.gradle```. - -##### 2.0.13 for Grails 3.3.* -Properties changed to `static` from `def`.
For example: -`def concurrent` will be now `static concurrent`. - +To start using Quartz plugin just simply add +`implementation 'org.grails.plugins:quartz:{version}'` in your `build.gradle`. +[!NOTE] +> __2.0.13 for Grails 3.3.*__\ +> Properties changed to `static` from `def`.\ +> For example: `def concurrent` will be now `static concurrent`. ### Scheduling Jobs To create a new job run the `grails create-job` command and enter the name of the job. Grails will create a new job and place it in the `grails-app/jobs` directory: +```groovy +package com.mycompany.myapp - package com.mycompany.myapp - - class MyJob { +class MyJob { - static triggers = { - simple repeatInterval: 1000 - } + static triggers = { + simple repeatInterval: 1000 + } - void execute() { - print "Job run!" - } + void execute() { + print "Job run!" } +} +``` -The above example will call the 'execute' method every second. +The above example will call the `execute()` method every second. ### Scheduling configuration syntax -Currently plugin supports three types of [triggers](http://quartz-scheduler.org/documentation/quartz-2.x/tutorials/tutorial-lesson-02): + +Currently, plugin supports three types of [triggers](http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/tutorial-lesson-02.html): * **simple trigger** — executes once per defined interval (ex. "every 10 seconds"); * **cron trigger** — executes job with cron expression (ex. "at 8:00 am every Monday through Friday"); -* **custom trigger** — your implementation of [Trigger](http://www.quartz-scheduler.org/api/2.2.0/org/quartz/Trigger.html) interface. +* **custom trigger** — your implementation of [Trigger](http://www.quartz-scheduler.org/api/2.3.0/org/quartz/Trigger.html) interface. Multiple triggers per job are allowed. +```groovy +class MyJob { - class MyJob { - - static triggers = { - simple name: 'simpleTrigger', startDelay: 10000, repeatInterval: 30000, repeatCount: 10 - cron name: 'cronTrigger', startDelay: 10000, cronExpression: '0/6 * 15 * * ?' - custom name: 'customTrigger', triggerClass: MyTriggerClass, myParam: myValue, myAnotherParam: myAnotherValue - } + static triggers = { + simple name: 'simpleTrigger', startDelay: 10000, repeatInterval: 30000, repeatCount: 10 + cron name: 'cronTrigger', startDelay: 10000, cronExpression: '0/6 * 15 * * ?' + custom name: 'customTrigger', triggerClass: MyTriggerClass, myParam: myValue, myAnotherParam: myAnotherValue + } - void execute() { - println "Job run!" - } + void execute() { + println "Job run!" } +} +``` -With this configuration job will be executed 11 times with 30 seconds interval with first run in 10 seconds after -scheduler startup (simple trigger), also it'll be executed each 6 second during 15th hour -(15:00:00, 15:00:06, 15:00:12, ... — this configured by cron trigger) and also it'll be executed each time your custom -trigger will fire. +With this configuration, job will be executed 11 times with 30 seconds interval with first run in 10 seconds after scheduler startup (simple trigger), also it'll be executed each 6 second during 15th hour (15:00:00, 15:00:06, 15:00:12, ... — this configured by cron trigger) and also it'll be executed each time your custom trigger will fire. Three kinds of triggers are supported with the following parameters. The name field must be unique: * `simple`: @@ -73,17 +80,17 @@ Three kinds of triggers are supported with the following parameters. The name fi * `startDelay` — delay (in milliseconds) between scheduler startup and first job's execution; * `cronExpression` — [cron expression](http://www.quartz-scheduler.org/api/2.2.0/org/quartz/CronExpression.html) * `custom`: - * `triggerClass` — your class which implements [CalendarIntervalTriggerImpl](http://www.quartz-scheduler.org/api/2.2.0/org/quartz/impl/triggers/CalendarIntervalTriggerImpl.html) impl; + * `triggerClass` — your class which implements [CalendarIntervalTriggerImpl](http://www.quartz-scheduler.org/api/2.3.0/org/quartz/impl/triggers/CalendarIntervalTriggerImpl.html) impl; * any params needed by your trigger. ### Configuration plugin syntax -You can add the following properties to control persisteance or not persistence: -* quartz.pluginEnabled - defaults to true, can disable plugin for test cases etc -* quartz.jdbcStore - true to enable database store, false to use RamStore (default true) -* quartz.autoStartup - delays jobs until after bootstrap startup phase (default false) -* quartz.jdbcStoreDataSource - jdbc data source alternate name -* quartz.waitForJobsToCompleteOnShutdown - wait for jobs to complete on shutdown (default true) -* quartz.exposeSchedulerInRepository - expose Schedule in repository -* quartz.scheduler.instanceName - name of the scheduler to avoid conflicts between apps -* quartz.purgeQuartzTablesOnStartup - when jdbcStore set to 'true' and this is true, clears out all quartz tables on startup +You can add the following properties to control persistence or not persistence: +* `quartz.pluginEnabled` - defaults to `true`, can disable plugin for test cases etc +* `quartz.jdbcStore` - `true` to enable database store, `false` to use RamStore (default: `true`) +* `quartz.autoStartup` - delays jobs until after bootstrap startup phase (default: `false`) +* `quartz.jdbcStoreDataSource` - jdbc data source alternate name +* `quartz.waitForJobsToCompleteOnShutdown` - wait for jobs to complete on shutdown (default: `true`) +* `quartz.exposeSchedulerInRepository` - expose Schedule in repository +* `quartz.scheduler.instanceName` - name of the scheduler to avoid conflicts between apps +* `quartz.purgeQuartzTablesOnStartup` - when jdbcStore set to `true` and this is `true`, clears out all quartz tables on startup diff --git a/build.gradle b/build.gradle index 4f678ff1..f365eaf1 100644 --- a/build.gradle +++ b/build.gradle @@ -1,94 +1,49 @@ -buildscript { - ext { - grailsVersion = project.grailsVersion - } - repositories { - mavenLocal() - maven { url "http://repo.grails.org/grails/core" } - } - dependencies { - classpath "org.grails:grails-gradle-plugin:$grailsVersion" - } -} - plugins { - id "io.spring.dependency-management" version "0.5.2.RELEASE" - id "com.jfrog.bintray" version "1.6" + id 'groovy' + id 'java-library' + id 'io.github.gradle-nexus.publish-plugin' + id 'maven-publish' + id 'signing' } -version "2.0.14.BUILD-SNAPSHOT" -group "org.grails.plugins" - - -apply plugin: 'eclipse' -apply plugin: 'idea' -apply plugin: "org.grails.grails-plugin" -apply plugin: "org.grails.grails-gsp" -apply plugin: "org.grails.grails-doc" -apply plugin: 'maven-publish' -// Used for publishing to central repository, remove if not needed -apply from:'https://raw.githubusercontent.com/grails/grails-profile-repository/master/profiles/plugin/templates/grailsCentralPublishing.gradle' -apply from:'https://raw.githubusercontent.com/grails/grails-profile-repository/master/profiles/plugin/templates/bintrayPublishing.gradle' +version = projectVersion +group = 'org.grails.plugins' +ext.set('grailsVersion', libs.versions.grails.get()) +ext.set('isReleaseVersion', !version.toString().endsWith('-SNAPSHOT')) +ext.set('isSnapshot', !isReleaseVersion) -ext { - grailsVersion = project.grailsVersion - gradleWrapperVersion = project.gradleWrapperVersion -} - -sourceCompatibility = 1.7 -targetCompatibility = 1.7 +apply plugin: 'org.grails.grails-plugin' // Needs to be applied after grailsVersion has been set repositories { mavenLocal() mavenCentral() - maven { url "http://repo.grails.org/grails/core" } -} - -dependencyManagement { - imports { - mavenBom "org.grails:grails-bom:$grailsVersion" - } - applyMavenExclusions false + maven { url = 'https://repo.grails.org/grails/core' } } dependencies { - provided 'org.springframework.boot:spring-boot-starter-logging' - provided "org.springframework.boot:spring-boot-starter-actuator" - provided "org.springframework.boot:spring-boot-autoconfigure" - provided "org.springframework.boot:spring-boot-starter-tomcat" - provided "org.grails:grails-web-boot" - provided "org.grails:grails-dependencies" - provided 'javax.servlet:javax.servlet-api:3.1.0' + api libs.quartz - testCompile "org.grails:grails-plugin-testing" + implementation libs.grails.bootstrap + implementation libs.grails.core + implementation libs.groovy.sql + implementation libs.spring.beans + implementation libs.spring.context + implementation libs.spring.context.support - console "org.grails:grails-console" + compileOnly libs.groovy.core // CompileStatic and Slf4j + compileOnly libs.javax.annotation.api // Provided - compile("org.quartz-scheduler:quartz:2.2.3") { - exclude module: 'slf4j-api' - exclude module: 'c3p0' - } -} - -compileGroovy.groovyOptions.forkOptions.jvmArgs = ['-Xmx512M'] - -tasks.withType(JavaExec) { - maxHeapSize '512m' -} + testImplementation libs.groovy.test + testImplementation libs.junit4 + testImplementation libs.spock.core -eclipse { - classpath { - plusConfigurations += [configurations.provided] - } + testRuntimeOnly libs.junit.vintage.engine // Needed for JUnit 4 tests to run + testRuntimeOnly libs.slf4j.nop // Get rid of warning about missing slf4j implementation during test task } -idea { - module { - scopes.PROVIDED.plus += [configurations.provided] - } -} - -task wrapper(type: Wrapper) { - gradleVersion = gradleWrapperVersion -} +apply from: layout.projectDirectory.file('gradle/java-config.gradle') +apply from: layout.projectDirectory.file('gradle/grails-plugin-config.gradle') +apply from: layout.projectDirectory.file('gradle/testing-config.gradle') +apply from: layout.projectDirectory.file('gradle/documentation-config.gradle') +apply from: layout.projectDirectory.file('gradle/publishing.gradle') \ No newline at end of file diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle new file mode 100644 index 00000000..710db146 --- /dev/null +++ b/buildSrc/build.gradle @@ -0,0 +1,9 @@ +repositories { + mavenCentral() + maven { url = 'https://repo.grails.org/grails/core' } +} + +dependencies { + implementation buildsrcLibs.nexus.publish.gradle.plugin + runtimeOnly buildsrcLibs.grails.gradle.plugin +} \ No newline at end of file diff --git a/buildSrc/settings.gradle b/buildSrc/settings.gradle new file mode 100644 index 00000000..6cd9ab17 --- /dev/null +++ b/buildSrc/settings.gradle @@ -0,0 +1,7 @@ +dependencyResolutionManagement { + versionCatalogs { + buildsrcLibs { + from(files('../gradle/buildsrc.libs.versions.toml')) + } + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 80758d38..1f0b6d83 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,13 @@ -grailsVersion=3.2.8 -gradleWrapperVersion=3.3 +projectVersion=3.0.0-SNAPSHOT +# 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 -websiteUrl=http://grails-plugins.github.io/grails-quartz/ -issueTrackerUrl=https://github.com/grails-plugins/grails-quartz/issues -vcsUrl=https://github.com/grails-plugins/grails-quartz +websiteUrl=https://grails.github.io/grails-quartz/latest/ +issueTrackerUrl=https://github.com/grails/grails-quartz/issues +vcsUrl=https://github.com/grails/grails-quartz + +org.gradle.caching=true +org.gradle.daemon=true +org.gradle.parallel=true diff --git a/gradle/buildsrc.libs.versions.toml b/gradle/buildsrc.libs.versions.toml new file mode 100644 index 00000000..6737c1f9 --- /dev/null +++ b/gradle/buildsrc.libs.versions.toml @@ -0,0 +1,7 @@ +[versions] +grails-gradle-plugin = '6.1.2' +nexus-publish-gradle-plugin = '1.3.0' + +[libraries] +grails-gradle-plugin = { module = 'org.grails:grails-gradle-plugin', version.ref = 'grails-gradle-plugin' } +nexus-publish-gradle-plugin = { module = 'io.github.gradle-nexus:publish-plugin', version.ref = 'nexus-publish-gradle-plugin' } diff --git a/gradle/documentation-config.gradle b/gradle/documentation-config.gradle new file mode 100644 index 00000000..2fdf9b2a --- /dev/null +++ b/gradle/documentation-config.gradle @@ -0,0 +1,29 @@ +import org.grails.gradle.plugin.doc.PublishGuideTask + +apply plugin: 'org.grails.grails-doc' + +configurations.register('groovydocConfiguration') +configurations.register('guideConfiguration') + +dependencies { + + groovydocConfiguration localGroovy(), { + because 'groovydoc needs to run with the same version as Gradle' + } + + guideConfiguration libs.grails.docs + guideConfiguration libs.groovy.templates +} + +tasks.withType(Groovydoc).configureEach { + access = GroovydocAccess.PRIVATE + processScripts = false + includeMainForScripts = false + includeAuthor = true + classpath = configurations.groovydocConfiguration + groovyClasspath = configurations.groovydocConfiguration +} + +tasks.withType(PublishGuideTask).configureEach { + classpath = configurations.guideConfiguration +} \ 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..da07410b --- /dev/null +++ b/gradle/grails-plugin-config.gradle @@ -0,0 +1,7 @@ +tasks.named('bootJar') { + enabled = false // Plugins should not create a bootJar +} +tasks.named('jar', Jar) { + enabled = true // Enable the jar task again, as the bootJar task has been disabled + archiveClassifier = '' // Remove '-plain' suffix from jar file name +} \ No newline at end of file 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..c62be637 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,28 @@ +[versions] +grails = '6.1.2' +groovy = '3.0.21' +javax-annotation-api = '1.3.2' +junit4 = '4.13' +junit-jupiter = '5.10.2' +quartz = '2.3.2' +slf4j = '1.7.36' +spring = '5.3.33' +spock = '2.3-groovy-3.0' + +[libraries] +grails-bootstrap = { group = 'org.grails', name = 'grails-bootstrap', version.ref = 'grails' } +grails-core = { group = 'org.grails', name = 'grails-core', version.ref = 'grails' } +grails-docs = { group = 'org.grails', name = 'grails-docs', version.ref = 'grails' } +groovy-core = { group = 'org.codehaus.groovy', name = 'groovy', version.ref = 'groovy' } +groovy-sql = { group = 'org.codehaus.groovy', name = 'groovy-sql', version.ref = 'groovy' } +groovy-templates = { group = 'org.codehaus.groovy', name = 'groovy-templates', version.ref = 'groovy' } +groovy-test = { group = 'org.codehaus.groovy', name = 'groovy-test', version.ref = 'groovy' } +javax-annotation-api = { module = 'javax.annotation:javax.annotation-api', version.ref = 'javax-annotation-api' } +junit4 = { group = 'junit', name = 'junit', version.ref = 'junit4' } +junit-vintage-engine = { group = 'org.junit.vintage', name = 'junit-vintage-engine', version.ref = 'junit-jupiter' } +quartz = { group = 'org.quartz-scheduler', name = 'quartz', version.ref = 'quartz' } +slf4j-nop = { group = 'org.slf4j', name = 'slf4j-nop', version.ref = 'slf4j' } +spring-beans = { group = 'org.springframework', name = 'spring-beans', version.ref = 'spring' } +spring-context = { group = 'org.springframework', name = 'spring-context', version.ref = 'spring' } +spring-context-support = { group = 'org.springframework', name = 'spring-context-support', version.ref = 'spring' } +spock-core = { group = 'org.spockframework', name = 'spock-core', version.ref = 'spock' } \ No newline at end of file diff --git a/gradle/publishing.gradle b/gradle/publishing.gradle new file mode 100644 index 00000000..3d3da001 --- /dev/null +++ b/gradle/publishing.gradle @@ -0,0 +1,111 @@ +import io.github.gradlenexus.publishplugin.InitializeNexusStagingRepository + +ext.set('signing.keyId', findProperty('signing.keyId') ?: System.getenv('SIGNING_KEY')) +ext.set('signing.password', findProperty('signing.password') ?: System.getenv('SIGNING_PASSPHRASE')) + +def javaComponent = components.named('java') +publishing { + publications { + register('grailsQuartzPlugin', MavenPublication) { + from javaComponent.get() + versionMapping { + usage('java-api') { fromResolutionOf('runtimeClasspath') } + usage('java-runtime') { fromResolutionResult() } + } + pom { + name = 'Grails Quartz plugin' + description = 'Grails plugin for Quartz scheduler integration' + url = 'https://github.com/grails/grails-quartz' + licenses { + license { + name = 'The Apache License, Version 2.0' + url = 'https://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + developers { + developer { + id = 'osscontributor' + name = 'Jeff Brown' + email = 'brownj@ociweb.com' + } + developer { + id = 'nebolsin' + name = 'Sergey Nebolsin' + email = 'nebolsin@gmail.com' + } + developer { + id = 'graemerocher' + name = 'Graeme Rocher' + email = 'graeme.rocher@gmail.com' + } + developer { + id = 'rvanderwerf' + name = 'Ryan Vanderwerf' + email = 'rvanderwerf@gmail.com' + } + developer { + id = 'kefirfromperm' + name = 'Vitalii Samolovskikh' + email = 'kefir@perm.ru' + } + } + scm { + connection = 'scm:git:git://github.com/grails/grails-quartz.git' + developerConnection = 'scm:git:ssh://github.com:grails/grails-quartz.git' + url = 'https://github.com/grails/grails-quartz' + } + } + // dependency management shouldn't be included + pom.withXml { + def root = it.asElement() + root.getElementsByTagName('dependencyManagement').each { root.removeChild(it) } + } + } + } + + if (isSnapshot) { + repositories { + maven { + credentials { + username = findProperty('artifactoryPublishUsername') ?: '' + password = findProperty('artifactoryPublishPassword') ?: '' + } + url = uri('https://repo.grails.org/grails/plugins3-snapshots-local') + } + } + } +} + + +def mavenPublication = extensions.findByType(PublishingExtension).publications.named('grailsQuartzPlugin') +tasks.withType(Sign).configureEach { + onlyIf { isReleaseVersion } +} +afterEvaluate { + signing { + required = { isReleaseVersion } + sign mavenPublication.get() + } +} + +if (isReleaseVersion) { + nexusPublishing { + String sonatypeUsername = findProperty('sonatypeUsername') ?: '' + String sonatypePassword = findProperty('sonatypePassword') ?: '' + String sonatypeStagingProfileId = findProperty('sonatypeStagingProfileId') ?: '' + repositories { + sonatype { + nexusUrl = uri('https://s01.oss.sonatype.org/service/local/') + username = sonatypeUsername + password = sonatypePassword + stagingProfileId = sonatypeStagingProfileId + } + } + } +} + + +//do not generate extra load on Nexus with new staging repository if signing fails +tasks.withType(InitializeNexusStagingRepository).configureEach { + shouldRunAfter = tasks.withType(Sign) +} \ No newline at end of file diff --git a/gradle/testing-config.gradle b/gradle/testing-config.gradle new file mode 100644 index 00000000..f01ed728 --- /dev/null +++ b/gradle/testing-config.gradle @@ -0,0 +1,4 @@ +tasks.withType(Test).configureEach { + useJUnitPlatform() + testLogging { events 'passed', 'skipped', 'failed', 'standardOut', 'standardError' } +} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 9d0f767f..afba1092 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 097a7a52..c7d437bb 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Mar 28 13:20:22 EDT 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip diff --git a/gradlew b/gradlew index 4453ccea..65dcd68d 100755 --- a/gradlew +++ b/gradlew @@ -1,78 +1,129 @@ -#!/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"` +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum -warn ( ) { +warn () { echo "$*" -} +} >&2 -die ( ) { +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,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + 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. Please set the JAVA_HOME variable in your environment to match the @@ -89,84 +140,105 @@ location of your Java installation." 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=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=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")" +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +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-app/conf/application.yml b/grails-app/conf/application.yml index 11dd61d3..30a1792e 100644 --- a/grails-app/conf/application.yml +++ b/grails-app/conf/application.yml @@ -1,108 +1,3 @@ grails: - profile: web-plugin codegen: - defaultPackage: quartz - mime: - disable: - accept: - header: - userAgents: - - Gecko - - WebKit - - Presto - - Trident - types: - all: '*/*' - atom: application/atom+xml - css: text/css - csv: text/csv - form: application/x-www-form-urlencoded - html: - - text/html - - application/xhtml+xml - js: text/javascript - json: - - application/json - - text/json - multipartForm: multipart/form-data - rss: application/rss+xml - text: text/plain - hal: - - application/hal+json - - application/hal+xml - xml: - - text/xml - - application/xml - urlmapping: - cache: - maxsize: 1000 - controllers: - defaultScope: singleton - converters: - encoding: UTF-8 - hibernate: - cache: - queries: false - views: - default: - codec: html - gsp: - encoding: UTF-8 - htmlcodec: xml - codecs: - expression: html - scriptlets: html - taglib: none - staticparts: none - -info: - app: - name: '@info.app.name@' - version: '@info.app.version@' - grailsVersion: '@info.app.grailsVersion@' -spring: - groovy: - template: - check-template-location: false - -quartz: - autoStartup: true - -dataSource: - pooled: true - jmxExport: true - driverClassName: org.h2.Driver - username: sa - password: - -environments: - development: - dataSource: - dbCreate: create-drop - url: jdbc:h2:mem:devDb;MVCC=TRUE;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 - production: - dataSource: - dbCreate: update - url: jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE - properties: - jmxEnabled: true - initialSize: 5 - maxActive: 50 - minIdle: 5 - maxIdle: 25 - maxWait: 10000 - maxAge: 600000 - timeBetweenEvictionRunsMillis: 5000 - minEvictableIdleTimeMillis: 60000 - validationQuery: SELECT 1 - validationQueryTimeout: 3 - validationInterval: 15000 - testOnBorrow: true - testWhileIdle: true - testOnReturn: false - jdbcInterceptors: ConnectionState - defaultTransactionIsolation: TRANSACTION_READ_COMMITTED + defaultPackage: quartz \ No newline at end of file diff --git a/grails-app/conf/logback.groovy b/grails-app/conf/logback.groovy deleted file mode 100644 index 5b2d1e35..00000000 --- a/grails-app/conf/logback.groovy +++ /dev/null @@ -1,28 +0,0 @@ -import grails.util.BuildSettings -import grails.util.Environment - - -// See http://logback.qos.ch/manual/groovy.html for details on configuration -appender('STDOUT', ConsoleAppender) { - encoder(PatternLayoutEncoder) { - pattern = "%level %logger - %msg%n" - } -} - -root(ERROR, ['STDOUT']) - -if(Environment.current == Environment.DEVELOPMENT) { - def targetDir = BuildSettings.TARGET_DIR - if(targetDir) { - - appender("FULL_STACKTRACE", FileAppender) { - - file = "${targetDir}/stacktrace.log" - append = true - encoder(PatternLayoutEncoder) { - pattern = "%level %logger - %msg%n" - } - } - logger("StackTrace", ERROR, ['FULL_STACKTRACE'], false ) - } -} diff --git a/grails-app/conf/plugin.yml b/grails-app/conf/plugin.yml index 15669e0f..131654ce 100644 --- a/grails-app/conf/plugin.yml +++ b/grails-app/conf/plugin.yml @@ -1 +1,2 @@ -quartz.jdbcStore: false +quartz: + jdbcStore: false diff --git a/grails-app/init/quartz/Application.groovy b/grails-app/init/quartz/Application.groovy index 49f3cca3..50034c89 100644 --- a/grails-app/init/quartz/Application.groovy +++ b/grails-app/init/quartz/Application.groovy @@ -2,7 +2,9 @@ package quartz import grails.boot.GrailsApp import grails.boot.config.GrailsAutoConfiguration +import grails.plugins.metadata.PluginSource +@PluginSource class Application extends GrailsAutoConfiguration { static void main(String[] args) { GrailsApp.run(Application) diff --git a/settings.gradle b/settings.gradle index 035133d6..49f3ddef 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,27 @@ +plugins { + id "com.gradle.enterprise" version '3.16.2' + id 'com.gradle.common-custom-user-data-gradle-plugin' version '1.13' +} + +gradleEnterprise { + server = 'https://ge.grails.org' + buildScan { + publishAlwaysIf(System.getenv('CI') == 'true') + publishIfAuthenticated() + uploadInBackground = System.getenv('CI') == null + capture { + taskInputFiles = true + } + } +} + +buildCache { + local { enabled = System.getenv('CI') != 'true' } + remote(gradleEnterprise.buildCache) { + def isAuthenticated = System.getenv('GRADLE_ENTERPRISE_ACCESS_KEY') + push = System.getenv('CI') == 'true' && isAuthenticated + enabled = true + } +} + rootProject.name = 'quartz' diff --git a/src/main/groovy/quartz/QuartzGrailsPlugin.groovy b/src/main/groovy/quartz/QuartzGrailsPlugin.groovy index a6d4da38..2d98fc11 100644 --- a/src/main/groovy/quartz/QuartzGrailsPlugin.groovy +++ b/src/main/groovy/quartz/QuartzGrailsPlugin.groovy @@ -32,16 +32,10 @@ import org.springframework.scheduling.quartz.SchedulerFactoryBean class QuartzGrailsPlugin extends Plugin { // the version or versions of Grails the plugin is designed for - def grailsVersion = "3.0.0.BUILD-SNAPSHOT > *" - - // resources that are excluded from plugin packaging - def pluginExcludes = [ - "grails-app/views/error.gsp" - ] + def grailsVersion = "6.0.0 > *" def watchedResources = "file:./grails-app/jobs/**/*Job.groovy" - def title = "Quartz" // Headline display name of the plugin def author = "Jeff Brown" def authorEmail = "brownj@ociweb.com" @@ -52,13 +46,13 @@ Adds Quartz job scheduling features List loadAfter = ['hibernate3', 'hibernate4', 'hibernate5', 'services'] // URL to the plugin's documentation - def documentation = "http://grails.org/plugin/quartz" + def documentation = 'https://grails.github.io/grails-quartz/latest/' // License: one of 'APACHE', 'GPL2', 'GPL3' def license = "APACHE" // Location of the plugin's issue tracker. - def issueManagement = [ system: "Github Issues", url: "http://github.com/grails3-plugins/quartz/issues" ] + def issueManagement = [ system: 'Github Issues', url: 'https://github.com/grails/grails-quartz/issues' ] // Any additional developers beyond the author specified above. @@ -70,7 +64,7 @@ Adds Quartz job scheduling features ] // Online location of the plugin's browseable source code. - def scm = [ url: "https://github.com/grails3-plugins/quartz/" ] + def scm = [ url: 'https://github.com/grails/grails-quartz' ] Closure doWithSpring() { diff --git a/travis-build.sh b/travis-build.sh deleted file mode 100755 index 52a31d3d..00000000 --- a/travis-build.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash -set -e -rm -rf *.zip -./gradlew clean test assemble - -filename=$(find build/libs -name "*.jar" | head -1) -filename=$(basename "$filename") - -EXIT_STATUS=0 -echo "Publishing archives for branch $TRAVIS_BRANCH" -if [[ -n $TRAVIS_TAG ]] || [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then - - echo "Publishing archives" - - if [[ -n $TRAVIS_TAG ]]; then - ./gradlew bintrayUpload || EXIT_STATUS=$? - else - ./gradlew publish || EXIT_STATUS=$? - fi - - ./gradlew 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' ]]; then - mkdir -p snapshot - cp -r ../build/docs/manual/. ./snapshot/ - - git add snapshot/* - fi - - # If there is a tag present then this becomes the latest - if [[ -n $TRAVIS_TAG ]]; then - git rm -rf latest/ - mkdir -p latest - cp -r ../build/docs/manual/. ./latest/ - git add latest/* - - version="$TRAVIS_TAG" - version=${version:1} - majorVersion=${version:0:4} - majorVersion="${majorVersion}x" - - mkdir -p "$version" - cp -r ../build/docs/manual/. "./$version/" - git add "$version/*" - - mkdir -p "$majorVersion" - cp -r ../build/docs/manual/. "./$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 - cd .. - rm -rf gh-pages -fi - -exit $EXIT_STATUS