EptaListProject/build.gradle

97 lines
2.3 KiB
Groovy

plugins {
id 'java'
id 'de.undercouch.download' version '5.4.0' apply false
}
import de.undercouch.gradle.tasks.download.Download
subprojects {
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
}
allprojects {
repositories {
mavenCentral()
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/groups/public/"
}
}
}
version = "1.4"
task mergePlugins(type: Jar) {
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())
}
return jr
}
def jarPaths = [
"D:\\Users\\User\\IdeaProjects\\EptaListProject\\velocity\\build\\libs\\velocity-"+version+".jar",
"D:\\Users\\User\\IdeaProjects\\EptaListProject\\spigot\\build\\libs\\spigot-"+version+".jar",
"D:\\Users\\User\\IdeaProjects\\EptaListProject\\base\\build\\libs\\base-"+version+".jar",
"D:\\Users\\User\\IdeaProjects\\EptaListProject\\boungecord\\build\\libs\\boungecord-"+version+".jar"
]
from jars().collect { zipTree(it) }
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
task mergeALL() {
dependsOn mergePlugins
}
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("RunBungeeCord") {
dependsOn mergeALL
dependsOn 'downloadBungeeCord'
def jarFile = file("$buildDir/libs/EptaList-${version}.jar")
def targetDir = file("$buildDir/run/plugins")
def jarFile2 = file("$buildDir/run/plugins/EptaList-${version}.jar")
if (jarFile2.exists()) {
jarFile2.delete()
}
targetDir.mkdirs()
copy {
from jarFile
into targetDir
}
targetDir = file("$buildDir/run")
jarFile = file("$buildDir/downloads/BungeeCord.jar")
doLast {
javaexec {
workingDir = targetDir
mainClass = '-jar'
args = [jarFile]
}
}
}