-
Notifications
You must be signed in to change notification settings - Fork 109
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 building on Windows #51
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. @compnerd, what do you think?
Package.swift
Outdated
var windowsPlatform: [Platform] = [] | ||
#if os(Windows) | ||
windowsPlatform.append(.windows) | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not that familiar with manifests. Why is conditional compilation needed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 AFAIK this is used to comfort SwiftPM 5.3 because it doesn't recognize Windows. This workaround is introduced by @compnerd for other projects and I just use it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that this would be needed given the comment below.
Package.swift
Outdated
var windowsPlatform: [Platform] = [] | ||
#if os(Windows) | ||
windowsPlatform.append(.windows) | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that this would be needed given the comment below.
Package.swift
Outdated
.target( | ||
name: "SystemPackage", | ||
dependencies: ["CSystem"], | ||
path: "Sources/System", | ||
cSettings: [ | ||
.define("_CRT_SECURE_NO_WARNINGS", .when(platforms: windowsPlatform)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do this unconditionally, it won't impact other targets. Alternatively, we could clean up the cases to use the Microsoft "extensions" (technically I believe that they are part of Annex G, so they should be portable).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds reasonable. Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@swift-ci please test |
@swift-ci please test |
Can confirm that the Windows build is broken, and that this patch fixes it. This is a blocking issue for me; is there anything you need before this can be merged @milseman? Also, once merged, it would be great if you could tag a new release so libraries which depend on There are still some deprecation warnings (included below), which should probably be addressed at some point, but at least this patch gets things building again.
|
My bad! |
@karwa I made a draft 0.0.3 release here: https://github.com/apple/swift-system/releases/tag/untagged-cb0bff1f58c393ba2621 Are you able to try it out before I publish it? The release process is still a little awkward as we're preparing for a proper 1.0 soon. |
@milseman Although this is off-topic here, could I expect using both POSIX and Windows path on either platform as for 1.0 release? This useful for cross-platform things or simply using POSIX path style on Windows (eg. in-memory file system in SwiftPM). |
Unfortunately not. While we can support that technology internally, we don't have a good way to surface that as API yet. I'm hoping that task-local values gives us a way of establishing a contextual platform path type. We can also explore a FilePathProtocol and have a family of various concrete conformers for explicitly picking one over the other, but there are many many design axis there and that would take more consideration than we can do before 1.0. I'd be interested in your thoughts on how you'd want to use such an ability though. |
@milseman Apologies for the delay. I'm not sure how to get the link you posted to work, but I switched the dependency to the The README currently suggests using That being said, probably all packages which use |
Published 0.0.3 |
Nothing but as shown in the title.
The base for swiftlang/swift-tools-support-core#219, swiftlang/swift-tools-support-core#221