func run()

in Sources/XCRemoteCache/Commands/Plugins/Thinning/ThinningConsumerPrebuildPlugin.swift [92:117]


    func run(meta: MainArtifactMeta) throws {
        onRun()
        let allArtifactFileKeys = ThinningPlugin.extractAllProductArtifacts(meta: meta)
        // Verify all thinned target's fileKeys are available in the meta
        let artifactToFetchFileKeys = allArtifactFileKeys.filter { key, _ in
            thinnedTargets.contains(key)
        }
        let missingCachedTargets = Set(thinnedTargets).subtracting(allArtifactFileKeys.keys)
        guard missingCachedTargets.isEmpty else {
            let missingTargets = Array(missingCachedTargets)
            let rawError = ThinningConsumerPrebuildPluginError.missingCachedTarget(missingTargets: missingTargets)
            // Thin project requires all artifacts to be available locally - has to fail immediately
            throw PluginError.unrecoverableError(rawError)
        }

        for (productName, fileKey) in artifactToFetchFileKeys {
            worker.appendAction {
                try self.downloadAndPrepareArtifactFor(productName: productName, fileKey: fileKey)
            }
        }
        if case .errors(let errors) = worker.waitForResult() {
            let rawError = ThinningConsumerPrebuildPluginError.failedPreparation(underlyingErrors: errors)
            // Thin project requires all artifacts to be available locally - has to fail immediately
            throw PluginError.unrecoverableError(rawError)
        }
    }