Advanced-Portals/build.gradle
2023-04-06 18:41:18 +01:00

115 lines
3.2 KiB
Groovy

buildscript {
repositories {
maven {url "https://plugins.gradle.org/m2/"}
mavenCentral()
mavenLocal()
}
dependencies {
classpath "org.apache.httpcomponents:httpmime:4.5.13"
classpath "com.google.code.gson:gson:2.8.6"
classpath "org.apache.httpcomponents:httpclient:4.5.13"
}
}
plugins {
id 'dev.s7a.gradle.minecraft.server' version '1.1.0'
}
allprojects {
apply plugin: 'java'
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
if (project.name != "advanced-portals") {
task buildSubmodules doLast {
task -> println "Building $task.project.name"
}
buildSubmodules.finalizedBy build
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
apply from: 'env-variables.gradle'
archivesBaseName = "Advanced-Portals"
group = 'com.sekwah.advancedportals'
def versionString = (file('./version.txt').text + (isRelease ? "" : "-${snapshotName}${shaRef}")).replaceAll('\n', '')
setVersion(versionString)
println "Version: ${getVersion()}"
description = ""
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
configurations {
// configuration that holds jars to copy into lib
implementation.extendsFrom(includeLibs)
}
repositories {
maven { url "https://repo.maven.apache.org/maven2" }
maven { url "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://nexus.velocitypowered.com/repository/maven-public/" }
}
// includeLibs just says to include the library in the final jar
dependencies {
includeLibs project(':lang')
includeLibs project(':core')
includeLibs project(':bungee')
includeLibs project(':spigot')
includeLibs project(':velocity')
}
apply from: 'env-variables.gradle'
println "Branch ${ext.branch}${ext.shaRef} isRelease: '${ext.isRelease}'"
jar {
// Filters the files out that are in the build folders. Look to see if there is a better way to do this?
from configurations.includeLibs.filter {
it.path.contains("${File.separator}build${File.separator}libs")
} .collect {
println("Will Include: ${it.name}")
it.isDirectory() ? it : zipTree(it)
}
}
minecraftServerConfig {
jarUrl.set('https://download.getbukkit.org/spigot/spigot-1.19.4.jar')
jvmArgument = ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005", "-DIReallyKnowWhatIAmDoingISwear=true"]
}
tasks.withType(Jar) {
duplicatesStrategy = DuplicatesStrategy.WARN
}
task copyPlugin() {
doLast {
copy {
println "$buildDir/libs/Advanced-Portals-${getVersion()}.jar"
println "$buildDir/MinecraftServer/plugins/Advanced-Portals-${getVersion()}.jar"
try {
delete fileTree("$buildDir/MinecraftServer/plugins/") {
include "*.jar"
}
}
catch (RuntimeException e) {
println e.getLocalizedMessage()
}
from file("$buildDir/libs/Advanced-Portals-${getVersion()}.jar")
into file("$buildDir/MinecraftServer/plugins")
}
}
}