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 #141 Upgrading to native-packager 1.0.4 and autoplugins #154

Merged
merged 1 commit into from
Dec 15, 2015
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
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, WindowsPlugin)

// 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