From c22ed6fea76bfa54ad6e178b7f5bcc8d0c0fd3c3 Mon Sep 17 00:00:00 2001 From: ikesyo Date: Tue, 12 Nov 2024 16:57:56 +0900 Subject: [PATCH] Replace `case project` with static func (using ProjectCacheStorage) --- Sources/ScipioKit/Producer/FrameworkProducer.swift | 14 -------------- Sources/ScipioKit/Runner.swift | 6 +++++- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/Sources/ScipioKit/Producer/FrameworkProducer.swift b/Sources/ScipioKit/Producer/FrameworkProducer.swift index c4b2b0c..c94a594 100644 --- a/Sources/ScipioKit/Producer/FrameworkProducer.swift +++ b/Sources/ScipioKit/Producer/FrameworkProducer.swift @@ -97,13 +97,6 @@ struct FrameworkProducer { let targetsToBuild: OrderedSet switch cacheMode { - case .project: - let valid = await validateExistingFrameworks( - availableTargets: Set(allTargets), - cacheSystem: cacheSystem - ) - targetsToBuild = allTargets.subtracting(valid) - case .storages(let configs): if configs.isEmpty { // no-op because cache is disabled @@ -208,9 +201,6 @@ struct FrameworkProducer { let cacheStorages: [any CacheStorage] switch cacheMode { - case .project: - // For `.project`, there is nothing to restore from external locations. - return [] case .storages(let configs): guard !configs.isEmpty else { return [] } @@ -368,10 +358,6 @@ struct FrameworkProducer { private func cacheFrameworksIfNeeded(_ targets: Set, cacheSystem: CacheSystem) async { switch cacheMode { - case .project: - // For `.project` which is not tied to any (external) storages, we don't need to do anything. - // The built frameworks under the project themselves are treated as valid caches. - break case .storages(let configs): guard !configs.isEmpty else { return } diff --git a/Sources/ScipioKit/Runner.swift b/Sources/ScipioKit/Runner.swift index 6201d4a..027be6a 100644 --- a/Sources/ScipioKit/Runner.swift +++ b/Sources/ScipioKit/Runner.swift @@ -226,10 +226,14 @@ extension Runner { case consumer } - case project case storages([StorageConfig]) public static let disabled: Self = .storages([]) + + public static let project: Self = .storages([ + .init(storage: ProjectCacheStorage(), actors: [.producer]), + ]) + public static func storage(_ config: StorageConfig) -> Self { .storages([config]) }