Skip to content

Commit 13b1ba7

Browse files
feat: Support new arch (#185)
* Update example app * Add codegen specs * iOS impl * Android impl * Fix CI * Update example README --------- Co-authored-by: Marc Rousavy <[email protected]>
1 parent ff6f307 commit 13b1ba7

File tree

101 files changed

+11582
-8406
lines changed

Some content is hidden

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

101 files changed

+11582
-8406
lines changed

.clang-format

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
AccessModifierOffset: -1
3+
AlignAfterOpenBracket: AlwaysBreak
4+
AlignConsecutiveAssignments: false
5+
AlignConsecutiveDeclarations: false
6+
AlignEscapedNewlinesLeft: true
7+
AlignOperands: false
8+
AlignTrailingComments: false
9+
AllowAllParametersOfDeclarationOnNextLine: false
10+
AllowShortBlocksOnASingleLine: false
11+
AllowShortCaseLabelsOnASingleLine: false
12+
AllowShortFunctionsOnASingleLine: Empty
13+
AllowShortIfStatementsOnASingleLine: false
14+
AllowShortLoopsOnASingleLine: false
15+
AlwaysBreakAfterReturnType: None
16+
AlwaysBreakBeforeMultilineStrings: true
17+
AlwaysBreakTemplateDeclarations: true
18+
BinPackArguments: false
19+
BinPackParameters: false
20+
BraceWrapping:
21+
AfterClass: false
22+
AfterControlStatement: false
23+
AfterEnum: false
24+
AfterFunction: false
25+
AfterNamespace: false
26+
AfterObjCDeclaration: false
27+
AfterStruct: false
28+
AfterUnion: false
29+
BeforeCatch: false
30+
BeforeElse: false
31+
IndentBraces: false
32+
BreakBeforeBinaryOperators: None
33+
BreakBeforeBraces: Attach
34+
BreakBeforeTernaryOperators: true
35+
BreakConstructorInitializersBeforeComma: false
36+
BreakAfterJavaFieldAnnotations: false
37+
BreakStringLiterals: false
38+
ColumnLimit: 80
39+
CommentPragmas: '^ IWYU pragma:'
40+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
41+
ConstructorInitializerIndentWidth: 4
42+
ContinuationIndentWidth: 4
43+
Cpp11BracedListStyle: true
44+
DerivePointerAlignment: false
45+
DisableFormat: false
46+
ForEachMacros: [ FOR_EACH_RANGE, FOR_EACH, ]
47+
IncludeCategories:
48+
- Regex: '^<.*\.h(pp)?>'
49+
Priority: 1
50+
- Regex: '^<.*'
51+
Priority: 2
52+
- Regex: '.*'
53+
Priority: 3
54+
IndentCaseLabels: true
55+
IndentWidth: 2
56+
IndentWrappedFunctionNames: false
57+
KeepEmptyLinesAtTheStartOfBlocks: false
58+
MacroBlockBegin: ''
59+
MacroBlockEnd: ''
60+
MaxEmptyLinesToKeep: 1
61+
NamespaceIndentation: None
62+
ObjCBlockIndentWidth: 2
63+
ObjCSpaceAfterProperty: true
64+
ObjCSpaceBeforeProtocolList: true
65+
PenaltyBreakBeforeFirstCallParameter: 1
66+
PenaltyBreakComment: 300
67+
PenaltyBreakFirstLessLess: 120
68+
PenaltyBreakString: 1000
69+
PenaltyExcessCharacter: 1000000
70+
PenaltyReturnTypeOnItsOwnLine: 200
71+
PointerAlignment: Left
72+
ReflowComments: true
73+
SortIncludes: true
74+
SpaceAfterCStyleCast: false
75+
SpaceBeforeAssignmentOperators: true
76+
SpaceBeforeParens: ControlStatements
77+
SpaceInEmptyParentheses: false
78+
SpacesBeforeTrailingComments: 1
79+
SpacesInAngles: false
80+
SpacesInContainerLiterals: true
81+
SpacesInCStyleCastParentheses: false
82+
SpacesInParentheses: false
83+
SpacesInSquareBrackets: false
84+
Standard: Cpp11
85+
TabWidth: 8
86+
UseTab: Never
87+
---
88+
Language: ObjC
89+
ColumnLimit: 120
90+
BreakBeforeBraces: WebKit
91+
PointerAlignment: Right
92+
...

.github/workflows/build-android.yml

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,56 @@ jobs:
2222
build_example:
2323
name: Build Android Example App
2424
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v3
27+
- name: Install node
28+
uses: actions/setup-node@v3
29+
with:
30+
node-version: 18
31+
- name: Setup JDK 17
32+
uses: actions/setup-java@v2
33+
with:
34+
java-version: 17
35+
distribution: 'temurin'
36+
37+
- name: Get yarn cache directory path
38+
id: yarn-cache-dir-path
39+
run: echo "::set-output name=dir::$(yarn cache dir)"
40+
- name: Restore node_modules from cache
41+
uses: actions/cache@v2
42+
id: yarn-cache
43+
with:
44+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
45+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
46+
restore-keys: |
47+
${{ runner.os }}-yarn-
48+
- name: Install node_modules
49+
run: yarn install --frozen-lockfile
50+
- name: Install node_modules for example/
51+
run: yarn install --frozen-lockfile --cwd example
52+
53+
- name: Restore Gradle cache
54+
uses: actions/cache@v2
55+
with:
56+
path: |
57+
~/.gradle/caches
58+
~/.gradle/wrapper
59+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
60+
restore-keys: |
61+
${{ runner.os }}-gradle-
62+
- name: Run Gradle Build for example/android/
63+
run: cd example/android && ./gradlew assembleDebug --build-cache && cd ../..
64+
build_example_new_arch:
65+
name: Build Android Example App with new arch enabled
66+
runs-on: ubuntu-latest
2567
steps:
2668
- uses: actions/checkout@v2
2769

28-
- name: Setup JDK 1.8
29-
uses: actions/setup-java@v1
70+
- name: Setup JDK 17
71+
uses: actions/setup-java@v2
3072
with:
31-
java-version: 1.8
73+
java-version: 17
74+
distribution: 'temurin'
3275

3376
- name: Get yarn cache directory path
3477
id: yarn-cache-dir-path
@@ -55,7 +98,5 @@ jobs:
5598
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
5699
restore-keys: |
57100
${{ runner.os }}-gradle-
58-
- name: Run Gradle Build for android/
59-
run: cd android && ./gradlew assembleDebug --build-cache && cd ..
60101
- name: Run Gradle Build for example/android/
61-
run: cd example/android && ./gradlew assembleDebug --build-cache && cd ../..
102+
run: cd example/android && ./gradlew assembleDebug -PnewArchEnabled=true --build-cache && cd ../..

.github/workflows/build-ios.yml

Lines changed: 68 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,70 @@ on:
1919
jobs:
2020
build:
2121
name: Build iOS Example App
22-
runs-on: macOS-latest
22+
runs-on: macOS-13
23+
defaults:
24+
run:
25+
working-directory: example/ios
26+
steps:
27+
- uses: actions/checkout@v3
28+
- name: Install node
29+
uses: actions/setup-node@v3
30+
with:
31+
node-version: 18
32+
- name: Get yarn cache directory path
33+
id: yarn-cache-dir-path
34+
run: echo "::set-output name=dir::$(yarn cache dir)"
35+
- name: Restore node_modules from cache
36+
uses: actions/cache@v2
37+
id: yarn-cache
38+
with:
39+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
40+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
41+
restore-keys: |
42+
${{ runner.os }}-yarn-
43+
- name: Install node_modules for example/
44+
run: yarn install --frozen-lockfile --cwd ..
45+
46+
- name: Restore buildcache
47+
uses: mikehardy/buildcache-action@v1
48+
continue-on-error: true
49+
50+
- name: Setup Ruby (bundle)
51+
uses: ruby/setup-ruby@v1
52+
with:
53+
ruby-version: 2.7
54+
bundler-cache: true
55+
working-directory: example
56+
57+
- name: Restore Pods cache
58+
uses: actions/cache@v2
59+
with:
60+
path: |
61+
example/ios/Pods
62+
~/Library/Caches/CocoaPods
63+
~/.cocoapods
64+
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
65+
restore-keys: |
66+
${{ runner.os }}-pods-
67+
- name: Install Pods
68+
run: pod install
69+
- name: Install xcpretty
70+
run: gem install xcpretty
71+
- name: Build App
72+
run: "set -o pipefail && xcodebuild \
73+
CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \
74+
-derivedDataPath build -UseModernBuildSystem=YES \
75+
-workspace example.xcworkspace \
76+
ONLY_ACTIVE_ARCH=NO \
77+
-scheme example \
78+
-sdk iphonesimulator \
79+
-configuration Debug \
80+
-destination 'platform=iOS Simulator,name=iPhone 11 Pro' \
81+
build \
82+
CODE_SIGNING_ALLOWED=NO | xcpretty"
83+
build_new_arch:
84+
name: Build iOS Example App with new arch enabled
85+
runs-on: macOS-13
2386
defaults:
2487
run:
2588
working-directory: example/ios
@@ -47,9 +110,9 @@ jobs:
47110
- name: Setup Ruby (bundle)
48111
uses: ruby/setup-ruby@v1
49112
with:
50-
ruby-version: 2.6
113+
ruby-version: 2.7
51114
bundler-cache: true
52-
working-directory: example/ios
115+
working-directory: example
53116

54117
- name: Restore Pods cache
55118
uses: actions/cache@v2
@@ -62,14 +125,15 @@ jobs:
62125
restore-keys: |
63126
${{ runner.os }}-pods-
64127
- name: Install Pods
65-
run: pod install
128+
run: RCT_NEW_ARCH_ENABLED=1 pod install
66129
- name: Install xcpretty
67130
run: gem install xcpretty
68131
- name: Build App
69132
run: "set -o pipefail && xcodebuild \
70133
CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \
71134
-derivedDataPath build -UseModernBuildSystem=YES \
72135
-workspace example.xcworkspace \
136+
ONLY_ACTIVE_ARCH=NO \
73137
-scheme example \
74138
-sdk iphonesimulator \
75139
-configuration Debug \

.github/workflows/lint-example.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ name: Lint library
55

66
on:
77
push:
8-
branches: [ master ]
8+
branches: [master]
99
pull_request:
10-
branches: [ master ]
10+
branches: [master]
1111

1212
jobs:
1313
lint:
@@ -16,26 +16,26 @@ jobs:
1616
runs-on: ubuntu-latest
1717

1818
steps:
19-
- uses: actions/checkout@v2
20-
- name: Install node v14
21-
uses: actions/setup-node@v1
22-
with:
23-
node-version: 14
24-
- name: Get yarn cache directory path
25-
id: yarn-cache-dir-path
26-
run: echo "::set-output name=dir::$(yarn cache dir)"
27-
- name: Restore node_modules from cache
28-
uses: actions/cache@v2
29-
id: yarn-cache
30-
with:
31-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
32-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
33-
restore-keys: |
34-
${{ runner.os }}-yarn-
19+
- uses: actions/checkout@v3
20+
- name: Install node
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: 18
24+
- name: Get yarn cache directory path
25+
id: yarn-cache-dir-path
26+
run: echo "::set-output name=dir::$(yarn cache dir)"
27+
- name: Restore node_modules from cache
28+
uses: actions/cache@v2
29+
id: yarn-cache
30+
with:
31+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
32+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
33+
restore-keys: |
34+
${{ runner.os }}-yarn-
3535
36-
- name: Install dependencies via yarn
37-
run: yarn install --frozen-lockfile
38-
working-directory: ${{env.working-directory}}
39-
- name: Run ESLint on all *.js*/*.ts* files
40-
run: yarn eslint --ext .js,.jsx,.ts,.tsx .
41-
working-directory: ${{env.working-directory}}
36+
- name: Install dependencies via yarn
37+
run: yarn install --frozen-lockfile
38+
working-directory: ${{env.working-directory}}
39+
- name: Run ESLint on all *.js*/*.ts* files
40+
run: yarn lint
41+
working-directory: ${{env.working-directory}}

0 commit comments

Comments
 (0)