EptaListProject/build.gradle

161 lines
3.6 KiB
Groovy

plugins {
id 'java'
id 'de.undercouch.download' version '5.4.0' apply false
id 'com.github.johnrengelman.shadow' version '8.1.1'
}
import de.undercouch.gradle.tasks.download.Download
subprojects {
plugins.apply("java")
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
}
allprojects {
repositories {
mavenCentral()
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/groups/public/"
}
}
}
version = project.findProperty("version")
ext {
}
task mergePlugins(type: Jar) {
dependsOn shadowJar
def io = it
archiveBaseName = 'EptaList'
archiveVersion = version
def projects = [':base', ':velocity', ':spigot', ":boungecord"]
def jars = {
def jr = []
projects.forEach {
evaluationDependsOn(it)
def task = project(it).tasks.named('jar')
dependsOn task
jr.add(task.get().archiveFile.get())
}
jr.add(file("./build/libs/libs-LOL.jar"))
return jr
}
from jars().collect { zipTree(it) }
from(file("LICENSE")) {
into("META-INF/license")
rename { "eptalist-LICENSE.txt" }
}
rename { name ->
if (name.endsWith("-LICENSE.txt")) {
"META-INF/license/$name"
} else {
name
}
}
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
tasks.build {
dependsOn mergePlugins
}
dependencies {
implementation("com.moandjiezana.toml:toml4j:0.7.2")
}
shadowJar {
archiveBaseName.set('libs')
archiveClassifier.set('')
archiveVersion.set("LOL")
exclude 'com/google/gson/**'
exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA'
}
tasks.register('downloadBungeeCord', Download) {
src 'https://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/BungeeCord.jar'
dest file("$buildDir/downloads/BungeeCord.jar")
overwrite false
}
tasks.register('downloadVelocity', Download) {
src 'https://api.papermc.io/v2/projects/velocity/versions/3.4.0-SNAPSHOT/builds/473/downloads/velocity-3.4.0-SNAPSHOT-473.jar'
dest file("$buildDir/downloads/Velocity.jar")
overwrite false
}
tasks.register("RunVelocity") {
dependsOn mergeALL
dependsOn 'downloadVelocity'
def jarFile = file("$buildDir/libs/EptaList-${version}.jar")
def targetDir = file("$buildDir/run/velocity/plugins")
def jarFile2 = file("$buildDir/run/velocity/plugins/EptaList-${version}.jar")
if (jarFile2.exists()) {
jarFile2.delete()
}
targetDir.mkdirs()
copy {
from jarFile
into targetDir
}
targetDir = file("$buildDir/run/velocity")
jarFile = file("$buildDir/downloads/Velocity.jar")
doLast {
javaexec {
workingDir = targetDir
mainClass = '-jar'
args = [jarFile]
}
}
}
tasks.register("RunBungeeCord") {
dependsOn mergeALL
dependsOn 'downloadBungeeCord'
def jarFile = file("$buildDir/libs/EptaList-${version}.jar")
def targetDir = file("$buildDir/run/bungeecord/plugins")
def jarFile2 = file("$buildDir/run/bungeecord/plugins/EptaList-${version}.jar")
if (jarFile2.exists()) {
jarFile2.delete()
}
targetDir.mkdirs()
copy {
from jarFile
into targetDir
}
targetDir = file("$buildDir/run/bungeecord")
jarFile = file("$buildDir/downloads/BungeeCord.jar")
doLast {
javaexec {
workingDir = targetDir
mainClass = '-jar'
args = [jarFile]
}
}
}