-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.gradle.kts
145 lines (124 loc) · 4.46 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
136
137
138
139
140
141
142
143
144
145
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import java.net.URI
buildscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.10")
}
}
plugins {
id("org.jetbrains.kotlin.jvm") version "1.9.10"
signing
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
id("org.jlleitschuh.gradle.ktlint") version "10.2.1"
}
repositories {
mavenCentral()
}
dependencies {
// Kotlin
// Pin kotlin packages together on a common version:
listOf(
libs.kotlin.allopen,
libs.kotlin.bom,
libs.kotlin.reflect,
libs.kotlin.jdk8,
).forEach(::implementation)
}
val projectVersion = project.property("version")?.takeIf { it != "unspecified" } ?: "1.0-SNAPSHOT"
object Repos {
private object sonatype {
const val snapshots = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
const val releases = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
}
fun RepositoryHandler.sonatypeOss(projectVersion: String): MavenArtifactRepository {
val murl =
if (projectVersion == "1.0-SNAPSHOT") sonatype.snapshots
else sonatype.releases
return maven {
name = "Sonatype"
url = URI.create(murl)
credentials {
username = System.getenv("OSSRH_USERNAME")
password = System.getenv("OSSRH_PASSWORD")
}
}
}
}
subprojects {
apply {
plugin("java")
plugin("kotlin")
plugin("signing")
plugin("maven-publish")
}
configurations.forEach { it.exclude("org.slf4j", "slf4j-api") }
val artifactName = "pb-grpc-$name-kotlin"
tasks.withType<PublishToMavenLocal> {
signing.isRequired = false
}
configure<PublishingExtension> {
publications {
create<MavenPublication>("maven") {
groupId = "io.provenance.client"
artifactId = artifactName
version = "$projectVersion"
from(components["java"])
pom {
name.set("Provenance Blockchain GRPC Kotlin Client")
description.set("A GRPC client for communicating with the Provenance Blockchain")
url.set("https://provenance.io")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("pstory")
name.set("Phil Story")
email.set("[email protected]")
}
developer {
id.set("vwagner")
name.set("Valerie Wagner")
email.set("[email protected]")
}
}
scm {
connection.set("[email protected]:provenance-io/pb-grpc-client-kotlin.git")
developerConnection.set("[email protected]/provenance-io/pb-grpc-client-kotlin.git")
url.set("https://github.com/provenance-io/pb-grpc-client-kotlin")
}
}
}
}
configure<SigningExtension> {
sign(publications["maven"])
}
}
configure<KotlinJvmProjectExtension> {
jvmToolchain(17)
compilerOptions {
freeCompilerArgs.set(listOf("-opt-in=kotlin.time.ExperimentalTime"))
}
}
java {
withJavadocJar()
withSourcesJar()
}
}
configure<io.github.gradlenexus.publishplugin.NexusPublishExtension> {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username.set(findProject("ossrhUsername")?.toString() ?: System.getenv("OSSRH_USERNAME"))
password.set(findProject("ossrhPassword")?.toString() ?: System.getenv("OSSRH_PASSWORD"))
stagingProfileId.set("3180ca260b82a7") // prevents querying for the staging profile id, performance optimization
}
}
}