-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
159 lines (141 loc) · 4.79 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
159 lines (141 loc) · 4.79 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
import com.vanniktech.maven.publish.DeploymentValidation
plugins {
`java-library`
kotlin("jvm") version "2.3.0"
id("io.gitlab.arturbosch.detekt") version "1.23.7"
id("org.jlleitschuh.gradle.ktlint") version "12.1.2"
id("org.jetbrains.dokka") version "2.0.0"
id("com.vanniktech.maven.publish") version "0.36.0"
jacoco
}
group = "com.teamraft"
version = (project.findProperty("sdkVersion") as? String)?.takeIf { it.isNotBlank() } ?: "0.0.0-dev"
base {
archivesName.set("rdp-sdk-java")
}
mavenPublishing {
coordinates("com.teamraft", "rdp-sdk-java", version.toString())
publishToMavenCentral(
automaticRelease = true,
validateDeployment = DeploymentValidation.PUBLISHED,
)
signAllPublications()
pom {
name.set("RDP SDK for Java")
description.set("Java SDK for client applications interacting with RDP.")
inceptionYear.set("2026")
url.set("https://github.com/raft-tech/rdp-sdk-java")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
}
}
developers {
developer {
id.set("raft-tech")
name.set("Raft")
organization.set("Raft")
organizationUrl.set("https://teamraft.com")
url.set("https://teamraft.com")
}
}
scm {
url.set("https://github.com/raft-tech/rdp-sdk-java/tree/main")
connection.set("scm:git:https://github.com/raft-tech/rdp-sdk-java.git")
developerConnection.set("scm:git:ssh://git@github.com/raft-tech/rdp-sdk-java.git")
}
}
}
repositories {
mavenCentral()
maven {
name = "buf"
url = uri("https://buf.build/gen/maven")
}
}
kotlin {
jvmToolchain(17)
}
dependencies {
api(
"build.buf.gen:raft_wdm_connectrpc_kotlin:0.9.0.2.20260717145038.489cef7b7304",
)
api("org.json:json:20240303")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1")
implementation("org.slf4j:slf4j-api:2.0.16")
implementation("com.squareup.okhttp3:okhttp:5.4.0")
implementation("io.github.cdimascio:dotenv-java:3.1.0")
testImplementation(kotlin("test"))
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.10.1")
testImplementation("com.squareup.okhttp3:mockwebserver:5.4.0")
testImplementation("io.mockk:mockk:1.13.13")
testRuntimeOnly("org.slf4j:slf4j-simple:2.0.16")
}
sourceSets {
create("examples") {
kotlin.srcDirs(
"examples/objects-search-kotlin",
"examples/objects-publish-kotlin",
)
java.srcDirs(
"examples/objects-search-java",
"examples/objects-publish-java",
)
compileClasspath += sourceSets.main.get().output + configurations["runtimeClasspath"]
runtimeClasspath += sourceSets.main.get().output + configurations["runtimeClasspath"]
}
}
dependencies {
"examplesRuntimeOnly"("org.slf4j:slf4j-simple:2.0.16")
}
tasks.register<JavaExec>("runExample") {
group = "application"
description = "Run an SDK example quietly (./gradlew -q runExample -PmainClass=...)"
classpath = sourceSets["examples"].runtimeClasspath
mainClass.set(
project.findProperty("mainClass") as? String ?: "examples.objects.searchkotlin.ObjectsSearchKotlin",
)
}
tasks.test {
useJUnitPlatform()
}
// Embed SDK version into resources at build time.
tasks.named<Copy>("processResources") {
filesMatching("rdp-version.properties") {
expand("sdkVersion" to version)
}
}
tasks.jacocoTestCoverageVerification {
dependsOn(tasks.jacocoTestReport)
violationRules {
rule {
// 0.50 reflects current facade-test surface (RdpClientTest).
// The Blocking*Service streaming wrappers are mechanical
// translations that lack dedicated tests; covered indirectly
// by integration tests against RDP services. TODO: add direct
// tests for the Blocking* wrappers to raise to 0.80.
element = "BUNDLE"
limit {
counter = "INSTRUCTION"
value = "COVEREDRATIO"
minimum = "0.50".toBigDecimal()
}
}
}
}
detekt {
source.setFrom("src/main/kotlin", "src/test/kotlin")
}
tasks.named<org.jetbrains.dokka.gradle.DokkaTask>("dokkaGfm") {
moduleName.set("rdp-sdk-java")
outputDirectory.set(layout.buildDirectory.dir("dokka/gfm"))
dokkaSourceSets.named("main") {
suppressGeneratedFiles.set(true)
perPackageOption {
matchingRegex.set("com\\.raft\\.rdp\\.internal.*")
suppress.set(true)
}
}
}