Skip to content

Commit

Permalink
Replace SwiftPM with Swift Argument Parser (#245)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
andrewchang-bird authored Jan 6, 2022
1 parent 6a682af commit c1f61ce
Show file tree
Hide file tree
Showing 87 changed files with 2,822 additions and 2,079 deletions.
75 changes: 21 additions & 54 deletions .github/workflows/build-framework-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,20 @@ jobs:
run: make build-framework
- name: Build and Install CLI
run: |
make print-debug-info | grep "Mockingbird rpath: /var/tmp/mockingbird/$(make get-version)/libs"
PREFIX=$(pwd) HERMETIC=1 make print-debug-info
PREFIX=$(pwd) HERMETIC=1 make install
- name: Set Up Caching Target
run: |
./bin/mockingbird install \
--target MockingbirdTests \
--source MockingbirdTestsHost \
./bin/mockingbird configure MockingbirdTests --verbose -- \
--targets \
MockingbirdTestsHost \
MockingbirdShadowedTestsHost \
--support Sources/MockingbirdSupport \
--output Tests/MockingbirdTests/Mocks/MockingbirdTestsHostMocks.generated.swift \
--outputs \
Tests/MockingbirdTests/Mocks/MockingbirdTestsHostMocks.generated.swift \
Tests/MockingbirdTests/Mocks/MockingbirdShadowedTestsHostMocks.generated.swift \
--header '// Header line 1' '// Header line 2' \
--diagnostics all \
--loglevel verbose \
--prune stub \
--verbose
- name: Test
Expand All @@ -40,70 +41,36 @@ jobs:
run: make test
- name: Set Up Non-Caching Target
run: |
./bin/mockingbird install \
--target MockingbirdTests \
--source MockingbirdTestsHost \
./bin/mockingbird configure MockingbirdTests --verbose -- \
--targets \
MockingbirdTestsHost \
MockingbirdShadowedTestsHost \
--support Sources/MockingbirdSupport \
--output Tests/MockingbirdTests/Mocks/MockingbirdTestsHostMocks.generated.swift \
--outputs \
Tests/MockingbirdTests/Mocks/MockingbirdTestsHostMocks.generated.swift \
Tests/MockingbirdTests/Mocks/MockingbirdShadowedTestsHostMocks.generated.swift \
--header '// Header line 1' '// Header line 2' \
--disable-cache \
--diagnostics all \
--loglevel verbose \
--prune stub \
--verbose
- name: Test Flakiness
run: make test-flaky
- name: Set Up Non-Pruning Target
run: |
./bin/mockingbird install \
--target MockingbirdTests \
--source MockingbirdTestsHost \
./bin/mockingbird configure MockingbirdTests --verbose -- \
--targets \
MockingbirdTestsHost \
MockingbirdShadowedTestsHost \
--support Sources/MockingbirdSupport \
--output Tests/MockingbirdTests/Mocks/MockingbirdTestsHostMocks.generated.swift \
--outputs \
Tests/MockingbirdTests/Mocks/MockingbirdTestsHostMocks.generated.swift \
Tests/MockingbirdTests/Mocks/MockingbirdShadowedTestsHostMocks.generated.swift \
--header '// Header line 1' '// Header line 2' \
--prune disable \
--disable-cache \
--diagnostics all \
--loglevel verbose \
--prune disable \
--verbose
- name: Test All Thunks
run: make clean-test

build-xcode-12:
name: Xcode 12 toolchain
runs-on: macOS-latest

steps:
- uses: actions/checkout@v2
- name: Set Up Environment
run: sudo xcode-select -s /Applications/Xcode_12.app/Contents/Developer
- name: Print Debug Info
run: make print-debug-info
- name: Set Up Project
run: make setup-project
- name: Clean
run: make clean
- name: Build Framework
run: make build-framework
- name: Build and Install CLI
run: |
make print-debug-info | grep "Mockingbird rpath: /var/tmp/mockingbird/$(make get-version)/libs"
PREFIX=$(pwd) HERMETIC=1 make print-debug-info
PREFIX=$(pwd) HERMETIC=1 make install
- name: Set Up Target
run: |
./bin/mockingbird install \
--target MockingbirdTests \
--source MockingbirdTestsHost \
--support Sources/MockingbirdSupport \
--output Tests/MockingbirdTests/Mocks/MockingbirdTestsHostMocks.generated.swift \
--header '// Header line 1' '// Header line 2' \
--diagnostics all \
--loglevel verbose \
--prune stub \
--verbose
- name: Test
run: make clean-test
- name: Cached Test
run: make test
15 changes: 5 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ jobs:
with:
name: Mockingbird.zip
path: Mockingbird.zip
- name: Upload Pkg
uses: actions/upload-artifact@v2
with:
name: Mockingbird.pkg
path: Mockingbird.pkg
- name: Upload Starter Pack
uses: actions/upload-artifact@v2
with:
Expand All @@ -57,8 +52,8 @@ jobs:
name: MockingbirdCli.dr
path: Codesigning/MockingbirdCli.dr

build-cisafe:
name: Build CI-Safe Signed Artifacts
build-installable:
name: Build Installable Signed Artifacts
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -77,7 +72,7 @@ jobs:
env:
AC_USERNAME: ${{ secrets.AC_USERNAME }}
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
HERMETIC: 1
MKB_INSTALLABLE: 1
run: make signed-release
- name: Document SHAs
run: |
Expand All @@ -88,10 +83,10 @@ jobs:
- name: Upload Zip
uses: actions/upload-artifact@v2
with:
name: Mockingbird-cisafe.zip
name: Mockingbird-installable.zip
path: Mockingbird.zip
- name: Upload Pkg
uses: actions/upload-artifact@v2
with:
name: Mockingbird-cisafe.pkg
name: Mockingbird.pkg
path: Mockingbird.pkg
2 changes: 1 addition & 1 deletion .xcode/xcconfigs/MockingbirdCli.xcconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
INFOPLIST_FILE = $(SRCROOT)/Sources/MockingbirdCli/Info.plist
FRAMEWORK_SEARCH_PATHS = $(PLATFORM_DIR)/Developer/Library/Frameworks
MACOSX_DEPLOYMENT_TARGET = 10.14
MACOSX_DEPLOYMENT_TARGET = 10.15
SUPPORTED_PLATFORMS = macosx
Loading

0 comments on commit c1f61ce

Please sign in to comment.