Skip to content

Commit

Permalink
Merge pull request #1086 from alvasw/gradle_verify_tor_binaries
Browse files Browse the repository at this point in the history
build-logic: Verify Tor binary
  • Loading branch information
alvasw authored Aug 2, 2023
2 parents 76a400f + 82358e2 commit 8622462
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ import bisq.gradle.tasks.PgpFingerprint
import bisq.gradle.tasks.download.SignedBinaryDownloader
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.file.RegularFile
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.Property
import org.gradle.api.provider.Provider
import org.gradle.kotlin.dsl.create

class BisqTorBinaryPlugin : Plugin<Project> {
Expand Down Expand Up @@ -35,8 +31,7 @@ class BisqTorBinaryPlugin : Plugin<Project> {
)
torBinaryDownloader.registerTasks()

val binaryTarFile: Provider<RegularFile> = torBinaryDownloader.verifySignatureTask.flatMap { it.fileToVerify }
val torBinaryPackager = TorBinaryPackager(project)
torBinaryPackager.registerTasks(binaryTarFile)
val torBinaryPackager = TorBinaryPackager(project, torBinaryDownloader)
torBinaryPackager.registerTasks()
}
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
package bisq.gradle.tor_binary

import bisq.gradle.tasks.download.SignedBinaryDownloader
import org.gradle.api.Project
import org.gradle.api.file.RegularFile
import org.gradle.api.provider.Property
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.Copy
import org.gradle.api.tasks.TaskProvider
import org.gradle.api.tasks.bundling.Zip
import org.gradle.kotlin.dsl.register

class TorBinaryPackager(private val project: Project) {
class TorBinaryPackager(private val project: Project, private val torBinaryDownloader: SignedBinaryDownloader) {

companion object {
private const val ARCHIVE_EXTRACTION_DIR = "${BisqTorBinaryPlugin.DOWNLOADS_DIR}/extracted"
private const val PROCESSED_DIR = "${BisqTorBinaryPlugin.DOWNLOADS_DIR}/processed"
}

fun registerTasks(tarFile: Provider<RegularFile>) {
fun registerTasks() {
val unpackTarTask: TaskProvider<Copy> = project.tasks.register<Copy>("unpackTorBinaryTar") {
dependsOn(torBinaryDownloader.verifySignatureTask)

val tarFile: Provider<RegularFile> = torBinaryDownloader.verifySignatureTask.flatMap { it.fileToVerify }
from(
tarFile.map {
project.tarTree(it.asFile.absolutePath)
Expand Down

0 comments on commit 8622462

Please sign in to comment.