Skip to content

Commit 3a84943

Browse files
authored
Merge pull request #203 from Ryu0118/fix-cache
Fix issue causing valid local cache to be discarded and external cache to be fetched
2 parents 907af11 + 4a47108 commit 3a84943

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Sources/ScipioKit/Producer/FrameworkProducer.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ struct FrameworkProducer {
8585
)
8686
}
8787

88+
let allTargets = targetGraph.allNodes.map(\.value)
89+
8890
let pinsStore = try descriptionPackage.workspace.pinsStore.load()
8991
let cacheSystem = CacheSystem(
9092
pinsStore: pinsStore,
@@ -132,7 +134,7 @@ struct FrameworkProducer {
132134

133135
if shouldGenerateVersionFile {
134136
// Versionfiles should be generate for all targets
135-
for target in builtTargets {
137+
for target in allTargets {
136138
await generateVersionFile(for: target, using: cacheSystem)
137139
}
138140
}

Tests/ScipioKitTests/RunnerTests.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,7 @@ final class RunnerTests: XCTestCase {
353353
"The framework should be cached to the cache storage"
354354
)
355355

356-
let outputFrameworkPath = frameworkOutputDir.appendingPathComponent("ScipioTesting.xcframework")
357-
try self.fileManager.removeItem(atPath: outputFrameworkPath.path)
356+
try self.fileManager.removeItem(atPath: frameworkOutputDir.path)
358357

359358
// Fetch from local storage
360359
do {
@@ -364,10 +363,17 @@ final class RunnerTests: XCTestCase {
364363
XCTFail("Build should be succeeded.")
365364
}
366365

366+
let outputFrameworkPath = frameworkOutputDir.appendingPathComponent("ScipioTesting.xcframework")
367+
let outputVersionFile = frameworkOutputDir.appendingPathComponent(".ScipioTesting.version")
368+
367369
XCTAssertTrue(
368370
fileManager.fileExists(atPath: outputFrameworkPath.path),
369371
"The framework should be restored from the cache storage"
370372
)
373+
XCTAssertTrue(
374+
fileManager.fileExists(atPath: outputVersionFile.path),
375+
"The version file should exist when restored"
376+
)
371377

372378
try fileManager.removeItem(at: storageDir)
373379
}

0 commit comments

Comments
 (0)