Skip to content

Commit 57e3f74

Browse files
committed
Merge branch 'java-17'
2 parents c68dac4 + 6aeb006 commit 57e3f74

37 files changed

+307
-242
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@ jobs:
1818
steps:
1919
- name: Checkout
2020
uses: actions/checkout@v3
21-
- name: Set up JDK 1.8
21+
- name: Set up JDK 17
2222
uses: actions/setup-java@v3
2323
with:
2424
distribution: temurin
25-
java-version: 8
25+
java-version: 17
2626
- name: Grant execute permission for gradlew
2727
run: chmod +x gradlew
2828
- name: Build
29-
run: |
30-
cd scripts
31-
./build.sh
29+
run: ./gradlew binDir macOSApp

.github/workflows/examples.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ jobs:
1515
steps:
1616
- name: Checkout
1717
uses: actions/checkout@v3
18-
- name: Set up JDK 1.8
18+
- name: Set up JDK 17
1919
uses: actions/setup-java@v3
2020
with:
2121
distribution: temurin
22-
java-version: 8
22+
java-version: 17
2323
- name: Build RVTester (Java)
2424
run: make -C examples/java
2525
- name: Build RVTester (C++)

.github/workflows/release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@ jobs:
1212
steps:
1313
- name: Checkout
1414
uses: actions/checkout@v3
15-
- name: Set up JDK 1.8
15+
- name: Set up JDK 17
1616
uses: actions/setup-java@v3
1717
with:
1818
distribution: temurin
19-
java-version: 8
19+
java-version: 17
2020
- name: Grant execute permission for gradlew
2121
run: chmod +x gradlew
2222
- name: Build
2323
run: |
24-
cd scripts
25-
./build.sh
26-
cd ..
24+
./gradlew binDir macOSApp
2725
tar czf RoboViz.tar.gz bin/
26+
mv build/macos/RoboViz.app .
27+
zip -r -9 RoboViz-macOS.zip RoboViz.app
2828
- name: Create Release
2929
id: create-release
3030
env:
3131
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
32-
run: gh release create ${{ github.ref }} --title ${{ github.ref }} ./RoboViz.tar.gz
32+
run: gh release create ${{ github.ref }} --title ${{ github.ref_name }} ./RoboViz.tar.gz ./RoboViz-macOS.zip

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
RoboViz is a monitor and visualization tool for the [RoboCup 3D Soccer Simulation League](https://ssim.robocup.org/3d-simulation/). This is a fork of the original version by Justin Stoecker [hosted on SourceForge](https://sourceforge.net/projects/rcroboviz/). Compared to the original version, major improvements have been made as can be seen in detail in the [changelog](CHANGELOG.md).
77

8-
Java 1.8 is required to build and run RoboViz. Pre-built binaries for Windows, Linux and Mac are available [here](https://github.com/magmaOffenburg/RoboViz/releases). You can also build it from source using [`scripts/build.sh`](scripts/build.sh) or [`scripts/build.bat`](scripts/build.bat).
8+
Java 17 is required to build and run RoboViz. Pre-built binaries for Windows, Linux and Mac are available [here](https://github.com/magmaOffenburg/RoboViz/releases). You can also build it from source using [`scripts/build.sh`](scripts/build.sh) or [`scripts/build.bat`](scripts/build.bat).
99

1010
![](images/video.gif)
1111

build.gradle

Lines changed: 0 additions & 59 deletions
This file was deleted.

build.gradle.kts

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2+
import org.apache.tools.ant.filters.ReplaceTokens
3+
4+
plugins {
5+
java
6+
application
7+
id("com.github.johnrengelman.shadow") version "8.1.1"
8+
kotlin("jvm") version "1.9.10"
9+
}
10+
11+
group = "org.magmaoffenburg.roboviz"
12+
version = "2.0.0-SNAPSHOT"
13+
application {
14+
mainClass.set("org.magmaoffenburg.roboviz.MainKt")
15+
applicationDefaultJvmArgs = listOf("--add-exports=java.desktop/sun.awt=ALL-UNNAMED")
16+
}
17+
18+
val javaVersion by extra(17)
19+
val joglVersion by extra("2.4.0")
20+
val log4jVersion by extra("2.20.0")
21+
22+
subprojects {
23+
apply(plugin = "java")
24+
25+
repositories {
26+
mavenCentral()
27+
maven(url = "https://www.jogamp.org/deployment/maven/")
28+
}
29+
30+
java {
31+
toolchain {
32+
languageVersion.set(JavaLanguageVersion.of(javaVersion))
33+
}
34+
}
35+
}
36+
37+
java {
38+
toolchain {
39+
languageVersion.set(JavaLanguageVersion.of(javaVersion))
40+
}
41+
}
42+
43+
kotlin {
44+
jvmToolchain(javaVersion)
45+
}
46+
47+
repositories {
48+
mavenCentral()
49+
maven(url = "https://www.jogamp.org/deployment/maven/")
50+
}
51+
52+
dependencies {
53+
implementation("org.jetbrains.kotlin:kotlin-stdlib")
54+
implementation("org.jetbrains.kotlin:kotlin-reflect")
55+
implementation("com.github.weisj:darklaf-core:3.0.2")
56+
implementation("org.jogamp.jogl:jogl-all-main:$joglVersion")
57+
implementation("org.jogamp.gluegen:gluegen-rt-main:$joglVersion")
58+
implementation("org.apache.commons:commons-compress:1.24.0")
59+
implementation("org.apache.logging.log4j:log4j-api-kotlin:1.2.0")
60+
implementation("org.apache.logging.log4j:log4j-api:$log4jVersion")
61+
implementation("org.apache.logging.log4j:log4j-core:$log4jVersion")
62+
63+
implementation(project(":jsgl"))
64+
}
65+
66+
tasks.jar {
67+
manifest {
68+
// We need to set Multi-Release to true so that log4j can determine the correct class names
69+
attributes("Multi-Release" to "true")
70+
}
71+
}
72+
73+
tasks.withType<ShadowJar> {
74+
archiveFileName.set("${project.name}.jar")
75+
}
76+
77+
tasks.register<Copy>("binDir") {
78+
dependsOn(tasks.withType<ShadowJar>())
79+
80+
val binPath = layout.projectDirectory.dir("bin")
81+
from(
82+
layout.buildDirectory.file("libs/${project.name}.jar"),
83+
layout.projectDirectory.file("config.txt"),
84+
layout.projectDirectory.file("scripts/roboviz.sh"),
85+
layout.projectDirectory.file("scripts/roboviz.bat"),
86+
layout.projectDirectory.file("LICENSE.md"),
87+
layout.projectDirectory.file("NOTICE.md"),
88+
layout.projectDirectory.file("CHANGELOG.md")
89+
)
90+
into(binPath)
91+
}
92+
93+
// Creates an application bundle for macOS
94+
tasks.register("macOSApp") {
95+
dependsOn(tasks.withType<ShadowJar>())
96+
97+
doLast {
98+
copy {
99+
from(layout.projectDirectory.file("macos/Info.plist"))
100+
into(layout.buildDirectory.dir("macos/${project.name}.app/Contents"))
101+
filter(ReplaceTokens::class, "tokens" to mapOf(
102+
"CFBundleExecutable" to "launcher",
103+
"CFBundleIconFile" to "icon",
104+
"CFBundleIdentifier" to group.toString(),
105+
"CFBundleName" to project.name,
106+
"CFBundleShortVersionString" to version.toString(),
107+
"CFBundleVersion" to version.toString(),
108+
))
109+
}
110+
copy {
111+
from(layout.projectDirectory.file("scripts/roboviz.sh"))
112+
into(layout.buildDirectory.dir("macos/${project.name}.app/Contents/MacOS"))
113+
rename(".*", "launcher")
114+
}
115+
copy {
116+
from(layout.projectDirectory.file("macos/icon.icns"))
117+
into(layout.buildDirectory.dir("macos/${project.name}.app/Contents/Resources"))
118+
}
119+
copy {
120+
from(layout.buildDirectory.file("libs/${project.name}.jar"))
121+
into(layout.buildDirectory.dir("macos/${project.name}.app/Contents/MacOS"))
122+
}
123+
}
124+
}

jsgl/build.gradle

Lines changed: 0 additions & 8 deletions
This file was deleted.

jsgl/build.gradle.kts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
val joglVersion: String by rootProject.extra
2+
val log4jVersion: String by rootProject.extra
3+
4+
dependencies {
5+
implementation("org.jogamp.gluegen:gluegen-rt-main:$joglVersion")
6+
implementation("org.jogamp.jogl:jogl-all-main:$joglVersion")
7+
implementation("org.apache.logging.log4j:log4j-api:$log4jVersion")
8+
}
9+
10+
group = "magmaOffenburg"
11+
description = "jsgl"

jsgl/src/main/java/jsgl/jogl/Shader.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,10 @@ private static boolean checkCompileStatus(GL2 gl, int id, String file)
157157
@Override
158158
public void dispose(GL gl)
159159
{
160-
if (gl instanceof GL2)
161-
gl.getGL2().glDeleteShader(id);
162-
else if (gl instanceof GL3)
163-
gl.getGL3().glDeleteShader(id);
160+
if (gl instanceof GL2 gl2)
161+
gl2.glDeleteShader(id);
162+
else if (gl instanceof GL3 gl3)
163+
gl3.glDeleteShader(id);
164164
disposed = true;
165165
}
166166

jsgl/src/main/java/jsgl/jogl/util/TessCallback.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ public void end()
5757
@Override
5858
public void vertex(Object vertexData)
5959
{
60-
double[] pointer;
61-
if (vertexData instanceof double[]) {
62-
pointer = (double[]) vertexData;
60+
if (vertexData instanceof double[] pointer) {
6361
if (pointer.length == 6)
6462
gl.glColor3dv(pointer, 3);
6563
gl.glVertex3dv(pointer, 0);

0 commit comments

Comments
 (0)