Skip to content

Improve handling of minimum deployment target #2710

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 5 commits into from
Apr 29, 2020

Conversation

neonichu
Copy link
Contributor

We have a bit of a muddled deployment target situation in 5.2:

  • anything declared by SwiftPM's own manifest defaulted to macOS 10.10,
    but the toolchain doesn't actually work on macOS < 10.15 anymore
  • libPackageDescription was built with minimum deployment target of
    10.15, but we were explicitly compiling the manifest for 10.10 minimum
  • support for running tests on macOS is aligned with Xcode (so 10.15
    minimum), but we were not enforcing that

This change makes it more consistent for 5.3:

  • declare a 10.15 minimum in the manifest
  • build manifests without deployment target, defaulting to the host
  • always build tests for macOS with a minimum deployment target of 10.15

rdar://problem/62121806

We have a bit of a muddled deployment target situation in 5.2:
- anything declared by SwiftPM's own manifest defaulted to macOS 10.10,
but the toolchain doesn't actually work on macOS < 10.15 anymore
- libPackageDescription was built with minimum deployment target of
10.15, but we were explicitly compiling the manifest for 10.10 minimum
- support for running tests on macOS is aligned with Xcode (so 10.15
minimum), but we were not enforcing that

This change makes it more consistent for 5.3:
- declare a 10.15 minimum in the manifest
- build manifests without deployment target, defaulting to the host
- always build tests for macOS with a minimum deployment target of 10.15

rdar://problem/62121806
@neonichu
Copy link
Contributor Author

@swift-ci please smoke test

@SDGGiesbrecht
Copy link
Contributor

Is there some way to do this without restricting client packages who want to continue using it conditionally with #available?

@neonichu
Copy link
Contributor Author

@SDGGiesbrecht you're specifically talking about the change to SwiftPM's package manifest and clients of libSwiftPM, right?

@SDGGiesbrecht
Copy link
Contributor

Yes. It’s just the platforms: [.macOS("10.15")] entry in the manifest that causes issues.

@SDGGiesbrecht
Copy link
Contributor

...and only when pulled in as a package dependency. Basing it on an environment variable like SWIFTPM_LLBUILD_FWK would be fine if it needs to be there for the toolchain build.

@neonichu
Copy link
Contributor Author

I think that sounds reasonable to me.

Copy link
Contributor

@jakepetroules jakepetroules left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build manifests without deployment target, defaulting to the host

Also slightly uncomfortable with this, since it could result in subtle behavioral differences between someone running Xcode on the latest macOS versus last year's OS (since they'd be compiling the manifest with different deployment targets).

How about we leave it at a fixed 10.15 for now?

@neonichu
Copy link
Contributor Author

How about we leave it at a fixed 10.15 for now?

I think we can actually do the same thing you suggested for XCTest and use the deployment target of libPackageDescription.

@neonichu
Copy link
Contributor Author

error: the library 'SKSwiftPMWorkspace' requires macos 10.10, but depends on the product 'SwiftPM-auto' which requires macos 10.15; consider changing the library 'SKSwiftPMWorkspace' to require macos 10.15 or later, or the product 'SwiftPM-auto' to require macos 10.10 or earlier.

Another reason to only specify the deployment target when we're building SwiftPM for deployment in a toolchain.

@jakepetroules
Copy link
Contributor

How about we leave it at a fixed 10.15 for now?

I think we can actually do the same thing you suggested for XCTest and use the deployment target of libPackageDescription.

Hmm, yeah, that seems like a good idea!

- Default to 10.10 in the manifest, but override it with 10.15 in the
bootstrap script
- Use XCTest and PackageDescription binaries as source for deployment
target for tests and manifest building respectively
@neonichu
Copy link
Contributor Author

@swift-ci please smoke test

@neonichu
Copy link
Contributor Author

