Files
darwin-apk/Sources/apk/Index/ApkIndexUpdate.swift

34 lines
921 B
Swift
Raw Normal View History

2024-11-10 17:51:53 +11:00
/*
* darwin-apk © 2024 Gay Pizza Specifications
* SPDX-License-Identifier: Apache-2.0
*/
import Foundation
public struct ApkIndexUpdater {
public var repositories: [ApkIndexRepository]
public init() {
self.repositories = []
}
public func buildGraph() async {
2024-11-11 21:06:37 +11:00
let graph: ApkPackageGraph
do {
graph = ApkPackageGraph(index: try await ApkIndexReader.resolve(self.repositories, fetch: .lazy))
2024-11-11 21:06:37 +11:00
graph.buildGraphNode()
try graph.pkgIndex.description.write(to: URL(filePath: "packages.txt"), atomically: false, encoding: .utf8)
} catch {
fatalError(error.localizedDescription)
}
2024-11-11 21:06:37 +11:00
if var out = TextFileWriter(URL(filePath: "shallowIsolates.txt")) {
for node in graph.shallowIsolates { print(node, to: &out) }
}
if var out = TextFileWriter(URL(filePath: "deepIsolates.txt")) {
for node in graph.deepIsolates { print(node, to: &out) }
}
}
}