-
Notifications
You must be signed in to change notification settings - Fork 12
/
build.gradle.kts
188 lines (162 loc) · 5.83 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
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
179
180
181
182
183
184
185
186
187
188
import com.jfrog.bintray.gradle.BintrayExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
val githubUsername = "snowe2010"
val repoName = "pretty-print"
repositories {
// jcenter()
mavenCentral()
maven(url = "https://oss.sonatype.org/content/repositories/snapshots/")
}
plugins {
`maven-publish`
`java-library`
jacoco
id("com.jfrog.bintray") version "1.8.5"
kotlin("jvm") version "1.6.0"
id("info.solidsoft.pitest") version "1.7.0"
}
println("+++++++${System.getenv("RELEASE_VERSION")}++++++")
group = "com.tylerthrailkill.helpers"
description = "Pretty printing of objects"
version = Ci.publishVersion
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(kotlin("reflect"))
testImplementation(kotlin("test"))
testImplementation(kotlin("test-junit5"))
implementation("com.ibm.icu:icu4j:63.1")
// logging
implementation(group = "ch.qos.logback", name = "logback-classic", version = "1.3.0-alpha10")
implementation(group = "org.slf4j", name = "slf4j-simple", version = "1.7.32")
implementation("io.github.microutils:kotlin-logging:2.0.11")
testImplementation("info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.7.0")
testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0")
testImplementation("io.mockk:mockk:1.12.3")
testImplementation("com.beust:klaxon:5.5") // used to parse naughty list
testImplementation("org.junit.platform:junit-platform-engine:1.8.1")
testImplementation("io.kotest:kotest-runner-junit5:4.6.3") // for kotest framework
testImplementation("io.kotest:kotest-plugins-pitest:4.4.3")
}
tasks {
withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
withType<Wrapper> {
distributionType = Wrapper.DistributionType.ALL
}
withType<Test> {
useJUnitPlatform {}
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).takeIf { it > 0 } ?: 1
}
val report = withType<JacocoReport> {
reports {
xml.apply {
isEnabled = true
this.destination = file("$buildDir/jacoco/report.xml")
}
html.apply {
isEnabled = true
this.destination = file("$buildDir/jacoco/html_report")
}
}
dependsOn("test")
}
this["check"].dependsOn(report)
}
sourceSets.test {
java.srcDirs("src/test/kotlin")
}
configure<info.solidsoft.gradle.pitest.PitestPluginExtension> {
testPlugin.set("Kotest") // <-- Telling Pitest that we're using Kotest
targetClasses.set(listOf("com.tylerthrailkill.*"))
// avoidCallsTo.set(listOf("java.util.logging", "org.apache.log4j", "org.slf4j", "org.apache.commons.logging", "mu"))
}
java {
withSourcesJar()
withJavadocJar()
}
jacoco {
toolVersion = "0.8.7"
}
/**
* Publishing
*/
bintray {
user = findProperty("bintrayUser") as String? ?: System.getenv("BINTRAY_USERNAME")
key = findProperty("bintrayKey") as String? ?: System.getenv("BINTRAY_API_KEY")
override = true
this.setPublications("release")
with(pkg) {
userOrg = "snowe"
repo = "maven"
name = "Pretty-Print"
desc = "Pretty printing of objects"
setLicenses("MIT")
websiteUrl = "https://github.com/$githubUsername/${project.name}"
issueTrackerUrl = "https://github.com/$githubUsername/${project.name}/issues"
vcsUrl = "https://github.com/$githubUsername/${project.name}.git"
setLabels("kotlin")
with(version) {
this.name = Ci.publishVersion
with(gpg) {
sign = true
passphrase = findProperty("gpgPassphrase") as String? ?: System.getenv("GPG_PASSPHRASE")
}
with(mavenCentralSync) {
user = findProperty("sonatypeUser") as String?
?: System.getenv("OSSRH_USERNAME") //OSS user token: mandatory
password = findProperty("sonatypePassword") as String?
?: System.getenv("OSSRH_PASSWORD") //OSS user password: mandatory
}
}
}
dryRun = false
publish = true
}
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/$githubUsername/$repoName")
credentials {
username = System.getenv("GITHUB_USERNAME") ?: project.findProperty("gpr.user") as String?
password = System.getenv("GITHUB_TOKEN") ?: project.findProperty("gpr.key") as String?
}
}
}
publications {
register<MavenPublication>("release") {
from(components["java"])
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
}
}
publications.withType<MavenPublication>().forEach {
it.apply {
pom {
name.set(repoName)
description.set("Pretty printing of objects")
url.set("http://www.github.com/$githubUsername/$repoName")
scm {
connection.set("scm:git:http://www.github.com/$githubUsername/$repoName")
developerConnection.set("scm:git:https://github.com/$githubUsername/")
url.set("http://www.github.com/snowe2010/$repoName/")
}
licenses {
license {
name.set("MIT")
url.set("https://opensource.org/licenses/MIT")
}
}
developers {
developer {
id.set("snowe")
name.set("Tyler Thrailkill")
email.set("[email protected]")
}
}
}
}
}
}