Skip to content

Commit

Permalink
feat: Support new arch (#185)
Browse files Browse the repository at this point in the history
* Update example app

* Add codegen specs

* iOS impl

* Android impl

* Fix CI

* Update example README

---------

Co-authored-by: Marc Rousavy <me@mrousavy.com>
  • Loading branch information
janicduplessis and mrousavy authored Jan 29, 2024
1 parent ff6f307 commit 13b1ba7
Show file tree
Hide file tree
Showing 101 changed files with 11,582 additions and 8,406 deletions.
92 changes: 92 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
AccessModifierOffset: -1
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands: false
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ForEachMacros: [ FOR_EACH_RANGE, FOR_EACH, ]
IncludeCategories:
- Regex: '^<.*\.h(pp)?>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
---
Language: ObjC
ColumnLimit: 120
BreakBeforeBraces: WebKit
PointerAlignment: Right
...
53 changes: 47 additions & 6 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,56 @@ jobs:
build_example:
name: Build Android Example App
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Setup JDK 17
uses: actions/setup-java@v2
with:
java-version: 17
distribution: 'temurin'

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Restore node_modules from cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install node_modules
run: yarn install --frozen-lockfile
- name: Install node_modules for example/
run: yarn install --frozen-lockfile --cwd example

- name: Restore Gradle cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Run Gradle Build for example/android/
run: cd example/android && ./gradlew assembleDebug --build-cache && cd ../..
build_example_new_arch:
name: Build Android Example App with new arch enabled
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup JDK 1.8
uses: actions/setup-java@v1
- name: Setup JDK 17
uses: actions/setup-java@v2
with:
java-version: 1.8
java-version: 17
distribution: 'temurin'

- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand All @@ -55,7 +98,5 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Run Gradle Build for android/
run: cd android && ./gradlew assembleDebug --build-cache && cd ..
- name: Run Gradle Build for example/android/
run: cd example/android && ./gradlew assembleDebug --build-cache && cd ../..
run: cd example/android && ./gradlew assembleDebug -PnewArchEnabled=true --build-cache && cd ../..
72 changes: 68 additions & 4 deletions .github/workflows/build-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,70 @@ on:
jobs:
build:
name: Build iOS Example App
runs-on: macOS-latest
runs-on: macOS-13
defaults:
run:
working-directory: example/ios
steps:
- uses: actions/checkout@v3
- name: Install node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Restore node_modules from cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install node_modules for example/
run: yarn install --frozen-lockfile --cwd ..

- name: Restore buildcache
uses: mikehardy/buildcache-action@v1
continue-on-error: true

- name: Setup Ruby (bundle)
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
working-directory: example

- name: Restore Pods cache
uses: actions/cache@v2
with:
path: |
example/ios/Pods
~/Library/Caches/CocoaPods
~/.cocoapods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Install Pods
run: pod install
- name: Install xcpretty
run: gem install xcpretty
- name: Build App
run: "set -o pipefail && xcodebuild \
CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \
-derivedDataPath build -UseModernBuildSystem=YES \
-workspace example.xcworkspace \
ONLY_ACTIVE_ARCH=NO \
-scheme example \
-sdk iphonesimulator \
-configuration Debug \
-destination 'platform=iOS Simulator,name=iPhone 11 Pro' \
build \
CODE_SIGNING_ALLOWED=NO | xcpretty"
build_new_arch:
name: Build iOS Example App with new arch enabled
runs-on: macOS-13
defaults:
run:
working-directory: example/ios
Expand Down Expand Up @@ -47,9 +110,9 @@ jobs:
- name: Setup Ruby (bundle)
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
ruby-version: 2.7
bundler-cache: true
working-directory: example/ios
working-directory: example

- name: Restore Pods cache
uses: actions/cache@v2
Expand All @@ -62,14 +125,15 @@ jobs:
restore-keys: |
${{ runner.os }}-pods-
- name: Install Pods
run: pod install
run: RCT_NEW_ARCH_ENABLED=1 pod install
- name: Install xcpretty
run: gem install xcpretty
- name: Build App
run: "set -o pipefail && xcodebuild \
CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \
-derivedDataPath build -UseModernBuildSystem=YES \
-workspace example.xcworkspace \
ONLY_ACTIVE_ARCH=NO \
-scheme example \
-sdk iphonesimulator \
-configuration Debug \
Expand Down
41 changes: 0 additions & 41 deletions .github/workflows/lint-example.yml

This file was deleted.

48 changes: 24 additions & 24 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Lint library

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
lint:
Expand All @@ -16,26 +16,26 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Install node v14
uses: actions/setup-node@v1
with:
node-version: 14
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Restore node_modules from cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- uses: actions/checkout@v3
- name: Install node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Restore node_modules from cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies via yarn
run: yarn install --frozen-lockfile
working-directory: ${{env.working-directory}}
- name: Run ESLint on all *.js*/*.ts* files
run: yarn eslint --ext .js,.jsx,.ts,.tsx .
working-directory: ${{env.working-directory}}
- name: Install dependencies via yarn
run: yarn install --frozen-lockfile
working-directory: ${{env.working-directory}}
- name: Run ESLint on all *.js*/*.ts* files
run: yarn lint
working-directory: ${{env.working-directory}}
Loading

0 comments on commit 13b1ba7

Please sign in to comment.