-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
124 lines (103 loc) · 3.55 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
import com.adarshr.gradle.testlogger.TestLoggerExtension
import com.adarshr.gradle.testlogger.theme.ThemeType
import java.io.FileInputStream
import java.util.*
val localProperties = loadLocalProps()
version = "1.0.3"
group = "io.github.tomwyr"
description = "A type-safe Godot node tree representation in Kotlin"
plugins {
kotlin("jvm") version "1.9.20"
id("com.gradle.plugin-publish") version "1.2.1"
id("com.adarshr.test-logger") version "4.0.0"
`maven-publish`
signing
}
repositories {
mavenCentral()
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0")
testImplementation(kotlin("test"))
}
configure<TestLoggerExtension> {
theme = ThemeType.MOCHA
showCauses = true
}
@Suppress("UnstableApiUsage")
gradlePlugin {
website = "https://github.com/tomwyr/godot-kotlin-tree"
vcsUrl = "https://github.com/tomwyr/godot-kotlin-tree.git"
fun bindProp(key: String) = System.setProperty(key, prop(key))
bindProp("gradle.publish.key")
bindProp("gradle.publish.secret")
plugins {
create("godot-kotlin-tree") {
id = "io.github.tomwyr.godot-kotlin-tree"
displayName = "Godot Kotlin Tree"
description = "A type-safe Godot node tree representation in Kotlin"
tags = listOf("godot", "kotlin", "node", "tree")
implementationClass = "com.tomwyr.GodotNodeTree"
}
}
}
java {
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
create<MavenPublication>("plugin") {
artifactId = "godot-kotlin-tree"
from(components["java"])
pom {
name = "Godot Kotlin Tree"
description = "A type-safe Godot node tree representation in Kotlin"
url = "https://github.com/tomwyr/godot-kotlin-tree"
licenses {
license {
name = "MIT License"
url = "https://gist.github.com/tomwyr/2edea68a06b67d69b2a80964a3ff6f34"
}
}
developers {
developer {
id = "tomwyr"
name = "Tomasz Wyrowiński"
url = "https://github.com/tomwyr"
}
}
scm {
url = "https://github.com/tomwyr/godot-kotlin-tree"
connection = "scm:git:git://github.com/tomwyr/godot-kotlin-tree.git"
}
}
}
}
repositories {
maven {
val releasesRepoUrl = "https://s01.oss.sonatype.org/content/repositories/releases/"
val snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
url = uri(if (isSnapshot) snapshotsRepoUrl else releasesRepoUrl)
credentials {
username = prop("maven.repo.username")
password = prop("maven.repo.password")
}
}
}
}
signing {
isRequired = true
val signingKey = prop("maven.signing.key").replace("\\n", "\n")
val signingPassword = prop("maven.signing.password")
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications["plugin"])
}
val isSnapshot: Boolean
get() = version.toString().endsWith("SNAPSHOT")
fun loadLocalProps() = Properties().apply {
load(FileInputStream(rootProject.file("local.properties")))
}
fun prop(key: String): String {
return localProperties[key] as? String ?: throw Exception("Expected local property $key not set")
}