Skip to content
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 windows problems (#472) #478

Merged
merged 1 commit into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
13 changes: 7 additions & 6 deletions src/main/scala/sbtassembly/Assembly.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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)
}
}
2 changes: 1 addition & 1 deletion src/main/scala/sbtassembly/AssemblyUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
3 changes: 2 additions & 1 deletion src/sbt-test/sbt-assembly/piecemeal/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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!!)
Expand Down