diff --git a/build.sbt b/build.sbt index ead95e4d..6097df5e 100644 --- a/build.sbt +++ b/build.sbt @@ -5,7 +5,7 @@ val macrosParadiseVersion = "2.1.1" ThisBuild / versionScheme := Some("semver-spec") ThisBuild / organization := "com.github.sbt" -ThisBuild / scalacOptions ++= Seq("-deprecation", "-feature") +ThisBuild / scalacOptions ++= Seq("-deprecation", "-feature", "-Xfatal-warnings") ThisBuild / licenses := Seq(("BSD New", url("http://opensource.org/licenses/BSD-3-Clause"))) ThisBuild / homepage := Some(url("https://github.com/jodersky/sbt-jni")) ThisBuild / developers := List( diff --git a/core/src/main/scala-2/com/github/sbt/jni/Process.scala b/core/src/main/scala-2/com/github/sbt/jni/Process.scala deleted file mode 100644 index 220ff800..00000000 --- a/core/src/main/scala-2/com/github/sbt/jni/Process.scala +++ /dev/null @@ -1,10 +0,0 @@ -package com.github.sbt.jni - -object Process { - def out(command: String): String = - try { - scala.sys.process.Process("uname -sm").lineStream.head - } catch { - case ex: Exception => sys.error("Error running `uname` command") - } -} diff --git a/core/src/main/scala-2/com/github/sbt/jni/annotations.scala b/core/src/main/scala-2/com/github/sbt/jni/annotations.scala index 215dc2e3..eb13f51c 100644 --- a/core/src/main/scala-2/com/github/sbt/jni/annotations.scala +++ b/core/src/main/scala-2/com/github/sbt/jni/annotations.scala @@ -44,9 +44,9 @@ class nativeLoaderAnnotationMacro(val c: Context) { val tmp: Path = Files.createTempDirectory("jni-") val plat: String = { val line = try { - scala.sys.process.Process("uname -sm").lineStream.head + scala.sys.process.Process("uname -sm").!!.linesIterator.next() } catch { - case ex: Exception => sys.error("Error running `uname` command") + case _: Exception => sys.error("Error running `uname` command") } val parts = line.split(" ") if (parts.length != 2) { @@ -80,7 +80,7 @@ class nativeLoaderAnnotationMacro(val c: Context) { def load(): Unit = try { System.loadLibrary($nativeLibrary) } catch { - case ex: UnsatisfiedLinkError => loadPackaged() + case _: UnsatisfiedLinkError => loadPackaged() } load() diff --git a/core/src/main/scala-3/com/github/sbt/jni/Process.scala b/core/src/main/scala-3/com/github/sbt/jni/Process.scala deleted file mode 100644 index 581c4406..00000000 --- a/core/src/main/scala-3/com/github/sbt/jni/Process.scala +++ /dev/null @@ -1,10 +0,0 @@ -package com.github.sbt.jni - -object Process { - def out(command: String): String = - try { - scala.sys.process.Process("uname -sm").lazyLines.head - } catch { - case ex: Exception => sys.error("Error running `uname` command") - } -} diff --git a/core/src/main/scala/com/github/sbt/jni/syntax/NativeLoader.scala b/core/src/main/scala/com/github/sbt/jni/syntax/NativeLoader.scala index 26ae126a..ac7e92bf 100644 --- a/core/src/main/scala/com/github/sbt/jni/syntax/NativeLoader.scala +++ b/core/src/main/scala/com/github/sbt/jni/syntax/NativeLoader.scala @@ -1,7 +1,5 @@ package com.github.sbt.jni.syntax -import com.github.sbt.jni.Process - import java.nio.file.{Files, Path} class NativeLoader(nativeLibrary: String) { @@ -16,7 +14,12 @@ object NativeLoader { val tmp: Path = Files.createTempDirectory("jni-") val plat: String = { - val line = Process.out("uname -sm") + val line = + try { + scala.sys.process.Process("uname -sm").!!.linesIterator.next() + } catch { + case _: Exception => sys.error("Error running `uname` command") + } val parts = line.split(" ") if (parts.length != 2) { sys.error("Could not determine platform: 'uname -sm' returned unexpected string: " + line) @@ -50,7 +53,7 @@ object NativeLoader { def load(): Unit = try { System.loadLibrary(nativeLibrary) } catch { - case ex: UnsatisfiedLinkError => loadPackaged() + case _: UnsatisfiedLinkError => loadPackaged() } load() diff --git a/plugin/src/main/scala/com/github/sbt/jni/plugins/JniNative.scala b/plugin/src/main/scala/com/github/sbt/jni/plugins/JniNative.scala index 4cddf0dd..ccbd1db9 100644 --- a/plugin/src/main/scala/com/github/sbt/jni/plugins/JniNative.scala +++ b/plugin/src/main/scala/com/github/sbt/jni/plugins/JniNative.scala @@ -53,7 +53,7 @@ object JniNative extends AutoPlugin { arch + "-" + kernel } } catch { - case ex: Exception => + case _: Exception => sLog.value.error("Error trying to determine platform.") sLog.value.warn("Cannot determine platform! It will be set to 'unknown'.") "unknown-unknown"