Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build-logic: Verify Tor binary #1086

Merged
merged 1 commit into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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