From 9ae48de87de6b7147236ad11a6cb0c58208721b9 Mon Sep 17 00:00:00 2001 From: Joshua Slack Date: Mon, 27 May 2024 13:36:05 -0500 Subject: [PATCH] Fix issues with gradle config and tests. --- .github/workflows/gradle.yml | 7 ++-- ardor3d-lwjgl3-swt/build.gradle.kts | 8 ++--- ardor3d-swt/build.gradle.kts | 10 +++--- .../input/swt/TestSwtKeyboardWrapper.java | 6 ++-- build.gradle.kts | 34 ++++++++++++------- 5 files changed, 36 insertions(+), 29 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index a05b391e..ced9010d 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -15,17 +15,18 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4.1.5 - name: Set up JDK 17 - uses: actions/setup-java@v1 + uses: actions/setup-java@v4.2.1 with: java-version: 17 + distribution: 'temurin' - name: Grant execute permission for gradlew run: chmod +x gradlew - name: Build with Gradle run: ./gradlew build - name: Publish artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4.3.3 with: name: Package path: ardor3d-*/build/libs diff --git a/ardor3d-lwjgl3-swt/build.gradle.kts b/ardor3d-lwjgl3-swt/build.gradle.kts index 51bdc88f..9756961b 100644 --- a/ardor3d-lwjgl3-swt/build.gradle.kts +++ b/ardor3d-lwjgl3-swt/build.gradle.kts @@ -3,10 +3,10 @@ import org.gradle.internal.os.OperatingSystem description = "Ardor 3D LWJGL3 SWT" val lwjglSwtVersion = "1.0.0" -val lwjgl3SwtPackage = when (OperatingSystem.current()) { - OperatingSystem.WINDOWS -> "lwjgl3-swt-windows" - OperatingSystem.LINUX -> "lwjgl3-swt-linux" - OperatingSystem.MAC_OS -> "lwjgl3-swt-macos" +val lwjgl3SwtPackage = when { + OperatingSystem.current().isWindows -> "lwjgl3-swt-windows" + OperatingSystem.current().isLinux -> "lwjgl3-swt-linux" + OperatingSystem.current().isMacOsX -> "lwjgl3-swt-macos" else -> throw IllegalStateException("Unsupported operating system") } diff --git a/ardor3d-swt/build.gradle.kts b/ardor3d-swt/build.gradle.kts index 5c7e0865..91a39472 100644 --- a/ardor3d-swt/build.gradle.kts +++ b/ardor3d-swt/build.gradle.kts @@ -3,17 +3,15 @@ import org.gradle.internal.os.OperatingSystem description = "Ardor 3D SWT" val swtVersion = "3.115.0" -val swtNatives = when (OperatingSystem.current()) { - OperatingSystem.WINDOWS -> "org.eclipse.swt.win32.win32.x86_64" - OperatingSystem.LINUX -> "org.eclipse.swt.gtk.linux.x86_64" - OperatingSystem.MAC_OS -> "org.eclipse.swt.cocoa.macosx.x86_64" +val swtNatives = when { + OperatingSystem.current().isWindows -> "org.eclipse.swt.win32.win32.x86_64" + OperatingSystem.current().isLinux -> "org.eclipse.swt.gtk.linux.x86_64" + OperatingSystem.current().isMacOsX -> "org.eclipse.swt.cocoa.macosx.x86_64" else -> throw IllegalStateException("Unsupported operating system") } dependencies { api(project(":ardor3d-core")) - api("org.eclipse.platform:org.eclipse.swt:$swtVersion") - implementation("org.eclipse.platform:$swtNatives:$swtVersion") } diff --git a/ardor3d-swt/src/test/java/com/ardor3d/input/swt/TestSwtKeyboardWrapper.java b/ardor3d-swt/src/test/java/com/ardor3d/input/swt/TestSwtKeyboardWrapper.java index 56aa8ad2..07bbade7 100644 --- a/ardor3d-swt/src/test/java/com/ardor3d/input/swt/TestSwtKeyboardWrapper.java +++ b/ardor3d-swt/src/test/java/com/ardor3d/input/swt/TestSwtKeyboardWrapper.java @@ -47,7 +47,7 @@ public void setup() throws Exception { } @Test - public void testKeys1() throws Exception { + public void testKeys1() { e1.keyCode = 'a'; @@ -70,7 +70,7 @@ public void testKeys1() throws Exception { } @Test - public void testKeys2() throws Exception { + public void testKeys2() { e1.keyCode = 'a'; e2.keyCode = 'b'; @@ -97,7 +97,7 @@ public void testKeys2() throws Exception { } @Test - public void testKeysRepeat() throws Exception { + public void testKeysRepeat() { e1.keyCode = 'a'; diff --git a/build.gradle.kts b/build.gradle.kts index fe517dbc..7660580f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,13 +5,13 @@ plugins { } group = "com.ardor3d" -version = "1.6.2" +version = "1.7.0" extra["lwjglVersion"] = "3.3.3" -extra["lwjglNatives"] = when (OperatingSystem.current()) { - OperatingSystem.WINDOWS -> "natives-windows" - OperatingSystem.LINUX -> "natives-linux" - OperatingSystem.MAC_OS -> "natives-macos" +extra["lwjglNatives"] = when { + OperatingSystem.current().isWindows -> "natives-windows" + OperatingSystem.current().isLinux -> "natives-linux" + OperatingSystem.current().isMacOsX -> "natives-macos" else -> throw IllegalStateException("Unsupported operating system") } @@ -28,12 +28,20 @@ allprojects { options.encoding = "UTF-8" } - tasks.register("packageSources", Jar::class) { - from(sourceSets.main.get().allSource) + tasks.named("jar") { + archiveBaseName.set(project.name) + from(sourceSets.main.get().output) } - artifacts.add("archives", tasks["packageSources"]) + tasks.register("packageSources") { + archiveBaseName.set("${project.name}-sources") + from(sourceSets.main.get().allSource) + } + artifacts { + add("archives", tasks["jar"]) + add("archives", tasks["packageSources"]) + } repositories { mavenCentral() maven("https://repo.maven.apache.org/maven2") @@ -43,14 +51,14 @@ allprojects { resolutionStrategy { eachDependency { if (requested.name.contains("\${osgi.platform}")) { - when (OperatingSystem.current()) { - OperatingSystem.WINDOWS -> { + when { + OperatingSystem.current().isWindows -> { useTarget(requested.toString().replace("\${osgi.platform}", "win32.win32.x86_64:3.108.0")) } - OperatingSystem.LINUX -> { + OperatingSystem.current().isLinux -> { useTarget(requested.toString().replace("\${osgi.platform}", "gtk.linux.x86_64:3.108.0")) } - OperatingSystem.MAC_OS -> { + OperatingSystem.current().isMacOsX -> { useTarget(requested.toString().replace("\${osgi.platform}", "cocoa.macosx.x86_64:3.108.0")) } } @@ -63,4 +71,4 @@ allprojects { testImplementation("junit:junit:4.13.2") testImplementation("org.easymock:easymock:5.2.0") } -} \ No newline at end of file +}