-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
[BUG FIX] Fix path resolution for executables #328
base: main
Are you sure you want to change the base?
Conversation
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've got a hunch of what you're trying to solve, but if you can describe the problem I can give better pointers
* @return The best matching executable path as a String. | ||
*/ | ||
fun findBestExecutableMatch(executableName: String): String { | ||
val pathVariable = System.getenv("PATH") ?: return executableName |
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.
iirc this won't work on windows where environment variables are case-insensitive (and default to Path
)
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.
Easy to fix, thanks.
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.
Done.
@@ -43,8 +61,9 @@ fun computeWorkingDir(nodeProjectDir: DirectoryProperty, execConfiguration: Exec | |||
*/ | |||
class ExecRunner { | |||
fun execute(projectHelper: ProjectApiHelper, extension: NodeExtension, execConfiguration: ExecConfiguration): ExecResult { | |||
val executablePath = findBestExecutableMatch(execConfiguration.executable) |
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.
From a quick glance it looks like this will break the download functionality entirely by only using already installed applications
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.
We will address these points. Thanks.
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.
Done with tests to validate behaviour (w/ download and without download)
@@ -181,6 +182,9 @@ open class NodeExtension(project: Project) { | |||
*/ | |||
val resolvedPlatform = project.objects.property<Platform>() | |||
|
|||
|
|||
val environment = project.objects.mapProperty<String, String>().convention(System.getenv()) |
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.
Primarily for test validation. Welcome other suggestions.
1. Add abiility for tests to override environment behaviour 2. Fix tests.
77c49cd
to
eb959c7
Compare
Updated comments. I prematurely submitted this pr, apologies. |
There’s an issue with mac silicion+intellij, whereby gradle process executor is not respecting path environment variables.
This gets around that by using a fix for the plugin whereby we attempt to resolve the path manually.
#152
https://youtrack.jetbrains.com/issue/IDEA-334183
We hit this constantly with our development team and this fix resolved it for us.