-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle.kts
106 lines (92 loc) · 3.32 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
import org.jetbrains.kotlin.konan.properties.loadProperties
// Project configuration
val projectName = "yeelight"
val projectVersion = "1.0.4"
val projectGroup = "com.github.omarmiatello.yeelight"
val projectRepoPath = "github.com/omarmiatello/yeelight"
val sharedArtifacts = mapOf(
":core" to "Control your Xiaomi Yeelight lamp using Kotlin",
":home-ktx" to "[example] Control Xiaomi Yeelight for my home"
)
// Plugins configuration
plugins {
kotlin("jvm") version "1.4.31" apply false
kotlin("plugin.serialization") version "1.4.30" apply false
id("io.github.gradle-nexus.publish-plugin") version "1.0.0"
}
// mavenCentral() configuration
group = projectGroup
version = projectVersion
loadProperties(file("local.properties").absolutePath).also { p ->
p.stringPropertyNames().forEach { key ->
ext[key] = p.getProperty(key)
}
}
val ossrhUsername: String? by ext
val ossrhPassword: String? by ext
nexusPublishing {
repositories {
create("myNexus") {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username.set(ossrhUsername)
password.set(ossrhPassword)
}
}
}
configure(subprojects.filter { it.path in sharedArtifacts.keys }) {
apply<JavaLibraryPlugin>()
apply<SigningPlugin>()
apply<MavenPublishPlugin>()
configure<JavaPluginExtension> {
withJavadocJar()
withSourcesJar()
}
configure<SigningExtension> {
val publishing: PublishingExtension by project
sign(publishing.publications)
}
configure<PublishingExtension> {
publications {
val main by creating(MavenPublication::class) {
from(components["java"])
pom {
name.set("$projectName-${project.name}")
description.set(sharedArtifacts.getValue(project.path))
url.set("https://$projectRepoPath")
group = projectGroup
version = projectVersion
licenses {
license {
name.set("MIT License")
// https://opensource.org/licenses/MIT
url.set("https://$projectRepoPath/blob/master/LICENSE")
}
}
developers {
developer {
id.set("jackl85")
name.set("Omar Miatello")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:$projectRepoPath.git")
developerConnection.set("scm:git:ssh://$projectRepoPath.git")
url.set("https://$projectRepoPath/tree/master")
}
}
}
}
repositories {
maven {
name = project.name
setUrl("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = ossrhUsername
password = ossrhPassword
}
}
}
}
}