Skip to content

Commit

Permalink
Merge pull request #10 from raboof/sbtTest
Browse files Browse the repository at this point in the history
Fix hooking in packageBin, add sbt-test (fixes #9)
  • Loading branch information
raboof authored Aug 5, 2018
2 parents c6d5f66 + bf10906 commit 5ddd207
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: scala
jdk: oraclejdk8
script:
- sbt ^test ^publishLocal
- sbt ^test scripted ^publishLocal
- md5sum target/scala-*/sbt-*/*.jar_

deploy:
Expand Down
5 changes: 5 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ enablePlugins(ReproducibleBuildsPlugin)
libraryDependencies += "net.bzzt" % "reproducible-build" % "0.2"

licenses += ("MIT", url("http://opensource.org/licenses/MIT"))

scriptedLaunchOpts := { scriptedLaunchOpts.value ++
Seq("-Xmx1024M", "-Dplugin.version=" + version.value)
}
scriptedBufferLog := false
1 change: 1 addition & 0 deletions project/scripted.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
libraryDependencies += { "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value }
3 changes: 2 additions & 1 deletion src/main/scala/ReproducibleBuildsPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ object ReproducibleBuildsPlugin extends AutoPlugin {
override def requires: Plugins = JvmPlugin

override lazy val projectSettings = Seq(
packageBin in (Compile, packageBin) ~= { bin =>
packageBin in Compile := {
val bin = (packageBin in Compile).value
val out = new File(bin.getCanonicalPath + "_")
new ZipStripper()
.addFileStripper("META-INF/MANIFEST.MF", new ManifestStripper())
Expand Down
2 changes: 2 additions & 0 deletions src/sbt-test/sbt-reproducible-builds/simple/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
enablePlugins(ReproducibleBuildsPlugin)

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=1.1.6
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sys.props.get("plugin.version") match {
case Some(x) => addSbtPlugin("net.bzzt" % "sbt-reproducible-builds" % sys.props("plugin.version"))
case _ => sys.error("""|The system property 'plugin.version' is not defined.
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
object Main extends App {
println("Hello, Reproducible World")
}
3 changes: 3 additions & 0 deletions src/sbt-test/sbt-reproducible-builds/simple/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
> package
$ exists target/scala-2.12/simple_2.12-0.1.0-SNAPSHOT.jar_
$ must-mirror target/scala-2.12/simple_2.12-0.1.0-SNAPSHOT.jar_ expected/simple_2.12-0.1.0-SNAPSHOT.jar

0 comments on commit 5ddd207

Please sign in to comment.