-
Notifications
You must be signed in to change notification settings - Fork 29
/
build.gradle
178 lines (158 loc) · 5.06 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
plugins {
id 'java-library'
id 'signing'
id 'maven-publish'
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
id 'io.codearte.nexus-staging' version '0.21.2'
id 'com.gradle.build-scan' version '2.3'
id 'io.freefair.lombok' version '3.8.1'
id "org.sonarqube" version "3.3"
id 'jacoco'
id "org.owasp.dependencycheck" version "7.1.0.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.30'
implementation 'org.apache.httpcomponents:httpclient:4.5.13'
implementation 'org.apache.commons:commons-lang3:3.11'
implementation 'javax.validation:validation-api:2.0.1.Final'
implementation 'org.apache.httpcomponents:httpmime:4.5.13'
testImplementation(platform('org.junit:junit-bom:5.7.2'))
testImplementation('org.junit.jupiter:junit-jupiter')
testImplementation("org.junit.jupiter:junit-jupiter-params")
testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'org.mockito:mockito-inline:3.11.2'
testImplementation 'org.mockito:mockito-junit-jupiter:3.11.2'
testImplementation 'org.apache.logging.log4j:log4j-api:2.17.1'
testImplementation 'org.apache.logging.log4j:log4j-core:2.17.1'
testImplementation 'org.apache.logging.log4j:log4j-slf4j-impl:2.17.1'
}
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
}
test {
systemProperty "org.slf4j.simpleLogger.defaultLogLevel", "INFO"
useJUnitPlatform()
testLogging {
events "passed", "failed", "skipped", "standardError"
showStandardStreams = true
}
finalizedBy jacocoTestReport
}
jacocoTestReport {
dependsOn test
reports {
xml.enabled true
}
}
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"
packageGroup = "com.checkout"
numberOfRetries = 100
delayBetweenRetriesInMillis = 5000
}
nexusPublishing {
connectTimeout = Duration.ofMinutes(15)
clientTimeout = Duration.ofMinutes(15)
repositories {
sonatype {
packageGroup = rootProject.nexusStaging.packageGroup
stagingProfileId = rootProject.nexusStaging.stagingProfileId
username = rootProject.nexusStaging.username
password = rootProject.nexusStaging.password
}
}
}
signing {
def signingKey = System.getenv('GPG_KEY')
def signingPassword = System.getenv('GPG_PASSPHRASE')
required { signingKey != null && signingPassword != null && gradle.taskGraph.hasTask("publish") }
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}
jar {
manifest {
attributes 'Implementation-Title': 'checkout-sdk-java',
'Implementation-Version': archiveVersion.get()
}
}
sonarqube {
properties {
property "sonar.projectKey", "checkout_checkout-sdk-java"
property "sonar.organization", "checkout-ltd"
property "sonar.host.url", "https://sonarcloud.io"
}
}
tasks.withType(Test) {
// a collection to track failedTests
ext.failedTests = []
afterTest { descriptor, result ->
if (result.resultType == TestResult.ResultType.FAILURE) {
String failedTest = "${descriptor.className}::${descriptor.name}"
logger.debug("Adding " + failedTest + " to failedTests...")
failedTests << [failedTest]
}
}
afterSuite { suite, result ->
if (!suite.parent) { // will match the outermost suite
// logs each failed test
if (!failedTests.empty) {
logger.lifecycle("Failed tests:")
failedTests.each { failedTest ->
logger.lifecycle("${failedTest}")
}
}
}
}
}