-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
140 lines (121 loc) · 3.93 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
plugins {
id 'groovy'
id 'maven-publish'
id 'signing'
}
targetCompatibility = 1.8
sourceCompatibility = 1.8
group = 'com.github.chubbard'
version = '0.1.0'
//version = '0.1.0-SNAPSHOT'
description = """
GroovyMail aims to replace using JavaMail as the API to send email in Groovy by
building a domain specific language (DSL) on top of JavaMail to make
sending email simpler.
"""
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.4.15'
//compile group: 'javax.mail', name: 'javax.mail-api', version: '1.6.2'
compile "com.sun.mail:javax.mail:1.6.2"
compile 'org.slf4j:slf4j-api:1.8.0-beta2'
// Use the awesome Spock testing and specification framework
testCompile 'org.spockframework:spock-core:1.1-groovy-2.4'
testCompile 'org.slf4j:slf4j-log4j12:1.8.0-beta2'
}
repositories {
mavenCentral()
}
publishing {
publications {
groovymail(MavenPublication) {
from components.java
pom {
name = project.name
description = project.description
url = 'https://github.com/chubbard/groovymail'
licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
id = "chubbard"
name = "Charlie Hubbard"
email = "groovymail@fuseanalytics.com"
}
}
scm {
connection = "https://github.com/chubbard/groovymail.git"
developerConnection = "scm:https://github.com/chubbard/groovymail.git"
url = "https://github.com/chubbard/groovymail.git"
}
}
pom.withXml {
def pomFile = file("${project.buildDir}/generated-pom.xml")
writeTo(pomFile)
def pomAscFile = signing.sign(pomFile).signatureFiles[0]
artifact(pomAscFile) {
classifier = null
extension = 'pom.asc'
}
}
// create the signed artifacts
project.tasks.signArchives.signatureFiles.each {
artifact(it) {
def matcher = it.file =~ /-(sources|javadoc|groovydoc)\.zip\.asc$/
if (matcher.find()) {
classifier = matcher.group(1)
} else {
classifier = null
}
extension = 'jar.asc'
}
}
}
}
repositories {
maven {
url project.version.endsWith('-SNAPSHOT') ? "https://oss.sonatype.org/content/repositories/snapshots/" : "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username sonatypeUsername
password sonatypePassword
}
}
mavenLocal()
}
}
task sourceJar(type: Jar) {
classifier "sources"
extension 'zip'
from sourceSets.main.allSource
}
task groovydocJar(type: Jar, dependsOn: groovydoc ) {
classifier 'groovydoc'
extension 'zip'
from groovydoc.destinationDir
}
artifacts {
archives jar
archives groovydocJar
archives sourceJar
}
signing {
required { !version.endsWith("SNAPSHOT") && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
model {
tasks.generatePomFileForGroovymailPublication {
destination = file("$buildDir/generated-pom.xml")
}
tasks.publishGroovymailPublicationToMavenLocal {
dependsOn project.tasks.signArchives
}
tasks.publishGroovymailPublicationToMavenRepository {
dependsOn project.tasks.signArchives
}
}
task wrapper(type: Wrapper) {
gradleVersion = '4.9'
}