Skip to content
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 @@ -135,7 +135,7 @@ public struct DependenciesResolverRunner {
try unarchiver.unzip(archivePath: downloadedFileURL.path(percentEncoded: false), outputFilePath: tempDir.path(percentEncoded: false))

// if we have additional contents directory from dependency, we should use it
let contentsDirectoryURL = tempDir.appending(path: asset.contents ?? "", directoryHint: .isDirectory)
let contentsDirectoryURL = tempDir.appending(path: asset.contents ?? "", directoryHint: .isDirectory).standardizedFileURL

let contents = try fileManager.contentsOfDirectory(at: contentsDirectoryURL)

Expand Down Expand Up @@ -183,6 +183,7 @@ public struct DependenciesResolverRunner {
func downloadDirectoryURL(for dependency: Dependency, asset: Dependency.Asset) -> URL {
downloadsDirectoryURL
.appending(components: dependency.repo, dependency.tag, asset.outputDirectory ?? "", directoryHint: .isDirectory)
.standardizedFileURL
}

/// Location of the file where the downloaded dependency will be placed
Expand All @@ -194,6 +195,7 @@ public struct DependenciesResolverRunner {
func outputDirectoryURL(for dependency: Dependency, asset: Dependency.Asset) -> URL {
outputDirectoryURL
.appending(components: dependency.repo, asset.outputDirectory ?? "", directoryHint: .isDirectory)
.standardizedFileURL
}

func outputDirectoryHashFile(for dependency: Dependency, asset: Dependency.Asset) throws -> URL {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ extension DependenciesResolverRunnerTests {
#expect(downloadsDir.path(percentEncoded: false).hasSuffix("/\(relativePath)/.downloads/"))
#expect(
downloadsDir == FileManager.default.currentDirectoryPath.asFileURL
.appending(components: relativePath, ".downloads", directoryHint: .isDirectory)
.appending(path: "relative/cache/.downloads", directoryHint: .isDirectory)
)
}

Expand Down Expand Up @@ -51,11 +51,9 @@ extension DependenciesResolverRunnerTests {
#expect(
outputDir == FileManager.default.currentDirectoryPath.asFileURL
.appending(
components: relativePath,
sampleDependency.repo,
sampleAsset.outputDirectory ?? "",
components: "relative/output/org/repo", sampleAsset.outputDirectory ?? "",
directoryHint: .isDirectory
)
).standardizedFileURL
)
}

Expand All @@ -70,9 +68,9 @@ extension DependenciesResolverRunnerTests {
// THEN
#expect(
downloadURL == tempDir.appending(
components: "cache/.downloads", sampleDependency.repo, sampleDependency.tag, sampleAsset.outputDirectory ?? "", sampleAsset.checksum + ".zip",
path: "cache/.downloads/org/repo/1.0.0/abc123.zip",
directoryHint: .notDirectory
)
).standardizedFileURL
)
}

Expand All @@ -85,10 +83,9 @@ extension DependenciesResolverRunnerTests {
let hashURL = try runner.outputDirectoryHashFile(for: sampleDependency, asset: sampleAsset)

// THEN
let hashFilename = "." + (sampleAsset.pattern?.replacingOccurrences(of: ".", with: "_") ?? "") + ".hash"
#expect(
hashURL == tempDir.appending(
components: "output", sampleDependency.repo, sampleAsset.outputDirectory ?? "", hashFilename,
path: "output/org/repo/.asset_zip.hash",
directoryHint: .notDirectory
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ final class DependenciesResolverRunnerUnzipTests {
let tempRootDir = tempDir.appending(
components: "PrivateDownloads", "mock-uuid", assetWithoutContents.contents ?? "",
directoryHint: .isDirectory
)
).standardizedFileURL
fileManager.directoryContents = [
tempRootDir.path(percentEncoded: false): ["file1.txt", "file2.txt"]
]
Expand Down