Skip to content

Allow swift-corelibs-foundation to use unsafeFlags when used as a d… #7431

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

Merged
merged 1 commit into from
Mar 28, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Sources/Workspace/Workspace+Manifests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,16 @@ extension Workspace {
let dependency = dependency.dependency
switch dependency.state {
case .sourceControlCheckout(let checkout):
if checkout.isBranchOrRevisionBased {
result.insert(dependency.packageRef)
let packageRef = dependency.packageRef

if checkout.isBranchOrRevisionBased
// FIXME: Remove this once we have a general mechanism
// for passing "safe" flags.
|| packageRef.identity == .plain("swift-corelibs-foundation")
{
result.insert(packageRef)
}

case .registryDownload, .edited, .custom:
continue
case .fileSystem:
Expand Down
42 changes: 42 additions & 0 deletions Tests/WorkspaceTests/WorkspaceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5590,6 +5590,48 @@ final class WorkspaceTests: XCTestCase {
}
}

func testUnsafeFlagsInFoundation() throws {
let sandbox = AbsolutePath("/tmp/ws/")
let fs = InMemoryFileSystem()

let workspace = try MockWorkspace(
sandbox: sandbox,
fileSystem: fs,
roots: [
MockPackage(
name: "Test",
targets: [
MockTarget(name: "Test",
dependencies: [
.product(name: "Foundation",
package: "swift-corelibs-foundation")
]),
],
products: [],
dependencies: [
.sourceControl(path: "swift-corelibs-foundation", requirement: .upToNextMajor(from: "1.0.0")),
]
),
],
packages: [
MockPackage(
name: "swift-corelibs-foundation",
targets: [
MockTarget(name: "Foundation", settings: [.init(tool: .swift, kind: .unsafeFlags(["-F", "/tmp"]))]),
],
products: [
MockProduct(name: "Foundation", targets: ["Foundation"])
],
versions: ["1.0.0", nil]
)
]
)

try workspace.checkPackageGraph(roots: ["Test"]) { _, diagnostics in
XCTAssertNoDiagnostics(diagnostics)
}
}

func testEditDependencyHadOverridableConstraints() throws {
let sandbox = AbsolutePath("/tmp/ws/")
let fs = InMemoryFileSystem()
Expand Down