-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
109 lines (93 loc) · 3.09 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
plugins {
kotlin("jvm") version "1.7.20"
id("java-library")
jacoco
java
id("org.jetbrains.kotlin.plugin.serialization") version "1.7.20"
id("maven-publish")
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
withJavadocJar()
withSourcesJar()
}
group = "io.github.rtmigo"
version = "0.1.8" // -SNAPSHOT
publishing {
publications {
create<MavenPublication>("dec") {
from(components["java"])
pom {
this.properties.put("java.version", "11")
//this.properties.put("maven.compiler.target", "11")
//this.properties.put("maven.compiler.source", "11")
val github = "https://github.com/rtmigo/dec_kt"
name.set("dec")
description.set("64-bit decimal floating-point number. " +
"Kotlin wrapper for Java BigDecimal.")
url.set(github)
organization {
this.name.set("Revercode")
this.url.set("https://revercode.com")
}
developers {
developer {
name.set("Artsiom iG")
email.set("ortemeo@gmail.com")
}
}
scm {
url.set(github)
connection.set(github.replace("https:", "scm:git:"))
}
licenses {
license {
name.set("ISC License")
url.set("$github/blob/HEAD/LICENSE")
}
}
}
}
}
}
repositories {
mavenCentral()
}
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1")
testImplementation(kotlin("test"))
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.0")
testImplementation("io.kotest:kotest-assertions-core:5.5.1")
}
tasks.jacocoTestReport {
dependsOn(tasks.test) // tests are required to run before generating JaCoCo report
}
tasks.test {
useJUnitPlatform()
finalizedBy(tasks.jacocoTestReport) // JaCoCo report is always generated after tests run
}
tasks.register("updateReadmeVersion") {
doFirst {
// найдем что-то вроде "io.github.rtmigo:dec:0.0.1"
// и поменяем на актуальную версию
val readmeFile = project.rootDir.resolve("README.md")
val prefixToFind = "io.github.rtmigo:dec:"
val regex = """(?<=${Regex.escape(prefixToFind)})[0-9\.+]+""".toRegex()
val oldText = readmeFile.readText()
val newText = regex.replace(oldText, project.version.toString())
if (newText!=oldText)
readmeFile.writeText(newText)
}
}
tasks.build {
dependsOn("updateReadmeVersion")
}
tasks.jacocoTestReport {
reports {
xml.required.set(false)
csv.required.set(true)
}
}