diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 753a7e7..a47d10b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,28 +1,51 @@ -# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle - -name: Build - +name: "Build" on: push: - branches: [ master ] + branches: + - '4.0.x' pull_request: - branches: [ master ] - + branches: + - '4.0.x' jobs: - build: - - runs-on: ubuntu-latest - + test_project: + name: "Test Project" + runs-on: ubuntu-24.04 + if: github.event_name == 'pull_request' steps: - - uses: actions/checkout@v2 - - name: Set up JDK 8 - uses: actions/setup-java@v2 + - name: "📥 Checkout repository" + uses: actions/checkout@v4 + - name: "☕️ Setup JDK" + uses: actions/setup-java@v4 with: - java-version: '8' - distribution: 'adopt' - cache: gradle - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Build with Gradle - run: ./gradlew build + java-version: 8 + distribution: liberica + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "🏃 Run Tests" + run: ./gradlew check --continue + build_project: + name: "Build Project and Publish Snapshot release" + runs-on: ubuntu-20.04 + if: github.event_name == 'push' + steps: + - name: "📥 Checkout repository" + uses: actions/checkout@v4 + - name: "☕️ Setup JDK" + uses: actions/setup-java@v4 + with: + java-version: 8, + distribution: liberica + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "🔨 Build Project" + run: ./gradlew build --continue + - name: "📤 Publish Snapshot version to Artifactory (repo.grails.org)" + if: success() + env: + ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} + ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} + run: ./gradlew publish \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 303a177..3f535b4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,68 +1,43 @@ -name: Release +name: "Release" on: release: types: [ published ] +env: + GIT_USER_NAME: ${{ secrets.GIT_USER_NAME }} + GIT_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }} jobs: release: - runs-on: ubuntu-latest - env: - GIT_USER_NAME: ${{ secrets.GIT_USER_NAME }} - GIT_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }} + name: "Release" + runs-on: ubuntu-24.04 steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - ref: 4.0.x - token: ${{ secrets.GH_TOKEN }} - - uses: gradle/wrapper-validation-action@v1 - - name: Set up JDK - uses: actions/setup-java@v1 - with: - java-version: 8 - - name: Get latest release version number - id: get_version - uses: battila7/get-version-action@v2 - - name: Run pre-release - uses: micronaut-projects/github-actions/pre-release@master - with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: Publish to Sonatype OSSRH - env: - SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} - SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} - SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} - SECRING_FILE: ${{ secrets.SECRING_FILE }} - RELEASE_VERSION: ${{ steps.get_version.outputs.version-without-v }} - run: | - echo "${SECRING_FILE}" | base64 -d > "${GITHUB_WORKSPACE}/secring.gpg" - echo "Publishing Artifacts for $RELEASE_VERSION" - (set -x; ./gradlew -Pversion="${RELEASE_VERSION}" -Psigning.secretKeyRingFile="${GITHUB_WORKSPACE}/secring.gpg" publishToSonatype closeAndReleaseSonatypeStagingRepository --no-daemon) - - name: Bump patch version by one - uses: actions-ecosystem/action-bump-semver@v1 - id: bump_semver - with: - current_version: ${{steps.get_version.outputs.version-without-v }} - level: patch - - name: Set version in gradle.properties - env: - NEXT_VERSION: ${{ steps.bump_semver.outputs.new_version }} - run: | - echo "Preparing next snapshot" - ./gradlew snapshotVersion -Pversion="${NEXT_VERSION}" - - name: Commit & Push changes - uses: actions-js/push@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - author_name: ${{ secrets.GIT_USER_NAME }} - author_email: $${ secrets.GIT_USER_EMAIL }} - branch: 4.0.x - message: 'Set version to next SNAPSHOT' - - name: Export Gradle Properties - uses: micronaut-projects/github-actions/export-gradle-properties@master - - name: Run post-release - if: success() - uses: micronaut-projects/github-actions/post-release@master - with: - token: ${{ secrets.GITHUB_TOKEN }} + - name: "📥 Checkout repository" + uses: actions/checkout@v4 + - name: "☕️ Setup JDK" + uses: actions/setup-java@v4 + with: + java-version: 8 + distribution: liberica + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "⚙ Run pre-release" + uses: grails/github-actions/pre-release@main + - name: "📤 Publish artifacts to Sonatype" + id: publish_to_sonatype + env: + SECRING_FILE: ${{ secrets.SECRING_FILE }} + SIGNING_KEY: ${{ secrets.SIGNING_KEY_ID }} + SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} + run: | + echo $SECRING_FILE | base64 -d > ${{ github.workspace }}/secring.gpg + ./gradlew --no-build-cache \ + -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg \ + publishToSonatype \ + closeAndReleaseSonatypeStagingRepository + - name: "⚙️ Run post-release" + if: steps.publish_to_sonatype.outcome == 'success' + uses: grails/github-actions/post-release@main \ No newline at end of file diff --git a/.sdkmanrc b/.sdkmanrc new file mode 100644 index 0000000..b4b2dbb --- /dev/null +++ b/.sdkmanrc @@ -0,0 +1 @@ +java=8.0.432-librca \ No newline at end of file diff --git a/build.gradle b/build.gradle index e74f1e9..47640fb 100644 --- a/build.gradle +++ b/build.gradle @@ -1,230 +1,67 @@ buildscript { repositories { - maven { url "https://repo.grails.org/grails/core" } - maven { url "https://plugins.gradle.org/m2" } + maven { url = 'https://repo.grails.org/grails/core' } } dependencies { classpath "org.grails:grails-gradle-plugin:$grailsVersion" - classpath "com.bertramlabs.plugins:asset-pipeline-gradle:3.0.10" - classpath "org.grails.plugins:hibernate5:7.0.4" - classpath "io.github.gradle-nexus:publish-plugin:1.0.0" + classpath "com.bertramlabs.plugins:asset-pipeline-gradle:$assetPipelineVersion" + classpath "io.github.gradle-nexus:publish-plugin:$nexusPublishVersion" } } -group "io.github.gpc" +version = projectVersion +group = 'io.github.gpc' -apply plugin:"eclipse" +apply plugin: 'asset-pipeline' +apply plugin: 'groovy' apply plugin: 'idea' -apply plugin:"org.grails.grails-plugin" -apply plugin:"asset-pipeline" -apply plugin:"org.grails.grails-gsp" -apply plugin: "maven-publish" -apply plugin: "signing" -apply plugin: "io.github.gradle-nexus.publish-plugin" +apply plugin: 'io.github.gradle-nexus.publish-plugin' +apply plugin: 'maven-publish' +apply plugin: 'org.grails.grails-plugin' +apply plugin: 'signing' repositories { - maven { url "https://repo.grails.org/grails/core" } + maven { url = 'https://repo.grails.org/grails/core' } } configurations { - developmentOnly - runtimeClasspath { - extendsFrom developmentOnly - } + integrationTestImplementation.extendsFrom(testImplementation) } dependencies { - developmentOnly("org.springframework.boot:spring-boot-devtools") - 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-web-boot" - compile "org.grails:grails-logging" - compile "org.grails:grails-plugin-rest" - compile "org.grails:grails-plugin-databinding" - compile "org.grails:grails-plugin-i18n" - compile "org.grails:grails-plugin-services" - compile "org.grails:grails-plugin-url-mappings" - compile "org.grails:grails-plugin-interceptors" - compile "org.grails.plugins:cache" - compile "org.grails.plugins:async" - compile "org.grails.plugins:scaffolding" - compile "org.grails.plugins:hibernate5" - compile "org.hibernate:hibernate-core:5.4.18.Final" - compile "org.grails.plugins:mongodb" - compile "org.grails.plugins:gsp" - compile "org.grails.plugins:mail:3.0.0" - // This is needed for the quartz-plugin on grails 4.0.x, https://github.com/grails-plugins/grails-quartz/issues/107#issuecomment-575951471 - compile("org.quartz-scheduler:quartz:2.2.3") { - exclude group: 'slf4j-api', module: 'c3p0' - } - compile ('org.grails.plugins:quartz:2.0.13') - compileOnly "io.micronaut:micronaut-inject-groovy" - console "org.grails:grails-console" - profile "org.grails.profiles:web-plugin" - runtime "org.apache.tomcat:tomcat-jdbc" - runtime "com.bertramlabs.plugins:asset-pipeline-grails:3.0.10" - testCompile "io.micronaut:micronaut-inject-groovy" - testCompile "org.grails:grails-gorm-testing-support" - testCompile "org.mockito:mockito-core" - testCompile "org.grails:grails-web-testing-support" -} - -bootRun { - ignoreExitValue true - jvmArgs( - '-Dspring.output.ansi.enabled=always', - '-noverify', - '-XX:TieredStopAtLevel=1', - '-Xmx1024m') - sourceResources sourceSets.main - String springProfilesActive = 'spring.profiles.active' - systemProperty springProfilesActive, System.getProperty(springProfilesActive) -} - - -tasks.withType(GroovyCompile) { - configure(groovyOptions) { - forkOptions.jvmArgs = ['-Xmx1024m'] - } -} -// enable if you wish to package this plugin as a standalone application -bootJar.enabled = false - -assets { - packagePlugin = true -} - -publishing { - publications { - maven(MavenPublication) { - groupId = project.group - artifactId = 'asynchronous-mail' - version = project.version - - from components.java - artifact sourcesJar - artifact javadocJar - - pom { - name = 'Grails Asynchronous Mail Plugin' - description = 'The plugin realises asynchronous mail sending. It stores messages in a DB and sends them asynchronously by a quartz job.' - url = 'https://github.com/gpc/grails-asynchronous-mail' - licenses { - license { - name = 'The Apache License, Version 2.0' - url = 'https://www.apache.org/licenses/LICENSE-2.0.txt' - } - } - developers { - developer { - id = 'kefirfromperm' - name = 'Vitalii Samolovskikh' - } - developer { - id = 'stokito' - name = 'Sergey Ponomarev' - } - developer { - id = 'ilopmar' - name = 'Iván López' - } - developer { - id = 'burtbeckwith' - name = 'Burt Beckwith' - } - developer { - id = 'puneetbehl' - name = 'Puneet Behl' - } - developer { - id = 'aberbenni' - name = 'Alessandro Berbenni' - } - developer { - id = 'dpcasady' - name = 'Danny Casady' - } - developer { - id = 'SAgrawal14' - name = 'Shashank Agrawal' - } - developer { - id = 'visheshd' - name = 'Vishesh' - } - developer { - id = 'micke-a' - name = 'Mikael Andersson' - } - developer { - id = 'pgdoval' - name = 'Pablo González Doval' - } - developer { - id = 'Uniqen' - name = 'Magnus Dalin' - } - developer { - id = 'demon101' - name = 'Demon' - } - developer { - id = 'matrei' - name = 'Mattias Reichel' - } - } - scm { - connection = 'scm:git:git://github.com/gpc/grails-asynchronous-mail.git' - developerConnection = 'scm:git:ssh://github.com:gpc/grails-asynchronous-mail.git' - url = 'https://github.com/gpc/grails-asynchronous-mail' - } - } - } - } -} - -ext."signing.keyId" = project.findProperty('signing.keyId') ?: System.getenv('SIGNING_KEY_ID') -ext."signing.password" = project.findProperty('signing.password') ?: System.getenv('SIGNING_PASSPHRASE') -ext."signing.secretKeyRingFile" = project.findProperty('signing.secretKeyRingFile') ?: (System.getenv('SIGNING_PASSPHRASE') ?: "${System.getProperty('user.home')}/.gnupg/secring.gpg") - -ext.isReleaseVersion = !version.endsWith("SNAPSHOT") - -afterEvaluate { - signing { - required { isReleaseVersion } - sign publishing.publications.maven - } -} -tasks.withType(Sign) { - onlyIf { isReleaseVersion } + compileOnly 'io.micronaut:micronaut-inject-groovy' + + implementation 'org.grails:grails-core' + implementation 'org.grails:grails-logging' + implementation 'org.grails:grails-plugin-databinding' + implementation 'org.grails:grails-plugin-i18n' + 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:async' + implementation 'org.grails.plugins:cache' + implementation 'org.grails.plugins:gsp' + implementation 'org.grails.plugins:hibernate5' + implementation "org.grails.plugins:mail:$grailsMailVersion" + implementation 'org.grails.plugins:scaffolding' + // This is needed for the quartz-plugin in Grails 4.0.x, https://github.com/grails-plugins/grails-quartz/issues/107#issuecomment-575951471 + implementation("org.quartz-scheduler:quartz:$quartzCoreVersion") { exclude(group: 'slf4j-api', module: 'c3p0') } + implementation "org.grails.plugins:quartz:$grailsQuartzVersion" + + testCompileOnly 'io.micronaut:micronaut-inject-groovy' + + testRuntimeOnly 'com.h2database:h2' + testRuntimeOnly 'org.apache.tomcat:tomcat-jdbc' + + testImplementation 'org.grails:grails-gorm-testing-support' + testImplementation "org.spockframework:spock-core:$spockVersion" + testImplementation 'org.springframework.boot:spring-boot-starter-tomcat' } -nexusPublishing { - repositories { - sonatype { - def ossUser = System.getenv("SONATYPE_USERNAME") ?: project.findProperty('sonatypeOss2Username') ?: '' - def ossPass = System.getenv("SONATYPE_PASSWORD") ?: project.findProperty("sonatypeOss2Password") ?: '' - def ossStagingProfileId = System.getenv("SONATYPE_STAGING_PROFILE_ID") ?: project.findProperty("sonatypeOssStagingProfileIdJms") ?: '' - - nexusUrl = uri("https://s01.oss.sonatype.org/service/local/") - snapshotRepositoryUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/") - username = ossUser - password = ossPass - stagingProfileId = ossStagingProfileId - } - } -} - -task snapshotVersion { - doLast { - if(!project.version.endsWith('-SNAPSHOT')) { - ant.propertyfile(file: "gradle.properties") { - entry(key: "version", value: "${project.version}-SNAPSHOT") - } - } - } -} +apply from: layout.projectDirectory.file('gradle/java-config.gradle') +apply from: layout.projectDirectory.file('gradle/plugin-config.gradle') +apply from: layout.projectDirectory.file('gradle/test-config.gradle') +apply from: layout.projectDirectory.file('gradle/publish-config.gradle') \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 7056c28..a7e9e00 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,18 @@ -version=3.0.1-SNAPSHOT -grailsVersion=4.0.6 -gormVersion=7.0.8.RELEASE +projectVersion=3.0.1-SNAPSHOT +grailsVersion=4.0.13 + +# Build script dependency versions +grailsGradlePluginVersion=5.3.1 +nexusPublishVersion=1.3.0 + +# Project dependency versions +javaVersion=8 +assetPipelineVersion=3.3.4 +grailsMailVersion=3.0.0 +grailsQuartzVersion=2.0.13 +quartzCoreVersion=2.3.2 +spockVersion=1.3-groovy-2.5 + org.gradle.daemon=true org.gradle.parallel=true org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx1024M \ No newline at end of file diff --git a/gradle/java-config.gradle b/gradle/java-config.gradle new file mode 100644 index 0000000..b076345 --- /dev/null +++ b/gradle/java-config.gradle @@ -0,0 +1,5 @@ +java { + sourceCompatibility = JavaVersion.toVersion(javaVersion) + withSourcesJar() + withJavadocJar() +} \ No newline at end of file diff --git a/gradle/plugin-config.gradle b/gradle/plugin-config.gradle new file mode 100644 index 0000000..0de6f7c --- /dev/null +++ b/gradle/plugin-config.gradle @@ -0,0 +1,13 @@ +assets { + packagePlugin = true +} +tasks.named('bootRun') { + enabled = false // Disable the bootRun task, it doesn't work anyway in this plugin +} +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/publish-config.gradle b/gradle/publish-config.gradle new file mode 100644 index 0000000..d2e16f2 --- /dev/null +++ b/gradle/publish-config.gradle @@ -0,0 +1,121 @@ +ext.set('signing.keyId', findProperty('signing.keyId') ?: System.getenv('SIGNING_KEY')) +ext.set('signing.password', findProperty('signing.password') ?: System.getenv('SIGNING_PASSPHRASE')) +ext.set('signing.secretKeyRingFile', findProperty('signing.secretKeyRingFile')) +ext.set('isReleaseVersion', !version.toString().endsWith('SNAPSHOT')) + +def javaComponent = components.named('java') +publishing { + publications { + register('maven', MavenPublication) { + from javaComponent.get() + pom { + name = 'Grails Asynchronous Mail Plugin' + description = 'The plugin realises asynchronous mail sending. It stores messages in a DB and sends them asynchronously by a quartz job.' + url = 'https://github.com/gpc/grails-asynchronous-mail' + licenses { + license { + name = 'The Apache License, Version 2.0' + url = 'https://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + developers { + developer { + id = 'kefirfromperm' + name = 'Vitalii Samolovskikh' + } + developer { + id = 'stokito' + name = 'Sergey Ponomarev' + } + developer { + id = 'ilopmar' + name = 'Iván López' + } + developer { + id = 'burtbeckwith' + name = 'Burt Beckwith' + } + developer { + id = 'puneetbehl' + name = 'Puneet Behl' + } + developer { + id = 'aberbenni' + name = 'Alessandro Berbenni' + } + developer { + id = 'dpcasady' + name = 'Danny Casady' + } + developer { + id = 'SAgrawal14' + name = 'Shashank Agrawal' + } + developer { + id = 'visheshd' + name = 'Vishesh' + } + developer { + id = 'micke-a' + name = 'Mikael Andersson' + } + developer { + id = 'pgdoval' + name = 'Pablo González Doval' + } + developer { + id = 'Uniqen' + name = 'Magnus Dalin' + } + developer { + id = 'demon101' + name = 'Demon' + } + developer { + id = 'matrei' + name = 'Mattias Reichel' + } + } + scm { + connection = 'scm:git:git://github.com/gpc/grails-asynchronous-mail.git' + developerConnection = 'scm:git:ssh://github.com:gpc/grails-asynchronous-mail.git' + url = 'https://github.com/gpc/grails-asynchronous-mail' + } + } + // dependency management shouldn't be included + pom.withXml { + def root = it.asElement() + root.getElementsByTagName('dependencyManagement').each { root.removeChild(it) } + } + } + } +} + +def mavenPublication = publishing.publications.named('maven') +afterEvaluate { + signing { + required = { isReleaseVersion } + sign(mavenPublication.get()) + } +} + +tasks.withType(Sign) { + onlyIf { isReleaseVersion } +} + +nexusPublishing { + repositories { + sonatype { + nexusUrl = uri('https://s01.oss.sonatype.org/service/local') + snapshotRepositoryUrl = uri('https://s01.oss.sonatype.org/content/repositories/snapshots') + username = System.getenv('SONATYPE_USERNAME') + password = System.getenv('SONATYPE_PASSWORD') + stagingProfileId = System.getenv('SONATYPE_STAGING_PROFILE_ID') + } + } +} + +//do not generate extra load on Nexus with new staging repository if signing fails +tasks.named('initializeSonatypeStagingRepository') { + shouldRunAfter = tasks.withType(Sign) +} diff --git a/gradle/test-config.gradle b/gradle/test-config.gradle new file mode 100644 index 0000000..b132b08 --- /dev/null +++ b/gradle/test-config.gradle @@ -0,0 +1,9 @@ +tasks.withType(Test).configureEach { + testLogging { + events 'passed', 'skipped', 'failed' + showExceptions true + exceptionFormat 'full' + showCauses true + showStackTraces true + } +} \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 5028f28..53b9e38 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/grails-app/conf/application.yml b/grails-app/conf/application.yml index 7de06ec..721723b 100644 --- a/grails-app/conf/application.yml +++ b/grails-app/conf/application.yml @@ -1,112 +1,4 @@ ---- grails: profile: web-plugin codegen: - defaultPackage: grails.plugin.asyncmail - gorm: - reactor: - # Whether to translate GORM events into Reactor events - # Disabled by default for performance reasons - events: false -info: - app: - name: '@info.app.name@' - version: '@info.app.version@' - grailsVersion: '@info.app.grailsVersion@' -spring: - jmx: - unique-names: true - main: - banner-mode: "off" - groovy: - template: - check-template-location: false - devtools: - restart: - additional-exclude: - - '*.gsp' - - '**/*.gsp' - - '*.gson' - - '**/*.gson' - - 'logback.groovy' - - '*.properties' -management: - endpoints: - enabled-by-default: false - ---- -grails: - 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 - pdf: application/pdf - 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 - views: - default: - codec: html - gsp: - encoding: UTF-8 - htmlcodec: xml - codecs: - expression: html - scriptlet: html - taglib: none - staticparts: none -management: - endpoints: - jmx: - unique-names: true - ---- - -environments: - test: - quartz: - jdbcStore: false - hibernate: - cache: - queries: false - use_second_level_cache: false - use_query_cache: false - dataSource: - pooled: true - jmxExport: true - driverClassName: org.h2.Driver - username: sa - password: '' - dbCreate: create-drop - url: jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE + defaultPackage: grails.plugin.asyncmail \ 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 ecdab13..0000000 --- a/grails-app/conf/logback.groovy +++ /dev/null @@ -1,36 +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 ) - } -} - -// Enable Asynchronous Mail plugin logging -logger('grails.app.jobs.grails.plugin.asyncmail', TRACE, ['STDOUT'], false) -logger('grails.app.services.grails.plugin.asyncmail', TRACE, ['STDOUT'], false) -logger('grails.plugin.asyncmail', TRACE, ['STDOUT'], false) - -// Enable Quartz plugin logging -logger('grails.plugins.quartz', DEBUG, ['STDOUT'], false) \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 5f4f710..8a3d48d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,28 @@ +plugins { + id 'com.gradle.develocity' version '3.19' + id 'com.gradle.common-custom-user-data-gradle-plugin' version '2.0.2' +} + +def isCI = System.getenv('CI') != null +def isLocal = !isCI +def isAuthenticated = System.getenv('DEVELOCITY_ACCESS_KEY') != null + +develocity { + server = 'https://ge.grails.org' + buildScan { + tag('gpc') + tag('asynchronous-mail') + publishing.onlyIf { isAuthenticated } + uploadInBackground = isLocal + } +} + +buildCache { + local { enabled = isLocal } + remote(develocity.buildCache) { + push = isCI && isAuthenticated + enabled = true + } +} + rootProject.name = 'asynchronous-mail' diff --git a/src/test/groovy/grails/plugin/asyncmail/AsynchronousMailMessageSpec.groovy b/src/test/groovy/grails/plugin/asyncmail/AsynchronousMailMessageSpec.groovy index 28e3d97..3cb0517 100644 --- a/src/test/groovy/grails/plugin/asyncmail/AsynchronousMailMessageSpec.groovy +++ b/src/test/groovy/grails/plugin/asyncmail/AsynchronousMailMessageSpec.groovy @@ -2,6 +2,7 @@ package grails.plugin.asyncmail import grails.testing.gorm.DomainUnitTest import spock.lang.Ignore +import spock.lang.PendingFeature import spock.lang.Specification import static grails.plugin.asyncmail.enums.MessageStatus.* @@ -265,7 +266,6 @@ class AsynchronousMailMessageSpec extends Specification implements DomainUnitTes ).validate() } - @Ignore void "testing message.toString()"() { setup: AsynchronousMailMessage message = new AsynchronousMailMessage( @@ -275,6 +275,6 @@ class AsynchronousMailMessageSpec extends Specification implements DomainUnitTes message.id = 1 expect: - message.toString() == 'grails.plugin.asyncmail.AsynchronousMailMessage(id:1, to:[Mary Smith , carl@example.com], subject:Subject, status:CREATED)' + message.toString() == 'grails.plugin.asyncmail.AsynchronousMailMessage(id:1, subject:Subject, to:[Mary Smith , carl@example.com], status:CREATED)' } } diff --git a/src/test/resources/application-test.yml b/src/test/resources/application-test.yml new file mode 100644 index 0000000..47211a3 --- /dev/null +++ b/src/test/resources/application-test.yml @@ -0,0 +1,15 @@ +quartz: + jdbcStore: false +hibernate: + cache: + queries: false + use_second_level_cache: false + use_query_cache: false +dataSource: + pooled: true + jmxExport: true + driverClassName: org.h2.Driver + username: sa + password: '' + dbCreate: update + url: jdbc:h2:mem:testDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE diff --git a/src/test/resources/logback-test.xml b/src/test/resources/logback-test.xml new file mode 100644 index 0000000..3cca810 --- /dev/null +++ b/src/test/resources/logback-test.xml @@ -0,0 +1,23 @@ + + + + + + + + + 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