Sharing JBang installation #2580
Conversation
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR factors out duplicated “where is my running JBang installation located?” logic from App and Wrapper into a shared JBangInstallation helper, so both commands resolve scripts/JAR directories consistently across flat and .jbang wrapper layouts.
Changes:
- Added
JBangInstallationhelper to locate/validate the running installation’s scripts and JAR directories. - Updated
WrapperandAppto useJBangInstallationinstead of duplicating path/layout checks. - Added initial unit tests for flat vs wrapper layout discovery.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/main/java/dev/jbang/cli/JBangInstallation.java | New helper to locate scripts + JAR directories relative to the running artifact. |
| src/main/java/dev/jbang/cli/Wrapper.java | Wrapper install now uses JBangInstallation to find source dirs for copying. |
| src/main/java/dev/jbang/cli/App.java | Offline install path now uses JBangInstallation and can copy scripts/JAR from separate dirs. |
| src/test/java/dev/jbang/cli/TestJBangInstallation.java | New tests for installation discovery behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
this is probably fine but I literally just updated this code so this would need a rebase. |
Updated to include changes from the main branch.
|
Thanks, i have rebased and updated the code to account for the changes. |
Summary
cli/App.javacontained a TODO noting duplicated JBang installation discovery logic inWrapper.java.This PR introduces a shared
JBangInstallationhelper that:.jbangwrapper layouts.jar,.bin, and.bin.exeartifactsAppandWrappernow use this helper while retaining their command-specific copy behavior.Testing