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

Update Package.swift for Swift 4.2 #136

Merged
merged 4 commits into from Sep 12, 2018
Merged

Update Package.swift for Swift 4.2 #136

merged 4 commits into from Sep 12, 2018

Conversation

keith
Copy link
Contributor

@keith keith commented Sep 10, 2018

Without this packages that depend on Yams build it in 4.0 mode, not 4.2
mode.

Without this packages that depend on Yams build it in 4.0 mode, not 4.2
mode.
@norio-nomura
Copy link
Collaborator

It is better to add Package@swift-4.2.swift instead of editing Package.swift.

@keith
Copy link
Contributor Author

keith commented Sep 10, 2018

Updated!

let package = Package(
name: "Yams",
products: [
.library(name: "Yams", targets: ["Yams"])
Copy link
Owner

Choose a reason for hiding this comment

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

Indentation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@keith
Copy link
Contributor Author

keith commented Sep 11, 2018

I realized we can possibly use a #if with a compiler version check to not have to duplicate this file. Happy to try that if you all would like

@norio-nomura
Copy link
Collaborator

we can possibly use a #if with a compiler version check to not have to duplicate this file.

I think it is impossible to integrate Package@swift-4.2.swift and Package.swift by using #if.

SwiftPM checks // swift-tools-version: … before invoking swiftc, because it needs controling -swift-version, -L and -I options for swiftc to switching libPackageDescription by path.

With // swift-tools-version:4.0, swift build -v's output contains following:

' /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc --driver-mode=swift -L /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm/4 -lPackageDescription -suppress-warnings -swift-version 4 -I /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm/4 -target x86_64-apple-macosx10.10 -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk /Users/norio/github/swift-dev/SourceKitten/Carthage/Checkouts/Yams/Package.swift -fileno 5

With // swift-tools-version:4.2, swift build -v's output contains following:

' /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc --driver-mode=swift -L /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm/4_2 -lPackageDescription -suppress-warnings -swift-version 4.2 -I /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm/4_2 -target x86_64-apple-macosx10.10 -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk /Users/norio/github/swift-dev/SourceKitten/Carthage/Checkouts/Yams/Package@swift-4.2.swift -fileno 5

Those process happens before swiftc parsing #if in Package.swift.

Copy link
Owner

@jpsim jpsim left a comment

Choose a reason for hiding this comment

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

Let's get this in. Even if it'd be possible to have a single package manifest, a little bit of duplication isn't bad and this for sure works.

@jpsim jpsim merged commit 8177c3b into jpsim:master Sep 12, 2018
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.

None yet

3 participants