├── .github └── workflows │ ├── ci.yml │ └── documentation.yml ├── .gitignore ├── Package.swift ├── README.md ├── Sources └── SwiftPackageManifest │ ├── File.swift │ ├── Package.swift │ ├── Product.swift │ └── Target.swift └── Tests ├── LinuxMain.swift └── SwiftPackageManifestTests ├── PackageDecodingTests.swift └── Supporting Types └── Fixtures.swift /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: [master] 6 | pull_request: 7 | branches: [master] 8 | 9 | jobs: 10 | macos: 11 | runs-on: macos-latest 12 | 13 | strategy: 14 | matrix: 15 | xcode: 16 | - "11.7" # Swift 5.2 17 | - "12" # Swift 5.3 18 | 19 | name: "macOS (Xcode ${{ matrix.xcode }})" 20 | 21 | steps: 22 | - name: Checkout 23 | uses: actions/checkout@v1 24 | - name: Build and Test 25 | run: swift test 26 | env: 27 | DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer 28 | 29 | linux: 30 | runs-on: ubuntu-latest 31 | 32 | strategy: 33 | matrix: 34 | swift: ["5.3", "5.2"] 35 | 36 | name: "Linux (Swift ${{ matrix.swift }})" 37 | 38 | container: 39 | image: swift:${{ matrix.swift }} 40 | 41 | steps: 42 | - name: Checkout 43 | uses: actions/checkout@v1 44 | - name: Build and Test 45 | run: swift test --enable-test-discovery 46 | -------------------------------------------------------------------------------- /.github/workflows/documentation.yml: -------------------------------------------------------------------------------- 1 | name: Documentation 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | paths: 8 | - .github/workflows/documentation.yml 9 | - Sources/**.swift 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - name: Checkout 17 | uses: actions/checkout@v1 18 | - name: Generate Documentation 19 | uses: SwiftDocOrg/swift-doc@master 20 | with: 21 | inputs: "Sources" 22 | module-name: SwiftPackageManifest 23 | output: "Documentation" 24 | - name: Upload Documentation to Wiki 25 | uses: SwiftDocOrg/github-wiki-publish-action@v1 26 | with: 27 | path: "Documentation" 28 | env: 29 | GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | .swiftpm 7 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.2 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "SwiftPackageManifest", 8 | products: [ 9 | // Products define the executables and libraries produced by a package, and make them visible to other packages. 10 | .library( 11 | name: "SwiftPackageManifest", 12 | targets: ["SwiftPackageManifest"]), 13 | ], 14 | dependencies: [ 15 | // Dependencies declare other packages that this package depends on. 16 | // .package(url: /* package url */, from: "1.0.0"), 17 | ], 18 | targets: [ 19 | // Targets are the basic building blocks of a package. A target can define a module or a test suite. 20 | // Targets can depend on other targets in this package, and on products in packages which this package depends on. 21 | .target( 22 | name: "SwiftPackageManifest", 23 | dependencies: []), 24 | .testTarget( 25 | name: "SwiftPackageManifestTests", 26 | dependencies: ["SwiftPackageManifest"]), 27 | ] 28 | ) 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SwiftPackageManifest 2 | 3 | ![CI][ci badge] 4 | [![Documentation][documentation badge]][documentation] 5 | 6 | A package that provides information about a Swift package, 7 | as encoded by running `swift package dump-package` 8 | in a directory containing a valid `Package.swift` manifest. 9 | 10 | `SwiftPackageManifest` is similar to but distinct from 11 | the Swift Package Manager's [`PackageDescription` module](https://developer.apple.com/documentation/swift_packages/package) 12 | It's intended to be a lightweight, portable alternative 13 | to the official library for the sole purpose of 14 | reading generated Swift package manifests in JSON format. 15 | 16 | > **Warning**: 17 | > The format of `swift package dump-package` isn't versioned, 18 | > and any changes to this format between Swift releases 19 | > may cause decoding to fail. 20 | 21 | ## Usage 22 | 23 | In a directory containing a valid `Package.swift` manifest, 24 | run the following command to generate a JSON representation: 25 | 26 | ```terminal 27 | $ swift package dump-package > Package.json 28 | ``` 29 | 30 | Read the contents of that file 31 | and use `JSONDecoder` to deserialize a `Package` object from it: 32 | 33 | ```swift 34 | import Foundation 35 | import SwiftPackageManifest 36 | 37 | let json = try! Data(contentsOfFile: "path/to/Package.json", options: []) 38 | let decoder = JSONDecoder() 39 | let package = try decoder.decode(Package.self, from: json) 40 | ``` 41 | 42 | ## Installation 43 | 44 | ### Swift Package Manager 45 | 46 | Add the SwiftPackageManifest package to your target dependencies in `Package.swift`: 47 | 48 | ```swift 49 | import PackageDescription 50 | 51 | let package = Package( 52 | name: "YourProject", 53 | dependencies: [ 54 | .package( 55 | url: "https://github.com/SwiftDocOrg/SwiftPackageManifest", 56 | from: "0.1.0" 57 | ), 58 | ] 59 | ) 60 | ``` 61 | 62 | Add `SwiftPackageManifest` as a dependency to your target(s): 63 | 64 | ```swift 65 | targets: [ 66 | .target( 67 | name: "YourTarget", 68 | dependencies: ["SwiftPackageManifest"]), 69 | ``` 70 | 71 | ## License 72 | 73 | MIT 74 | 75 | ## Contact 76 | 77 | Mattt ([@mattt](https://twitter.com/mattt)) 78 | 79 | [ci badge]: https://github.com/SwiftDocOrg/SwiftPackageManifest/workflows/CI/badge.svg 80 | [documentation badge]: https://github.com/SwiftDocOrg/SwiftPackageManifest/workflows/Documentation/badge.svg 81 | [documentation]: https://github.com/SwiftDocOrg/SwiftPackageManifest/wiki 82 | -------------------------------------------------------------------------------- /Sources/SwiftPackageManifest/File.swift: -------------------------------------------------------------------------------- 1 | // 2 | // File.swift 3 | // 4 | // 5 | // Created by Mattt Zmuda on 4/7/20. 6 | // 7 | 8 | import Foundation 9 | -------------------------------------------------------------------------------- /Sources/SwiftPackageManifest/Package.swift: -------------------------------------------------------------------------------- 1 | /** 2 | Information about a Swift package as provided by its manifest. 3 | 4 | Use `JSONDecoder` to decode a `Package` value 5 | from the output of running `swift package dump-package` 6 | in a directory containing a valid `Package.swift` manifest. 7 | 8 | - Important: This API is similar to but distinct from 9 | the Swift Package Manager's `PackageDescription` module 10 | (https://developer.apple.com/documentation/swift_packages/package). 11 | It's intended to be a lightweight, portable alternative 12 | to the official library for the sole purpose of 13 | reading generated Swift package manifests in JSON format. 14 | 15 | - Warning: The format of `swift package dump-package` isn't versioned, 16 | and any changes to this format between Swift releases 17 | may cause decoding to fail. 18 | */ 19 | public struct Package: Equatable { 20 | /// Declares other packages that this package depends on. 21 | public struct Dependency: Equatable { 22 | // Version requirements for the dependency. 23 | public enum Requirement { 24 | public typealias Range = (lowerBound: String, upperBound: String) 25 | 26 | /// A specific revision. 27 | case revision([String]) 28 | 29 | /// A range of version numbers. 30 | case range([Range]) 31 | 32 | /// A branch. 33 | case branch([String]) 34 | 35 | /// An exact version 36 | case exact([String]) 37 | } 38 | 39 | /// The name of the dependency. 40 | public let name: String? 41 | 42 | /// The URL for the dependency repository. 43 | public let url: String 44 | 45 | /// The version requirements for the dependency. 46 | public let requirement: Requirement 47 | } 48 | 49 | /// A platform that the Swift package supports. 50 | public struct SupportedPlatform: Decodable, Equatable { 51 | /// The name of the platform. 52 | let name: String 53 | 54 | /// The minimum deployment target of the platform. 55 | let minimumDeploymentTarget: String 56 | 57 | private enum CodingKeys: String, CodingKey { 58 | case name = "platformName" 59 | case minimumDeploymentTarget = "version" 60 | } 61 | } 62 | 63 | /// The name of the package. 64 | public let name: String 65 | 66 | /// The products provided by the package. 67 | public let products: [Product] 68 | 69 | /// The dependencies used by the package. 70 | public let dependencies: [Dependency] 71 | 72 | /// The targets defined in the package. 73 | public let targets: [Target] 74 | 75 | /// The platforms supported by the package. 76 | public let platforms: [SupportedPlatform] 77 | 78 | /// The name used for C modules. 79 | public let cModuleName: String? 80 | 81 | /// The C programming language standard used by the package. 82 | public let cLanguageStandard: String? 83 | 84 | /// The C++ programming language standard used by the package. 85 | public let cxxLanguageStandard: String? 86 | 87 | /// Declares the minimum version of Swift required to build this package. 88 | public let toolsVersion: String 89 | } 90 | 91 | // MARK: Decodable 92 | 93 | extension Package: Decodable { 94 | private enum CodingKeys: String, CodingKey { 95 | case name 96 | case products 97 | case dependencies 98 | case targets 99 | case platforms 100 | case pkgConfig 101 | case cLanguageStandard 102 | case cxxLanguageStandard 103 | case toolsVersion 104 | 105 | enum NestedCodingKeys: String, CodingKey { 106 | case _version 107 | } 108 | } 109 | 110 | public init(from decoder: Decoder) throws { 111 | let container = try decoder.container(keyedBy: CodingKeys.self) 112 | self.name = try container.decode(String.self, forKey: .name) 113 | self.products = try container.decode([Product].self, forKey: .products) 114 | self.dependencies = try container.decode([Dependency].self, forKey: .dependencies) 115 | self.targets = try container.decode([Target].self, forKey: .targets) 116 | self.platforms = try container.decode([SupportedPlatform].self, forKey: .platforms) 117 | 118 | self.cModuleName = try container.decode(String?.self, forKey: .pkgConfig) 119 | self.cLanguageStandard = try container.decode(String?.self, forKey: .cLanguageStandard) 120 | self.cxxLanguageStandard = try container.decode(String?.self, forKey: .cxxLanguageStandard) 121 | 122 | let nestedContainer = try container.nestedContainer(keyedBy: CodingKeys.NestedCodingKeys.self, forKey: .toolsVersion) 123 | self.toolsVersion = try nestedContainer.decode(String.self, forKey: ._version) 124 | } 125 | } 126 | 127 | // MARK: - 128 | 129 | // MARK: Decodable 130 | 131 | extension Package.Dependency: Decodable {} 132 | 133 | // MARK: - 134 | 135 | // MARK: Equatable 136 | 137 | extension Package.Dependency.Requirement: Equatable { 138 | public static func == (lhs: Package.Dependency.Requirement, rhs: Package.Dependency.Requirement) -> Bool { 139 | switch (lhs, rhs) { 140 | case let (.revision(l), .revision(r)), 141 | let (.exact(l), .exact(r)), 142 | let (.branch(l), .branch(r)): 143 | return l == r 144 | case let (.range(l), .range(r)): 145 | guard l.count == r.count else { return false } 146 | for case let ((ll, lu), (rl, ru)) in zip(l, r) { 147 | guard ll == rl, lu == ru else { return false } 148 | } 149 | return true 150 | default: 151 | return false 152 | } 153 | } 154 | } 155 | 156 | // MARK: Decodable 157 | 158 | extension Package.Dependency.Requirement: Decodable { 159 | private enum CodingKeys: String, CodingKey { 160 | case revision 161 | case range 162 | case branch 163 | case exact 164 | 165 | enum NestedRangeCodingKeys: String, CodingKey { 166 | case lowerBound 167 | case upperBound 168 | } 169 | } 170 | 171 | public init(from decoder: Decoder) throws { 172 | let container = try decoder.container(keyedBy: CodingKeys.self) 173 | if container.contains(.revision) { 174 | self = try .revision(container.decode([String].self, forKey: .revision)) 175 | } else if container.contains(.range) { 176 | var nestedUnkeyedContainer = try container.nestedUnkeyedContainer(forKey: .range) 177 | 178 | var ranges: [Package.Dependency.Requirement.Range] = [] 179 | while !nestedUnkeyedContainer.isAtEnd { 180 | let nestedContainer = try nestedUnkeyedContainer.nestedContainer(keyedBy: CodingKeys.NestedRangeCodingKeys.self) 181 | 182 | let lowerBound = try nestedContainer.decode(String.self, forKey: .lowerBound) 183 | let upperBound = try nestedContainer.decode(String.self, forKey: .upperBound) 184 | ranges.append((lowerBound: lowerBound, upperBound: upperBound)) 185 | } 186 | 187 | self = .range(ranges) 188 | } else if container.contains(.branch) { 189 | self = try .branch(container.decode([String].self, forKey: .branch)) 190 | } else if container.contains(.exact) { 191 | self = try .exact(container.decode([String].self, forKey: .exact)) 192 | } else { 193 | let context = DecodingError.Context(codingPath: container.codingPath, debugDescription: "unknown or invalid requirement") 194 | throw DecodingError.dataCorrupted(context) 195 | } 196 | } 197 | } 198 | -------------------------------------------------------------------------------- /Sources/SwiftPackageManifest/Product.swift: -------------------------------------------------------------------------------- 1 | /** 2 | Defines the executables and libraries produced by a package, 3 | and makes them visible to other packages. 4 | */ 5 | public struct Product: Equatable { 6 | /// A product type. 7 | public enum `Type`: String, Hashable, CaseIterable, CodingKey { 8 | case library 9 | case executable 10 | } 11 | 12 | /// The type of product (`library` or `executable`). 13 | public let `type`: `Type` 14 | 15 | /// The name of the product. 16 | public let name: String 17 | 18 | /// The targets that comprise the product. 19 | public let targets: [String] 20 | } 21 | 22 | // MARK: Decodable 23 | 24 | extension Product: Decodable { 25 | private enum CodingKeys: String, CodingKey { 26 | case type 27 | case name 28 | case targets 29 | } 30 | 31 | public init(from decoder: Decoder) throws { 32 | let container = try decoder.container(keyedBy: CodingKeys.self) 33 | 34 | let nestedContainer = try container.nestedContainer(keyedBy: `Type`.self, forKey: .type) 35 | guard let type = `Type`.allCases.first(where: { nestedContainer.contains($0) }) else { 36 | let context = DecodingError.Context(codingPath: nestedContainer.codingPath, debugDescription: "unknown or invalid type") 37 | throw DecodingError.dataCorrupted(context) 38 | } 39 | 40 | self.`type` = type 41 | 42 | self.name = try container.decode(String.self, forKey: .name) 43 | self.targets = try container.decode([String].self, forKey: .targets) 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Sources/SwiftPackageManifest/Target.swift: -------------------------------------------------------------------------------- 1 | /** 2 | The basic building blocks of a package. 3 | 4 | A target can define a module or a test suite. 5 | 6 | Targets can depend on other targets in this package, 7 | and on products in packages which this package depends on. 8 | */ 9 | public struct Target: Equatable { 10 | /// A target type. 11 | public enum `Type`: String, Hashable, Decodable { 12 | case regular 13 | case test 14 | case system 15 | } 16 | 17 | public enum SystemPackageProvider: Equatable { 18 | /** 19 | A list of packages installed using 20 | the apt-get package manager on Ubuntu 21 | to create a system package provider instance. 22 | */ 23 | 24 | case apt([String]) 25 | 26 | /** 27 | A list of packages installed using 28 | the homebrew package manager on macOS 29 | to create a system package provider instance. 30 | */ 31 | case brew([String]) 32 | } 33 | 34 | /// The type of target (`regular`, `test`, or `system`) 35 | public let `type`: `Type` 36 | 37 | /// The name of the target. 38 | public let name: String 39 | 40 | /// The path to the target sources. 41 | public let path: String? 42 | 43 | /// The paths to sources that are excluded from the target. 44 | public let excludedPaths: [String] 45 | 46 | /// The names of the dependencies used by the target. 47 | public let dependencies: [String] 48 | 49 | /// The paths to resources bundled into the target. 50 | public let resources: [String] 51 | 52 | /// The settings specified for build the target. 53 | public let settings: [String] 54 | 55 | /// The name used for C modules. 56 | public let cModuleName: String? 57 | 58 | /// The providers of system packages used by the target. 59 | public let providers: [SystemPackageProvider] 60 | } 61 | 62 | // MARK: Decodable 63 | 64 | extension Target: Decodable { 65 | private enum CodingKeys: String, CodingKey { 66 | case type 67 | case name 68 | case path 69 | case exclude 70 | case dependencies 71 | case resources 72 | case settings 73 | case providers 74 | case pkgConfig 75 | 76 | enum NestedDependencyCodingKeys: String, CodingKey { 77 | case byName 78 | } 79 | 80 | enum NestedSystemPackageProviderKeys: String, CodingKey { 81 | case apt 82 | case brew 83 | } 84 | } 85 | 86 | public init(from decoder: Decoder) throws { 87 | let container = try decoder.container(keyedBy: CodingKeys.self) 88 | self.type = try container.decode(`Type`.self, forKey: .type) 89 | self.name = try container.decode(String.self, forKey: .name) 90 | self.path = try container.decodeIfPresent(String.self, forKey: .path) 91 | self.excludedPaths = try container.decode([String].self, forKey: .exclude) 92 | 93 | var dependencies: [String] = [] 94 | do { 95 | var nestedUnkeyedContainer = try container.nestedUnkeyedContainer(forKey: .dependencies) 96 | while !nestedUnkeyedContainer.isAtEnd { 97 | let nestedKeyedContainer = try nestedUnkeyedContainer.nestedContainer(keyedBy: CodingKeys.NestedDependencyCodingKeys.self) 98 | let names = try nestedKeyedContainer.decode([String].self, forKey: .byName) 99 | dependencies.append(contentsOf: names) 100 | } 101 | } 102 | self.dependencies = dependencies 103 | 104 | self.resources = try container.decode([String].self, forKey: .resources) 105 | self.settings = try container.decode([String].self, forKey: .settings) 106 | 107 | var providers: [SystemPackageProvider] = [] 108 | do { 109 | if var nestedUnkeyedContainer = try? container.nestedUnkeyedContainer(forKey: .providers) { 110 | while !nestedUnkeyedContainer.isAtEnd { 111 | let nestedKeyedContainer = try nestedUnkeyedContainer.nestedContainer(keyedBy: CodingKeys.NestedSystemPackageProviderKeys.self) 112 | if nestedKeyedContainer.contains(.apt) { 113 | let packages = try nestedKeyedContainer.decode([[String]].self, forKey: .apt) 114 | providers.append(.apt(packages.flatMap { $0 })) 115 | } else if nestedKeyedContainer.contains(.brew) { 116 | let packages = try nestedKeyedContainer.decode([[String]].self, forKey: .apt) 117 | providers.append(.brew(packages.flatMap { $0 })) 118 | } else { 119 | let context = DecodingError.Context(codingPath: nestedKeyedContainer.codingPath, debugDescription: "unknown or invalid system package provider") 120 | throw DecodingError.dataCorrupted(context) 121 | } 122 | } 123 | } 124 | } 125 | self.providers = providers 126 | 127 | self.cModuleName = try container.decodeIfPresent(String.self, forKey: .pkgConfig) 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /Tests/LinuxMain.swift: -------------------------------------------------------------------------------- 1 | fatalError("Run with `swift test --enable-test-discovery`") 2 | -------------------------------------------------------------------------------- /Tests/SwiftPackageManifestTests/PackageDecodingTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import SwiftPackageManifest 3 | 4 | final class PackageDecodingTests: XCTestCase { 5 | func testDecodePackageDump() throws { 6 | let decoder = JSONDecoder() 7 | let package = try decoder.decode(Package.self, from: Fixtures.example) 8 | 9 | XCTAssertEqual(package.name, "Example") 10 | XCTAssertEqual(package.toolsVersion, "5.1.0") 11 | 12 | XCTAssertEqual(package.products.count, 2) 13 | XCTAssertEqual(package.products[0].name, "swift-doc") 14 | XCTAssertEqual(package.products[0].targets, ["swift-doc"]) 15 | XCTAssertEqual(package.products[0].type, .executable) 16 | XCTAssertEqual(package.products[1].name, "SwiftDoc") 17 | XCTAssertEqual(package.products[1].targets, ["SwiftDoc"]) 18 | XCTAssertEqual(package.products[1].type, .library) 19 | 20 | XCTAssertEqual(package.dependencies.count, 9) 21 | XCTAssertEqual(package.dependencies[0].name, "swift-syntax") 22 | XCTAssertEqual(package.dependencies[0].url, "https://github.com/apple/swift-syntax.git") 23 | XCTAssertEqual(package.dependencies[0].requirement, .revision(["0.50200.0"])) 24 | 25 | XCTAssertEqual(package.targets.count, 5) 26 | XCTAssertEqual(package.targets[0].type, .regular) 27 | XCTAssertEqual(package.targets[0].name, "swift-doc") 28 | XCTAssertNil(package.targets[0].path) 29 | XCTAssertEqual(package.targets[0].dependencies, ["ArgumentParser", "SwiftDoc", "SwiftSemantics", "SwiftMarkup", "CommonMarkBuilder", "HypertextLiteral", "Markup", "DCOV", "GraphViz", "SwiftSyntaxHighlighter"]) 30 | XCTAssertEqual(package.targets[0].resources, []) 31 | XCTAssertEqual(package.targets[0].settings, []) 32 | 33 | XCTAssertEqual(package.targets[4].type, .system) 34 | XCTAssertEqual(package.targets[4].name, "libxml2") 35 | XCTAssertEqual(package.targets[4].path, "Modules") 36 | XCTAssertEqual(package.targets[4].dependencies, []) 37 | XCTAssertEqual(package.targets[4].providers, [.apt(["libxml2-dev"])]) 38 | XCTAssertEqual(package.targets[4].resources, []) 39 | XCTAssertEqual(package.targets[4].settings, []) 40 | } 41 | 42 | func testExactDependency() throws { 43 | let decoder = JSONDecoder() 44 | let package = try decoder.decode(Package.self, from: Fixtures.xcparseDump) 45 | 46 | XCTAssertEqual(package.toolsVersion, "5.1.0") 47 | XCTAssertEqual(package.dependencies.count, 1) 48 | XCTAssertEqual(package.dependencies[0].url, "https://github.com/apple/swift-package-manager.git") 49 | XCTAssertEqual(package.dependencies[0].requirement, .exact(["0.5.0"])) 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Tests/SwiftPackageManifestTests/Supporting Types/Fixtures.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | enum Fixtures { 4 | static let example = #""" 5 | { 6 | "cLanguageStandard": null, 7 | "cxxLanguageStandard": null, 8 | "dependencies": [ 9 | { 10 | "name": "swift-syntax", 11 | "requirement": { 12 | "revision": [ 13 | "0.50200.0" 14 | ] 15 | }, 16 | "url": "https:\/\/github.com\/apple\/swift-syntax.git" 17 | }, 18 | { 19 | "name": "SwiftSemantics", 20 | "requirement": { 21 | "range": [ 22 | { 23 | "lowerBound": "0.1.0", 24 | "upperBound": "0.2.0" 25 | } 26 | ] 27 | }, 28 | "url": "https:\/\/github.com\/SwiftDocOrg\/SwiftSemantics.git" 29 | }, 30 | { 31 | "name": "CommonMark", 32 | "requirement": { 33 | "branch": [ 34 | "master" 35 | ] 36 | }, 37 | "url": "https:\/\/github.com\/SwiftDocOrg\/CommonMark.git" 38 | }, 39 | { 40 | "name": "SwiftMarkup", 41 | "requirement": { 42 | "range": [ 43 | { 44 | "lowerBound": "0.0.5", 45 | "upperBound": "0.1.0" 46 | } 47 | ] 48 | }, 49 | "url": "https:\/\/github.com\/SwiftDocOrg\/SwiftMarkup.git" 50 | }, 51 | { 52 | "name": "GraphViz", 53 | "requirement": { 54 | "revision": [ 55 | "03405c13dc1c31f50c08bbec6e7587cbee1c7fb3" 56 | ] 57 | }, 58 | "url": "https:\/\/github.com\/SwiftDocOrg\/GraphViz.git" 59 | }, 60 | { 61 | "name": "HypertextLiteral", 62 | "requirement": { 63 | "range": [ 64 | { 65 | "lowerBound": "0.0.2", 66 | "upperBound": "0.1.0" 67 | } 68 | ] 69 | }, 70 | "url": "https:\/\/github.com\/NSHipster\/HypertextLiteral.git" 71 | }, 72 | { 73 | "name": "Markup", 74 | "requirement": { 75 | "range": [ 76 | { 77 | "lowerBound": "0.0.3", 78 | "upperBound": "0.1.0" 79 | } 80 | ] 81 | }, 82 | "url": "https:\/\/github.com\/SwiftDocOrg\/Markup.git" 83 | }, 84 | { 85 | "name": "SwiftSyntaxHighlighter", 86 | "requirement": { 87 | "revision": [ 88 | "1.0.0" 89 | ] 90 | }, 91 | "url": "https:\/\/github.com\/NSHipster\/SwiftSyntaxHighlighter.git" 92 | }, 93 | { 94 | "name": "swift-argument-parser", 95 | "requirement": { 96 | "range": [ 97 | { 98 | "lowerBound": "0.0.2", 99 | "upperBound": "0.1.0" 100 | } 101 | ] 102 | }, 103 | "url": "https:\/\/github.com\/apple\/swift-argument-parser.git" 104 | } 105 | ], 106 | "name": "Example", 107 | "pkgConfig": null, 108 | "platforms": [ 109 | { 110 | "platformName": "macos", 111 | "version": "10.10" 112 | }, 113 | { 114 | "platformName": "ios", 115 | "version": "9.0" 116 | }, 117 | { 118 | "platformName": "tvos", 119 | "version": "9.0" 120 | } 121 | ], 122 | "products": [ 123 | { 124 | "name": "swift-doc", 125 | "targets": [ 126 | "swift-doc" 127 | ], 128 | "type": { 129 | "executable": null 130 | } 131 | }, 132 | { 133 | "name": "SwiftDoc", 134 | "targets": [ 135 | "SwiftDoc" 136 | ], 137 | "type": { 138 | "library": [ 139 | "automatic" 140 | ] 141 | } 142 | } 143 | ], 144 | "providers": null, 145 | "swiftLanguageVersions": null, 146 | "targets": [ 147 | { 148 | "dependencies": [ 149 | { 150 | "byName": [ 151 | "ArgumentParser" 152 | ] 153 | }, 154 | { 155 | "byName": [ 156 | "SwiftDoc" 157 | ] 158 | }, 159 | { 160 | "byName": [ 161 | "SwiftSemantics" 162 | ] 163 | }, 164 | { 165 | "byName": [ 166 | "SwiftMarkup" 167 | ] 168 | }, 169 | { 170 | "byName": [ 171 | "CommonMarkBuilder" 172 | ] 173 | }, 174 | { 175 | "byName": [ 176 | "HypertextLiteral" 177 | ] 178 | }, 179 | { 180 | "byName": [ 181 | "Markup" 182 | ] 183 | }, 184 | { 185 | "byName": [ 186 | "DCOV" 187 | ] 188 | }, 189 | { 190 | "byName": [ 191 | "GraphViz" 192 | ] 193 | }, 194 | { 195 | "byName": [ 196 | "SwiftSyntaxHighlighter" 197 | ] 198 | } 199 | ], 200 | "exclude": [], 201 | "name": "swift-doc", 202 | "resources": [], 203 | "settings": [], 204 | "type": "regular" 205 | }, 206 | { 207 | "dependencies": [], 208 | "exclude": [], 209 | "name": "DCOV", 210 | "resources": [], 211 | "settings": [], 212 | "type": "regular" 213 | }, 214 | { 215 | "dependencies": [ 216 | { 217 | "byName": [ 218 | "SwiftSyntax" 219 | ] 220 | }, 221 | { 222 | "byName": [ 223 | "SwiftSemantics" 224 | ] 225 | }, 226 | { 227 | "byName": [ 228 | "SwiftMarkup" 229 | ] 230 | } 231 | ], 232 | "exclude": [], 233 | "name": "SwiftDoc", 234 | "resources": [], 235 | "settings": [], 236 | "type": "regular" 237 | }, 238 | { 239 | "dependencies": [ 240 | { 241 | "byName": [ 242 | "SwiftDoc" 243 | ] 244 | }, 245 | { 246 | "byName": [ 247 | "SwiftSyntax" 248 | ] 249 | }, 250 | { 251 | "byName": [ 252 | "SwiftSemantics" 253 | ] 254 | }, 255 | { 256 | "byName": [ 257 | "SwiftMarkup" 258 | ] 259 | } 260 | ], 261 | "exclude": [], 262 | "name": "SwiftDocTests", 263 | "resources": [], 264 | "settings": [], 265 | "type": "test" 266 | }, 267 | { 268 | "dependencies": [], 269 | "exclude": [], 270 | "name": "libxml2", 271 | "path": "Modules", 272 | "pkgConfig": "libxml-2.0", 273 | "providers": [ 274 | { 275 | "apt": [ 276 | [ 277 | "libxml2-dev" 278 | ] 279 | ] 280 | } 281 | ], 282 | "resources": [], 283 | "settings": [], 284 | "type": "system" 285 | }, 286 | ], 287 | "toolsVersion": { 288 | "_version": "5.1.0" 289 | } 290 | } 291 | """#.data(using: .utf8)! 292 | 293 | /// Generated from https://github.com/blaquez/xcparse/blob/61bfe78c55e2e0fc2bc3d3d49add3dbd3829a56b/Package.swift 294 | /// using `Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)` 295 | /// Contains 'exact' version requirement 296 | static let xcparseDump = #""" 297 | { 298 | "cLanguageStandard" : null, 299 | "cxxLanguageStandard" : null, 300 | "dependencies" : [ 301 | { 302 | "name" : "swift-package-manager", 303 | "requirement" : { 304 | "exact" : [ 305 | "0.5.0" 306 | ] 307 | }, 308 | "url" : "https:\/\/github.com\/apple\/swift-package-manager.git" 309 | } 310 | ], 311 | "name" : "xcparse", 312 | "pkgConfig" : null, 313 | "platforms" : [ 314 | { 315 | "platformName" : "macos", 316 | "version" : "10.13" 317 | } 318 | ], 319 | "products" : [ 320 | { 321 | "name" : "xcparse", 322 | "targets" : [ 323 | "xcparse" 324 | ], 325 | "type" : { 326 | "executable" : null 327 | } 328 | }, 329 | { 330 | "name" : "XCParseCore", 331 | "targets" : [ 332 | "XCParseCore" 333 | ], 334 | "type" : { 335 | "library" : [ 336 | "automatic" 337 | ] 338 | } 339 | } 340 | ], 341 | "providers" : null, 342 | "swiftLanguageVersions" : [ 343 | "5" 344 | ], 345 | "targets" : [ 346 | { 347 | "dependencies" : [ 348 | { 349 | "byName" : [ 350 | "XCParseCore" 351 | ] 352 | }, 353 | { 354 | "byName" : [ 355 | "SPMUtility" 356 | ] 357 | } 358 | ], 359 | "exclude" : [ 360 | 361 | ], 362 | "name" : "xcparse", 363 | "resources" : [ 364 | 365 | ], 366 | "settings" : [ 367 | 368 | ], 369 | "type" : "regular" 370 | }, 371 | { 372 | "dependencies" : [ 373 | { 374 | "byName" : [ 375 | "SPMUtility" 376 | ] 377 | } 378 | ], 379 | "exclude" : [ 380 | 381 | ], 382 | "name" : "XCParseCore", 383 | "resources" : [ 384 | 385 | ], 386 | "settings" : [ 387 | 388 | ], 389 | "type" : "regular" 390 | }, 391 | { 392 | "dependencies" : [ 393 | { 394 | "byName" : [ 395 | "xcparse" 396 | ] 397 | } 398 | ], 399 | "exclude" : [ 400 | 401 | ], 402 | "name" : "xcparseTests", 403 | "resources" : [ 404 | 405 | ], 406 | "settings" : [ 407 | 408 | ], 409 | "type" : "test" 410 | } 411 | ], 412 | "toolsVersion" : { 413 | "_version" : "5.1.0" 414 | } 415 | } 416 | """#.data(using: .utf8)! 417 | } 418 | --------------------------------------------------------------------------------