-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
139 lines (119 loc) · 4.67 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
139 lines (119 loc) · 4.67 KB
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
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
java
id("com.github.ben-manes.versions") version Versions.VERSIONS_PLUGIN
id("org.jlleitschuh.gradle.ktlint") version Versions.KTLINT_PLUGIN
kotlin("jvm") version Versions.KOTLIN
kotlin("plugin.serialization") version Versions.KOTLIN
id("signing")
id("com.vanniktech.maven.publish") version Versions.MAVEN_PUBLISH
}
group = "io.newm"
version = "2.7.1-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_21
java.targetCompatibility = JavaVersion.VERSION_21
repositories {
mavenLocal()
mavenCentral()
maven {
name = "jitpack.io"
url = uri("https://jitpack.io")
}
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${Versions.KOTLIN}")
implementation("io.ktor:ktor-client-websockets:${Versions.KTOR}")
implementation("io.ktor:ktor-client-cio-jvm:${Versions.KTOR}")
implementation("commons-logging:commons-logging:${Versions.COMMONS_LOGGING}")
implementation("ch.qos.logback:logback-classic:${Versions.LOGBACK}")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.COROUTINES}")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:${Versions.COROUTINES}")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:${Versions.KOTLINX_SERIALIZATION}")
implementation("org.apache.commons:commons-numbers-fraction:${Versions.COMMONS_NUMBERS}")
testImplementation("io.mockk:mockk:${Versions.MOCKK}")
testImplementation("com.google.truth:truth:${Versions.GOOGLE_TRUTH}")
testImplementation("org.junit.jupiter:junit-jupiter:${Versions.JUNIT}")
testImplementation("org.junit.jupiter:junit-jupiter-engine:${Versions.JUNIT}")
testImplementation("org.junit.platform:junit-platform-launcher:${Versions.JUNIT_PLATFORM}")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${Versions.COROUTINES}")
}
ktlint {
version.set(Versions.KTLINT)
}
signing {
useGpgCmd()
}
mavenPublishing {
publishToMavenCentral()
signAllPublications()
coordinates("io.newm", "kogmios", version.toString())
pom {
name.set("Kogmios")
description.set("Kotlin Wrapper for Ogmios")
url.set("https://github.com/projectNEWM/kogmios")
licenses {
license {
name.set("Apache 2.0")
url.set("https://github.com/projectNEWM/kogmios/blob/master/LICENSE")
distribution.set("https://github.com/projectNEWM/kogmios/blob/master/LICENSE")
}
}
developers {
developer {
id.set("AndrewWestberg")
name.set("Andrew Westberg")
email.set("andrewwestberg@gmail.com")
organization.set("NEWM")
organizationUrl.set("https://newm.io")
}
}
scm {
connection.set("scm:git:git://github.com/projectNEWM/kogmios.git")
developerConnection.set("scm:git:ssh://github.com/projectNEWM/kogmios.git")
url.set("https://github.com/projectNEWM/kogmios")
}
}
}
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.withType<DependencyUpdatesTask> {
rejectVersionIf {
isNonStable(candidate.version) && !isNonStable(currentVersion)
}
filterConfigurations = Spec<Configuration> {
// println("checking ${it.name}")
it.name.contains("ktlint", ignoreCase = true).not()
}
}
project.tasks.withType<org.jetbrains.kotlin.gradle.tasks.UsesKotlinJavaToolchain>().configureEach {
val service = project.extensions.getByType<JavaToolchainService>()
val customLauncher =
service.launcherFor {
this.languageVersion.set(JavaLanguageVersion.of(JavaVersion.VERSION_17.majorVersion))
}
this.kotlinJavaToolchain.toolchain.use(customLauncher)
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions {
freeCompilerArgs =
listOf(
"-Xjsr305=strict",
"-opt-in=kotlin.RequiresOptIn",
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi",
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-opt-in=kotlin.time.ExperimentalTime",
)
jvmTarget.set(JvmTarget.JVM_21)
}
}
tasks.withType<Test> {
maxHeapSize = "8192m"
}