-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
108 lines (92 loc) · 3.21 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
plugins {
kotlin("jvm") version "1.9.20"
kotlin("kapt") version "1.9.20"
id("com.github.johnrengelman.shadow") version "8.1.1"
`maven-publish`
}
group = "co.statu.parsek"
version =
(if (project.hasProperty("version") && project.findProperty("version") != "unspecified") project.findProperty("version") else "local-build")!!
val pf4jVersion: String by project
val vertxVersion: String by project
val handlebarsVersion: String by project
val bootstrap = (project.findProperty("bootstrap") as String?)?.toBoolean() ?: false
val pluginsDir: File? by rootProject.extra
repositories {
mavenCentral()
maven("https://jitpack.io")
}
dependencies {
if (bootstrap) {
compileOnly(project(mapOf("path" to ":Parsek")))
compileOnly(project(mapOf("path" to ":plugins:parsek-plugin-database")))
} else {
compileOnly("com.github.StatuParsek:Parsek:main-SNAPSHOT")
compileOnly("com.github.StatuParsek:parsek-plugin-database:main-SNAPSHOT")
}
compileOnly(kotlin("stdlib-jdk8"))
compileOnly("org.pf4j:pf4j:${pf4jVersion}")
kapt("org.pf4j:pf4j:${pf4jVersion}")
compileOnly("io.vertx:vertx-lang-kotlin:$vertxVersion")
compileOnly("io.vertx:vertx-lang-kotlin-coroutines:$vertxVersion")
compileOnly("io.vertx:vertx-jdbc-client:$vertxVersion")
}
tasks {
shadowJar {
val pluginId: String by project
val pluginClass: String by project
val pluginProvider: String by project
val pluginDependencies: String by project
manifest {
attributes["Plugin-Class"] = pluginClass
attributes["Plugin-Id"] = pluginId
attributes["Plugin-Version"] = version
attributes["Plugin-Provider"] = pluginProvider
attributes["Plugin-Dependencies"] = pluginDependencies
}
archiveFileName.set("$pluginId-$version.jar")
dependencies {
exclude(dependency("io.vertx:vertx-core"))
exclude {
it.moduleGroup == "io.netty" || it.moduleGroup == "org.slf4j"
}
}
}
register("copyJar") {
pluginsDir?.let {
doLast {
copy {
from(shadowJar.get().archiveFile.get().asFile.absolutePath)
into(it)
}
}
}
outputs.upToDateWhen { false }
mustRunAfter(shadowJar)
}
jar {
enabled = false
dependsOn(shadowJar)
dependsOn("copyJar")
}
}
publishing {
repositories {
maven {
name = "parsek-plugin-system-property"
url = uri("https://maven.pkg.github.com/StatuParsek/parsek-plugin-system-property")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("USERNAME_GITHUB")
password = project.findProperty("gpr.token") as String? ?: System.getenv("TOKEN_GITHUB")
}
}
}
publications {
create<MavenPublication>("shadow") {
project.extensions.configure<com.github.jengelman.gradle.plugins.shadow.ShadowExtension> {
artifactId = "parsek-plugin-system-property"
component(this@create)
}
}
}
}