Skip to content

Commit

Permalink
FIX #141 Upgrading to native-packager 1.0.4 and autoplugins
Browse files Browse the repository at this point in the history
  • Loading branch information
muuki88 committed Nov 11, 2015
1 parent 282f468 commit 1da1582
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
4 changes: 3 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Docs.settings

ScalaDist.platformSettings

enablePlugins(UniversalPlugin, RpmPlugin, JDebPackaging)

// resolvers += "local" at "file:///e:/.m2/repository"
// resolvers += Resolver.mavenLocal
// to test, run e.g., stage, or windows:packageBin, show s3-upload::mappings
// to test, run e.g., stage, or windows:packageBin, show s3-upload::mappings
20 changes: 9 additions & 11 deletions project/ScalaDist.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import sbt._
import sbt.Keys._

import com.typesafe.sbt.SbtNativePackager._
import com.typesafe.sbt.packager.MappingsHelper._
import com.typesafe.sbt.packager.universal.UniversalPlugin.autoImport.useNativeZip
import com.typesafe.sbt.packager.Keys._

import com.typesafe.sbt.S3Plugin.S3.upload
Expand Down Expand Up @@ -42,7 +44,6 @@ object ScalaDist {
)

def settings: Seq[Setting[_]] =
packagerSettings ++
useNativeZip ++ // use native zip to preserve +x permission on scripts
Seq(
name := "scala",
Expand Down Expand Up @@ -74,19 +75,16 @@ object ScalaDist {
case "scala-dist" =>
val tmpdir = IO.createTemporaryDirectory
IO.unzip(file, tmpdir)
// IO.listFiles(tmpdir) does not recurse, use ** with glob "*" to find all files
(PathFinder(IO.listFiles(tmpdir)) ** "*").get flatMap { file =>
val relative = IO.relativize(tmpdir, file).get // .get is safe because we just unzipped under tmpdir

// files are stored in repository with platform-appropriate line endings
// if (onWindows && (relative endsWith ".bat")) toDosInPlace(file)

// create mappings from the unzip scala-dist zip
contentOf(tmpdir) filter {
case (file, dest) => !(dest.endsWith("MANIFEST.MF") || dest.endsWith("META-INF"))
} map {
// make unix scripts executable (heuristically...)
if ((relative startsWith "bin/") && !(file.getName endsWith ".bat"))
case (file, dest) if (dest startsWith "bin/") && !(dest endsWith ".bat") =>
file.setExecutable(true, true)

if (relative startsWith "META-INF") Seq()
else Seq(file -> relative)
file -> dest
case mapping => mapping
}

// core jars: use simple name for backwards compat
Expand Down
2 changes: 2 additions & 0 deletions project/Unix.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import sbt.Keys._
import com.typesafe.sbt.SbtNativePackager._
import com.typesafe.sbt.packager.Keys._
import com.typesafe.sbt.packager.linux.{LinuxPackageMapping => pkgMap, LinuxSymlink}
import com.typesafe.sbt.packager.linux.LinuxPlugin.autoImport.packageMapping

/** Create debian & rpm packages.
*
Expand Down Expand Up @@ -96,5 +97,6 @@ object Unix {

// Hack so we use regular version, rather than debian version.
target in Debian := target.value / s"${(name in Debian).value}-${version.value}"

)
}
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.6.4")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.4")

addSbtPlugin("com.typesafe.sbt" % "sbt-s3" % "0.8")

Expand Down

0 comments on commit 1da1582

Please sign in to comment.