-
Notifications
You must be signed in to change notification settings - Fork 82
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
Replace SwiftPM with Swift Argument Parser #245
Merged
andrewchang-bird
merged 17 commits into
master
from
dev/andrewchang-bird/swift-argument-parser
Jan 6, 2022
Merged
Replace SwiftPM with Swift Argument Parser #245
andrewchang-bird
merged 17 commits into
master
from
dev/andrewchang-bird/swift-argument-parser
Jan 6, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The CLI was previously split out from the framework package definitions to fix SwiftUI issues. This merges the packages under a conditional build flag, similar to the official SwiftPM package manifest: https://github.com/apple/swift-package-manager/blob/main/Package.swift
Hermetic / non-portable builds are the default going forward given the the launcher included in 0.17. Installable artifacts will be released with the `-installable` suffix and the less intuitive `-cisafe` will be dropped for hermetic builds.
- XcodeProj 8.0.0 -> 8.7.1 - SwiftSyntax 0.50400.0 -> 0.50500.0
Fixes the linker warning that lib_InternalSwiftSyntaxParser.dylib was built for newer macOS version (10.14.6) than being linked (10.13).
- Removed Xcode 12 workflow as SwiftSyntax 0.50500.0 is not source compatible with Xcode 13. - Migrated from `install` to `configure` command.
andrewchang-bird
changed the title
[1/n] Replace SwiftPM with Swift Argument Parser
Replace SwiftPM with Swift Argument Parser
Dec 24, 2021
This was referenced Dec 24, 2021
This was referenced Dec 24, 2021
ryanmeisters
approved these changes
Jan 5, 2022
andrewchang-bird
deleted the
dev/andrewchang-bird/swift-argument-parser
branch
January 6, 2022 03:08
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
The CLI currently uses the old SwiftPM utils to parse command line arguments, which is no longer source-compatible with the Xcode 13 toolchain / Swift 5.5. Migrating to Swift Argument Parser has been on our backlog for a while and it makes sense to switch now. In addition to offering a more future-proof solution, Swift Argument Parser has a robust feature set that enables us to implement more expressive CLI options.
Considerations
Backwards Compatibility
Backwards compatibility is always important to minimize developer thrash when upgrading. The
generate
andversion
commands are used in the critical path for mock generation and can’t be modified much, while theinstall
,download
, andtestbed
commands are only used infrequently such as when setting up new projects.Duplicate Options
Currently the
install
command is a rough superset of thegenerate
command as it needs to use those options and flags when configuring the build phase. Although it’s possible to share the parsing and validation logic between the two commands, some of the options are contextual and don’t mix well. For example, it’s reasonable to assume that passing--verbose
when configuring a test target will print debug info during the process, but unclear whether it should also carry over to the installed build phase and cause the generator to log verbosely. De-duping options works, but bloats the CLI and makes the options used to configure the generator less predictable.Setup Process
To simplify setup, adding supporting source files were made an optional step in the guide and default thunk pruning set to
omit
. Not providing supporting source files for common system frameworks can introduce subtle bugs in generated mocks which are difficult for developers to debug. Ideally, integrating supporting source files into the project should be part of the configuration process.Implementation
The CLI is almost fully backwards compatible for the
generate
command but completely replacesinstall
anddownload
with a shiny newconfigure
command. Theconfigure
command uses the standard bash double dash (--
) to handle parsing and validation of generator options separately. Configuring a test target to generate mocks for a source module in another project is now supported in addition to providing helpful output to streamline the first-time developer experience.Major Changes
install
withconfigure
uninstall
download
configure
testbed
Minor Changes
--version
as a global flag--srcproject
toconfigure
--disable-module-import
fromgenerate
--asynchronous
frominstall
Incidental Changes
Fixes #242
Closes https://github.com/birdrides/mockingbird/projects/2#card-66279076