diff --git a/build.sbt b/build.sbt index bfc0a36c..b3cf6928 100644 --- a/build.sbt +++ b/build.sbt @@ -1,4 +1,4 @@ -ThisBuild / version := "2.0.0-SNAPSHOT" +ThisBuild / version := "2.0.1-SNAPSHOT" ThisBuild / organization := "com.eed3si9n" def scala212 = "2.12.8" diff --git a/src/main/scala/sbtassembly/Assembly.scala b/src/main/scala/sbtassembly/Assembly.scala index a7eaac35..9d4cd8a5 100644 --- a/src/main/scala/sbtassembly/Assembly.scala +++ b/src/main/scala/sbtassembly/Assembly.scala @@ -36,7 +36,7 @@ object Assembly { type LazyInputStream = () => InputStream val defaultShadeRules: Seq[com.eed3si9n.jarjarabrams.ShadeRule] = Nil - val newLine: String = System.lineSeparator() + val newLine: String = "\n" val indent: String = " " * 2 val newLineIndented: String = newLine + indent @@ -530,7 +530,7 @@ object Assembly { manifest: JManifest, localTime: Long ): Unit = { - jarFileSystemResource(URI.create(s"jar:file:${output.toPath.toString}")) { jarFs => + jarFileSystemResource(URI.create(s"jar:${output.toURI}")) { jarFs => val manifestPath = jarFs.getPath("META-INF/MANIFEST.MF") Files.createDirectories(manifestPath.getParent) val manifestOut = Files.newOutputStream( @@ -717,11 +717,12 @@ object Assembly { } object PathList { - private val sysFileSep = System.getProperty("file.separator") + private val sysFileSep = "/" def unapplySeq(path: String): Option[Seq[String]] = { - val split = path.split(if (sysFileSep.equals("""\""")) """\\""" else sysFileSep) - if (split.isEmpty) None - else Some(split.toList) + val sanitizedPath = if (path.contains('\\')) path.replace('\\', '/') else path + val split = sanitizedPath.split(sysFileSep) + if (split.isEmpty) Option.empty + else Option(split.toList) } } diff --git a/src/main/scala/sbtassembly/AssemblyUtils.scala b/src/main/scala/sbtassembly/AssemblyUtils.scala index 6e05d635..f4af9a5c 100644 --- a/src/main/scala/sbtassembly/AssemblyUtils.scala +++ b/src/main/scala/sbtassembly/AssemblyUtils.scala @@ -59,6 +59,6 @@ private[sbtassembly] object AssemblyUtils { * @param eof the terminating string to add at the end if needed * @return an [[AppendEofInputStream]] instance */ - def apply(is: InputStream, eof: String = System.lineSeparator()) = new AppendEofInputStream(is, eof) + def apply(is: InputStream, eof: String = "\n") = new AppendEofInputStream(is, eof) } } diff --git a/src/sbt-test/sbt-assembly/piecemeal/build.sbt b/src/sbt-test/sbt-assembly/piecemeal/build.sbt index 65eb30ba..8fe0f62f 100644 --- a/src/sbt-test/sbt-assembly/piecemeal/build.sbt +++ b/src/sbt-test/sbt-assembly/piecemeal/build.sbt @@ -24,7 +24,8 @@ lazy val root = (project in file(".")) }, TaskKey[Unit]("check2") := { val process = sys.process.Process("java", Seq("-cp", - (crossTarget.value / "scala-library-2.12.15-assembly.jar").toString + ":" + + (crossTarget.value / "scala-library-2.12.15-assembly.jar").toString + + (if (scala.util.Properties.isWin) ";" else ":") + (crossTarget.value / "foo-assembly-0.1.jar").toString, "Main")) val out = (process!!)