Skip to content

[5.9] Reduce XCTest minimum deployment target computation #6886

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
Sep 21, 2023

Conversation

neonichu
Copy link
Contributor

We never need this for any platform that we're not building for and we also don't really need it for most commands. So we can just move the computation to SwiftTool and leave these empty for all other cases.

rdar://64596106

(cherry picked from commit 019a6fb)

@neonichu neonichu added the swift 5.9 This PR targets the 5.9 branch label Sep 11, 2023
@neonichu neonichu self-assigned this Sep 11, 2023
@neonichu
Copy link
Contributor Author

@swift-ci please test

@neonichu
Copy link
Contributor Author

error: the test 'IntegrationTests' requires macos 10.13, but depends on the product 'SwiftToolsSupport-auto' which requires macos 10.15; consider changing the test 'IntegrationTests' to require macos 10.15 or later, or the product 'SwiftToolsSupport-auto' to require macos 10.13 or earlier.
error: the test 'IntegrationTests' requires macos 10.13, but depends on the product 'TSCTestSupport' which requires macos 10.15; consider changing the test 'IntegrationTests' to require macos 10.15 or later, or the product 'TSCTestSupport' to require macos 10.13 or earlier.

The first time I saw this I took it at face value and updated the integration tests package, but I think this is actually an issue with this PR. The diagnostic is technically correct in the sense that these are the deployment targets at the package level, but the test target specifically should receive a raised deployment target of macOS 11 or maybe even 12?

@neonichu
Copy link
Contributor Author

Hm, it doesn't seem as if I can reproduce the IntegrationTests issue locally

@neonichu
Copy link
Contributor Author

Ah, I cannot reproduce locally because the Xcode I am using contains XCTest with a macOS 13 deployment target which is new enough to fulfill the TSC requirement. So that suggests that the raising of the deployment target still works correctly with my changes, at least in principle.

So that means it is correct to update the IntegrationTests package manifest, but I still cannot explain why the issue is only surfacing in this PR. Seems like there must still be a change in behavior somewhere, albeit it seems like that might bring us closer to expect behavior.

@neonichu
Copy link
Contributor Author

Scratch that, this was working locally because I had a random old resolved file lying around in the IntegrationTests, so I was getting a version that still used a 10.13 minimum deployment target.

We never need this for any platform that we're not building for and we also don't really need it for most commands. So we can just move the computation to SwiftTool and leave these empty for all other cases.

rdar://64596106

(cherry picked from commit 019a6fb)
@neonichu neonichu force-pushed the less-xctest-minimum-5.9 branch from 4e8cd3e to 977c1f5 Compare September 20, 2023 20:49
@neonichu
Copy link
Contributor Author

Found the issue:

diff --git a/Sources/Build/BuildPlan.swift b/Sources/Build/BuildPlan.swift
index 1799c963f..b5873c7ca 100644
--- a/Sources/Build/BuildPlan.swift
+++ b/Sources/Build/BuildPlan.swift
@@ -573,7 +573,7 @@ public class BuildPlan: SPMBuildCore.BuildPlan {
         // Supported platforms are defined at the package level.
         // This will need to become a bit complicated once we have target-level or product-level platform support.
         let productPlatform = product.platforms.getDerived(for: .macOS, usingXCTest: product.isLinkingXCTest)
-        let targetPlatform = target.platforms.getDerived(for: .macOS, usingXCTest: product.isLinkingXCTest)
+        let targetPlatform = target.platforms.getDerived(for: .macOS, usingXCTest: target.type == .test)
 
         // Check if the version requirement is satisfied.
         //

@neonichu
Copy link
Contributor Author

@swift-ci please test

@neonichu
Copy link
Contributor Author

@swift-ci please test windows

@neonichu
Copy link
Contributor Author

We'll need the fix in main as well and should revert the changes to IntegrationTests there.

neonichu added a commit that referenced this pull request Sep 20, 2023
This fixes an issue introduced in #6849 and noticed in the cherry-pick to 5.9 in #6886.
neonichu added a commit that referenced this pull request Sep 21, 2023
This fixes an issue introduced in #6849 and noticed in the cherry-pick to 5.9 in #6886.
@neonichu neonichu merged commit 5d6c0cb into release/5.9 Sep 21, 2023
@neonichu neonichu deleted the less-xctest-minimum-5.9 branch September 21, 2023 00:14
MaxDesiatov pushed a commit that referenced this pull request Sep 28, 2023
This fixes an issue introduced in #6849 and noticed in the cherry-pick to 5.9 in #6886.
MaxDesiatov pushed a commit that referenced this pull request Sep 28, 2023
This fixes an issue introduced in #6849 and noticed in the cherry-pick to 5.9 in #6886.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
swift 5.9 This PR targets the 5.9 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants