-
Notifications
You must be signed in to change notification settings - Fork 77
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
Add bin folders of dependencies to the classpath when they're open in the workspace #2094
Add bin folders of dependencies to the classpath when they're open in the workspace #2094
Conversation
@@ -543,8 +543,10 @@ public static PathConfig fromSourceProjectRascalManifest(ISourceLocation manifes | |||
switch (mode) { | |||
case INTERPRETER: | |||
srcsWriter.appendAll(childConfig.getSrcs()); | |||
libsWriter.append(childConfig.getBin()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be conceptually nicer (?) to:
- Generalize the
bin
field fromISourceLocation
toList<ISourceLocation>
(and rename the field tobins
) - Add the
bin
locations from the dependencies to that list
But, I expect this will touch a lot more places in the existing code, so I thought I'd go for the solution with the smallest footprint first...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bin folder must be in one place; this follows the target folder convention in other build systems like mvn. Also it is required to be unambiguous and unique, because this is what ends up being packaged into a runtime module like a jar or zip or doll.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this does the trick! Surgical precision 👍
case COMPILER: | ||
// FIXME (?): Add something to `srcsWriter` here? | ||
libsWriter.append(setTargetScheme(projectLoc)); | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Davy asked to be mindful of possible similar changes for COMPILER
, so I added this FIXME
provisionally. I'm not sure if the sources need to be explicitly added, or if this is already covered as part of the libs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No the compiler never uses libraries from source positions. That's the main difference between interpreter and compiler mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the important feature of the Compiler to be able to work with binary dependencies. It's also important to keep a "single source of truth" , the exact bill of materials, for library dependencies: we never depend on both the source and the binary ofa library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just remove the todo. The code checks for existing open projects and now it also adds the target folder to the Classpath libraries.
Thank you for clarifying! Removed the FIXME and merged. |
Before this PR, when a REPL was created in a project, and when one of its dependencies (as declared in the POM) was open in the same workspace:
src
folder of the dependency was loaded from the workspace;bin
folder of the dependency wasn't loaded at all (neither from the workspace, nor from the local Maven repository).After this PR, the
bin
folder is loaded from the workspace, too. This PR fixes the following issue (inrascal-language-servers
):See the separate comments for additional clarification/questions.