Skip to content

Commit

Permalink
Fix issues with gradle config and tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Renanse committed May 27, 2024
1 parent 978b80f commit 9ae48de
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 29 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions ardor3d-lwjgl3-swt/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand Down
10 changes: 4 additions & 6 deletions ardor3d-swt/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void setup() throws Exception {
}

@Test
public void testKeys1() throws Exception {
public void testKeys1() {

e1.keyCode = 'a';

Expand All @@ -70,7 +70,7 @@ public void testKeys1() throws Exception {
}

@Test
public void testKeys2() throws Exception {
public void testKeys2() {
e1.keyCode = 'a';
e2.keyCode = 'b';

Expand All @@ -97,7 +97,7 @@ public void testKeys2() throws Exception {
}

@Test
public void testKeysRepeat() throws Exception {
public void testKeysRepeat() {

e1.keyCode = 'a';

Expand Down
34 changes: 21 additions & 13 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand All @@ -28,12 +28,20 @@ allprojects {
options.encoding = "UTF-8"
}

tasks.register("packageSources", Jar::class) {
from(sourceSets.main.get().allSource)
tasks.named<Jar>("jar") {
archiveBaseName.set(project.name)
from(sourceSets.main.get().output)
}

artifacts.add("archives", tasks["packageSources"])
tasks.register<Jar>("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")
Expand All @@ -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"))
}
}
Expand All @@ -63,4 +71,4 @@ allprojects {
testImplementation("junit:junit:4.13.2")
testImplementation("org.easymock:easymock:5.2.0")
}
}
}

0 comments on commit 9ae48de

Please sign in to comment.