-
Notifications
You must be signed in to change notification settings - Fork 28
/
build.gradle
120 lines (104 loc) · 3.36 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
plugins {
id 'java-library'
id 'signing'
id 'de.marcphilipp.nexus-publish' version '0.2.0'
id 'io.codearte.nexus-staging' version '0.21.0'
id 'com.gradle.build-scan' version '2.3'
id 'io.freefair.lombok' version '3.8.1'
}
allprojects {
repositories {
mavenLocal()
mavenCentral()
}
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'org.slf4j:slf4j-api:1.7.26'
testCompile 'junit:junit:4.12'
testCompile 'org.slf4j:slf4j-simple:1.7.26'
}
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
}
test {
environment "CHECKOUT_PUBLIC_KEY", System.getenv("CHECKOUT_PUBLIC_KEY")
environment "CHECKOUT_SECRET_KEY", System.getenv("CHECKOUT_SECRET_KEY")
systemProperty "org.slf4j.simpleLogger.defaultLogLevel", "DEBUG"
}
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
archiveClassifier = 'sources'
}
task javadocJar(type: Jar) {
from javadoc
archiveClassifier = 'javadoc'
}
publishing {
publications {
mavenJava(MavenPublication) {
from(components.java)
artifact sourcesJar
artifact javadocJar
pom {
name = project_name
packaging = 'jar'
description = project_description
url = project_url
scm {
connection = project_scm
developerConnection = project_scm
url = project_url
}
licenses {
license {
name = project_license_slug
url = project_license_url
}
}
developers {
developer {
id = project_developer
name = project_developer
}
}
}
}
}
}
nexusStaging {
username = System.getenv("SONATYPE_USERNAME")
password = System.getenv("SONATYPE_PASSWORD")
stagingProfileId = "57cde3b2433ed7"
}
signing {
sign publishing.publications.mavenJava
}
javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.allTasks.any { it instanceof Sign }) {
allprojects {
ext."signing.keyId" = System.getenv('GPG_KEY_ID')
ext."signing.secretKeyRingFile" = System.getenv('GPG_KEY_LOCATION')
ext."signing.password" = System.getenv('GPG_PASSPHRASE')
}
}
// Do not sign archives by default (a local build without gpg keyring should succeed)
if (taskGraph.allTasks.any { it.name == 'build' || it.name == 'assemble' }) {
tasks.findAll {
it.name == 'signArchives' || it.name == 'signDocsJar' || it.name == 'signTestJar'
}.each { task ->
task.enabled = false
}
}
if (taskGraph.hasTask(test) && (System.getenv('CHECKOUT_PUBLIC_KEY') == null || System.getenv('CHECKOUT_SECRET_KEY') == null)) {
throw new GradleException("Please ensure both the CHECKOUT_PUBLIC_KEY and CHECKOUT_SECRET_KEY environment variables are set in order to run the tests against the Checkout Sandbox.")
}
}