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

[photon-targeting] Fix JNI loading #1563

Merged
merged 13 commits into from
Nov 13, 2024
Merged

Conversation

Gold856
Copy link
Contributor

@Gold856 Gold856 commented Nov 12, 2024

This is still a hack, but it should work better than the old one.

For simulation:

  • Now successfully passes smoketest for me!
    image

For RoboRIO:

  • photontargeting-java ships the linux .so's, because reasons
  • Since photontargeting-jni is a JNI dependency in our vendor JSON, it will be extracted and deployed to the roborio as part of the deploy process to a directory on the java library search path (?)
    • Which we then have RuntimeLoader System.load for us as part of PhotonTargetingJniLoader

@Gold856 Gold856 requested a review from a team as a code owner November 12, 2024 17:41
@mcm001
Copy link
Contributor

mcm001 commented Nov 12, 2024

Would like to see this tested on a robot <3 but ty!

@person4268
Copy link
Contributor

person4268 commented Nov 12, 2024

I needed to add duplicatesStrategy = 'exclude' to the cppHeadersZip task to get this to build. Not sure if that's related to the PR or not (edit: it isnt). Will test PR on real robot this wednesday.

@mcm001
Copy link
Contributor

mcm001 commented Nov 12, 2024

Are you sure you don't have two PhotonVersion.h's floating around?

@person4268
Copy link
Contributor

I tried running the clean task between builds. This is an otherwise unmodified worktree, as far as I know.

@person4268
Copy link
Contributor

person4268 commented Nov 12, 2024

There are in fact two PhotonVersion.h'es. One in ./photon-lib/src/main/native/include/PhotonVersion.h and one in ./photon-lib/src/generate/native/include/PhotonVersion.h. I think those are conflicting (since the cpp header zipping is likely flattening the src/main and src/generate distinction), but we obviously want the generated one to win so just excluding duplicates naively probably isn't the best strategy?

@mcm001
Copy link
Contributor

mcm001 commented Nov 12, 2024

Agreed. The clean task seems not to be sufficiently aggressive with its cleaning of generated files too (needs to be fixed). On current main we would want to delete the generated one and keep the in-source one.

@Gold856
Copy link
Contributor Author

Gold856 commented Nov 12, 2024

Opened #1564 for tracking

@mcm001
Copy link
Contributor

mcm001 commented Nov 13, 2024

I've updated your PR description

Copy link
Contributor

@mcm001 mcm001 left a comment

Choose a reason for hiding this comment

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

Needs testing on a Rio; happy otherwise

@mcm001 mcm001 merged commit c7ed377 into PhotonVision:master Nov 13, 2024
36 checks passed
@Gold856 Gold856 deleted the fix-jni-loading branch November 13, 2024 22:47
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.

3 participants