Add includedPackages to Repository, populate from GIR include elements
This commit is contained in:
parent
4637693cdb
commit
bc67617649
2 changed files with 8 additions and 1 deletions
|
|
@ -12,13 +12,19 @@ public struct Repository {
|
|||
public var includedLibraryLinks: [String]
|
||||
/// Package name from `<package>` element (e.g. `"gtk4"`).
|
||||
public var packageName: String
|
||||
/// Package entries from `<include>` elements for Swift dependency resolution.
|
||||
/// Each entry records the included GIR namespace name and version (e.g. `"Gdk"`, `"4.0"`).
|
||||
public var includedPackages: [IncludeEntry]
|
||||
/// Creates a new repository.
|
||||
/// - Parameter namespaces: The namespaces contained in this repository.
|
||||
public init(namespaces: [Namespace] = [], cHeaderPath: String = "", includedLibraryLinks: [String] = [], packageName: String = "") {
|
||||
public init(namespaces: [Namespace] = [], cHeaderPath: String = "",
|
||||
includedLibraryLinks: [String] = [], packageName: String = "",
|
||||
includedPackages: [IncludeEntry] = []) {
|
||||
self.namespaces = namespaces
|
||||
self.cHeaderPath = cHeaderPath
|
||||
self.includedLibraryLinks = includedLibraryLinks
|
||||
self.packageName = packageName
|
||||
self.includedPackages = includedPackages
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ final class GIRXMLDelegate: NSObject, XMLParserDelegate {
|
|||
let majorVersion = version.split(separator: ".").first.map(String.init) ?? version
|
||||
let linkName = "\(name.lowercased())-\(majorVersion)"
|
||||
repository.includedLibraryLinks.append(linkName)
|
||||
repository.includedPackages.append(IncludeEntry(name: name, version: version))
|
||||
|
||||
case "namespace":
|
||||
guard let name = requireAttribute("name", from: attributeDict, for: elementName, parser: parser),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue