Skip to content

Commit

Permalink
Merge pull request #53 from SwiftPackageIndex/split-custom-parameters
Browse files Browse the repository at this point in the history
Split custom parameters into elements
  • Loading branch information
finestructure authored Sep 19, 2024
2 parents c0dbd80 + 0e2b411 commit 1297f85
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Sources/SPIManifest/Manifest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ extension Manifest {

public func customDocumentationParameters(platform: Platform, swiftVersion: SwiftVersion) -> [String]? {
self[platform, swiftVersion, \.customDocumentationParameters]?.compactMap { $0 }
.flatMap { $0.components(separatedBy: .whitespaces) }
.filter { $0.count > 0 }
.map { String($0) }
}

public func scheme(for platform: Platform) -> String? {
Expand Down
19 changes: 19 additions & 0 deletions Tests/SPIManifestTests/ManifestTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -508,4 +508,23 @@ class ManifestTests: XCTestCase {
)
}

func test_customDocumentationParameters_splitParameters() throws {
let m = try Manifest(yml: """
version: 1
builder:
configs:
- documentation_targets: [t0]
custom_documentation_parameters:
- a b
- c d
- e
"""
)

XCTAssertEqual(
m.customDocumentationParameters(platform: .macosSpm, swiftVersion: .latestRelease),
["a", "b", "c", "d", "e"]
)
}

}

0 comments on commit 1297f85

Please sign in to comment.