-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
121 lines (100 loc) · 3.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
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
group = "dev.g000sha256"
version = "1.0.0"
plugins {
alias(catalog.plugins.gradle.pluginPublish)
alias(catalog.plugins.jetbrains.binaryCompatibilityValidator)
alias(catalog.plugins.jetbrains.kotlinJvm)
id("org.gradle.java-gradle-plugin")
id("org.gradle.maven-publish")
id("org.gradle.signing")
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlin {
explicitApi()
compilerOptions {
jvmTarget = JvmTarget.JVM_11
moduleName = "g000sha256.sonatype_maven_central"
}
sourceSets {
main {
dependencies {
implementation(catalog.library.jetbrains.annotations)
implementation(catalog.library.jetbrains.kotlin)
implementation(catalog.library.ktor.core)
implementation(catalog.library.ktor.java)
}
}
}
}
val pomName = "Sonatype Maven Central publish plugin"
val pomDescription = "A plugin to publish artifacts to the Sonatype Maven Central repository"
val pomUrl = "https://github.com/g000sha256/sonatype-maven-central"
publishing {
publications {
withType<MavenPublication> {
if (name == "pluginMaven") {
pom {
name = pomName
description = pomDescription
}
}
pom {
url = pomUrl
inceptionYear = "2024"
licenses {
license {
name = "Apache License 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
id = "g000sha256"
name = "Georgii Ippolitov"
email = "detmmpmznb@g000sha256.dev"
url = "https://github.com/g000sha256"
}
}
scm {
connection = "scm:git:git://github.com/g000sha256/sonatype-maven-central.git"
developerConnection = "scm:git:ssh://github.com:g000sha256/sonatype-maven-central.git"
url = "https://github.com/g000sha256/sonatype-maven-central/tree/master"
}
issueManagement {
system = "GitHub Issues"
url = "https://github.com/g000sha256/sonatype-maven-central/issues"
}
}
}
}
}
@Suppress("UnstableApiUsage")
gradlePlugin {
vcsUrl = pomUrl
website = pomUrl
plugins {
register("release") {
id = "dev.g000sha256.sonatype-maven-central"
implementationClass = "g000sha256.sonatype_maven_central.SonatypeMavenCentralPlugin"
displayName = pomName
description = pomDescription
tags = setOf("artifact", "central", "kotlin", "maven", "publish", "repository", "sonatype", "upload")
}
}
}
signing {
val key = getProperty("Signing.Key") ?: getEnvironment("SIGNING_KEY")
val password = getProperty("Signing.Password") ?: getEnvironment("SIGNING_PASSWORD")
useInMemoryPgpKeys(key, password)
sign(publishing.publications)
}
private fun getProperty(key: String): String? {
return properties[key] as String?
}
private fun getEnvironment(key: String): String? {
return System.getenv(key)
}