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
Rework setting PATH variable to not store in a File temporarily #576
Conversation
...m.core/src/org/eclipse/embedcdt/managedbuild/cross/arm/core/EnvironmentVariableSupplier.java
Outdated
Show resolved
Hide resolved
Should we be concerned with compatibility issues? My first impulse is to leave the buggy code there, with a deprecation notice, and add a new class with the fix. |
I'll have a think about that more while I write and test it. The external behaviour of the code isn't changing with my fix, except for places where the entries are being corrupted. Therefore my current instinct is to simply fix the issue. |
If in the end only the private class or private members are changed, you are right, we should have no compatibility issues. |
Do you plan more work on this PR? |
Yes - I will finish this up in the coming days. |
3b6ec14
to
3f709b1
Compare
|
||
path = xpackBinPath.toOSString(); | ||
String xpackBinPath = project.getFolder("xpacks").getFolder(".bin").getLocation().toOSString(); | ||
path.add(xpackBinPath); |
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.
Does this produce the absolute path of the xpacks/.bin
folder located inside the project?
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.
This fixed a bug that the code assumed that the project was located on disk in the workspace folder.
e.g. if I have a project on my computer in E:\cdt\git\armproj
and my workspace is E:\cdt\runtime-CDT
then the old code would add E:\cdt\runtime-CDT\armproj\xpacks\.bin
to the path
variable, when it should have added E:\cdt\git\armproj\xpacks\.bin
This was happening because of the order of resolution. The updated code gets the full internal path to the bin
first (e.g. project.getFolder("xpacks").getFolder(".bin")
== F/armproj/xpacks/.bin
) and then gets the location on disk of that folder. The old code (project.getWorkspace().getRoot().getLocation()
) got the location on disk of the workspace and then appended paths to it.
Let me know if you want me to split that out to a different PR.
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.
Does this produce the absolute path of the xpacks/.bin folder located inside the project?
TL;DR - Yes! :)
I have tested this on Linux and Windows. On Windows since I don't actually have a server to install tools I used
I used:
( |
In your example you show the path for the windows-build-tools, which is retrieved from the preferences as an absolute path. My question refers to the This is a relatively recent feature, unfortunately not very well documented. :-(
The advantage of such a configuration is that the versions of the binary tools are stored in the |
This comment #576 (comment) was not in reply to your question in #576 (comment) - please see #576 (comment)
Yes.
AFAICT the feature currently only works if the project is checked out into the workspace folder. Also the normal paths are added to the path to. e.g. if you have a project with When |
Hmmm... not good... how can we make it work for standalone projects? That's the point with the xpm dependencies, they are local to the project, regardless where the project is located. |
Not only that it should stop adding other locations to the PATH (except the windows build tools), but the |
That is what the change I introduced fixed. It will work once you merge.
In that case I will wrap the rest of the path code in the else block of |
be sure you keep the windows build tools, if defined, and locate them deeper than xpacks/.bin. |
I'm going to split the xpacks into a new PR. |
The old code placed multiple entries for adding to PATH in a File temporarily to get the absolute path. This worked generally on non-Windows platforms because often there was only a single entry. However on Windows there are generally two entries. Adding to that is the UNC path names that are sometimes present on Windows and the temporary use of File causes corruption in the settings. Instead collect the new PATH entries in a list of strings, and then before making the final PATH setting, run each individual entry through new File(entry).getAbsolutePath() Fixes eclipse-embed-cdt#230
3f709b1
to
7c4b9ae
Compare
I entered #580 for the changes related to preferXpacksBin. |
The old code placed multiple entries for adding to PATH in a File temporarily to get the absolute path. This worked generally on non-Windows platforms because often there was only a single entry.
However on Windows there are generally two entries. Adding to that is the UNC path names that are sometimes present on Windows and the temporary use of File causes corruption in the settings.
Instead collect the new PATH entries in a list of strings, and then before making the final PATH setting, run each individual entry through new File(entry).getAbsolutePath()
TODO:
Fixes #230