-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathpublishing.gradle
112 lines (101 loc) · 2.99 KB
/
publishing.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
import java.text.SimpleDateFormat
Date buildTimeAndDate = new Date()
ext {
buildDate = new SimpleDateFormat('yyyy-MM-dd').format(buildTimeAndDate)
buildTime = new SimpleDateFormat('HH:mm:ss.SSSZ').format(buildTimeAndDate)
}
def projectArtifactId = 'fency'
def isReleaseVersion = !version.endsWith("SNAPSHOT")
jar {
manifest {
attributes(
'Built-By': 'Fency.io',
'Created-By': System.properties['java.version'] + " (" + System.properties['java.vendor'] + " " +
System.properties['java.vm.version'] + ")",
'Build-Date': project.buildDate,
'Build-Time': project.buildTime,
'Specification-Title': projectArtifactId,
'Specification-Version': project.version,
'Implementation-Title': projectArtifactId,
'Implementation-Version': project.version
)
}
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
archiveClassifier = 'sources'
}
task javadocJar(type: Jar) {
from javadoc
archiveClassifier = 'javadoc'
}
artifacts {
archives jar
archives sourcesJar
archives javadocJar
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom {
name = 'Fency'
description = 'Idempotency barrier for RabbitMQ consumers.'
url = 'https://github.com/fencyio/fency'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'ask4gilles'
name = 'Gilles Robert'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:https://github.com/fencyio/fency.git'
developerConnection = 'scm:git:https://github.com/fencyio/fency.git'
url = 'https://github.com/fencyio/fency'
}
}
}
}
repositories {
maven {
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
url = isReleaseVersion ? releasesRepoUrl : snapshotsRepoUrl
credentials {
username = System.getenv('SONATYPE_USERNAME')
password = System.getenv('SONATYPE_PASSWORD')
}
}
}
gradle.taskGraph.whenReady {
taskGraph ->
if (taskGraph.allTasks.any {it instanceof Sign}) {
allprojects {ext."signing.keyId" = "1C1CBBC4"}
allprojects {ext."signing.secretKeyRingFile" = "/home/travis/.gnupg/secring.gpg"}
allprojects {ext."signing.password" = System.getenv('PASSPHRASE')}
}
}
signing {
sign publishing.publications.mavenJava
}
tasks.withType(Sign) {
onlyIf { isReleaseVersion }
}
}