2024-11-10 17:51:53 +11:00
|
|
|
/*
|
|
|
|
* darwin-apk © 2024 Gay Pizza Specifications
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2024-11-08 21:22:33 +11:00
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
|
|
|
public struct ApkIndexUpdater {
|
2024-11-16 00:30:19 +11:00
|
|
|
public var repositories: [ApkIndexRepository]
|
2024-11-08 21:22:33 +11:00
|
|
|
|
|
|
|
public init() {
|
2024-11-16 00:30:19 +11:00
|
|
|
self.repositories = []
|
2024-11-08 21:22:33 +11:00
|
|
|
}
|
|
|
|
|
2024-11-22 21:01:01 +11:00
|
|
|
public func buildGraph() async {
|
2024-11-11 21:06:37 +11:00
|
|
|
let graph: ApkPackageGraph
|
2024-11-08 21:22:33 +11:00
|
|
|
do {
|
2024-11-22 21:01:01 +11:00
|
|
|
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)
|
2024-11-08 21:22:33 +11:00
|
|
|
} 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) }
|
|
|
|
}
|
2024-11-08 21:22:33 +11:00
|
|
|
}
|
|
|
|
}
|