-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
118 lines (104 loc) · 2.85 KB
/
build.gradle.kts
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
import java.io.ByteArrayOutputStream
import java.util.Properties
buildscript {
repositories {
jcenter()
}
dependencies {
classpath("com.opencsv:opencsv:4.5")
}
}
plugins {
java
jacoco
maven
`maven-publish`
id("com.diffplug.gradle.spotless") version "3.21.1"
}
repositories {
jcenter()
}
dependencies {
implementation("org.json:json:20180130")
implementation("org.apache.httpcomponents:httpclient:4.5.10")
implementation("org.slf4j:slf4j-api:1.7.29")
testImplementation("org.testng:testng:6.14.2")
testImplementation("org.mockito:mockito-core:2.18.3")
testImplementation("ch.qos.logback:logback-classic:1.2.3")
testImplementation("commons-io:commons-io:2.6")
}
project.group = "ru.rambler.usermodel"
spotless {
java {
importOrderFile("spotless.importorder")
eclipse().configFile("spotless.eclipseformat.xml")
custom("Lambda fix", {
it.replace("} )", "})")
.replace("} ,", "},")
})
custom("Long literal fix", {
it.replace(Regex("([0-9_]+) [Ll]"), "$1L")
})
}
}
fun make_version(): String {
val stdout = ByteArrayOutputStream()
exec {
executable("bash")
args(
"-c",
"git describe --always --tags | sed -r \'s/^(.*)-(.*)-(.*)/\\1.\\2-\\3/\'"
)
standardOutput = stdout
}
return stdout.toString().trim()
}
project.version = make_version()
tasks.named<Task>("build"){
dependsOn("spotlessCheck")
}
tasks.test {
onlyIf { project.hasProperty("integration.test.props") }
useTestNG()
options {
systemProperties(
Properties().run {
load(file(project.properties.getOrDefault("integration.test.props", "test.properties") as String).inputStream())
toMap()
} as Map<String, Any>
)
}
}
jacoco {
toolVersion = "0.8.1"
}
tasks.jacocoTestReport {
reports {
xml.isEnabled = false
csv.isEnabled = true
html.isEnabled = true
html.destination = file("$buildDir/jacocoHtml")
}
}
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/rambler-digital-solutions/java-webhdfs")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") as String? ?: System.getenv("PASSWORD")
}
}
}
publications {
publications {
create<MavenPublication>("maven") {
groupId = project.group as String
artifactId = project.name
version = project.version as String
from(components["java"])
}
}
}
}