8000 Fix Java shared library path for darwin by viren-nadkarni · Pull Request #11792 · localstack/localstack · GitHub
[go: up one dir, main page]

Skip to content

Fix Java shared library path for darwin #11792

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

Merged
merged 4 commits into from
Nov 13, 2024
Merged

Fix Java shared library path for darwin #11792

merged 4 commits into from
Nov 13, 2024

Conversation

viren-nadkarni
Copy link
Member
@viren-nadkarni viren-nadkarni commented Nov 6, 2024

Background

In #11139 we started using Temurin builds for Java. All Java applications were explicitly configured to use these JREs, not OS ones.

On Mac OS, it was discovered that Jpype was failing to start, and this was affecting LocalStack development on Mac OS.

Changes

Mac builds of Temurin have a different directory structure. Furthermore the shared library usage is also different. On Linux, it is simply libjvm.so. On Darwin, there is a passthrough interface, the so-called Java launcher interface aka libjli.dylib, which invokes the JVM.

This PR ensures that the Java installer accounts for these differences.

@viren-nadkarni viren-nadkarni self-assigned this Nov 6, 2024
@viren-nadkarni viren-nadkarni added the semver: patch Non-breaking changes which can be included in patch releases label Nov 6, 2024
Copy link
github-actions bot commented Nov 6, 2024

LocalStack Community integration with Pro

    2 files  ±0      2 suites  ±0   1h 43m 32s ⏱️ +40s
3 538 tests ±0  3 123 ✅ ±0  415 💤 ±0  0 ❌ ±0 
3 540 runs  ±0  3 123 ✅ ±0  417 💤 ±0  0 ❌ ±0 

Results for commit a7136f9. ± Comparison against base commit d08dfc5.

♻️ This comment has been updated with latest results.

@viren-nadkarni viren-nadkarni marked this pull request as ready for review November 10, 2024 08:31
Copy link
Member
@joe4dev joe4dev left a comment

Choose a reason for hiding this comment

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

Thank you very much @viren-nadkarni for considering the macOS particularities here :)

I can confirm that this patch resolves the test failures in host mode (e.g., aws.services.events.test_events_patterns.TestEventPattern.test_event_pattern_with_escape_characters) 🙌

"""
if java_home := self.get_java_home():
if is_mac_os():
return os.path.join(java_home, "Contents", "Home", "lib", "jli", "libjli.dylib")
Copy link
Member

Choose a reason for hiding this comment

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

nit: any particular reason why we use pathlib (e.g., Path and get_*_path) and os.path interchangeably ?
(/-separated pathlib.Path look a little more readable to me than ,-separated os.path)

Copy link
Member Author

Choose a reason for hiding this comment

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

Most of the old code uses os.path, including the packaging library. I think it's nice to maintain the consistency but I don't see any issues with migrating everything to pathlib together.

@viren-nadkarni viren-nadkarni merged commit 3c57ab9 into master Nov 13, 2024
32 checks passed
@viren-nadkarni viren-nadkarni deleted the java-dylib branch November 13, 2024 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0