Cache output of assembly
Previously, the build would rebuild over and over the uber jar with the shaded protobuf3 distribution. With this patch, this is no longer the case, as the output is cached locally.
This commit is contained in:
parent
231b9a991a
commit
805b9cbc89
2 changed files with 14 additions and 3 deletions
15
build.sbt
15
build.sbt
|
|
@ -368,8 +368,19 @@ lazy val protobufV3 = pekkoModule("protobuf-v3")
|
|||
Compile / packageBin / packagedArtifact := Scoped.mkTuple2(
|
||||
(Compile / packageBin / artifact).value,
|
||||
ReproducibleBuildsPlugin.postProcessJar(OsgiKeys.bundle.value)),
|
||||
Compile / packageBin := ReproducibleBuildsPlugin
|
||||
.postProcessJar((Compile / assembly).value), // package by running assembly
|
||||
Compile / packageBin := Def.taskDyn {
|
||||
val store = streams.value.cacheStoreFactory.make("shaded-output")
|
||||
val uberJarLocation = (assembly / assemblyOutputPath).value
|
||||
val tracker = Tracked.outputChanged(store) { (changed: Boolean, file: File) =>
|
||||
if (changed) {
|
||||
Def.task {
|
||||
val uberJar = (Compile / assembly).value
|
||||
ReproducibleBuildsPlugin.postProcessJar(uberJar)
|
||||
}
|
||||
} else Def.task { file }
|
||||
}
|
||||
tracker(() => uberJarLocation)
|
||||
}.value,
|
||||
// Prevent cyclic task dependencies, see https://github.com/sbt/sbt-assembly/issues/365 by
|
||||
// redefining the fullClasspath with just what we need to avoid the cyclic task dependency
|
||||
assembly / fullClasspath := (Runtime / managedClasspath).value ++ (Compile / products).value.map(Attributed.blank),
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ object Protobuf {
|
|||
outputPaths := Seq((Compile / sourceDirectory).value, (Test / sourceDirectory).value).map(_ / "java"),
|
||||
importPath := None,
|
||||
// this keeps intellij happy for files that use the shaded protobuf
|
||||
Compile / unmanagedJars += (LocalProject("protobuf-v3") / assembly).value,
|
||||
Compile / unmanagedJars += (LocalProject("protobuf-v3") / Compile / packageBin).value,
|
||||
protoc := "protoc",
|
||||
protocVersion := "3.11.4",
|
||||
generate := {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue