Skip to content

Commit

Permalink
Cache stripped result (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
raboof authored Jan 14, 2020
1 parent b80767a commit fee64b4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main/scala/ReproducibleBuildsPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,13 @@ object ReproducibleBuildsPlugin extends AutoPlugin {

def postProcessZip(zip: File): File = postProcessWith(zip, new ZipStripper())

private def postProcessWith(file: File, stripper: Stripper): File = {
val dir = file.getParentFile.toPath.resolve("stripped")
private def postProcessWith(in: File, stripper: Stripper): File = {
val dir = in.getParentFile.toPath.resolve("stripped")
dir.toFile.mkdir()
val out = dir.resolve(file.getName).toFile
stripper.strip(file, out)
val out = dir.resolve(in.getName).toFile
stripper.strip(in, out)
// Allowed since stripping is idempotent. This way sbt can cache the result better.
out.setLastModified(in.lastModified);
out
}

Expand Down

0 comments on commit fee64b4

Please sign in to comment.