-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add support for sbt-assembly * Move assembly override to separate autoplugin Co-authored-by: Arnout Engelen <arnout@bzzt.net>
- Loading branch information
Showing
10 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package net.bzzt.reproduciblebuilds | ||
|
||
import sbtassembly.{Assembly, AssemblyPlugin} | ||
import sbtassembly.AssemblyPlugin.autoImport.{Assembly => _, baseAssemblySettings => _, _} | ||
import sbt._ | ||
import sbt.Keys._ | ||
|
||
object AssemblyHelpers { | ||
val plugin: Plugins.Basic = AssemblyPlugin | ||
|
||
val settings: Seq[Setting[_]] = | ||
Seq( | ||
assembly := ReproducibleBuildsPlugin.postProcessJar(assembly.value) | ||
) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package net.bzzt.reproduciblebuilds | ||
|
||
import scala.util.Try | ||
|
||
import sbt._ | ||
import sbt.plugins.JvmPlugin | ||
|
||
object ReproducibleBuildsAssemblyPlugin extends AutoPlugin { | ||
val assemblyPluginOnClasspath = | ||
Try(getClass.getClassLoader.loadClass("sbtassembly.AssemblyPlugin")).isSuccess | ||
|
||
override def requires: Plugins = | ||
if (assemblyPluginOnClasspath) AssemblyHelpers.plugin | ||
else JvmPlugin | ||
|
||
override def trigger = allRequirements | ||
|
||
override def projectSettings = | ||
if (assemblyPluginOnClasspath) AssemblyHelpers.settings | ||
else Seq.empty | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
scalaVersion := "2.12.7" | ||
|
||
enablePlugins(ReproducibleBuildsPlugin) |
Binary file added
BIN
+4.98 MB
src/sbt-test/sbt-reproducible-builds/assembly/expected/assembly-assembly-0.1.0-SNAPSHOT.jar
Binary file not shown.
1 change: 1 addition & 0 deletions
1
src/sbt-test/sbt-reproducible-builds/assembly/project/build.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sbt.version=1.3.12 |
7 changes: 7 additions & 0 deletions
7
src/sbt-test/sbt-reproducible-builds/assembly/project/plugins.sbt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
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) | ||
} | ||
|
||
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10") |
5 changes: 5 additions & 0 deletions
5
src/sbt-test/sbt-reproducible-builds/assembly/src/main/scala/Main.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package net.bzzt | ||
|
||
object Main extends App { | ||
println("Hello, Reproducible World") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
> assembly | ||
$ exists target/scala-2.12/assembly-assembly-0.1.0-SNAPSHOT.jar | ||
$ exists target/scala-2.12/stripped/assembly-assembly-0.1.0-SNAPSHOT.jar | ||
$ must-mirror target/scala-2.12/stripped/assembly-assembly-0.1.0-SNAPSHOT.jar expected/assembly-assembly-0.1.0-SNAPSHOT.jar |