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

Use target dependency condition instead of build machine info #842

Merged
merged 3 commits into from
Apr 24, 2021

Conversation

kateinoigakukun
Copy link
Contributor

Since swift-tools-version 5.3, SwiftPM allows us to declare conditional target dependencies in Package.swift. This is an important part when cross-building a package.

For example, when building a binary for Linux on macOS (currently it's impossible), Package.swift is evaluated as os(macOS) == true, but produced binary will run on Linux.

So, the platform we build on does not always match the platform a produced binary will run on.

The condition: .when(...) will be resolved based on the target platform a produced binary will run on.

Checklist - While not every PR needs it, new features should consider this list:

  • Does this have tests?
  • Does this have documentation?
  • Does this break the public API (Requires major version bump)?
  • Is this a new feature (Requires minor version bump)?

@kateinoigakukun kateinoigakukun changed the title Use target dependency condition instead of building environment info Use target dependency condition instead of build machine info Nov 7, 2020
Copy link
Member

@ikesyo ikesyo left a comment

Choose a reason for hiding this comment

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

I'm sorry for the late response, thanks for the pull request!

Package.swift Outdated Show resolved Hide resolved
- CwlPreconditionTesting is used on macOS and iOS
- CwlPosixPreconditionTesting is used on tvOS

Co-authored-by: IKEDA Sho <suicaicoca@gmail.com>
Copy link
Member

@ikesyo ikesyo left a comment

Choose a reason for hiding this comment

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

LGTM 👏

@ikesyo ikesyo merged commit 5534f78 into Quick:master Apr 24, 2021
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.

2 participants