Skip to content

Feature: Java bindings for libktx#481

Merged
MarkCallow merged 53 commits intoKhronosGroup:masterfrom
ShukantPal:feature/libktx-jni
Nov 25, 2021
Merged

Feature: Java bindings for libktx#481
MarkCallow merged 53 commits intoKhronosGroup:masterfrom
ShukantPal:feature/libktx-jni

Conversation

@ShukantPal
Copy link
Copy Markdown
Contributor

Fixes #479

Todo

I need you to answer some questions:

  • Will you publish the JAR to maven?
  • The current CMakeLists.txt for the JNI bindings assumes libktx is already installed on the system. Is that ok? (It isn't integrated with the main build)
  • I don't have Windows so can't test the build on it - would be nice if someone can help?
  • JUnit tests in CI?

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Sep 12, 2021

CLA assistant check
All committers have signed the CLA.

@MarkCallow
Copy link
Copy Markdown
Collaborator

MarkCallow commented Sep 13, 2021

* Will you publish the JAR to maven?

If that is the standard way to publish JNI stuff, then sure, let's do it. Neither Appveyor nor Travis support direct deployment to Maven. I haven't checked GitHub Actions yet. Can it be done via FTP/SFTP?

* The current `CMakeLists.txt` for the JNI bindings assumes libktx is already installed on the system. Is that ok? (It isn't integrated with the main build)

I'd prefer it to be integrated, i.e., the JNI build should have the ktx target as a dependency.

* I don't have Windows so can't test the build on it - would be nice if someone can help?

The Appveyor build which is done using VS 2015, 2017 and 2019 succeeded. I haven't reviewed the changes yet so I don't know if anything related to this JNI addition was actually built. The Travis build failed. Please look at it. I may be able to try on Windows.

* JUnit tests in CI?

Tests would be great. It will also be a way to test on Windows. Please add this.

Copy link
Copy Markdown
Collaborator

@MarkCallow MarkCallow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only a partial review. I am submitting this to unblock replying to other comments (I hope).

@ShukantPal
Copy link
Copy Markdown
Contributor Author

@MarkCallow I moved the build script to jni.cmake in the cmake directory. It is now included as a part of the main build. It requires the environment variable JAVA_HOME to be defined; if it isn't, it will log a non-fatal warning.

How can I make sure it fails the CI if JAVA_HOME isn't defined?

@ShukantPal
Copy link
Copy Markdown
Contributor Author

@MarkCallow It would be nice if you could look into the "jni_md.h" not being found on Windows 😄.

@MarkCallow
Copy link
Copy Markdown
Collaborator

If you publish to maven central, people can add libktx as a dependency and maven will install for them. That's a pro; however, its hard to get access to that repository and the person who will own the artifact (you) will have to prove that they're a part of Khronos Group (to get the org.khronos groupId). That's the con.

Releasing with GitHub is super simple - you simply publish the JAR in the artifacts. People can download it and add it to their classpath manually to bundle it in their Java applications.

I will look into getting access to maven central when I am preparing the next release. Assuming I get access what do I need to do here in order to send the artifacts to maven? Make sure the necessary code is here in this PR commented out.

@MarkCallow
Copy link
Copy Markdown
Collaborator

MarkCallow commented Nov 8, 2021

Please

  • answer my question about the macOS build and fix the build, but then comment out the lines as, with it, it will likely exceed the CI time limit.
  • add the code, again commented out, for submitting to maven central.
  • Fix the conflicts and rebase.

I want to get this PR merged.

@ShukantPal
Copy link
Copy Markdown
Contributor Author

I'll address this this weekend. Sorry for the delay - am exceptionally busy this month.

@ShukantPal
Copy link
Copy Markdown
Contributor Author

@MarkCallow I haven't published to Maven before. I'm following instructions from https://dzone.com/articles/publish-your-artifacts-to-maven-central.

You don't need additional code for publishing to Maven Central. Instead, once you have your username / password to the repository, you'll need to add this to $HOME/.m2/settings.xml (as listed in the article) on the machine that will publish libktx for Java:

<settings>

<servers>
<server>
<id>ossrh</id>
<username>your-jira-id</username>
<password>your-jira-pwd</password>
</server>
</servers>

<profiles>
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.passphrase>[your_gpg_passphrase]</gpg.passphrase>
</properties>
</profile>
</profiles>

</settings>

Note that you'll need to generate a GPG key and put the passphrase in the settings.xml

Once this configuration is done, you'll need to run the following commands in the Java project folder (interface/java_binding):

mvn clean
mvn release:prepare
mvn release:perform

@ShukantPal
Copy link
Copy Markdown
Contributor Author

✅ Fixed the macOS build and answered the question
✅ Posted instructions for publishing to maven. No code needed (some config needed on your machine with credentials)
✅ Fixed conflicts

@MarkCallow
Copy link
Copy Markdown
Collaborator

The conflicts still need to be fixed.

@ShukantPal
Copy link
Copy Markdown
Contributor Author

The conflicts still need to be fixed.

What?

Screen Shot 2021-11-16 at 10 23 12 PM

@MarkCallow
Copy link
Copy Markdown
Collaborator

The conflicts still need to be fixed.

What?

This is what I am seeing. I don't know why you are seeing something different.

image

@ShukantPal
Copy link
Copy Markdown
Contributor Author

@MarkCallow Can you do a merge commit? (change from rebase and merge to just merge?)

@ShukantPal
Copy link
Copy Markdown
Contributor Author

Any way I can help here @MarkCallow ?

@MarkCallow MarkCallow merged commit a715992 into KhronosGroup:master Nov 25, 2021
@MarkCallow
Copy link
Copy Markdown
Collaborator

MarkCallow commented Nov 25, 2021

Sorry for the delay. I've been away from the computer for a couple of days. Thank you very much for this great addition to KTX.

KaperD pushed a commit to KaperD/KTX-Software that referenced this pull request Feb 21, 2024
Specify KTX_FEATURE_JNI to enable building of libktx_jni and the
corresponding Java wrapper.

Co-authored-by: Mark Callow <2244683+MarkCallow@users.noreply.github.com>
KaperD pushed a commit to KaperD/KTX-Software that referenced this pull request Feb 22, 2024
Specify KTX_FEATURE_JNI to enable building of libktx_jni and the
corresponding Java wrapper.

Co-authored-by: Mark Callow <2244683+MarkCallow@users.noreply.github.com>
KaperD pushed a commit to KaperD/KTX-Software that referenced this pull request Feb 22, 2024
Specify KTX_FEATURE_JNI to enable building of libktx_jni and the
corresponding Java wrapper.

Co-authored-by: Mark Callow <2244683+MarkCallow@users.noreply.github.com>
KaperD pushed a commit to KaperD/KTX-Software that referenced this pull request Feb 22, 2024
Specify KTX_FEATURE_JNI to enable building of libktx_jni and the
corresponding Java wrapper.

Co-authored-by: Mark Callow <2244683+MarkCallow@users.noreply.github.com>
KaperD pushed a commit to KaperD/KTX-Software that referenced this pull request Feb 22, 2024
Specify KTX_FEATURE_JNI to enable building of libktx_jni and the
corresponding Java wrapper.

Co-authored-by: Mark Callow <2244683+MarkCallow@users.noreply.github.com>
richgel999 pushed a commit to BinomialLLC/KTX-Software-Binomial-Fork that referenced this pull request Mar 9, 2026
Specify KTX_FEATURE_JNI to enable building of libktx_jni and the
corresponding Java wrapper.

Co-authored-by: Mark Callow <2244683+MarkCallow@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Java bindings

3 participants