Skip to content

Commit

Permalink
Give LWJGL3 JARs correct names.
Browse files Browse the repository at this point in the history
This also puts them in `libs` again, instead of the non-standard `lib` that jpackage required. We don't use jpackage now, so we don't need to change the destination directory.
  • Loading branch information
tommyettinger committed Aug 5, 2024
1 parent a8d0432 commit 288dabd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/main/kotlin/gdx/liftoff/data/platforms/Headless.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ java.targetCompatibility = ${project.advanced.serverJavaVersion}
if (JavaVersion.current().isJava9Compatible()) {
compileJava.options.release.set(${project.advanced.serverJavaVersion})
}
${if (project.rootGradle.plugins.contains("kotlin")) "kotlin.compilerOptions.jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_" + (if(project.advanced.serverJavaVersion == "8") "1_8" else project.advanced.serverJavaVersion) + ")\n" else ""}
${if (project.rootGradle.plugins.contains("kotlin")) "kotlin.compilerOptions.jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_" + (if (project.advanced.serverJavaVersion == "8") "1_8" else project.advanced.serverJavaVersion) + ")\n" else ""}
mainClassName = '${project.basic.rootPackage}.headless.HeadlessLauncher'
application.setMainClass(mainClassName)
eclipse.project.name = appName + '-headless'
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/gdx/liftoff/data/platforms/Lwjgl2.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ java.targetCompatibility = ${project.advanced.desktopJavaVersion}
if (JavaVersion.current().isJava9Compatible()) {
compileJava.options.release.set(${project.advanced.desktopJavaVersion})
}
${if (project.rootGradle.plugins.contains("kotlin")) "kotlin.compilerOptions.jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_" + (if(project.advanced.desktopJavaVersion == "8") "1_8" else project.advanced.desktopJavaVersion) + ")\n" else ""}
${if (project.rootGradle.plugins.contains("kotlin")) "kotlin.compilerOptions.jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_" + (if (project.advanced.desktopJavaVersion == "8") "1_8" else project.advanced.desktopJavaVersion) + ")\n" else ""}
dependencies {
${joinDependencies(dependencies)}}
Expand Down
13 changes: 5 additions & 8 deletions src/main/kotlin/gdx/liftoff/data/platforms/Lwjgl3.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Lwjgl3 : Platform {
addGradleTaskDescription(
project,
"jar",
"builds application's runnable jar, which can be found at `$id/build/lib`."
"builds application's runnable jar, which can be found at `$id/build/libs`."
)
project.properties["graalHelperVersion"] = "2.0.1"
project.properties["enableGraalNative"] = "false"
Expand Down Expand Up @@ -173,11 +173,10 @@ java.targetCompatibility = ${project.advanced.desktopJavaVersion}
if (JavaVersion.current().isJava9Compatible()) {
compileJava.options.release.set(${project.advanced.desktopJavaVersion})
}
${if (project.rootGradle.plugins.contains("kotlin")) "kotlin.compilerOptions.jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_" + (if(project.advanced.desktopJavaVersion == "8") "1_8" else project.advanced.desktopJavaVersion) + ")\n" else ""}
${if (project.rootGradle.plugins.contains("kotlin")) "kotlin.compilerOptions.jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_" + (if (project.advanced.desktopJavaVersion == "8") "1_8" else project.advanced.desktopJavaVersion) + ")\n" else ""}
dependencies {
${joinDependencies(dependencies)}}
def jarName = "${'$'}{appName}-${'$'}{version}.jar"
def os = System.properties['os.name'].toLowerCase()
run {
Expand All @@ -188,10 +187,8 @@ run {
}
jar {
// sets the name of the .jar file this produces to the name of the game or app.
archiveFileName.set(jarName)
// using 'lib' instead of the default 'libs' appears to be needed by jpackageimage.
destinationDirectory = file("${'$'}{project.layout.buildDirectory.asFile.get().absolutePath}/lib")
// sets the name of the .jar file this produces to the name of the game or app, with the version after.
archiveFileName.set("${'$'}{appName}-${'$'}{projectVersion}.jar")
// the duplicatesStrategy matters starting in Gradle 7.0; this setting works.
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
dependsOn configurations.runtimeClasspath
Expand Down Expand Up @@ -255,7 +252,7 @@ tasks.register('dist') {
distributions {
main {
contents {
into('lib') {
into('libs') {
project.configurations.runtimeClasspath.files.findAll { file ->
file.getName() != project.tasks.jar.outputs.files.singleFile.name
}.each { file ->
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/gdx/liftoff/data/platforms/Server.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ java.targetCompatibility = ${project.advanced.serverJavaVersion}
if (JavaVersion.current().isJava9Compatible()) {
compileJava.options.release.set(${project.advanced.serverJavaVersion})
}
${if (project.rootGradle.plugins.contains("kotlin")) "kotlin.compilerOptions.jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_" + (if(project.advanced.serverJavaVersion == "8") "1_8" else project.advanced.serverJavaVersion) + ")\n" else ""}
${if (project.rootGradle.plugins.contains("kotlin")) "kotlin.compilerOptions.jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_" + (if (project.advanced.serverJavaVersion == "8") "1_8" else project.advanced.serverJavaVersion) + ")\n" else ""}
mainClassName = '${project.basic.rootPackage}.server.ServerLauncher'
application.setMainClass(mainClassName)
eclipse.project.name = appName + '-server'
Expand Down

0 comments on commit 288dabd

Please sign in to comment.