-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
114 lines (98 loc) · 3.07 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
import com.diffplug.gradle.spotless.SpotlessExtension
plugins {
id("maven-publish")
id("com.diffplug.spotless") version "6.25.0"
`java-library`
kotlin("jvm") version "1.9.24"
}
repositories {
mavenCentral()
}
version = "0.0.1-SNAPSHOT"
dependencies {
// Coroutines
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1")
// Serialization
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.17.1")
// Retrofit
api("com.squareup.okhttp3:okhttp:4.12.0")
api("com.squareup.retrofit2:retrofit:2.11.0")
api("com.squareup.retrofit2:converter-jackson:2.11.0")
// Tests
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.10.2")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.8.1")
testImplementation("com.squareup.okhttp3:mockwebserver:4.12.0")
testImplementation("io.mockk:mockk:1.13.11")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
tasks.named<Test>("test") {
useJUnitPlatform()
}
tasks.jar {
archiveFileName.set("${project.name}-${project.version}.jar")
manifest {
attributes(
"Implementation-Title" to project.name,
"Implementation-Version" to project.version,
)
}
from(
configurations.runtimeClasspath
.get()
.filter { it.exists() }
.map { if (it.isDirectory) it else zipTree(it) },
)
exclude("META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA", "META-INF/LICENSE.txt")
includeEmptyDirs = false
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
publishing {
publications {
create<MavenPublication>("maven") {
groupId = "com.yonatankarp"
artifactId = project.name
version = project.version.toString()
from(components["java"])
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/yonatankarp/cat-fact-client")
credentials {
username = project.findProperty("gpr.user")?.toString() ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.key")?.toString() ?: System.getenv("GITHUB_TOKEN")
}
}
}
}
}
configure<SpotlessExtension> {
kotlin {
target(
fileTree(".") {
include("**/*.kt")
exclude("**/.gradle/**")
},
)
// see https://github.com/shyiko/ktlint#standard-rules
ktlint()
}
kotlinGradle {
target(
fileTree(".") {
include("**/*.gradle.kts")
exclude("**/.gradle/**")
},
)
trimTrailingWhitespace()
ktlint()
}
}
tasks.findByName("spotlessKotlinGradle")?.dependsOn("spotlessKotlin")
tasks.findByName("spotlessKotlin")?.dependsOn("compileKotlin")