Skip to content

Commit

Permalink
@DependencyClient macro (#132)
Browse files Browse the repository at this point in the history
* wip

* wip

* fix

* wip

* wip

* wip

* wip

* wip

* wip

* ranges

* docs

* wip

* wip

* wip

* wip

* wip

* fix

* wip

* customizable method name

* docs for @DependencyEndpoint

* clean up code

* wip

* fix

* fixes

* validate method

* wip

* wip

* add test

* add test

* apply availability even when using @DependencyEndpoint(method:)

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* docs fix

* wip

* wip

* wip

* wip

* wip

* wip

* Handle escaped identifiers correctly.

* update diagnostic

* wip

* updated gotchas

* Disable windows and integration tests.

---------

Co-authored-by: Brandon Williams <[email protected]>
  • Loading branch information
stephencelis and mbrandonw authored Nov 15, 2023
1 parent b323c53 commit 3870cfc
Show file tree
Hide file tree
Showing 20 changed files with 2,557 additions and 134 deletions.
64 changes: 25 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,48 +15,34 @@ concurrency:

jobs:
macos:
name: macOS 13 (Xcode 14.3.1)
name: macOS
runs-on: macos-13
strategy:
matrix:
config: ['debug', 'release']
xcode: ['14.3.1', '15.0.1']
steps:
- uses: actions/checkout@v3
- name: Select Xcode 14.3.1
run: sudo xcode-select -s /Applications/Xcode_14.3.1.app
- name: Select Xcode ${{ matrix.xcode }}
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
- name: Skip macro validation
run: defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES
- name: Run tests
run: make test-swift
- name: Build platforms ${{ matrix.config }}
run: CONFIG=${{ matrix.config }} make build-all-platforms
- name: Build for library evolution
run: make build-for-library-evolution

# xcode-13:
# name: macOS 12 (Xcode 13.4.1)
# runs-on: macos-12
# strategy:
# matrix:
# config: ['debug', 'release']
# integration:
# name: Integration (UI Tests)
# runs-on: macos-13
# steps:
# - uses: actions/checkout@v3
# - name: Select Xcode 13.4.1
# run: sudo xcode-select -s /Applications/Xcode_13.4.1.app
# - name: Select Xcode 14.3.1
# run: sudo xcode-select -s /Applications/Xcode_14.3.1.app
# - name: Run tests
# run: make test-swift
# - name: Build platforms ${{ matrix.config }}
# run: CONFIG=${{ matrix.config }} make build-all-platforms
# - name: Build for library evolution
# run: make build-for-library-evolution

integration:
name: Integration (UI Tests)
runs-on: macos-13
steps:
- uses: actions/checkout@v3
- name: Select Xcode 14.3
run: sudo xcode-select -s /Applications/Xcode_14.3.app
- name: Run tests
run: make test-integration
# run: make test-integration

ubuntu:
name: Linux
Expand All @@ -80,20 +66,20 @@ jobs:
with:
shell-action: carton test --environment node

windows:
name: Windows
runs-on: windows-latest
steps:
- uses: compnerd/gha-setup-swift@main
with:
branch: swift-5.8-release
tag: 5.8-RELEASE
# windows:
# name: Windows
# runs-on: windows-latest
# steps:
# - uses: compnerd/gha-setup-swift@main
# with:
# branch: swift-5.8-release
# tag: 5.8-RELEASE

- uses: actions/checkout@v3
- name: Run tests
run: swift test
- name: Run tests (release)
run: swift test -c release
# - uses: actions/checkout@v3
# - name: Run tests
# run: swift test
# - name: Run tests (release)
# run: swift test -c release

static-stdlib:
strategy:
Expand Down
72 changes: 0 additions & 72 deletions .github/workflows/documentation.yml

This file was deleted.

10 changes: 4 additions & 6 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ concurrency:
jobs:
swift_format:
name: swift-format
runs-on: macos-12
runs-on: macos-13
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Xcode Select
run: sudo xcode-select -s /Applications/Xcode_14.0.1.app
- name: Tap
run: brew tap pointfreeco/formulae
run: sudo xcode-select -s /Applications/Xcode_15.0.1.app
- name: Install
run: brew install Formulae/swift-format@5.7
run: brew install swift-format
- name: Format
run: make format
- uses: stefanzweifel/git-auto-commit-action@v4
Expand Down
7 changes: 7 additions & 0 deletions .spi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 1
builder:
configs:
- documentation_targets:
- Dependencies
- DependenciesMacros
swift_version: 5.9
27 changes: 27 additions & 0 deletions Dependencies.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,33 @@
"version" : "1.0.0"
}
},
{
"identity" : "swift-macro-testing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-macro-testing",
"state" : {
"revision" : "35acd9468d40ae87e75991a18af6271e8124c261",
"version" : "0.2.1"
}
},
{
"identity" : "swift-snapshot-testing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-snapshot-testing",
"state" : {
"revision" : "bb0ea08db8e73324fe6c3727f755ca41a23ff2f4",
"version" : "1.14.2"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax",
"state" : {
"revision" : "ffa3cd6fc2aa62adbedd31d3efaf7c0d86a9f029",
"version" : "509.0.1"
}
},
{
"identity" : "xctest-dynamic-overlay",
"kind" : "remoteSourceControl",
Expand Down
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
CONFIG = debug
PLATFORM_IOS = iOS Simulator,id=$(call udid_for,iPhone,iOS-16)
PLATFORM_IOS = iOS Simulator,id=$(call udid_for,iOS 17,iPhone \d\+ Pro [^M])
PLATFORM_MACOS = macOS
PLATFORM_MAC_CATALYST = macOS,variant=Mac Catalyst
PLATFORM_TVOS = tvOS Simulator,id=$(call udid_for,TV,tvOS-16)
PLATFORM_WATCHOS = watchOS Simulator,id=$(call udid_for,Watch,watchOS-9)
PLATFORM_TVOS = tvOS Simulator,id=$(call udid_for,tvOS 17,TV)
PLATFORM_WATCHOS = watchOS Simulator,id=$(call udid_for,watchOS 10,Watch)

default: test

Expand Down Expand Up @@ -31,7 +31,7 @@ test-linux:
--rm \
-v "$(PWD):$(PWD)" \
-w "$(PWD)" \
swift:5.7-focal \
swift:5.9-focal \
bash -c 'apt-get update && apt-get -y install make && make test-swift'

build-for-static-stdlib:
Expand All @@ -54,23 +54,23 @@ build-for-static-stdlib-docker:
@docker run \
-v "$(PWD):$(PWD)" \
-w "$(PWD)" \
swift:5.8-focal \
swift:5.9-focal \
bash -c "swift build -c debug --static-swift-stdlib"
@docker run \
-v "$(PWD):$(PWD)" \
-w "$(PWD)" \
swift:5.8-focal \
swift:5.9-focal \
bash -c "swift build -c release --static-swift-stdlib"

format:
swift format \
--ignore-unparsable-files \
--in-place \
--recursive \
./Package.swift ./Sources ./Tests
./Package.swift ./Sources ./Tests/DependenciesTests

.PHONY: test test-swift test-linux build-for-library-evolution format

define udid_for
$(shell xcrun simctl list --json devices available $(1) | jq -r '.devices | to_entries | map(select(.value | add)) | sort_by(.key) | .[] | select(.key | contains("$(2)")) | .value | last.udid')
$(shell xcrun simctl list devices available '$(1)' | grep '$(2)' | sort -r | head -1 | awk -F '[()]' '{ print $$(NF-3) }')
endef
27 changes: 27 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,33 @@
"version" : "1.0.0"
}
},
{
"identity" : "swift-macro-testing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-macro-testing",
"state" : {
"revision" : "35acd9468d40ae87e75991a18af6271e8124c261",
"version" : "0.2.1"
}
},
{
"identity" : "swift-snapshot-testing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-snapshot-testing",
"state" : {
"revision" : "bb0ea08db8e73324fe6c3727f755ca41a23ff2f4",
"version" : "1.14.2"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax",
"state" : {
"revision" : "ffa3cd6fc2aa62adbedd31d3efaf7c0d86a9f029",
"version" : "509.0.1"
}
},
{
"identity" : "xctest-dynamic-overlay",
"kind" : "remoteSourceControl",
Expand Down
Loading

0 comments on commit 3870cfc

Please sign in to comment.