From 03c49e43610309274a6b3212dfca7caeaa12a6c0 Mon Sep 17 00:00:00 2001 From: Toni Helenius Date: Thu, 9 Nov 2023 22:47:49 +0200 Subject: [PATCH] Gradle build improvements --- .../gde/templates/files/freemarker/build.gradle.ftl | 13 +++++++++---- .../GradleDesktopGameWizardIterator.java | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/jme3-templates/src/com/jme3/gde/templates/files/freemarker/build.gradle.ftl b/jme3-templates/src/com/jme3/gde/templates/files/freemarker/build.gradle.ftl index 73603c3c3..cd3af9e34 100644 --- a/jme3-templates/src/com/jme3/gde/templates/files/freemarker/build.gradle.ftl +++ b/jme3-templates/src/com/jme3/gde/templates/files/freemarker/build.gradle.ftl @@ -7,11 +7,16 @@ plugins { group 'com.mygame' version '1.0' -mainClassName = "com.mygame.Main" +application { + applicationName = '${name}' + mainClass = 'com.mygame.Main' + if (System.getProperty("os.name").toLowerCase().contains("mac")) { + applicationDefaultJvmArgs = ['-XstartOnFirstThread'] + } +} repositories { mavenCentral() - jcenter() maven { url 'https://jitpack.io' } } @@ -99,7 +104,7 @@ dependencies { jar { manifest { - attributes 'Main-Class': "$mainClassName" + attributes 'Main-Class': application.mainClass } } @@ -110,5 +115,5 @@ java { } wrapper { - gradleVersion = '7.6' + gradleVersion = '8.4' } \ No newline at end of file diff --git a/jme3-templates/src/com/jme3/gde/templates/gradledesktop/GradleDesktopGameWizardIterator.java b/jme3-templates/src/com/jme3/gde/templates/gradledesktop/GradleDesktopGameWizardIterator.java index bb18311b9..e0f204379 100644 --- a/jme3-templates/src/com/jme3/gde/templates/gradledesktop/GradleDesktopGameWizardIterator.java +++ b/jme3-templates/src/com/jme3/gde/templates/gradledesktop/GradleDesktopGameWizardIterator.java @@ -132,6 +132,7 @@ private String[] createSteps() { // Create build.gradle from template File gradleBuildFile = new File(dirF, "build.gradle"); Map buildFileBindings = new HashMap<>(); + buildFileBindings.put("name", wiz.getProperty("name")); buildFileBindings.put("jmeVersion", wiz.getProperty("jmeVersion")); buildFileBindings.put("lwjglLibrary", wiz.getProperty("lwjglLibrary")); buildFileBindings.put("guiLibrary", wiz.getProperty("guiLibrary"));