-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathbuild.gradle
110 lines (91 loc) · 2.62 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
plugins {
id "java"
id "maven"
id "signing"
}
group "io.github.jamsesso"
version "1.0.10-SNAPSHOT"
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile "com.google.code.gson:gson:2.8.5"
testCompile "junit:junit:4.12"
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = "javadoc"
from javadoc.destinationDir
}
task sourcesJar(type: Jar) {
classifier = "sources"
from sourceSets.main.allSource
}
test {
testLogging {
events "passed", "skipped", "failed"
exceptionFormat "full"
showStandardStreams = true
}
}
artifacts {
archives jar, javadocJar, sourcesJar
}
def getSonatypeUsername() {
return System.getenv('SONATYPE_USERNAME')
}
def getSonatypePassword() {
return System.getenv('SONATYPE_PASSWORD')
}
def hasCredentials() {
def result = getSonatypeUsername() != null && getSonatypePassword() != null
if (!result) {
println "Cannot publish package since Sonatype credentials are not set. Please set SONATYPE_USERNAME and SONATYPE_PASSWORD environment variables."
}
return result
}
signing {
required { gradle.taskGraph.hasTask("uploadArchives") }
useInMemoryPgpKeys(System.getenv('SIGNING_KEY'), System.getenv('SIGNING_PASSWORD'))
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: getSonatypeUsername(), password: getSonatypePassword())
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: getSonatypeUsername(), password: getSonatypePassword())
}
pom.project {
name "json-logic-java"
artifactId "json-logic-java"
packaging "jar"
description "A native Java implementation of the json-logic project"
url "https://github.com/jamsesso/json-logic-java"
scm {
connection "scm:[email protected]:jamsesso/json-logic-java.git"
developerConnection "scm:[email protected]:jamsesso/json-logic-java.git"
url "https://github.com/jamsesso/json-logic-java.git"
}
licenses {
license {
name "MIT License"
url "https://github.com/jamsesso/json-logic-java/blob/master/LICENSE"
}
}
developers {
developer {
id "jamsesso"
name "Sam Jesso"
email "[email protected]"
}
}
}
}
}
onlyIf { hasCredentials() }
}