gcgm-plugin/gc-plugin/build.gradle
2022-05-03 22:05:02 +08:00

88 lines
2.0 KiB
Groovy

/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java project to get you started.
* For more details take a look at the Java Quickstart chapter in the Gradle
* User Manual available at https://docs.gradle.org/5.6.3/userguide/tutorial_java_projects.html
*/
buildscript {
}
plugins {
// Apply the java plugin to add support for Java
id 'java'
id 'idea'
}
sourceCompatibility = 17
targetCompatibility = 17
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
maven {
url "https://repo.spring.io/release"
}
maven {
url "https://s01.oss.sonatype.org/content/groups/public/"
}
}
dependencies {
implementation fileTree(dir: 'lib', include: ['*.jar'])
runtimeOnly project(':web-interface')
}
task copyWebApp(type: Copy) {
dependsOn ":web-interface:npm_run_build"
println ('Copying data from NPM output')
from "$rootDir/web-interface/build/"
into "$rootDir/gc-plugin/build/resources/main/static/."
}
task zipWebApp(type: Zip) {
dependsOn "processResources"
dependsOn "copyWebApp"
println ('Zipping web app files')
from "$rootDir/gc-plugin/build/resources/main/static/"
include '**/*'
archiveName 'DefaultWebApp.zip'
destinationDir(file("$rootDir/gc-plugin/build/resources/main/"))
}
task compileWebApp(type: Delete) {
dependsOn "zipWebApp"
println ('Deleting non-zipped web app files')
delete files("$rootDir/gc-plugin/build/resources/main/static")
}
jar {
dependsOn "compileWebApp"
jar.baseName = 'gcgm-plugin'
from {
configurations.runtimeClasspath.collect {
if(!it.name.contains("grasscutter")) {
println ('Packaging ' + it.name)
it.isDirectory() ? it : zipTree(it)
}
}
} {
exclude('META-INF/LICENSE*')
exclude("META-INF/versions/9/module-info.class")
exclude("META-INF/NOTICE")
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
destinationDir = file(".")
}