-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
135 lines (115 loc) · 3.73 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.kotlin.dsl.*
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.22.0")
}
}
plugins {
kotlin("jvm") version "1.9.21"
`maven-publish`
signing
id("io.codearte.nexus-staging") version "0.22.0"
}
group = "com.recombee"
version = "5.0.0"
repositories {
mavenCentral()
google()
}
dependencies {
testImplementation("org.jetbrains.kotlin:kotlin-test")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.1")
testImplementation("org.mockito:mockito-core:5.8.0")
implementation("com.squareup.okhttp3:okhttp:4.12.0")
implementation("com.google.code.gson:gson:2.10.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0")
}
tasks.test {
useJUnitPlatform()
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = listOf("-Xjvm-default=all")
}
}
tasks.withType<JavaCompile> {
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
}
kotlin {
explicitApi()
}
val sourcesJar by tasks.registering(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
}
val javadocJar by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
from(tasks.javadoc)
}
// Retrieve credentials and other properties
val ossrhUsername: String by project
val ossrhPassword: String by project
// Nexus Staging Plugin Configuration
configure<io.codearte.gradle.nexus.NexusStagingExtension> {
packageGroup = "com.recombee"
username = ossrhUsername
password = ossrhPassword
}
publishing {
publications {
create<MavenPublication>("mavenKotlin") {
from(components["kotlin"])
artifact(sourcesJar)
artifact(javadocJar)
pom {
name.set("Recombee API Client in Kotlin")
description.set("A client library for easy use of the Recombee recommendation API in Android applications")
url.set("https://recombee.com")
licenses {
license {
name.set("MIT License")
url.set("https://opensource.org/licenses/MIT")
}
}
developers {
developer {
id.set("ondra_fiedler")
name.set("Ondrej Fiedler")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:[email protected]:Recombee/kotlin-api-client.git")
developerConnection.set("scm:git:[email protected]:Recombee/kotlin-api-client.git")
url.set("https://github.com/Recombee/kotlin-api-client")
}
}
}
}
repositories {
maven {
val releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
url = uri(releasesRepoUrl)
credentials {
username = ossrhUsername
password = ossrhPassword
}
}
}
}
signing {
if (findProperty("signing.keyId") != null &&
findProperty("signing.secretKeyRingFile") != null &&
findProperty("signing.password") != null) {
sign(publishing.publications["mavenKotlin"])
} else {
println("Signing properties not found, skipping signing configuration.")
}
}