Skip to content

Commit b88d620

Browse files
authored
Merge pull request #766 from mac-cain13/refactor
R.swift 7 – Major version, Xcode plugin, internal refactor
2 parents 2c16de6 + 6a6b0a7 commit b88d620

File tree

260 files changed

+10401
-7386
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

260 files changed

+10401
-7386
lines changed

.github/workflows/checks.yml

Lines changed: 59 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ on:
77
branches: '*'
88

99
env:
10-
DEVELOPER_DIR: /Applications/Xcode_13.0.app/Contents/Developer
10+
DEVELOPER_DIR: /Applications/Xcode_14.0.app/Contents/Developer
1111

1212
jobs:
1313
unit-tests:
14-
runs-on: macos-11
14+
runs-on: macos-12
1515
steps:
1616
- name: Checkout
1717
uses: actions/checkout@v2
@@ -25,9 +25,9 @@ jobs:
2525
- name: Test
2626
run: swift test -v
2727

28-
test-iOS:
29-
runs-on: macos-11
30-
needs: build
28+
test-iOS-ResourceApp:
29+
runs-on: macos-12
30+
needs: build-rswift
3131
steps:
3232
- name: Checkout
3333
uses: actions/checkout@v2
@@ -37,26 +37,27 @@ jobs:
3737
name: rswift-dev
3838
- name: Put build into place
3939
run: |
40-
mkdir -p build/Debug
41-
mv rswift-dev/rswift build/Debug/rswift
42-
chmod +x build/Debug/rswift
40+
mkdir -p .build/release
41+
mv rswift-dev/rswift .build/release/rswift
42+
chmod +x .build/release/rswift
4343
- name: Pull cache
4444
uses: actions/cache@v2
4545
id: podcache-ios
4646
with:
47-
path: Examples/Pods
47+
path: Examples/ResourceApp/Pods
4848
key: ${{ runner.os }}pods${{ hashFiles('**/Podfile.lock') }}
4949
restore-keys: |
5050
${{ runner.os }}pods
5151
- name: Install pods
5252
if: steps.podcache-ios.outputs.cache-hit != 'true'
53-
run: pod install --project-directory=Examples
53+
run: pod install --project-directory=Examples/ResourceApp
5454
- name: Test
55-
run: fastlane scan --workspace "Examples/RswiftExamples.xcworkspace" --scheme "ResourceApp"
55+
#run: fastlane scan --workspace "Examples/ResourceApp/ResourceApp.xcworkspace" --scheme "ResourceApp"
56+
run: xcodebuild -workspace Examples/ResourceApp/ResourceApp.xcworkspace -scheme ResourceApp -destination 'platform=iOS Simulator,name=iPhone 14,OS=16.0' test
5657

