2020-01-14 02:22:15 +01:00
|
|
|
plugins {
|
|
|
|
id 'com.moowork.node' version '1.3.1'
|
|
|
|
}
|
|
|
|
|
2019-11-02 17:23:48 +01:00
|
|
|
dependencies {
|
2020-01-14 02:22:15 +01:00
|
|
|
compile 'com.google.guava:guava:21.0'
|
|
|
|
compile 'com.google.code.gson:gson:2.8.0'
|
|
|
|
compile 'org.apache.commons:commons-lang3:3.5'
|
|
|
|
compile group: 'commons-io', name: 'commons-io', version: '2.6'
|
|
|
|
compile 'com.flowpowered:flow-math:1.0.3'
|
|
|
|
compile 'ninja.leaping.configurate:configurate-hocon:3.3'
|
|
|
|
compile 'ninja.leaping.configurate:configurate-gson:3.3'
|
|
|
|
compile 'ninja.leaping.configurate:configurate-yaml:3.3'
|
|
|
|
compile 'com.github.Querz:NBT:4.0'
|
|
|
|
|
|
|
|
testCompile 'junit:junit:4.12'
|
|
|
|
}
|
|
|
|
|
|
|
|
node {
|
|
|
|
version = '12.14.1'
|
|
|
|
download = true
|
|
|
|
}
|
|
|
|
|
2020-01-15 20:57:51 +01:00
|
|
|
task fixPackageLock() {
|
|
|
|
if (!file("./package-lock.json").exists()) {
|
|
|
|
file("./package-lock.json").text = ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-14 02:22:15 +01:00
|
|
|
task cleanWebroot(type: Delete) {
|
|
|
|
delete 'build/generated/webroot/'
|
|
|
|
}
|
|
|
|
|
|
|
|
// Run WebPack build to generate resources into the generated resources
|
|
|
|
task webpackWebroot(type: NpmTask) {
|
|
|
|
args = ['run', 'build']
|
2019-11-02 17:23:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
task zipWebroot(type: Zip) {
|
2020-01-14 02:22:15 +01:00
|
|
|
from fileTree('build/generated/webroot/')
|
2019-11-02 17:23:48 +01:00
|
|
|
archiveName 'webroot.zip'
|
2019-12-29 16:41:30 +01:00
|
|
|
destinationDir(file('src/main/resources/'))
|
2019-11-02 17:23:48 +01:00
|
|
|
outputs.upToDateWhen { false }
|
|
|
|
}
|
|
|
|
|
2020-01-14 02:22:15 +01:00
|
|
|
// removes tmp build directory, build project with webpack, zip contents for the shaded jar
|
|
|
|
task buildWebroot {
|
2020-01-15 20:57:51 +01:00
|
|
|
dependsOn 'fixPackageLock'
|
2020-01-14 23:38:03 +01:00
|
|
|
dependsOn 'npmInstall'
|
2020-01-14 02:22:15 +01:00
|
|
|
dependsOn 'cleanWebroot'
|
|
|
|
dependsOn 'webpackWebroot'
|
|
|
|
dependsOn 'zipWebroot'
|
|
|
|
}
|
|
|
|
|
2019-12-29 16:23:43 +01:00
|
|
|
task zipResourceExtensions(type: Zip) {
|
|
|
|
from fileTree('src/main/resourceExtensions')
|
|
|
|
archiveName 'resourceExtensions.zip'
|
2019-12-29 16:41:30 +01:00
|
|
|
destinationDir(file('src/main/resources/'))
|
2019-12-29 16:23:43 +01:00
|
|
|
outputs.upToDateWhen { false }
|
|
|
|
}
|
|
|
|
|
2019-11-02 17:23:48 +01:00
|
|
|
//always update the zip before build
|
2020-01-14 02:22:15 +01:00
|
|
|
processResources.dependsOn(buildWebroot)
|
|
|
|
processResources.dependsOn(zipResourceExtensions)
|