-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
112 lines (95 loc) · 3.44 KB
/
build.gradle
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
//file:noinspection GroovyAssignabilityCheck
plugins {
id "java-library"
id "io.fairyproject" version "0.7.0dev-SNAPSHOT" apply false
id "io.spring.dependency-management" version "1.1.0"
id "com.github.johnrengelman.shadow" version "7.1.2"
}
ext {
isProd = System.properties['env'] == 'prod'
}
repositories {
mavenLocal()
mavenCentral()
}
version = "1.0.0"
allprojects {
if (isNotJavaProject(project)) {
project.tasks.configureEach { task -> task.enabled = false }
return
}
group = findProperty("plugin.package")
}
subprojects {
version = rootProject.version
if (isNotJavaProject(project)) {
project.tasks.configureEach { task -> task.enabled = false }
project.tasks.withType(PublishToMavenRepository).configureEach { it.enabled = false }
return
}
apply plugin: "java-library"
apply plugin: "io.spring.dependency-management"
apply plugin: "com.github.johnrengelman.shadow"
repositories {
mavenLocal()
mavenCentral()
maven {
name "Jitpack"
url "https://jitpack.io"
}
maven {
name "Imanity"
url "https://repo.imanity.dev/imanity-libraries"
}
maven {
name "PaperMC"
url "https://repo.papermc.io/repository/maven-public"
}
maven {
name = "CodeMC"
url = uri("https://repo.codemc.io/repository/maven-public/")
}
}
dependencies {
// Lombok
compileOnly(libs.lombok)
annotationProcessor(libs.lombok)
testCompileOnly(libs.lombok)
testAnnotationProcessor(libs.lombok)
// Testing
implementation("org.apache.commons:commons-compress:1.22")
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.9.0")
}
shadowJar {
if (isProd) {
relocate("io.fairyproject", "" + findProperty("plugin.package") + ".fairy")
relocate("net.kyori", "" + findProperty("plugin.package") + ".fairy.libs.kyori")
//relocate("com.github.retrooper.packetevents", "" + findProperty("plugin.package") + ".fairy.libs.packetevents")
relocate("dev.imanity.brew", "" + findProperty("plugin.package") + ".brew")
relocate("org.yaml.snakeyaml", "" + findProperty("plugin.package") + ".snakeyaml")
relocate("com.cryptomorin.xseries", "" + findProperty("plugin.package") + ".xseries")
relocate("org.spongepowered.configurate", "" + findProperty("plugin.package") + ".libs.configurate")
relocate("io.leangen.geantyref", "" + findProperty("plugin.package") + ".libs.geantyref")
relocate("xyz.xenondevs.particle", "" + findProperty("plugin.package") + ".libs.particle")
minimize {
exclude(dependency("io.fairyproject:.*:.*"))
exclude(dependency("org.apache.commons.compress:.*:.*"))
}
dependencies {
exclude(dependency("com.google.*:.*:.*"))
//exclude(dependency("net.kyori:.*:.*"))
exclude(dependency("io.fairyproject.packetevents:.*:.*"))
}
}
archiveFileName.set(archiveFileName.get().split("-")[0] + ".jar")
}
build {
dependsOn(shadowJar)
}
test {
useJUnitPlatform()
}
}
static boolean isNotJavaProject(Project project) {
return project.buildFile == null || !project.buildFile.exists()
}