This repository has been archived by the owner on Aug 23, 2021. It is now read-only.
forked from SecondStoryServer/SS-W-Plugins
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
105 lines (92 loc) · 3.37 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
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import net.minecrell.pluginyml.bungee.BungeePluginDescription
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jlleitschuh.gradle.ktlint.KtlintExtension
plugins {
kotlin("jvm") version "1.4.30"
id("com.github.johnrengelman.shadow") version "6.1.0" apply false
id("net.minecrell.plugin-yml.bungee") version "0.3.0" apply false
id("org.jlleitschuh.gradle.ktlint") version "10.0.0"
}
allprojects {
apply(plugin = "org.jlleitschuh.gradle.ktlint")
repositories {
mavenCentral()
}
configure<KtlintExtension> {
version.set("0.40.0")
}
}
subprojects {
apply(plugin = "kotlin")
apply(plugin = "com.github.johnrengelman.shadow")
apply(plugin = "net.minecrell.plugin-yml.bungee")
val shadowImplementation by configurations.creating
configurations["implementation"].extendsFrom(shadowImplementation)
val project = Project.get(project.name) ?: error("Not Found Project ${project.name}")
repositories {
maven(url = "https://papermc.io/repo/repository/maven-public/")
}
dependencies {
when (project) {
Project.Core -> {
shadowImplementation(kotlin("stdlib-jdk8"))
}
Project.Discord -> {
implementation("com.google.code.gson:gson:2.8.6")
testImplementation("org.slf4j:slf4j-simple:1.7.30")
}
Project.Votifier -> {
implementation("io.netty:netty-handler:4.1.53.Final")
implementation("io.netty", "netty-transport-native-epoll", "4.1.53.Final", classifier = "linux-x86_64")
}
}
implementation(kotlin("stdlib-jdk8"))
implementation("io.github.waterfallmc:waterfall-api:1.16-R0.4-SNAPSHOT")
project.dependProjectName.forEach { implementation(project(":$it")) }
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "11"
freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}
}
tasks.withType<ShadowJar> {
configurations = listOf(shadowImplementation)
classifier = null
destinationDirectory.set(file("../jars"))
}
configure<BungeePluginDescription> {
name = project.name
version = project.version
main = project.main
author = project.author
depends = project.allDependPlugin
}
}
task("updateVersions") {
doLast {
val outputBlockComment = "<!-- Generate Versions -->"
val escapedOutputBlockComment = Regex.escape(outputBlockComment)
val mdFile = file("README.md")
val fileContent = mdFile.bufferedReader().use { it.readText() }
mdFile.writeText(
fileContent.replace(
"$escapedOutputBlockComment[\\s\\S]*$escapedOutputBlockComment".toRegex(),
buildString {
appendln(outputBlockComment)
appendln(
"""
| Name | Version |
|:-----|--------:|
""".trimIndent()
)
Project.list.sortedBy { it.name }.forEach {
appendln("| ${it.name} | ${it.version} |")
}
append(outputBlockComment)
}
)
)
}
}