-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
234 lines (204 loc) · 7.34 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
234 lines (204 loc) · 7.34 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
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
// SPDX-FileCopyrightText: 2025 Deutsche Telekom AG and others
//
// SPDX-License-Identifier: Apache-2.0
import com.vanniktech.maven.publish.SonatypeHost
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
import java.io.BufferedReader
import java.io.InputStreamReader
import java.lang.System.getenv
import java.net.URI
group = "org.eclipse.lmos"
version = project.findProperty("version") as String
val ignoreKtLint = setOf("arc-result", "arc-azure-client")
plugins {
kotlin("jvm") version "2.2.21" apply false
kotlin("plugin.serialization") version "2.2.21" apply false
id("org.jetbrains.dokka") version "2.1.0"
id("org.cyclonedx.bom") version "2.3.1"
// id("org.jlleitschuh.gradle.ktlint") version "12.2.0"
id("org.jetbrains.kotlinx.kover") version "0.9.1"
id("net.researchgate.release") version "3.1.0"
id("com.vanniktech.maven.publish") version "0.31.0"
}
subprojects {
group = "org.eclipse.lmos"
apply(plugin = "org.jetbrains.dokka")
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "kotlinx-serialization")
//if (!ignoreKtLint.contains(project.name)) apply(plugin = "org.jlleitschuh.gradle.ktlint")
apply(plugin = "org.jetbrains.kotlinx.kover")
apply(plugin = "com.vanniktech.maven.publish")
java {
sourceCompatibility = JavaVersion.VERSION_21
}
// currently ktlint has issues with context parameters.
// if (!ignoreKtLint.contains(project.name)) {
// configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
// debug.set(true)
// }
// }
tasks.withType<KotlinJvmCompile>().configureEach {
compilerOptions {
freeCompilerArgs.addAll(listOf("-Xcontext-parameters", "-Xjsr305=strict"))
jvmTarget = JvmTarget.fromTarget("21")
}
}
// Needed for gradle 9
tasks.withType<AbstractTestTask>().configureEach {
failOnNoDiscoveredTests = false
}
tasks.withType<Test> {
useJUnitPlatform()
}
val javadocJar: TaskProvider<Jar> by tasks.registering(Jar::class) {
dependsOn(tasks.dokkaJavadoc)
from(tasks.dokkaJavadoc.flatMap { it.outputDirectory })
archiveClassifier.set("javadoc")
}
if (project.name != "arc-gradle-plugin") {
mavenPublishing {
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)
signAllPublications()
pom {
name = "ARC"
description = "ARC is an AI framework."
url = "https://github.com/eclipse-lmos/arc"
licenses {
license {
name = "Apache-2.0"
distribution = "repo"
url = "https://github.com/eclipse-lmos/arc/blob/main/LICENSES/Apache-2.0.txt"
}
}
developers {
developer {
id = "pat"
name = "Patrick Whelan"
email = "opensource@telekom.de"
}
developer {
id = "bharat_bhushan"
name = "Bharat Bhushan"
email = "opensource@telekom.de"
}
developer {
id = "merrenfx"
name = "Max Erren"
email = "opensource@telekom.de"
}
developer {
id = "jas34"
name = "Jasbir Singh"
email = "jasbirsinghkamboj@gmail.com"
}
developer {
id = "harishsainik"
name = "Harish Kumar Saini"
email = "harishsaini.lajak@gmail.com"
}
}
scm {
url = "https://github.com/eclipse-lmos/arc.git"
}
}
repositories {
maven {
name = "GitHubPackages"
url = URI("https://maven.pkg.github.com/eclipse-lmos/arc")
credentials {
username = findProperty("GITHUB_USER")?.toString() ?: getenv("GITHUB_USER")
password = findProperty("GITHUB_TOKEN")?.toString() ?: getenv("GITHUB_TOKEN")
}
}
}
}
}
if (!project.name.endsWith("-bom")) {
dependencies {
"implementation"(rootProject.libs.kotlinx.coroutines.slf4j)
"implementation"(rootProject.libs.kotlinx.coroutines.jdk8)
"implementation"(rootProject.libs.kotlinx.coroutines.reactor)
"implementation"(rootProject.libs.kotlinx.serialization.json)
// Testing
"testImplementation"("org.junit.jupiter:junit-jupiter:6.0.1")
"testRuntimeOnly"("org.junit.platform:junit-platform-launcher")
"testImplementation"("org.assertj:assertj-core:3.27.3")
"testImplementation"("io.mockk:mockk:1.14.2")
}
}
repositories {
mavenLocal()
mavenCentral()
google()
}
tasks.named("dokkaJavadoc") {
mustRunAfter("checksum")
}
}
dependencies {
kover(project("arc-scripting"))
kover(project("arc-azure-client"))
kover(project("arc-result"))
kover(project("arc-readers"))
kover(project("arc-agents"))
kover(project("arc-spring-boot-starter"))
kover(project("arc-memory-mongo-spring-boot-starter"))
kover(project("arc-api"))
kover(project("arc-graphql-spring-boot-starter"))
kover(project(("arc-openai-api-spring-boot-starter")))
kover(project("arc-agent-client"))
kover(project("arc-assistants"))
kover(project("arc-langchain4j-client"))
kover(project("arc-memory-redis"))
kover(project("arc-mcp"))
}
repositories {
mavenLocal()
mavenCentral()
}
fun Project.java(configure: Action<JavaPluginExtension>): Unit =
(this as ExtensionAware).extensions.configure("java", configure)
fun String.execWithCode(workingDir: File? = null): Pair<CommandResult, Sequence<String>> {
ProcessBuilder().apply {
workingDir?.let { directory(it) }
command(split(" "))
redirectErrorStream(true)
val process = start()
val result = process.readStream()
val code = process.waitFor()
return CommandResult(code) to result
}
}
class CommandResult(val code: Int) {
val isFailed = code != 0
val isSuccess = !isFailed
fun ifFailed(block: () -> Unit) {
if (isFailed) block()
}
}
/**
* Executes a string as a command.
*/
fun String.exec(workingDir: File? = null) = execWithCode(workingDir).second
fun Project.isBOM() = name.endsWith("-bom")
private fun Process.readStream() = sequence<String> {
val reader = BufferedReader(InputStreamReader(inputStream))
try {
var line: String?
while (true) {
line = reader.readLine()
if (line == null) {
break
}
yield(line)
}
} finally {
reader.close()
}
}
release {
ignoredSnapshotDependencies = listOf("org.springframework.ai:spring-ai-bom")
newVersionCommitMessage = "New Snapshot-Version:"
preTagCommitMessage = "Release:"
}