/Users/buildnode/jenkins/workspace/swift-package-manager-PR-osx-smoke-test/branch-master/swiftpm/Tests/PackageLoadingTests/PackageBuilderTests.swift:1578: error: -[PackageLoadingTests.PackageBuilderTests testPlatforms] : XCTAssertEqual failed: ("["watchos": "2.0", "ios": "8.0", "macos": "10.15", "android": "0.0", "wasi": "0.0", "tvos": "9.0", "linux": "0.0"]") is not equal to ("["watchos": "2.0", "tvos": "9.0", "ios": "8.0", "linux": "0.0", "android": "0.0", "wasi": "0.0", "macos": "10.14"]")

makes sense, XCTest on CI still has a 10.14 minimum deployment target, the test should be using a dynamic value as well.

- Improved caching
- Check XCTest minimum deployment target for all platforms
@neonichu
Copy link
Contributor Author

@swift-ci please smoke test

@neonichu
Copy link
Contributor Author

neonichu commented Apr 28, 2020

Failure is:

/home/buildnode/jenkins/workspace/swift-package-manager-self-hosted-Linux-smoke-test/branch-master/swiftpm/Tests/PackageLoadingTests/PackageBuilderTests.swift:1580: error: PackageBuilderTests.testPlatforms : XCTAssertEqual failed: ("["linux": "0.0", "watchos": "2.0", "ios": "8.0", "macos": "10.10", "wasi": "0.0", "tvos": "9.0", "android": "0.0"]") is not equal to ("["android": "0.0", "macos": "10.12", "watchos": "2.0", "linux": "0.0", "wasi": "0.0", "ios": "8.0", "tvos": "9.0"]") -

That makes sense. On Linux, we won't get a value from XCTest, so it'll default to 10.10, but there's a higher declared deployment target of 10.12 for the package. The test is incorrectly expecting 10.10 in this scenario.

@neonichu
Copy link
Contributor Author

@swift-ci please smoke test

@neonichu
Copy link
Contributor Author

@swift-ci please smoke test

@neonichu neonichu merged commit cf6f83c into swiftlang:master Apr 29, 2020
@neonichu neonichu deleted the deployment-target branch April 29, 2020 20:34
neonichu added a commit to neonichu/swift-package-manager that referenced this pull request Apr 29, 2020
We have a bit of a muddled deployment target situation in 5.2:
- anything declared by SwiftPM's own manifest defaulted to macOS 10.10,
but the toolchain doesn't actually work on macOS < 10.15 anymore
- libPackageDescription was built with minimum deployment target of
10.15, but we were explicitly compiling the manifest for 10.10 minimum
- support for running tests on macOS is aligned with Xcode (so 10.15
minimum), but we were not enforcing that

This change makes it more consistent for 5.3:
- make the deployment target configurable in the manifest, we'll still default to 10.10 but set it to 10.15 in the bootstrap script, so toolchains will end up with a 10.15 minimum deployment target
- build manifests with the same deployment target as `libPackageDescription`, defaulting to 10.15
- always build tests with the minimum deployment target of the corresponding XCTest framework

rdar://problem/62121806

(cherry picked from commit cf6f83c)
neonichu added a commit that referenced this pull request Apr 29, 2020
We have a bit of a muddled deployment target situation in 5.2:
- anything declared by SwiftPM's own manifest defaulted to macOS 10.10,
but the toolchain doesn't actually work on macOS < 10.15 anymore
- libPackageDescription was built with minimum deployment target of
10.15, but we were explicitly compiling the manifest for 10.10 minimum
- support for running tests on macOS is aligned with Xcode (so 10.15
minimum), but we were not enforcing that

This change makes it more consistent for 5.3:
- make the deployment target configurable in the manifest, we'll still default to 10.10 but set it to 10.15 in the bootstrap script, so toolchains will end up with a 10.15 minimum deployment target
- build manifests with the same deployment target as `libPackageDescription`, defaulting to 10.15
- always build tests with the minimum deployment target of the corresponding XCTest framework

rdar://problem/62121806

(cherry picked from commit cf6f83c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants