Skip to content

Commit

Permalink
Replace case project with static func (using ProjectCacheStorage)
Browse files Browse the repository at this point in the history
  • Loading branch information
ikesyo committed Nov 12, 2024
1 parent a451614 commit c22ed6f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
14 changes: 0 additions & 14 deletions Sources/ScipioKit/Producer/FrameworkProducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,6 @@ struct FrameworkProducer {

let targetsToBuild: OrderedSet<CacheSystem.CacheTarget>
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
Expand Down Expand Up @@ -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 [] }

Expand Down Expand Up @@ -368,10 +358,6 @@ struct FrameworkProducer {

private func cacheFrameworksIfNeeded(_ targets: Set<CacheSystem.CacheTarget>, 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 }

Expand Down
6 changes: 5 additions & 1 deletion Sources/ScipioKit/Runner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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])
}
Expand Down

0 comments on commit c22ed6f

Please sign in to comment.