This post summarizes some of the features and enhancements that landed in SwiftPM trunk recently. It would be great if the community can try some of these features and possibly provide feedback. These features are available in the latest trunk or Swift 4.2 toolchain. If you find something unexpected, feel free to reply to this post or create a bug report in JIRA.
Improved scheme generation logic:
The scheme generation logic is improved and generates schemes as follows:
- One scheme containing all regular and test targets of the root package.
- One scheme per executable target containing the test targets whose dependencies intersect with the dependencies of the exectuable target.
This is implementation of SE-0201. You will need to update the tools version comment to 4.2 in order to use this feature.
Known bug: if you convert an existing dependency to a local dependency, you will need to run Fixed by #1616.
swift package update or blow away the
.build directory in order for the local package to take effect.
Automatic Xcode project generation:
generate-xcodeproj has a new
--watch option to watch the file system and automatically regenerate the Xcode project if needed. This uses the
watchman tool to watch the required files. In future, we can add this option to other commands like
System library targets:
This is implementation for SE-0208. You will need to the update tools version comment to 4.2 in order to use this feature.
Embedable Xcode projects:
For various complex reasons, C language targets are not mapped to "real" framework targets in the generated Xcode project. In practice, this means that the "defines module" and "enable modules" build settings are turned off in the generated framework target. This causes issues when trying to use the generated project as a subproject.
The issue is resolved for C language targets that have an umbrella header. To create an umbrella header, place a file named
<targetname>.h inside the
include/ directory of that target and include all the public headers in the umbrella header.