From 9fc5e3193d06a0863bd9837ef77309a527c93fa1 Mon Sep 17 00:00:00 2001 From: Vitalii Budnik Date: Tue, 24 Jun 2025 12:44:41 +0300 Subject: [PATCH] chore: add BinaryDependenciesDownloader --- .../Utils/BinaryDependenciesDownloader.swift | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Sources/BinaryDependencyManager/Utils/BinaryDependenciesDownloader.swift diff --git a/Sources/BinaryDependencyManager/Utils/BinaryDependenciesDownloader.swift b/Sources/BinaryDependencyManager/Utils/BinaryDependenciesDownloader.swift new file mode 100644 index 0000000..f538cf3 --- /dev/null +++ b/Sources/BinaryDependencyManager/Utils/BinaryDependenciesDownloader.swift @@ -0,0 +1,32 @@ +/// A protocol for downloading binary dependencies from git repositories. +protocol BinaryDependenciesDownloader { + /// Downloads the source code as a zip archive from the specified repo and release tag. + /// + /// - Parameters: + /// - repo: Git repository, e.g. "owner/repo". + /// - tag: The release tag to download. + /// - outputFilePath: The output file path for the downloaded archive. + /// - Throws: If the download fails. + func downloadSourceCode( + repo: String, + tag: String, + outputFilePath: String + ) throws + + /// Downloads a specific release asset from git repo matching the provided pattern. + /// + /// - Parameters: + /// - repo: Git repository, e.g. "owner/repo". + /// - tag: The release tag to download. + /// - pattern: Optional asset name pattern to select the correct file. + /// - outputFilePath: Where to save the downloaded asset. + /// - Throws: If the download fails. + func downloadReleaseAsset( + repo: String, + tag: String, + pattern: String?, + outputFilePath: String + ) throws +} + +extension CLI.GitHub: BinaryDependenciesDownloader {}