-
Notifications
You must be signed in to change notification settings - Fork 363
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
Fix sbt plugin incompatibilities on Windows #2189
Fix sbt plugin incompatibilities on Windows #2189
Conversation
I had put in an issue #2127 and had at least a plan sketch to use the I found that I think PR right now looks good. |
@@ -185,4 +178,12 @@ private[scalanative] object NativeLib { | |||
case true => Some(path) | |||
case false => None | |||
} | |||
|
|||
private def makeDirPath(path: Path, elems: String*): String = { | |||
val pathSep = if (Platform.isWindows) raw"\\" else File.separator |
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 is needed because it is inside a glob
which is like a regex?
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.
Yes, I think that glob in java is also implemented based on regex.
Without this, we would not be able to correctly find all native libs.
@@ -85,7 +85,8 @@ object Discover { | |||
private[scalanative] def checkClangVersion(pathToClangBinary: Path): Unit = { | |||
def versionMajorFull(clang: String): (Int, String) = { | |||
val versionCommand = s"$clang --version" |
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.
Unused?
val path = Process(s"which $binaryNameOrPath") | ||
val binaryNameOrPath = sys.env.getOrElse(envPath, binaryName) | ||
val locateCmd = if (Platform.isWindows) "where" else "which" | ||
val path = Process(s"$locateCmd $binaryNameOrPath") |
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.
Should this also use a Seq
for the arguments?
package scala.scalanative.build | ||
|
||
object Platform { | ||
private lazy val osUsed = System.getProperty("os.name", "unknown").toLowerCase |
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 won't work on a Turkish/Lithuanian/Azeri system.
private lazy val osUsed = System.getProperty("os.name", "unknown").toLowerCase | |
private lazy val osUsed = System.getProperty("os.name", "unknown").toLowerCase(Locale.ROOT) |
- Use toLowerCase with Root locale - Pass command as sequence instead of string - Remove duplicated commands definitions
This PR fixes fatal errors in the sbt plugin when trying to use it on Windows. Changes include: * detection of os used in sbt plugin * using `where` command instead of `which` * passing paths in process commands in sequences, to correctly handle spaces * fixes to regex and globing filters including usage of the correct path separator Some methods with single usage were inlined.
This PR fixes fatal errors in the sbt plugin when trying to use it on Windows. Changes include: * detection of os used in sbt plugin * using `where` command instead of `which` * passing paths in process commands in sequences, to correctly handle spaces * fixes to regex and globing filters including usage of the correct path separator Some methods with single usage were inlined.
This PR fixes fatal errors in the sbt plugin when trying to use it on Windows. Changes include:
where
command instead ofwhich
Some methods with single usage were inlined.
There are still some pending sbt plugin related issues that would need to resolve in the following PRs, e.g.:
llvm-config
dependent settings -llvm-config
is not included in prebuilt binaries targeted for Windows. We don't want to force users to build it locally. Probably forinclude
andlib
dir we can use fixed relative paths based on the location ofclang
orclang++
. I have such change prepared, however I decided to not include it now, because of next probleminclude
andlib
directories, however might finally decide to leave this part for users to configure.