-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
79 lines (67 loc) · 2.36 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
plugins {
`maven-publish`
// extremely questionable hack to get the list of all pluginAliases
fun <T : java.lang.reflect.AccessibleObject> T.jailbreak() = apply { isAccessible = true }
val createPlugin = libs.plugins.javaClass.superclass.getDeclaredMethod("createPlugin", String::class.java).jailbreak()
val configField = libs.javaClass.superclass.superclass.getDeclaredField("config").jailbreak()
val actualLibs = configField.get(libs) as org.gradle.api.internal.catalog.DefaultVersionCatalog
@Suppress("UNCHECKED_CAST")
actualLibs.pluginAliases.forEach { alias(createPlugin(libs.plugins, it) as Provider<PluginDependency>) }
}
/**
* Retrieves a value from the `gradle.properties` map.
*/
fun prop(key: String) = extra.properties[key] as String
group = "ai.arcblroth"
version = "3.0-SNAPSHOT"
val mainClassName = "ai.arcblroth.somnus3.SomnusMain"
repositories {
mavenCentral()
maven("https://oss.sonatype.org/content/repositories/snapshots")
maven("https://m2.dv8tion.net/releases")
maven("https://jitpack.io")
}
dependencies {
compileOnly(kotlin("stdlib-jdk8"))
val versionCatalog = project.extensions.getByType<VersionCatalogsExtension>().named("libs")
versionCatalog.libraryAliases.forEach { implementation(versionCatalog.findLibrary(it).get()) }
configurations["implementation"].dependencies.find { it.group == "dev.kord" && it.name == "kord-core" }!!.apply {
(this as ExternalModuleDependency).capabilities {
requireCapability("dev.kord:core-voice:${[email protected]}")
}
}
}
tasks {
compileKotlin {
kotlinOptions {
jvmTarget = "11"
freeCompilerArgs = listOf("-opt-in=kotlin.RequiresOptIn")
}
}
shadowJar {
archiveBaseName.set("somnus")
archiveClassifier.set("")
manifest {
attributes(
mapOf(
"Main-Class" to mainClassName,
"Implementation-Version" to archiveVersion,
)
)
}
}
jar.get().enabled = false
assemble.get().dependsOn(shadowJar.get())
ktlint {
disabledRules.set(setOf("no-wildcard-imports"))
}
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
artifact(tasks.shadowJar) {
artifactId = "somnus"
}
}
}
}