Skip to content

Commit

Permalink
Remove unnecessary struct
Browse files Browse the repository at this point in the history
  • Loading branch information
giginet committed May 20, 2024
1 parent 5785b6e commit 92a23e5
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions Sources/ScipioKit/Producer/Cache/CacheSystem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,26 +159,19 @@ struct CacheSystem: Sendable {
self.fileSystem = fileSystem
}

private struct TaskContext: Sendable {
var outputDirectory: URL
var frameworkName: String
}

func cacheFrameworks(_ targets: Set<CacheTarget>) async {
let chunked = targets.chunks(ofCount: storage?.paralellNumber ?? CacheSystem.defaultParalellNumber)

for chunk in chunked {
await withTaskGroup(of: Void.self) { group in
for target in chunk {
let context = TaskContext(
outputDirectory: outputDirectory,
frameworkName: target.buildProduct.frameworkName
)
let outputDirectory = outputDirectory
let frameworkName = target.buildProduct.frameworkName
group.addTask {
let frameworkPath = context.outputDirectory.appendingPathComponent(context.frameworkName)
let frameworkPath = outputDirectory.appendingPathComponent(frameworkName)
do {
logger.info(
"🚀 Cache \(context.frameworkName) to cache storage",
"🚀 Cache \(frameworkName) to cache storage",
metadata: .color(.green)
)
try await cacheFramework(target, at: frameworkPath)
Expand Down

0 comments on commit 92a23e5

Please sign in to comment.