-
Notifications
You must be signed in to change notification settings - Fork 41
/
build.gradle
168 lines (146 loc) Β· 4.57 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
plugins {
id "jacoco"
id "java-library"
id "maven-publish"
id "org.sonarqube" version "4.3.0.3225"
id "com.diffplug.spotless" version "6.19.0"
id "io.github.gradle-nexus.publish-plugin" version "1.3.0"
}
repositories {
mavenLocal()
mavenCentral()
}
group = groupId
var ver = System.getenv().getOrDefault("RELEASE_VERSION", artifactVersion)
version = ver.startsWith("v") ? ver.substring(1) : ver
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
dependencies {
compileOnly "org.jetbrains:annotations:23.0.0"
implementation "io.goodforgod:gson-configuration:2.0.0"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.9.3"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.9.3"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.9.3"
}
test {
failFast(false)
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
exceptionFormat("full")
showStandardStreams(false)
}
reports {
html.required = false
junitXml.required = true
}
environment([
"": "",
])
}
spotless {
java {
encoding("UTF-8")
importOrder()
removeUnusedImports()
eclipse("4.21").configFile("${rootDir}/config/codestyle.xml")
}
}
sonarqube {
properties {
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.organization", "goodforgod"
property "sonar.projectKey", "GoodforGod_$artifactId"
}
}
nexusPublishing {
packageGroup = groupId
repositories {
sonatype {
username = System.getenv("OSS_USERNAME")
password = System.getenv("OSS_PASSWORD")
nexusUrl.set(uri("https://oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://oss.sonatype.org/content/repositories/snapshots/"))
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
name = "Java Etherscan API"
url = "https://github.com/GoodforGod/$artifactId"
description = "Library is a wrapper for EtherScan API."
license {
name = "MIT License"
url = "https://github.com/GoodforGod/$artifactId/blob/master/LICENSE"
distribution = "repo"
}
developer {
id = "GoodforGod"
name = "Anton Kurako"
email = "goodforgod.dev@gmail.com"
url = "https://github.com/GoodforGod"
}
scm {
connection = "scm:git:git://github.com/GoodforGod/${artifactId}.git"
developerConnection = "scm:git:ssh://GoodforGod/${artifactId}.git"
url = "https://github.com/GoodforGod/$artifactId/tree/master"
}
}
}
}
repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username System.getenv("OSS_USERNAME")
password System.getenv("OSS_PASSWORD")
}
}
if (!version.endsWith("SNAPSHOT")) {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/GoodforGod/$artifactId"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
}
java {
withJavadocJar()
withSourcesJar()
}
tasks.withType(JavaCompile) {
options.encoding("UTF-8")
options.incremental(true)
options.fork = true
}
check.dependsOn jacocoTestReport
jacocoTestReport {
reports {
xml.required = true
html.destination file("${buildDir}/jacocoHtml")
}
}
javadoc {
options.encoding = "UTF-8"
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption("html5", true)
}
}
if (project.hasProperty("signingKey")) {
apply plugin: "signing"
signing {
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}
}