Skip to content

Commit 55e79b1

Browse files
authored
SwiftSyntax version in new macro template has trailing period in dependency version, causing error reading manifest (#7018)
This fixes a regression I believe was introduced in #6774 where the new macro package template has its dependency on swift-syntax expressed as `from: "509.0.0."`, including an unncessary trailing period character. This causes an error reading the manifest. I have not tested this, but I experienced the bug and from source inspection believe this is likely the issue. Resolves rdar://117132800
1 parent 1741b4c commit 55e79b1

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

Sources/PackageModel/InstalledSwiftPMConfiguration.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public struct InstalledSwiftPMConfiguration: Codable {
2525
}
2626

2727
public var description: String {
28-
return "\(major).\(minor).\(patch).\(prereleaseIdentifier.map { "-\($0)" } ?? "")"
28+
return "\(major).\(minor).\(patch)\(prereleaseIdentifier.map { "-\($0)" } ?? "")"
2929
}
3030
}
3131

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift open source project
4+
//
5+
// Copyright (c) 2014-2020 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See http://swift.org/LICENSE.txt for license information
9+
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
import XCTest
14+
15+
@testable import PackageModel
16+
17+
final class InstalledSwiftPMConfigurationTests: XCTestCase {
18+
func testVersionDescription() {
19+
do {
20+
let version = InstalledSwiftPMConfiguration.Version(major: 509, minor: 0, patch: 0)
21+
XCTAssertEqual(version.description, "509.0.0")
22+
}
23+
do {
24+
let version = InstalledSwiftPMConfiguration.Version(major: 509, minor: 0, patch: 0, prereleaseIdentifier: "alpha1")
25+
XCTAssertEqual(version.description, "509.0.0-alpha1")
26+
}
27+
do {
28+
let version = InstalledSwiftPMConfiguration.Version(major: 509, minor: 0, patch: 0, prereleaseIdentifier: "beta.1")
29+
XCTAssertEqual(version.description, "509.0.0-beta.1")
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)