57-
test-tvOS:
58-
runs-on: macos-11
59-
needs: build
58+
test-iOS-StaticFrameworks:
59+
runs-on: macos-12
60+
needs: build-rswift
6061
steps:
6162
- name: Checkout
6263
uses: actions/checkout@v2
@@ -66,25 +67,52 @@ jobs:
6667
name: rswift-dev
6768
- name: Put build into place
6869
run: |
69-
mkdir -p build/Debug
70-
mv rswift-dev/rswift build/Debug/rswift
71-
chmod +x build/Debug/rswift
72-
- name: Pull cache
73-
uses: actions/cache@v2
74-
id: podcache-tvos
70+
mkdir -p .build/release
71+
mv rswift-dev/rswift .build/release/rswift
72+
chmod +x .build/release/rswift
73+
- name: Test
74+
#run: fastlane scan --project "Examples/RswiftAppWithStaticFrameworks/RswiftAppWithStaticFrameworks.xcodeproj" --scheme "App"
75+
run: xcodebuild -project Examples/RswiftAppWithStaticFrameworks/RswiftAppWithStaticFrameworks.xcodeproj -scheme App -destination 'platform=iOS Simulator,name=iPhone 14,OS=16.0' test
76+
77+
test-iOS-LocalizedStringApp:
78+
runs-on: macos-12
79+
needs: build-rswift
80+
steps:
81+
- name: Checkout
82+
uses: actions/checkout@v2
83+
- name: Download build
84+
uses: actions/download-artifact@v1
7585
with:
76-
path: Examples/Pods
77-
key: ${{ runner.os }}pods${{ hashFiles('**/Podfile.lock') }}
78-
restore-keys: |
79-
${{ runner.os }}pods
80-
- name: Install pods
81-
if: steps.podcache-tvos.outputs.cache-hit != 'true'
82-
run: pod install --project-directory=Examples
86+
name: rswift-dev
87+
- name: Put build into place
88+
run: |
89+
mkdir -p .build/release
90+
mv rswift-dev/rswift .build/release/rswift
91+
chmod +x .build/release/rswift
92+
- name: Test
93+
run: xcodebuild -project Examples/LocalizedStringApp/LocalizedStringApp.xcodeproj -scheme LocalizedStringApp -destination 'platform=iOS Simulator,name=iPhone 14,OS=16.0' test
94+
95+
test-tvOS:
96+
runs-on: macos-12
97+
needs: build-rswift
98+
steps:
99+
- name: Checkout
100+
uses: actions/checkout@v2
101+
- name: Download build
102+
uses: actions/download-artifact@v1
103+
with:
104+
name: rswift-dev
105+
- name: Put build into place
106+
run: |
107+
mkdir -p .build/release
108+
mv rswift-dev/rswift .build/release/rswift
109+
chmod +x .build/release/rswift
83110
- name: Test
84-
run: fastlane scan --workspace "Examples/RswiftExamples.xcworkspace" --scheme "ResourceApp-tvOS"
111+
#run: fastlane scan --project "Examples/RtvApp/RtvApp.xcodeproj" --scheme "ResourceApp-tvOS"
112+
run: xcodebuild -project Examples/RtvApp/RtvApp.xcodeproj -scheme ResourceApp-tvOS -destination 'platform=tvOS Simulator,name=Apple TV,OS=16.0' test
85113

86-
build:
87-
runs-on: macos-11
114+
build-rswift:
115+
runs-on: macos-12
88116
steps:
89117
- name: Checkout
90118
uses: actions/checkout@v2
@@ -97,7 +125,7 @@ jobs:
97125
${{ runner.os }}spm
98126
- name: Set version
99127
run: |
100-
sed -i "" "s/\(static let version = \"\)Unknown\(\"\)/\1Development build: ${GITHUB_SHA}\2/" Sources/rswift/Rswift.swift
128+
sed -i "" "s/\(static let version = \"\)Unknown\(\"\)/\1Development build: ${GITHUB_SHA}\2/" Sources/rswift/Config.swift
101129
- name: Build
102130
run: swift build -v -c release
103131
- name: Store artifact

.github/workflows/release.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ on:
55
types: created
66

77
env:
8-
DEVELOPER_DIR: /Applications/Xcode_12.5.app/Contents/Developer
8+
DEVELOPER_DIR: /Applications/Xcode_14.0.app/Contents/Developer
99

1010
jobs:
1111
release-build:
12-
runs-on: macos-11
12+
runs-on: macos-12
1313
steps:
1414
- name: Checkout
1515
uses: actions/checkout@v2
1616
- name: Set version
1717
run: |
18-
sed -i "" "s/\(static let version = \"\).*\(\"\)/\1${TAG}\2/" Sources/rswift/Rswift.swift
18+
sed -i "" "s/\(static let version = \"\).*\(\"\)/\1${TAG}\2/" Sources/rswift/Config.swift
1919
env:
2020
TAG: ${{ github.event.release.tag_name }}
2121
- name: Tarball source
@@ -52,7 +52,9 @@ jobs:
5252
path: .build/apple/Products/Release/rswift
5353

