[API] Automatic Module Names (#105)

* Initial implementation of Automatic Module Names

* Fix using java 17 for publishing

* Roll build back to jdk 1.8

* Fix package name for imgui.lwjgl3 module

* Reworking package change to prevent breaking backwards compatability
This commit is contained in:
Trevor Flynn authored and GitHub committed 2022-01-21 09:34:38 +02:00
1 parent 6f48a70564
commit 8c1ef209ad
9 files changed
+52 -11

No files matched your search

+14
View File
@@ -121,6 +121,10 @@ dependencies {
3. Add the jar to your classpath. 3. Add the jar to your classpath.
</details> </details>
#### Java Module System
If using Java 9 modules, you will need to require the `imgui.app` module.
## Binding ## Binding
Using binding without the wrapper requires to "attach" it to your application manually. Using binding without the wrapper requires to "attach" it to your application manually.
You can refer to [imgui-app](https://github.com/SpaiR/imgui-java/blob/v1.86.0/imgui-app) module and see how things are done there. You can refer to [imgui-app](https://github.com/SpaiR/imgui-java/blob/v1.86.0/imgui-app) module and see how things are done there.
@@ -247,6 +251,16 @@ dependencies {
4. Provide a VM option: `imgui.library.path` or `java.library.path`. It should point to the folder where you've placed downloaded native libraries. 4. Provide a VM option: `imgui.library.path` or `java.library.path`. It should point to the folder where you've placed downloaded native libraries.
</details> </details>
#### Java Module System
If using Java 9 modules, imgui-java has Automatic Module Names:
| Package | Module |
|--------------------|---------------|
| imgui-java-app | imgui.app |
| imgui-java-binding | imgui.binding |
| imgui-java-lwjgl3 | imgui.lwjgl3 |
| imgui-java-natives | imgui.natives |
## Extensions ## Extensions
- [ImNodes](https://github.com/Nelarius/imnodes/tree/857cc860af05ac0f6a4039c2af33d982377b6cf4) | [Example](https://github.com/SpaiR/imgui-java/blob/v1.86.0/example/src/main/java/ExampleImNodes.java) <br> - [ImNodes](https://github.com/Nelarius/imnodes/tree/857cc860af05ac0f6a4039c2af33d982377b6cf4) | [Example](https://github.com/SpaiR/imgui-java/blob/v1.86.0/example/src/main/java/ExampleImNodes.java) <br>
A small, dependency-free node editor for dear imgui. (A good choice for simple start.) A small, dependency-free node editor for dear imgui. (A good choice for simple start.)
+3
View File
@@ -37,6 +37,9 @@ jar {
include 'imgui-java64.dll' include 'imgui-java64.dll'
into 'io/imgui/java/native-bin/' into 'io/imgui/java/native-bin/'
} }
manifest {
attributes 'Automatic-Module-Name': 'imgui.app'
}
} }
shadowJar { shadowJar {
@@ -4,7 +4,7 @@ package imgui.app;
* Application class from which ImGui applications extend. * Application class from which ImGui applications extend.
* Serves as an abstraction layer to hide all low-level details about window creation and rendering routine. * Serves as an abstraction layer to hide all low-level details about window creation and rendering routine.
* *
* <h3>Life-cycle</h3> * <h2>Life-cycle</h2>
* <p>The entry point for ImGui applications is the Application class and {@link #launch(Application)} method. * <p>The entry point for ImGui applications is the Application class and {@link #launch(Application)} method.
* It initializes application instance and starts the main application loop. * It initializes application instance and starts the main application loop.
* *
+3
View File
@@ -38,6 +38,9 @@ jar {
include "$libName" // this is fine include "$libName" // this is fine
into 'io/imgui/java/native-bin/' into 'io/imgui/java/native-bin/'
} }
manifest {
attributes 'Automatic-Module-Name': 'imgui.natives'
}
} }
apply from: "$rootDir/publish.gradle" apply from: "$rootDir/publish.gradle"
+6
View File
@@ -22,3 +22,9 @@ tasks.register('generateLibs', GenerateLibs) {
apply from: "$rootDir/publish.gradle" apply from: "$rootDir/publish.gradle"
configurePublishing('imgui-java-binding', 'JNI based binding for Dear ImGui') configurePublishing('imgui-java-binding', 'JNI based binding for Dear ImGui')
jar {
manifest {
attributes 'Automatic-Module-Name': 'imgui.binding'
}
}
@@ -1,6 +1,6 @@
package imgui.glfw; package imgui.lwjgl3.glfw;
final class ImGuiImplGlfwNative { public final class ImGuiImplGlfwNative {
private ImGuiImplGlfwNative() { private ImGuiImplGlfwNative() {
} }
@@ -10,9 +10,15 @@ final class ImGuiImplGlfwNative {
#endif #endif
*/ */
// GLFW hack: Hide icon from task bar /**
// Applied only for windows * GLFW hack: Hide icon from task bar
static native void win32hideFromTaskBar(long hwndPtr); /* * Applied only for windows
*
* Internal Use Only.
* FIXME: Once Java Module System has been implemented, this function should only be exported
* to the imgui.lwjgl module.
*/
public static native void win32hideFromTaskBar(long hwndPtr); /*
#if defined(_WIN32) #if defined(_WIN32)
HWND hwnd = (HWND)hwndPtr; HWND hwnd = (HWND)hwndPtr;
LONG ex_style = ::GetWindowLong(hwnd, GWL_EXSTYLE); LONG ex_style = ::GetWindowLong(hwnd, GWL_EXSTYLE);
+6
View File
@@ -17,3 +17,9 @@ dependencies {
apply from: "$rootDir/publish.gradle" apply from: "$rootDir/publish.gradle"
configurePublishing('imgui-java-lwjgl3', 'Backend LWJGL3 implementation for imgui-java') configurePublishing('imgui-java-lwjgl3', 'Backend LWJGL3 implementation for imgui-java')
jar {
manifest {
attributes 'Automatic-Module-Name': 'imgui.lwjgl3'
}
}
@@ -20,6 +20,7 @@ import imgui.flag.ImGuiMouseButton;
import imgui.flag.ImGuiMouseCursor; import imgui.flag.ImGuiMouseCursor;
import imgui.flag.ImGuiNavInput; import imgui.flag.ImGuiNavInput;
import imgui.flag.ImGuiViewportFlags; import imgui.flag.ImGuiViewportFlags;
import imgui.lwjgl3.glfw.ImGuiImplGlfwNative;
import org.lwjgl.PointerBuffer; import org.lwjgl.PointerBuffer;
import org.lwjgl.glfw.GLFWCharCallback; import org.lwjgl.glfw.GLFWCharCallback;
import org.lwjgl.glfw.GLFWCursorEnterCallback; import org.lwjgl.glfw.GLFWCursorEnterCallback;
+7 -5
View File
@@ -58,10 +58,12 @@ ext.configurePublishing = { packageName, packageDesc ->
} }
} }
} }
signing { if (System.getenv('SIGNING_KEY_ID') != null) {
def signingKeyId = System.getenv('SIGNING_KEY_ID') signing {
def signingKey = System.getenv('SIGNING_KEY') def signingKeyId = System.getenv('SIGNING_KEY_ID')
useInMemoryPgpKeys(signingKeyId, signingKey, '') def signingKey = System.getenv('SIGNING_KEY')
sign publishing.publications.mavenJava useInMemoryPgpKeys(signingKeyId, signingKey, '')
sign publishing.publications.mavenJava
}
} }
} }