Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Java 17 and other improvements #134

Merged
merged 24 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
205fe57
Update Kotlin to 1.9.0
hannesbraun Aug 3, 2023
19fc8e2
Update JOGL to 2.4.0
hannesbraun Aug 3, 2023
713a3c4
Update minimum required Java version to 17
hannesbraun Aug 3, 2023
c0ea73b
Use String.repeat instead of calling append repeatedly
hannesbraun Aug 3, 2023
875500c
Use instanceof with pattern variables if possible
hannesbraun Aug 3, 2023
5c2f3ac
Use records for classes HistoryItem, Goal and CameraSetting
hannesbraun Aug 3, 2023
198e2c3
Update Kotlin to 1.9.10
hannesbraun Aug 24, 2023
42748ab
Export java.desktop/sun.awt to all unnamed modules
hannesbraun Sep 11, 2023
c790a17
Migrate Gradle build scripts from Groovy to Kotlin
hannesbraun Sep 11, 2023
56e1aec
Set Multi-Release to true in a jar's manifest
hannesbraun Sep 11, 2023
cf1f383
Already copy resources to bin directory with Gradle
hannesbraun Sep 12, 2023
4c59eed
Update commons-compress to 1.24.0
hannesbraun Sep 12, 2023
b0e26b8
Support building a macOS application bundle
hannesbraun Sep 15, 2023
a508c76
Improve the roboviz shell script
hannesbraun Sep 15, 2023
5160502
Copy files in the execution phase of macOSApp task
hannesbraun Sep 18, 2023
86b93f9
Default to the same config values as in config.txt
hannesbraun Sep 22, 2023
faec5f7
Directly invoke Gradle in GitHub Actions
hannesbraun Sep 23, 2023
d48cc93
Also add lists to the config if their key is not present yet
hannesbraun Sep 23, 2023
8f9b200
Support running without a present config file
hannesbraun Sep 23, 2023
0d87b06
Increase version to 2.0.0-SNAPSHOT
hannesbraun Sep 23, 2023
d1d7453
Merge branch 'master' into java-17
hannesbraun Sep 23, 2023
01ea2d6
Upload the macOS app bundle to the release as well
hannesbraun Sep 23, 2023
5fcaa2a
Fix zipping of macOS app during release
hannesbraun Sep 23, 2023
6aeb006
Fix release name generated through GitHub Actions
hannesbraun Sep 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 1.8
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8
java-version: 17
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build
run: |
cd scripts
./build.sh
run: ./gradlew binDir macOSApp
4 changes: 2 additions & 2 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 1.8
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8
java-version: 17
- name: Build RVTester (Java)
run: make -C examples/java
- name: Build RVTester (C++)
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 1.8
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8
java-version: 17
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build
run: |
cd scripts
./build.sh
cd ..
./gradlew binDir macOSApp
tar czf RoboViz.tar.gz bin/
mv build/macos/RoboViz.app .
zip -r -9 RoboViz-macOS.zip RoboViz.app
- name: Create Release
id: create-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
run: gh release create ${{ github.ref }} --title ${{ github.ref }} ./RoboViz.tar.gz
run: gh release create ${{ github.ref }} --title ${{ github.ref_name }} ./RoboViz.tar.gz ./RoboViz-macOS.zip
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

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).

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).
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).

![](images/video.gif)

Expand Down
59 changes: 0 additions & 59 deletions build.gradle

This file was deleted.

124 changes: 124 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.apache.tools.ant.filters.ReplaceTokens

plugins {
java
application
id("com.github.johnrengelman.shadow") version "8.1.1"
kotlin("jvm") version "1.9.10"
}

group = "org.magmaoffenburg.roboviz"
version = "2.0.0-SNAPSHOT"
application {
mainClass.set("org.magmaoffenburg.roboviz.MainKt")
applicationDefaultJvmArgs = listOf("--add-exports=java.desktop/sun.awt=ALL-UNNAMED")
}

val javaVersion by extra(17)
val joglVersion by extra("2.4.0")
val log4jVersion by extra("2.20.0")

subprojects {
apply(plugin = "java")

repositories {
mavenCentral()
maven(url = "https://www.jogamp.org/deployment/maven/")
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(javaVersion))
}
}
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(javaVersion))
}
}

kotlin {
jvmToolchain(javaVersion)
}

repositories {
mavenCentral()
maven(url = "https://www.jogamp.org/deployment/maven/")
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("com.github.weisj:darklaf-core:3.0.2")
implementation("org.jogamp.jogl:jogl-all-main:$joglVersion")
implementation("org.jogamp.gluegen:gluegen-rt-main:$joglVersion")
implementation("org.apache.commons:commons-compress:1.24.0")
implementation("org.apache.logging.log4j:log4j-api-kotlin:1.2.0")
implementation("org.apache.logging.log4j:log4j-api:$log4jVersion")
implementation("org.apache.logging.log4j:log4j-core:$log4jVersion")

implementation(project(":jsgl"))
}

tasks.jar {
manifest {
// We need to set Multi-Release to true so that log4j can determine the correct class names
attributes("Multi-Release" to "true")
}
}

tasks.withType<ShadowJar> {
archiveFileName.set("${project.name}.jar")
}

