Skip to content

Commit

Permalink
gradle file optimization, added shadowjar as build dep
Browse files Browse the repository at this point in the history
  • Loading branch information
Ifiht committed Oct 26, 2024
1 parent a975870 commit 346b922
Showing 1 changed file with 31 additions and 42 deletions.
73 changes: 31 additions & 42 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ plugins {
}

group = 'org.evlis'
version = '0.3.9'
version = '0.3.10'

def targetJavaVersion = 21

repositories {
mavenCentral()
Expand All @@ -31,58 +33,45 @@ dependencies {
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.10.0')
}

def targetJavaVersion = 21
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
sourceCompatibility = JavaVersion.toVersion(targetJavaVersion)
targetCompatibility = JavaVersion.toVersion(targetJavaVersion)
toolchain.languageVersion.set(JavaLanguageVersion.of(targetJavaVersion))
}

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'

if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release.set(targetJavaVersion)
}
}

compileJava {
options.compilerArgs += ["-parameters"]
options.fork = true
//options.forkOptions.executable = System.getProperty("java.home") + "/bin/javac"
options.release.set(targetJavaVersion)
}

shadowJar {
relocate 'co.aikar.commands', 'Lunamatic.acf'
relocate 'co.aikar.locales', 'Lunamatic.locales'
}

processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
tasks {
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}
}

test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
build { dependsOn(shadowJar) }
shadowJar {
relocate 'co.aikar.commands', 'Lunamatic.acf'
relocate 'co.aikar.locales', 'Lunamatic.locales'
}
}

runServer {
// Configure the Minecraft version for our task.
// This is the only required configuration besides applying the plugin.
// Your plugin's jar (or shadowJar if present) will be used automatically.
minecraftVersion("1.21.1")
downloadPlugins {
github("Ifiht", "AutoStop", "v1.1.0", "AutoStop-1.1.0.jar")
test {
useJUnitPlatform()
testLogging { events "passed", "skipped", "failed" }
}
runServer {
// Configure the Minecraft version for our task.
// This is the only required configuration besides applying the plugin.
// Your plugin's jar (or shadowJar if present) will be used automatically.
minecraftVersion("1.21.1")
downloadPlugins {
github("Ifiht", "AutoStop", "v1.1.0", "AutoStop-1.1.0.jar")
}
}
}

Expand Down

0 comments on commit 346b922

Please sign in to comment.