Skip to content

Commit

Permalink
Serialize hash as hex string
Browse files Browse the repository at this point in the history
  • Loading branch information
romainreuillon committed Nov 8, 2023
1 parent 23998be commit abcba3b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/main/scala/com/typesafe/sbt/osgi/Osgi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ private object Osgi {
cacheBundle: Boolean): Option[File] = {

def fileFootprint(file: File) =
if(!file.exists()) Seq()
else if(file.isDirectory) Files.walk(file.toPath).iterator().asScala.map(f => f.toAbsolutePath.toString -> FileInfo.hash(f.toFile).hash.mkString(" ")).toSeq
else Seq(file.absolutePath -> FileInfo.hash(file).hash.mkString(" "))
if (!file.exists()) Seq()
else if (file.isDirectory) Files.walk(file.toPath).iterator().asScala.map(f => f.toAbsolutePath.toString -> Hash.toHex(FileInfo.hash(f.toFile).hash.toArray)).toSeq
else Seq(file.absolutePath -> Hash.toHex(FileInfo.hash(file).hash.toArray))

def serialized =
s"""${headers}
Expand All @@ -73,13 +73,12 @@ private object Osgi {
val footprintValue = footprint
val bundleCacheFootprint = file(artifactPath.absolutePath + "_footprint")

if(!bundleCacheFootprint.exists() || IO.read(bundleCacheFootprint) != footprintValue) {
if (!bundleCacheFootprint.exists() || IO.read(bundleCacheFootprint) != footprintValue) {
IO.write(bundleCacheFootprint, footprintValue)
None
} else if(artifactPath.exists()) Some(artifactPath) else None
} else if (artifactPath.exists()) Some(artifactPath) else None
}
}

def withCache(
headers: OsgiManifestHeaders,
additionalHeaders: Map[String, String],
Expand Down

0 comments on commit abcba3b

Please sign in to comment.