in Sources/XCRemoteCache/Commands/Prepare/PrepareContext.swift [60:83]
init(_ config: XCRemoteCacheConfig, offline: Bool) throws {
guard !config.primaryRepo.isEmpty else {
throw PrepareContextError.invalidPrimaryRepo(config.primaryRepo)
}
guard !config.primaryBranch.isEmpty else {
throw PrepareContextError.invalidPrimaryBranch(config.primaryBranch)
}
primaryRepo = config.primaryRepo
primaryBranch = config.primaryBranch
let sourceRoot = URL(fileURLWithPath: config.sourceRoot, isDirectory: true)
repoRoot = URL(fileURLWithPath: config.repoRoot, relativeTo: sourceRoot)
remoteCommitLocation = URL(fileURLWithPath: config.remoteCommitFile, relativeTo: repoRoot)
maximumSha = config.cacheCommitHistory
self.offline = offline
guard let address = URL(string: config.recommendedCacheAddress) else {
throw PrepareContextError.invalidRemoteCacheAddress(config.recommendedCacheAddress)
}
recommendedCacheAddress = address
xcccCommand = URL(fileURLWithPath: config.xcccFile, relativeTo: repoRoot)
cacheAddresses = try config.cacheAddresses.map(URL.build)
cacheHealthPath = config.cacheHealthPath
cacheHealthPathProbeCount = config.cacheHealthPathProbeCount
gracefullyHandleMissingCommonSha = config.gracefullyHandleMissingCommonSha
}