tasks.register<Copy>("binDir") {
dependsOn(tasks.withType<ShadowJar>())

val binPath = layout.projectDirectory.dir("bin")
from(
layout.buildDirectory.file("libs/${project.name}.jar"),
layout.projectDirectory.file("config.txt"),
layout.projectDirectory.file("scripts/roboviz.sh"),
layout.projectDirectory.file("scripts/roboviz.bat"),
layout.projectDirectory.file("LICENSE.md"),
layout.projectDirectory.file("NOTICE.md"),
layout.projectDirectory.file("CHANGELOG.md")
)
into(binPath)
}

// Creates an application bundle for macOS
tasks.register("macOSApp") {
dependsOn(tasks.withType<ShadowJar>())

doLast {
copy {
from(layout.projectDirectory.file("macos/Info.plist"))
into(layout.buildDirectory.dir("macos/${project.name}.app/Contents"))
filter(ReplaceTokens::class, "tokens" to mapOf(
"CFBundleExecutable" to "launcher",
"CFBundleIconFile" to "icon",
"CFBundleIdentifier" to group.toString(),
"CFBundleName" to project.name,
"CFBundleShortVersionString" to version.toString(),
"CFBundleVersion" to version.toString(),
))
}
copy {
from(layout.projectDirectory.file("scripts/roboviz.sh"))
into(layout.buildDirectory.dir("macos/${project.name}.app/Contents/MacOS"))
rename(".*", "launcher")
}
copy {
from(layout.projectDirectory.file("macos/icon.icns"))
into(layout.buildDirectory.dir("macos/${project.name}.app/Contents/Resources"))
}
copy {
from(layout.buildDirectory.file("libs/${project.name}.jar"))
into(layout.buildDirectory.dir("macos/${project.name}.app/Contents/MacOS"))
}
}
}
8 changes: 0 additions & 8 deletions jsgl/build.gradle

This file was deleted.

11 changes: 11 additions & 0 deletions jsgl/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
val joglVersion: String by rootProject.extra
val log4jVersion: String by rootProject.extra

dependencies {
implementation("org.jogamp.gluegen:gluegen-rt-main:$joglVersion")
implementation("org.jogamp.jogl:jogl-all-main:$joglVersion")
implementation("org.apache.logging.log4j:log4j-api:$log4jVersion")
}

group = "magmaOffenburg"
description = "jsgl"
8 changes: 4 additions & 4 deletions jsgl/src/main/java/jsgl/jogl/Shader.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ private static boolean checkCompileStatus(GL2 gl, int id, String file)
@Override
public void dispose(GL gl)
{
if (gl instanceof GL2)
gl.getGL2().glDeleteShader(id);
else if (gl instanceof GL3)
gl.getGL3().glDeleteShader(id);
if (gl instanceof GL2 gl2)
gl2.glDeleteShader(id);
else if (gl instanceof GL3 gl3)
gl3.glDeleteShader(id);
disposed = true;
}

Expand Down
4 changes: 1 addition & 3 deletions jsgl/src/main/java/jsgl/jogl/util/TessCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ public void end()
@Override
public void vertex(Object vertexData)
{
double[] pointer;
if (vertexData instanceof double[]) {
pointer = (double[]) vertexData;
if (vertexData instanceof double[] pointer) {
if (pointer.length == 6)
gl.glColor3dv(pointer, 3);
gl.glVertex3dv(pointer, 0);
Expand Down
32 changes: 32 additions & 0 deletions macos/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>@CFBundleExecutable@</string>
<key>CFBundleIconFile</key>
<string>@CFBundleIconFile@</string>
<key>CFBundleIdentifier</key>
<string>@CFBundleIdentifier@</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>@CFBundleName@</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>@CFBundleShortVersionString@</string>
<key>CFBundleVersion</key>
<string>@CFBundleVersion@</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>NSHighResolutionCapable</key>
<false/>
<key>NSHumanReadableCopyright</key>
<string>Copyright 2011-2023 The RoboViz authors</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
Binary file added macos/icon.icns
Binary file not shown.
16 changes: 1 addition & 15 deletions scripts/build.bat
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
cd ..

set BIN=bin\

IF EXIST %BIN% GOTO COMPILE
mkdir %BIN%

:COMPILE
call gradlew.bat clean shadowJar

copy build\libs\RoboViz.jar %BIN%\
copy config.txt %BIN%\
copy scripts\roboviz.sh %BIN%\
copy scripts\roboviz.bat %BIN%\
copy LICENSE.md %BIN%\
copy NOTICE.md %BIN%\
copy CHANGELOG.md %BIN%\
call gradlew.bat clean binDir

gradlew.bat clean
pause
20 changes: 3 additions & 17 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
#!/bin/bash
#!/bin/sh

BIN=../bin
../gradlew -p .. clean binDir

# create a bin folder in the RoboViz root directory
mkdir -p $BIN

../gradlew -p .. clean shadowJar

# copy over resources and libraries to bin folder
cp ../build/libs/RoboViz.jar $BIN/
cp ../config.txt $BIN/
cp ../scripts/roboviz.sh $BIN/
cp ../scripts/roboviz.bat $BIN/
cp ../LICENSE.md $BIN/
cp ../NOTICE.md $BIN/
cp ../CHANGELOG.md $BIN/

# clean up the gradle build directorys
# clean up the gradle build directories
../gradlew -p .. clean
2 changes: 1 addition & 1 deletion scripts/roboviz.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
set prev=%cd%
cd /D "%~dp0"

java -jar RoboViz.jar %*
java --add-exports=java.desktop/sun.awt=ALL-UNNAMED -jar RoboViz.jar %*

cd %prev%
Loading