Skip to content

Commit

Permalink
Don't hash the dev bundle zip twice
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla committed Nov 17, 2023
1 parent daab4fa commit e80565b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ abstract class PaperweightUser : Plugin<Project> {
parameters {
cache.set(cacheDir)
bundleZip.set(devBundleZip)
bundleZipHash.set(bundleHash)
downloadService.set(target.download)
genSources.set(target.genSources)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ data class ExtractedBundle<C>(

fun extractDevBundle(
destinationDirectory: Path,
devBundle: Path
devBundle: Path,
newDevBundleHash: String
): ExtractedBundle<Any> {
val hashFile = destinationDirectory.resolve("current.sha256")
val newDevBundleHash = devBundle.sha256asHex()

if (destinationDirectory.exists()) {
val currentDevBundleHash = if (hashFile.isRegularFile()) hashFile.readText(Charsets.UTF_8) else ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ abstract class UserdevSetup : BuildService<UserdevSetup.Parameters>, SetupHandle

interface Parameters : BuildServiceParameters {
val bundleZip: RegularFileProperty
val bundleZipHash: Property<String>
val cache: RegularFileProperty
val downloadService: Property<DownloadService>
val genSources: Property<Boolean>
Expand All @@ -55,7 +56,8 @@ abstract class UserdevSetup : BuildService<UserdevSetup.Parameters>, SetupHandle
private val extractDevBundle: ExtractedBundle<Any> = lockSetup(parameters.cache.path) {
val extract = extractDevBundle(
parameters.cache.path.resolve(paperSetupOutput("extractDevBundle", "dir")),
parameters.bundleZip.path
parameters.bundleZip.path,
parameters.bundleZipHash.get()
)
lastUsedFile(parameters.cache.path).writeText(System.currentTimeMillis().toString())
extract
Expand Down

0 comments on commit e80565b

Please sign in to comment.