5454
- name: Archive ZIP
55-
run: zip --junk-paths ${{ runner.temp }}/rswift-${{ github.event.release.tag_name }}.zip .build/apple/Products/Release/rswift License
55+
run: zip --junk-paths $FILENAME .build/apple/Products/Release/rswift License && zip --recurse-paths $FILENAME Sources/RswiftResources
56+
env:
57+
FILENAME: ${{ runner.temp }}/rswift-${{ github.event.release.tag_name }}.zip
5658
- name: Notarize ZIP
5759
run: |
5860
sh notarize.sh
@@ -74,7 +76,7 @@ jobs:
7476

7577
- name: Publish to Cocoapods
7678
run: |
77-
export POD_VERSION=$(echo $TAG_NAME | cut -c2-)
79+
export POD_VERSION=$TAG_NAME
7880
pod trunk push
7981
env:
8082
TAG_NAME: ${{ github.event.release.tag_name }}
81 KB
Loading
84.6 KB
Loading
281 KB
Loading

Documentation/Migration.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,46 @@
22

33
Pointers for migration between major versions.
44

5+
## Upgrading to 7.0
6+
7+
[Demo video: Updating from R.swift 6 to Rswift 7](https://www.youtube.com/watch?v=icihJ_hin3I)
8+
9+
#### Running the executable
10+
11+
If you're using Swift Package Manager:
12+
- Separate R.swift.Library is no longer needed, remove dependency on that package
13+
- Add SPM dependency on `github.com/mac-cain13/R.swift.git` package
14+
- Add `RswiftLibrary` to your targets
15+
- Remove custom Run Script Build Phase that invokes `rswift` binary
16+
- Under "Run Build Tool Plug-ins" Build Phase, add `RswiftGenerateInternalResources` or `RswiftGeneratePublicResources` ([Screenshot](Images/RunBuildToolPluginsRswift.png))
17+
- Right-click on your project, and run `RswiftXcodeModifyPackages` to modify your Xcode project so that the build tool plug-in will actually run during builds (this seems to fix a bug in Xcode?) ([Screenshot](Images/RunXcodeModifyPackages.png))
18+
19+
If you're using Mint or manual call `rswift` executable:
20+
- Separate R.swift.Library is no longer needed, remove dependency on that package
21+
- Add SPM dependency on `github.com/mac-cain13/R.swift.git` package
22+
- Add `RswiftLibrary` to your targets
23+
24+
Changes to the commandline tool `rswift` (not relevant when using SPM):
25+
- Argument `accessLevel` renamed to `access-level`
26+
- Argument `generateUITestFile` removed, if you need a separate file with just ids, call rswift a second time with `--generators id`
27+
- Argument `hostingBundle` removed, bundle can be specified in code: `_R(bundle: someBundle)`
28+
- Arguments removed: `bundleIdentifier`, `productModuleName`, `infoPlistFile`, `codeSignEntitlements`, `builtProductsDir`, `developerDir`, `platformDir`, `sdkRoot`, `sourceRoot`. Use environment variables instead.
29+
30+
#### Library changes
31+
32+
Internal changes in the Rswift support library:
33+
- Renamed internal module, update `import Rswift` to `import RswiftResources`
34+
- Removed protocols: `ColorResourceType`, `FileResourceType`, `FontResourceType`, `IdentifierType`, `ImageResourceType`, `StoryboardViewControllerResourceType`, `StringResourceType`, `Validatable`
35+
- Added `StringResource1` up to `StringResource9`, for strings with parameters
36+
- Renamed types:
37+
* `ReuseIdentifierType` to `ReuseIdentifierContainer`
38+
* `NibResourceType` to `NibReferenceContainer`
39+
* `StoryboardResourceType` to `StoryboardReference`
40+
* `StoryboardResourceWithInitialControllerType` to `InitialControllerContainer`
41+
* `TypedStoryboardSegueInfo` to `TypedSegue`
42+
* `StoryboardSegueIdentifier` to `SegueIdentifier`
43+
44+
545
## Upgrading to 6.0
646

747
- In the Build Phase, some changes are needed, [see an example screenshot](Images/BuildPhaseExample.png):

0 commit comments

Comments
 (0)