mirror of https://github.com/sbt/sbt.git
package signer
This commit is contained in:
parent
95f970634a
commit
080bd0d92f
10
build.sbt
10
build.sbt
|
|
@ -7,8 +7,8 @@ import DebianConstants._
|
||||||
|
|
||||||
lazy val sbtOfflineInstall =
|
lazy val sbtOfflineInstall =
|
||||||
sys.props.getOrElse("sbt.build.offline", sys.env.getOrElse("sbt.build.offline", "true")) match {
|
sys.props.getOrElse("sbt.build.offline", sys.env.getOrElse("sbt.build.offline", "true")) match {
|
||||||
case "true" => true
|
case "true" | "1" => true
|
||||||
case "1" => true
|
case "false" | "0" => false
|
||||||
case _ => false
|
case _ => false
|
||||||
}
|
}
|
||||||
lazy val sbtVersionToRelease = sys.props.getOrElse("sbt.build.version", sys.env.getOrElse("sbt.build.version", {
|
lazy val sbtVersionToRelease = sys.props.getOrElse("sbt.build.version", sys.env.getOrElse("sbt.build.version", {
|
||||||
|
|
@ -47,6 +47,8 @@ val root = (project in file(".")).
|
||||||
val _ = (clean in dist).value
|
val _ = (clean in dist).value
|
||||||
clean.value
|
clean.value
|
||||||
},
|
},
|
||||||
|
useGpg := true,
|
||||||
|
usePgpKeyHex("642AC823"),
|
||||||
pgpSecretRing := file(s"""${sys.props("user.home")}""") / ".ssh" / "scalasbt.key",
|
pgpSecretRing := file(s"""${sys.props("user.home")}""") / ".ssh" / "scalasbt.key",
|
||||||
pgpPublicRing := file(s"""${sys.props("user.home")}""") / ".ssh" / "scalasbt.pub",
|
pgpPublicRing := file(s"""${sys.props("user.home")}""") / ".ssh" / "scalasbt.pub",
|
||||||
publishToSettings,
|
publishToSettings,
|
||||||
|
|
@ -85,7 +87,7 @@ val root = (project in file(".")).
|
||||||
if (debianBuildId.value == 0) sbtVersionToRelease
|
if (debianBuildId.value == 0) sbtVersionToRelease
|
||||||
else sbtVersionToRelease + "." + debianBuildId.value
|
else sbtVersionToRelease + "." + debianBuildId.value
|
||||||
},
|
},
|
||||||
debianBuildId := 2, // 0
|
debianBuildId := 3, // 0
|
||||||
// Used to have "openjdk-8-jdk" but that doesn't work on Ubuntu 14.04 https://github.com/sbt/sbt/issues/3105
|
// Used to have "openjdk-8-jdk" but that doesn't work on Ubuntu 14.04 https://github.com/sbt/sbt/issues/3105
|
||||||
// before that we had java6-runtime-headless" and that was pulling in JDK9 on Ubuntu 16.04 https://github.com/sbt/sbt/issues/2931
|
// before that we had java6-runtime-headless" and that was pulling in JDK9 on Ubuntu 16.04 https://github.com/sbt/sbt/issues/2931
|
||||||
debianPackageDependencies in Debian ++= Seq("bash (>= 3.2)"),
|
debianPackageDependencies in Debian ++= Seq("bash (>= 3.2)"),
|
||||||
|
|
@ -111,7 +113,7 @@ val root = (project in file(".")).
|
||||||
})
|
})
|
||||||
else stable
|
else stable
|
||||||
},
|
},
|
||||||
rpmRelease := "2",
|
rpmRelease := "3",
|
||||||
rpmVendor := "lightbend",
|
rpmVendor := "lightbend",
|
||||||
rpmUrl := Some("http://github.com/sbt/sbt-launcher-package"),
|
rpmUrl := Some("http://github.com/sbt/sbt-launcher-package"),
|
||||||
rpmLicense := Some("BSD"),
|
rpmLicense := Some("BSD"),
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
import sbt._
|
||||||
|
import Keys._
|
||||||
|
import com.typesafe.sbt.SbtPgp
|
||||||
|
import com.typesafe.sbt.packager.universal.{ UniversalPlugin, UniversalDeployPlugin }
|
||||||
|
import com.typesafe.sbt.packager.debian.{ DebianPlugin, DebianDeployPlugin }
|
||||||
|
import com.typesafe.sbt.packager.rpm.{ RpmPlugin, RpmDeployPlugin }
|
||||||
|
import com.typesafe.sbt.pgp.gpgExtension
|
||||||
|
|
||||||
|
object PackageSignerPlugin extends sbt.AutoPlugin {
|
||||||
|
override def trigger = allRequirements
|
||||||
|
override def requires = SbtPgp && UniversalDeployPlugin && DebianDeployPlugin && RpmDeployPlugin
|
||||||
|
|
||||||
|
import com.typesafe.sbt.pgp.PgpKeys._
|
||||||
|
import UniversalPlugin.autoImport._
|
||||||
|
import DebianPlugin.autoImport._
|
||||||
|
import RpmPlugin.autoImport._
|
||||||
|
|
||||||
|
override def projectSettings: Seq[Setting[_]] =
|
||||||
|
inConfig(Universal)(packageSignerSettings) ++
|
||||||
|
inConfig(Debian)(packageSignerSettings) ++
|
||||||
|
inConfig(Rpm)(packageSignerSettings)
|
||||||
|
|
||||||
|
def subExtension(art: Artifact, ext: String): Artifact =
|
||||||
|
art.copy(extension = ext)
|
||||||
|
|
||||||
|
def packageSignerSettings: Seq[Setting[_]] = Seq(
|
||||||
|
signedArtifacts := {
|
||||||
|
val artifacts = packagedArtifacts.value
|
||||||
|
val r = pgpSigner.value
|
||||||
|
val skipZ = (skip in pgpSigner).value
|
||||||
|
val s = streams.value
|
||||||
|
if (!skipZ) {
|
||||||
|
artifacts flatMap { case (art, f) =>
|
||||||
|
Seq(art -> f,
|
||||||
|
subExtension(art, art.extension + gpgExtension) ->
|
||||||
|
r.sign(f, file(f.getAbsolutePath + gpgExtension), s))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else artifacts
|
||||||
|
},
|
||||||
|
publishSignedConfiguration := Classpaths.publishConfig(
|
||||||
|
signedArtifacts.value,
|
||||||
|
None,
|
||||||
|
resolverName = Classpaths.getPublishTo(publishTo.value).name,
|
||||||
|
checksums = (checksums in publish).value,
|
||||||
|
logging = ivyLoggingLevel.value,
|
||||||
|
overwrite = isSnapshot.value),
|
||||||
|
publishLocalSignedConfiguration := Classpaths.publishConfig(
|
||||||
|
signedArtifacts.value,
|
||||||
|
None,
|
||||||
|
resolverName = "local",
|
||||||
|
checksums = (checksums in publish).value,
|
||||||
|
logging = ivyLoggingLevel.value,
|
||||||
|
overwrite = isSnapshot.value),
|
||||||
|
publishSigned := Classpaths.publishTask(publishSignedConfiguration, deliver).value,
|
||||||
|
publishLocalSigned := Classpaths.publishTask(publishLocalSignedConfiguration, deliver).value
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -39,3 +39,4 @@ sbt (0.11.2-build-0100)
|
||||||
* First debian package release
|
* First debian package release
|
||||||
|
|
||||||
-- Joshua Suereth <joshua.suereth@typesafe.com> 2011-11-29
|
-- Joshua Suereth <joshua.suereth@typesafe.com> 2011-11-29
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue