gcgm-plugin/gc-plugin/build.gradle

88 lines
2.0 KiB
Groovy
Raw Normal View History

2022-04-27 17:11:28 +08:00
/*
* 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 {
2022-04-27 17:11:28 +08:00
}
plugins {
// Apply the java plugin to add support for Java
id 'java'
id 'idea'
2022-04-27 17:11:28 +08:00
}
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")) {
2022-04-27 17:11:28 +08:00
println ('Packaging ' + it.name)
it.isDirectory() ? it : zipTree(it)
2022-04-27 17:11:28 +08:00
}
}
} {
exclude('META-INF/LICENSE*')
exclude("META-INF/versions/9/module-info.class")
exclude("META-INF/NOTICE")
2022-04-27 17:11:28 +08:00
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
2022-04-27 17:11:28 +08:00
destinationDir = file(".")
}