-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
77 lines (62 loc) · 2.09 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
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.net.URI
group = "io.github.clayclaw"
version = "0.0.1"
val kotlinVersion = "1.5.20"
plugins {
java
kotlin("jvm") version "1.5.20"
id("com.github.johnrengelman.shadow") version "7.0.0"
}
java {
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "16"
kotlinOptions.freeCompilerArgs = listOf("-Xjvm-default=compatibility")
}
repositories {
mavenCentral()
maven { url = uri("https://papermc.io/repo/repository/maven-public/") }
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }
maven { url = uri("https://repo.codemc.org/repository/maven-public/") }
maven { url = uri("https://repo.extendedclip.com/content/repositories/placeholderapi") }
}
dependencies {
compileOnly("dev.reactant:reactant:0.2.3")
compileOnly("io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT")
compileOnly("world.bentobox:bentobox:1.18.0-SNAPSHOT")
compileOnly("me.clip:placeholderapi:2.10.10")
// Load jar libraries from "libs" folder
compileOnly(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
/** The external library you would like to use */
/** implementation("...") */
}
val sourcesJar by tasks.registering(Jar::class) {
dependsOn(JavaPlugin.CLASSES_TASK_NAME)
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
}
val shadowJar = (tasks["shadowJar"] as ShadowJar).apply {
exclude("kotlin*")
//relocate("org.from.package", "org.target.package")
}
val deployPlugin by tasks.registering(Copy::class) {
dependsOn(shadowJar)
System.getenv("PLUGIN_DEPLOY_PATH")?.let {
from(shadowJar)
into(it)
}
}
val build = (tasks["build"] as Task).apply {
arrayOf(
sourcesJar
, shadowJar
, deployPlugin
).forEach { dependsOn(it) }
}