Skip to content

Commit

Permalink
Merge branch 'java-17'
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesbraun committed Oct 6, 2023
2 parents c68dac4 + 6aeb006 commit 57e3f74
Show file tree
Hide file tree
Showing 37 changed files with 307 additions and 242 deletions.
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

0 comments on commit 57e3f74

Please sign in to comment.