Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix interpreter flags for manifests using pre-release tools-version #6633

Merged
merged 1 commit into from Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/Workspace/Workspace.swift
Expand Up @@ -1951,7 +1951,7 @@ extension Workspace {
let manifestPath = try ManifestLoader.findManifest(packagePath: packagePath, fileSystem: self.fileSystem, currentToolsVersion: self.currentToolsVersion)
let manifestToolsVersion = try ToolsVersionParser.parse(manifestPath: manifestPath, fileSystem: self.fileSystem)

guard self.currentToolsVersion >= manifestToolsVersion, manifestToolsVersion >= ToolsVersion.minimumRequired else {
guard self.currentToolsVersion >= manifestToolsVersion || SwiftVersion.current.isDevelopment, manifestToolsVersion >= ToolsVersion.minimumRequired else {
throw StringError("invalid tools version")
}
return manifestLoader.interpreterFlags(for: manifestToolsVersion)
Expand Down
14 changes: 14 additions & 0 deletions Tests/WorkspaceTests/WorkspaceTests.swift
Expand Up @@ -203,6 +203,20 @@ final class WorkspaceTests: XCTestCase {

XCTAssertEqual(ws.interpreterFlags(for: foo), [])
}

do {
let ws = try createWorkspace(
"""
// swift-tools-version:999.0
import PackageDescription
let package = Package(
name: "foo"
)
"""
)

XCTAssertMatch(ws.interpreterFlags(for: foo), [.equal("-swift-version"), .equal("5")])
}
}
}

Expand Down