forked from t0xa/gelfj
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbuild.gradle
113 lines (95 loc) · 3.04 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
apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'signing'
group = 'com.github.pukkaone'
sourceCompatibility = 1.7
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compile "ch.qos.logback:logback-classic:1.2.3"
compile "com.fasterxml.jackson.core:jackson-databind:2.8.5"
compile "com.rabbitmq:amqp-client:3.6.3"
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:2.2.29'
}
// Gets version from tag.
def readVersion() {
def output = new ByteArrayOutputStream()
def result = exec {
commandLine = ['git', 'describe']
standardOutput = output
ignoreExitValue = true
}
def version = (result.getExitValue() == 0) ?
output.toString().trim() : 'UNKNOWN'
println "Version ${version}"
return version
}
def assignVersion() {
project.version = readVersion()
project.ext.isReleaseVersion = project.version.find(/^[^-]+-\d+-g.+/) == null
}
afterEvaluate { project ->
assignVersion()
jar {
manifest {
attributes('Implementation-Version': project.version)
}
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from 'build/docs/javadoc'
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives jar
archives javadocJar
archives sourcesJar
}
signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
uploadArchives {
if (project.hasProperty("sonatypeUsername") && project.hasProperty("sonatypePassword")) {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
pom.project {
name 'logback-gelf'
packaging 'jar'
description 'Logback appender that sends GELF messages'
url 'https://github.com/pukkaone/logback-gelf'
scm {
connection 'scm:git:git@github.com:pukkaone/logback-gelf.git'
developerConnection 'scm:git:git@github.com:pukkaone/logback-gelf.git'
url 'https://github.com/pukkaone/logback-gelf'
}
licenses {
license {
name 'MIT License'
url 'http://opensource.org/licenses/MIT'
distribution 'repo'
}
}
developers {
developer {
id 'pukkaone'
name 'Chin Huang'
}
}
}
}
}
}
}