Skip to content

Commit

Permalink
Added java 9+ modules
Browse files Browse the repository at this point in the history
  • Loading branch information
nshtengauer committed Dec 14, 2024
1 parent b254b51 commit 7d74893
Show file tree
Hide file tree
Showing 16 changed files with 91 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/maven_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'

- name: "Importing GPG key"
run: |
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@ Available modules:
- ```openglfx-jogl```
- ```openglfx-libgdx```

If you are using java modules, then you need to add the following module in `module-info.java`:
```java
requires openglfx.lwjgl;
```
and launch with the following arguments:
```
--add-exports=javafx.graphics/com.sun.prism=ALL-UNNAMED
--add-exports=javafx.graphics/com.sun.javafx.scene.layout=ALL-UNNAMED
--add-exports=javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED
--add-exports=javafx.graphics/com.sun.javafx.sg.prism=ALL-UNNAMED
--add-exports=javafx.graphics/com.sun.scenario=ALL-UNNAMED
--add-exports=javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED
--add-exports=javafx.graphics/com.sun.glass.ui=ALL-UNNAMED
```

# Example
https://github.com/husker-dev/openglfx-example
Expand Down
7 changes: 4 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
projectName=openglfx
version=4.1.4

kotlinVersion=2.0.0
graplVersion=2.3.1
javafxVersion=20.0.2
kotlinVersion=2.0.20
graplVersion=2.3.2
javafxVersion=17.0.2
lwjglVersion=3.3.2
lwjgl2Version=2.9.3
joglVersion=2.5.0
Expand All @@ -26,6 +26,7 @@ addons_testing=testing
addons_mavenPublish=maven-publish
addons_nativeCompilation=native-compilation
addons_propertyClass=property-class
addons_moduleInfo=kotlin-module-info

kotlin.code.style=official

Expand Down
12 changes: 12 additions & 0 deletions gradle/addons/kotlin-module-info.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

compileKotlin {
destinationDirectory = compileJava.destinationDirectory
}

jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

tasks.withType(Javadoc).configureEach {
enabled = false
}
2 changes: 1 addition & 1 deletion gradle/addons/maven-publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class MavenPublishPlugin implements Plugin<Project> {
}

project.signing {
if(project.properties.hasProperty("ossrhUsername"))
if(project.properties.containsKey("ossrhUsername"))
sign project.publishing.publications.mavenJava
}
}
Expand Down
4 changes: 4 additions & 0 deletions modules/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ plugins {

apply from: addon(addons_mavenPublish)
apply from: addon(addons_propertyClass)
apply from: addon(addons_moduleInfo)

sourceSets {
main.java.srcDirs = ['kotlin']
}

kotlin {
jvmToolchain(11)
compilerOptions.freeCompilerArgs = [
"-Xjavac-arguments" // Let not use "--add-exports"
]
}

maven {
Expand Down
20 changes: 20 additions & 0 deletions modules/core/kotlin/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module openglfx {

requires transitive kotlin.stdlib;
requires transitive grapl.gl;

requires javafx.base;
requires javafx.graphics;

exports com.huskerdev.openglfx;
exports com.huskerdev.openglfx.canvas;
exports com.huskerdev.openglfx.canvas.events;
exports com.huskerdev.openglfx.effects;
exports com.huskerdev.openglfx.image;
exports com.huskerdev.openglfx.internal;
exports com.huskerdev.openglfx.internal.canvas;
exports com.huskerdev.openglfx.internal.platforms;
exports com.huskerdev.openglfx.internal.platforms.win;
exports com.huskerdev.openglfx.internal.platforms.macos;
exports com.huskerdev.openglfx.internal.shaders;
}
1 change: 1 addition & 0 deletions modules/jogl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
}

apply from: addon(addons_mavenPublish)
apply from: addon(addons_moduleInfo)

sourceSets {
main.java.srcDirs = ['kotlin']
Expand Down
7 changes: 7 additions & 0 deletions modules/jogl/kotlin/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module openglfx.jogl {

requires transitive openglfx;

exports com.huskerdev.openglfx.jogl;
exports com.huskerdev.openglfx.jogl.events;
}
1 change: 1 addition & 0 deletions modules/libgdx/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
}

apply from: addon(addons_mavenPublish)
apply from: addon(addons_moduleInfo)

sourceSets {
main.java.srcDirs = ['kotlin']
Expand Down
11 changes: 11 additions & 0 deletions modules/libgdx/kotlin/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module openglfx.libgdx {

requires transitive openglfx;

requires org.lwjgl;
requires org.lwjgl.opengl;

exports com.huskerdev.openglfx.libgdx;
exports com.huskerdev.openglfx.libgdx.events;
exports com.huskerdev.openglfx.libgdx.internal;
}
1 change: 1 addition & 0 deletions modules/lwjgl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
}

apply from: addon(addons_mavenPublish)
apply from: addon(addons_moduleInfo)

sourceSets {
main.java.srcDirs = ['kotlin']
Expand Down
9 changes: 9 additions & 0 deletions modules/lwjgl/kotlin/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module openglfx.lwjgl {

requires transitive openglfx;

requires org.lwjgl;
requires org.lwjgl.opengl;

exports com.huskerdev.openglfx.lwjgl;
}
1 change: 1 addition & 0 deletions modules/lwjgl2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
}

apply from: addon(addons_mavenPublish)
apply from: addon(addons_moduleInfo)

sourceSets {
main.java.srcDirs = ['kotlin']
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package com.huskerdev.openglfx.lwjgl2

import com.huskerdev.grapl.gl.GLContext
import com.huskerdev.openglfx.GLExecutor

Expand Down
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include (
'modules:bom',
'modules:core',
'modules:core:native',
'modules:jogl',
Expand Down

0 comments on commit 7d74893

Please sign in to comment.