This repository has been archived by the owner on Apr 18, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
189 lines (163 loc) · 6.26 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
plugins {
id 'java'
id 'com.modrinth.minotaur' version '2.+'
id 'io.papermc.hangar-publish-plugin' version '0.0.5'
}
defaultTasks 'build'
def buildNum = System.getenv('GITHUB_RUN_NUMBER') ?: 'SNAPSHOT'
project.group = 'net.pl3x.map'
project.version = "$minecraftVersion-$buildNum"
def npmCmd = DefaultNativePlatform.currentOperatingSystem.isWindows() ? 'npm.cmd' : 'npm'
dependencies {
compileOnly project(':core')
compileOnly project(':bukkit')
compileOnly project(':fabric')
//compileOnly project(':forge')
}
def cleanWebmap = tasks.register('cleanWebmap', Delete) {
dependsOn clean
println 'Cleaning webmap...'
delete "$rootDir/core/src/main/resources/web"
}
def copyJavadocAndSources = tasks.register('copyJavadocAndSources', Copy) {
from("$rootDir/core/build/libs") {
include "*-*-*-*-*.jar"
}
into layout.buildDirectory.dir('libs')
rename "${rootProject.name}-core-${version}-javadoc.jar", "${rootProject.name}-${version}-javadoc.jar"
rename "${rootProject.name}-core-${version}-sources.jar", "${rootProject.name}-${version}-sources.jar"
}
def combineJars = tasks.register('combineJars', Jar) {
mustRunAfter build
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(files(subprojects.findAll { it.name != 'webmap' }.collect {
it.layout.buildDirectory.file("libs/${rootProject.name}-${it.name}-${it.version}.jar").get()
}).filter { it.name != 'MANIFEST.MF' }.collect { if (it.isDirectory()) it else zipTree(it) })
manifest {
// this must be here because it overrides the default jar task
attributes['Main-Class'] = "${rootProject.group}.core.Pl3xMap"
def commit = 'git rev-parse --short HEAD'.execute()
commit.waitFor()
attributes['Git-Commit'] = commit.text.trim()
}
finalizedBy copyJavadocAndSources
}
def npmInstall = tasks.register('npmInstall', Exec) {
println 'Installing npm dependencies...'
workingDir new File(projectDir, 'webmap')
commandLine npmCmd, 'install'
}
def npmBuild = tasks.register('npmBuild', Exec) {
dependsOn npmInstall
println 'Building webmap...'
workingDir new File(projectDir, 'webmap')
commandLine npmCmd, 'run', 'build'
}
def copyWebmap = tasks.register('copyWebmap', Copy) {
dependsOn npmBuild
println 'Copying webmap...'
from "$rootDir/webmap/public"
include '**/*'
exclude 'tiles*/'
into "$rootDir/core/src/main/resources/web"
from "$rootDir/webmap/dist"
include '**/*'
into "$rootDir/core/src/main/resources/web"
}
assemble {
// copy the webmap over
dependsOn copyWebmap
mustRunAfter copyWebmap
// this is to ensure the subprojects finish building completely before this task is finished
subprojects
.findAll { it.name != 'webmap' }
.forEach { project ->
dependsOn ":${project.name}:build"
}
// after subprojects are finished we can combine their jars into a fatjar
finalizedBy combineJars
}
clean {
finalizedBy cleanWebmap
}
allprojects {
if (name == 'webmap') {
return
}
apply plugin: 'java'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
repositories {
mavenCentral()
mavenLocal()
maven { url = 'https://jitpack.io' }
}
dependencies {
implementation "cloud.commandframework:cloud-core:$cloudVersion"
implementation "cloud.commandframework:cloud-brigadier:$cloudVersion"
implementation "cloud.commandframework:cloud-paper:$cloudVersion"
implementation("cloud.commandframework:cloud-minecraft-extras:$cloudVersion") {
exclude group: 'net.kyori', module: '*'
}
implementation "net.kyori:adventure-api:$adventureVersion"
implementation "net.kyori:adventure-text-minimessage:$adventureVersion"
implementation "net.kyori:adventure-text-serializer-plain:$adventureVersion"
implementation "net.kyori:adventure-platform-bukkit:$adventureBukkitVersion"
implementation "com.github.ben-manes.caffeine:caffeine:$caffeineVersion"
implementation "com.github.Querz:NBT:$querzNbtVersion"
implementation("com.github.Carleslc.Simple-YAML:Simple-Yaml:$simpleYamlVersion") {
exclude group: 'org.yaml', module: 'snakeyaml'
}
implementation "io.undertow:undertow-core:$undertowVersion"
implementation "org.jboss.xnio:xnio-nio:$xnioVersion"
// provided by mojang
compileOnly "com.google.code.gson:gson:$gsonVersion"
compileOnly "com.google.guava:guava:$guavaVersion"
//noinspection VulnerableLibrariesLocal
compileOnly "org.apache.logging.log4j:log4j-core:$log4jVersion"
compileOnly "org.slf4j:slf4j-api:$slf4jVersion"
}
jar {
if (rootProject.name == project.name) {
archiveBaseName = rootProject.name
} else {
archiveBaseName = "${rootProject.name}-${project.name}"
}
}
compileJava {
options.encoding = 'UTF-8'
options.release.set(17)
}
processResources {
filteringCharset = 'UTF-8'
}
}
modrinth {
autoAddDependsOn = false
token = System.getenv('MODRINTH_TOKEN')
projectId = 'pl3xmap'
versionName = "${project.version}"
versionNumber = "${project.version}"
versionType = 'beta'
uploadFile = rootProject.layout.buildDirectory.file("libs/${rootProject.name}-${project.version}.jar").get()
//additionalFiles.addAll([
// rootProject.layout.buildDirectory.file("libs/${rootProject.name}-${project.version}-javadoc.jar").get(),
// rootProject.layout.buildDirectory.file("libs/${rootProject.name}-${project.version}-sources.jar").get()
//])
gameVersions.addAll(["${minecraftVersion}"])
loaders.addAll(['bukkit', 'fabric', /*'forge',*/ 'paper', 'purpur', 'quilt', 'spigot'])
changelog = System.getenv('COMMIT_MESSAGE')
dependencies {
required.project 'fabric-api'
optional.project 'pl3xmap-banners'
optional.project 'pl3xmap-claims'
optional.project 'pl3xmap-mobs'
optional.project 'pl3xmap-signs'
optional.project 'pl3xmap-warps'
optional.project 'deathspots'
}
}