Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge v2.0.3 changes to 6.x.x #9

Open
wants to merge 6 commits into
base: 6.x.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/gradle-github-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle

name: Gradle Package

on:
release:
types: [created]

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'zulu'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

- name: Build with Gradle
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
with:
arguments: build

# The USERNAME and TOKEN need to correspond to the credentials environment variables used in
# the publishing section of your build.gradle
- name: Publish to GitHub Packages
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
with:
arguments: publishMavenPublicationToGitHubPackagesRepository
env:
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ Installation

To install just add the plugin to the plugins block of `build.gradle`:

For Grails 6.x.x
```groovy
implementation "io.github.gpc:asynchronous-mail:4.0.0-SNAPSHOT"
```


For Grails 5.x.x
```groovy
implementation "io.github.gpc:asynchronous-mail:3.1.2"
Expand All @@ -35,6 +41,18 @@ For grails 4.0.x
compile "io.github.gpc:asynchronous-mail:3.0.0"
```

For Grails 3.3.x (Via jitpack proxy on github registry packages as for grails 3.3.x support on nexus publish not working)

```groovy
repositories {
maven { url 'https://jitpack.io' }
}
```

```groovy
compile "com.github.gpc:asynchronous-mail:2.0.3"
```

For Grails 3.3.x
```groovy
compile "org.grails.plugins:asynchronous-mail:2.0.2"
Expand Down
82 changes: 73 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
id 'org.grails.grails-gsp'
id 'maven-publish'
id 'signing'
id "com.gorylenko.gradle-git-properties"
}

group = 'io.github.gpc'
Expand Down Expand Up @@ -35,7 +36,7 @@ dependencies {
implementation 'org.grails.plugins:hibernate5'
implementation 'org.hibernate:hibernate-core:5.6.15.Final'
implementation 'org.grails.plugins:gsp'
implementation 'org.grails.plugins:mail:3.0.0'
implementation 'org.grails.plugins:mail:4.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
implementation('org.quartz-scheduler:quartz:2.3.2') { exclude group: 'slf4j-api', module: 'c3p0' }
implementation 'org.grails.plugins:quartz:2.0.13'
Expand All @@ -55,8 +56,6 @@ dependencies {
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
withSourcesJar()
withJavadocJar()
}

tasks.withType(Test).configureEach {
Expand All @@ -65,15 +64,64 @@ tasks.withType(Test).configureEach {

// enable if you wish to package this plugin as a standalone application
bootJar.enabled = false
jar {
enabled = true
archiveClassifier = ''
}

assets {
packagePlugin = true
}

task sourceJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}

task packageJavadoc(type: Jar) {
from javadoc
classifier = 'javadoc'
}

task packageGroovydoc(type: Jar) {
from groovydoc
classifier = 'groovydoc'
}


gitProperties {
keys = ['git.branch', 'git.commit.id', 'git.commit.time', 'git.commit.id.abbrev']
failOnNoGitDirectory = true
extProperty = 'gitProps' // git properties will be put in a map at project.ext.gitProps
}

javadoc {
source = sourceSets.main.allJava
classpath = configurations.compileClasspath
options
{
setMemberLevel JavadocMemberLevel.PUBLIC
setAuthor true

links "https://docs.oracle.com/javase/8/docs/api/"
}
}


generateGitProperties.outputs.upToDateWhen { false } // make sure the generateGitProperties task always executes (even when git.properties is not changed)

jar {
enabled = true
archiveClassifier = ''
dependsOn generateGitProperties
manifest {
attributes("Built-By": System.getProperty("user.name"))
attributes(["Plugin-Version" : version,
"Plugin-Title" : project.name,
"Plugin-Build-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"Git-Commit" : "${-> project.ext.gitProps['git.commit.id.abbrev']}",
"Git-Branch" : "${-> project.ext.gitProps['git.branch']}"])
}
from sourceSets.main.output
exclude 'git.properties'
}

publishing {
publications {
maven(MavenPublication) {
Expand All @@ -82,8 +130,9 @@ publishing {
version = project.version

from components.java
artifact sourcesJar
artifact javadocJar
artifact sourceJar
artifact packageJavadoc
artifact packageGroovydoc

pom {
name = 'Grails Asynchronous Mail Plugin'
Expand Down Expand Up @@ -152,6 +201,10 @@ publishing {
id = 'matrei'
name = 'Mattias Reichel'
}
developer {
id = 'vsachinv'
name = 'Sachin Verma'
}
}
scm {
connection = 'scm:git:git://github.com/gpc/grails-asynchronous-mail.git'
Expand All @@ -161,6 +214,17 @@ publishing {
}
}
}

repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/gpc/grails-asynchronous-mail1"
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
}
}
}
}

ext."signing.keyId" = project.findProperty('signing.keyId') ?: System.getenv('SIGNING_KEY_ID')
Expand Down
1 change: 1 addition & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ dependencies {
implementation 'org.grails.plugins:hibernate5:8.0.1'
implementation 'io.github.gradle-nexus:publish-plugin:1.3.0'
implementation 'com.bertramlabs.plugins:asset-pipeline-gradle:4.4.0'
implementation("com.gorylenko.gradle-git-properties:gradle-git-properties:2.4.2")
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ import org.quartz.TriggerKey
class AsynchronousMailGrailsPlugin extends Plugin {

def grailsVersion = "6.0.0 > *"
def dependsOn = [mail: "* > 4.0.0"]
def loadAfter = ['mail', 'quartz', 'hibernate', 'hibernate3', 'hibernate4', 'hibernate5', 'mongodb']

@Override
Closure doWithSpring() {
{ ->
//noinspection GrUnresolvedAccess
asynchronousMailMessageBuilderFactory(AsynchronousMailMessageBuilderFactory) { it.autowire = true }
asynchronousMailService(AsynchronousMailService) { it.autowire = true }
//noinspection GrUnresolvedAccess
springConfig.addAlias 'asyncMailService', 'asynchronousMailService'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class CompareMessageBuilderSpec extends Specification {

// Remove these methods as they are not part of MailMessageBuilder api and has found to be missing from
// AsynchronousMailMessageBuilder with some versions of groovy which will make the test fail
mbMethods.removeAll { ['getProperty', 'setProperty', 'invokeMethod'].contains(it.name) }
mbMethods.removeAll { ['getProperty', 'setProperty', 'invokeMethod', 'access$0', 'pfaccess$0', 'pfaccess$1'].contains(it.name) }

expect:
mbMethods.every { MetaMethod mbm ->
Expand Down
Loading