Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: duplicate worklets code the smart way #6827

Merged
merged 42 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
2f8b9c4
feat: stub of node module react-native-worklets
tjzel Dec 11, 2024
fcfda4f
feat: preliminary use of react-native-worklets in reanimated
tjzel Dec 11, 2024
a9b6af2
chore: fix CMakeLists
tjzel Dec 12, 2024
96b76d7
Merge branch 'main' into @tjzel/worklets/node-module-with-rea-support
tjzel Dec 12, 2024
3ee4d4f
chore: add explanatory comments
tjzel Dec 17, 2024
1f40ace
feat: add linting to react-native-worklets
tjzel Dec 17, 2024
7fccc99
chore: add missing dependency
tjzel Dec 17, 2024
661706a
chore: add external-worklets-example
tjzel Dec 12, 2024
b127bea
chore: fix FabricExample occurences
tjzel Dec 17, 2024
a507fdc
chore: update github actions
tjzel Dec 17, 2024
afd030d
chore: fix CI
tjzel Dec 17, 2024
2634199
chore: remove excessive changes
tjzel Dec 12, 2024
64aea46
chore: remove external worklets
tjzel Jan 20, 2025
3701183
chore: cleanup
tjzel Jan 20, 2025
ceee2f7
chore: draft duplication
tjzel Dec 17, 2024
62c9488
chore: cleanup
tjzel Jan 21, 2025
50d3f00
chore: improve react-native-worklets detection script
tjzel Jan 21, 2025
7e75fb3
refactor: move ReanimatedVersion to Reanimated
tjzel Jan 21, 2025
88e38c0
Merge branch 'main' into @tjzel/worklets/restructure-worklets-source-…
tjzel Jan 23, 2025
08ad6ab
chore: cleanup
tjzel Jan 23, 2025
6a35149
chore: cleanup
tjzel Jan 23, 2025
45a4c27
Merge branch 'main' into @tjzel/worklets/restructure-worklets-source-…
tjzel Jan 23, 2025
1bcb1a9
Merge remote-tracking branch 'origin/@tjzel/worklets/restructure-work…
tjzel Jan 24, 2025
077304b
chore: fix CI issues
tjzel Jan 24, 2025
2017a8e
refactor: actually copy from worklets
tjzel Jan 24, 2025
6a85786
chore: fix dir
tjzel Jan 24, 2025
48669d5
chore: remove worklets
tjzel Jan 24, 2025
cb09fa5
refactor: major
tjzel Jan 27, 2025
8604d29
chore: apple
tjzel Jan 27, 2025
627827d
refactor: adjust to downstream changes
tjzel Jan 27, 2025
8d30b32
Merge branch 'main' into @tjzel/worklets/restructure-worklets-source-…
tjzel Jan 27, 2025
5585839
chore: update CI
tjzel Jan 27, 2025
8b9319c
chore: dont fire CIs twice
tjzel Jan 27, 2025
55301e8
chore: fix java package
tjzel Jan 27, 2025
3b9eac8
Merge branch '@tjzel/worklets/restructure-worklets-source-sets' into …
tjzel Jan 27, 2025
2cd50bc
chore: update CI
tjzel Jan 27, 2025
15c4fba
Merge branch '@tjzel/worklets/restructure-worklets-source-sets' into …
tjzel Jan 28, 2025
70ededc
chore: cleanup
tjzel Jan 28, 2025
85b3e07
chore: apply formatting
tjzel Jan 28, 2025
daad12a
Merge branch 'main' into @tjzel/worklets/duplicate-reanimated-code
tjzel Jan 28, 2025
8aa02a7
chore: add targets to build gradle`
tjzel Jan 28, 2025
510cbff
chore: restore order
tjzel Jan 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion .github/workflows/example-android-build-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- .github/workflows/example-android-build-check.yml
- packages/react-native-reanimated/android/**
- packages/react-native-reanimated/Common/**
- packages/react-native-worklets/**
- apps/fabric-example/package.json
- apps/fabric-example/android/**
merge_group:
Expand All @@ -19,19 +20,32 @@ on:
- .github/workflows/example-android-build-check.yml
- packages/react-native-reanimated/android/**
- packages/react-native-reanimated/Common/**
- packages/react-native-worklets/**
- apps/fabric-example/package.json
- apps/fabric-example/android/**
workflow_call:
inputs:
use-external-worklets:
required: false
type: boolean
default: false
workflow_dispatch:
inputs:
use-external-worklets:
required: false
type: boolean
default: false

jobs:
build:
if: github.repository == 'software-mansion/react-native-reanimated'
runs-on: ubuntu-latest
env:
WORKING_DIRECTORY: apps/fabric-example
COMMON_APP_DIR: apps/common-app
REANIMATED_DIR: packages/react-native-reanimated
concurrency:
group: android-${{ github.ref }}
group: android-${{ github.ref }}-${{ inputs.use-external-worklets }}
cancel-in-progress: true
steps:
- name: Check out Git repository
Expand All @@ -46,6 +60,14 @@ jobs:
# TODO: Add caching for node_modules and artifacts that will work with monorepo setup.
- name: Install monorepo node dependencies
run: yarn install --immutable
- name: Build Reanimated package
working-directory: ${{ env.REANIMATED_DIR }}
run: yarn build

- name: Use external worklets
if: ${{ inputs.use-external-worklets == 'true' }}
working-directory: ${{ env.COMMON_APP_DIR }}
run: yarn add react-native-worklets@workspace:"*"

- name: Build app
working-directory: ${{ env.WORKING_DIRECTORY }}/android
Expand Down
25 changes: 24 additions & 1 deletion .github/workflows/example-ios-build-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- packages/react-native-reanimated/scripts/reanimated_utils.rb
- packages/react-native-reanimated/apple/**
- packages/react-native-reanimated/Common/**
- packages/react-native-worklets/**
- apps/fabric-example/package.json
- apps/fabric-example/ios/**
merge_group:
Expand All @@ -23,19 +24,32 @@ on:
- packages/react-native-reanimated/scripts/reanimated_utils.rb
- packages/react-native-reanimated/apple/**
- packages/react-native-reanimated/Common/**
- packages/react-native-worklets/**
- apps/fabric-example/package.json
- apps/fabric-example/ios/**
workflow_call:
inputs:
use-external-worklets:
required: false
type: boolean
default: false
workflow_dispatch:
inputs:
use-external-worklets:
required: false
type: boolean
default: false

jobs:
build:
if: github.repository == 'software-mansion/react-native-reanimated'
runs-on: macos-14
env:
WORKING_DIRECTORY: apps/fabric-example
COMMON_APP_DIR: apps/common-app
REANIMATED_DIR: packages/react-native-reanimated
concurrency:
group: ios-${{ github.ref }}
group: ios-${{ github.ref }}-${{ inputs.use-external-worklets }}
cancel-in-progress: true
steps:
- name: Check out Git repository
Expand All @@ -47,6 +61,15 @@ jobs:

- name: Install monorepo node dependencies
run: yarn install --immutable
- name: Build Reanimated package
working-directory: ${{ env.REANIMATED_DIR }}
run: yarn build

- name: Use external worklets
if: ${{ inputs.use-external-worklets == 'true' }}
working-directory: ${{ env.COMMON_APP_DIR }}
run: yarn add react-native-worklets@workspace:"*"

# TODO: Add caching for node_modules and artifacts that will work with monorepo setup.
- name: Install Pods
working-directory: ${{ env.WORKING_DIRECTORY }}/ios
Expand Down
24 changes: 23 additions & 1 deletion .github/workflows/example-macos-build-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- packages/react-native-reanimated/scripts/reanimated_utils.rb
- packages/react-native-reanimated/apple/**
- packages/react-native-reanimated/Common/**
- packages/react-native-worklets/**
- apps/macos-example/package.json
- apps/macos-example/ios/**
- apps/macos-example/macos/**
Expand All @@ -24,20 +25,33 @@ on:
- packages/react-native-reanimated/scripts/reanimated_utils.rb
- packages/react-native-reanimated/apple/**
- packages/react-native-reanimated/Common/**
- packages/react-native-worklets/**
- apps/macos-example/package.json
- apps/macos-example/ios/**
- apps/macos-example/macos/**
workflow_call:
inputs:
use-external-worklets:
required: false
type: boolean
default: false
workflow_dispatch:
inputs:
use-external-worklets:
required: false
type: boolean
default: false

jobs:
build:
if: github.repository == 'software-mansion/react-native-reanimated'
runs-on: macos-14
env:
WORKING_DIRECTORY: apps/macos-example
COMMON_APP_DIR: apps/common-app
REANIMATED_DIR: packages/react-native-reanimated
concurrency:
group: macos-${{ github.ref }}
group: macos-${{ github.ref }}-${{ inputs.use-external-worklets }}
cancel-in-progress: true
steps:
- name: Check out Git repository
Expand All @@ -50,6 +64,14 @@ jobs:
# TODO: Add caching for node_modules and artifacts that will work with monorepo setup.
- name: Install monorepo node dependencies
run: yarn install --immutable
- name: Build Reanimated package
working-directory: ${{ env.REANIMATED_DIR }}
run: yarn build

- name: Use external worklets
if: ${{ inputs.use-external-worklets == 'true' }}
working-directory: ${{ env.COMMON_APP_DIR }}
run: yarn add react-native-worklets@workspace:"*"

- name: Install Pods
working-directory: ${{ env.WORKING_DIRECTORY }}/macos
Expand Down
34 changes: 22 additions & 12 deletions .github/workflows/example-tvos-build-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ on:
- packages/react-native-reanimated/scripts/reanimated_utils.rb
- packages/react-native-reanimated/apple/**
- packages/react-native-reanimated/Common/**
- packages/react-native-reanimated/TVOSExample/package.json
- packages/react-native-reanimated/TVOSExample/ios/**
- packages/react-native-worklets/**
merge_group:
branches:
- main
Expand All @@ -23,19 +22,30 @@ on:
- packages/react-native-reanimated/scripts/reanimated_utils.rb
- packages/react-native-reanimated/apple/**
- packages/react-native-reanimated/Common/**
- packages/react-native-reanimated/TVOSExample/package.json
- packages/react-native-reanimated/TVOSExample/ios/**
- packages/react-native-worklets/**
workflow_call:
inputs:
use-external-worklets:
required: false
type: boolean
default: false
workflow_dispatch:
inputs:
use-external-worklets:
required: false
type: boolean
default: false

jobs:
build:
if: github.repository == 'software-mansion/react-native-reanimated'
runs-on: macos-14
env:
WORKING_DIRECTORY: apps/tvos-example
COMMON_APP_DIR: apps/common-app
REANIMATED_DIR: packages/react-native-reanimated
concurrency:
group: tvos-${{ github.ref }}
group: tvos-${{ github.ref }}-${{ inputs.use-external-worklets }}
cancel-in-progress: true
steps:
- name: Check out Git repository
Expand All @@ -47,14 +57,14 @@ jobs:

- name: Install monorepo node dependencies
run: yarn install --immutable
# TODO: Add caching for node_modules and artifacts that will work with monorepo setup.
- name: Install Reanimated node_modules
working-directory: packages/react-native-reanimated
run: yarn install --immutable
- name: Build Reanimated package
working-directory: ${{ env.REANIMATED_DIR }}
run: yarn build

- name: Install app node_modules
working-directory: ${{ env.WORKING_DIRECTORY }}
run: yarn install --immutable
- name: Use external worklets
if: ${{ inputs.use-external-worklets == 'true' }}
working-directory: ${{ env.COMMON_APP_DIR }}
run: yarn add react-native-worklets@workspace:"*"

- name: Install Pods
working-directory: ${{ env.WORKING_DIRECTORY }}/ios
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/reanimated-android-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:
concurrency:
group: validate-java-${{ github.ref }}
cancel-in-progress: true
env:
REANIMATED_DIR: packages/react-native-reanimated
steps:
- name: checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -62,7 +64,10 @@ jobs:

- name: Install monorepo node dependencies
run: yarn install --immutable
- name: Build Reanimated package
working-directory: ${{ env.REANIMATED_DIR }}
run: yarn build

- name: Lint Android
working-directory: packages/react-native-reanimated
working-directory: ${{ env.REANIMATED_DIR }}
run: yarn lint:android
7 changes: 6 additions & 1 deletion .github/workflows/reanimated-apple-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,18 @@ on:
jobs:
check:
if: github.repository == 'software-mansion/react-native-reanimated'
env:
REANIMATED_DIR: packages/react-native-reanimated
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install monorepo node dependencies
run: yarn install --immutable
- name: Build Reanimated package
working-directory: ${{ env.REANIMATED_DIR }}
run: yarn build

- name: Lint apple
working-directory: packages/react-native-reanimated
working-directory: ${{ env.REANIMATED_DIR }}
run: yarn lint:apple
11 changes: 8 additions & 3 deletions .github/workflows/reanimated-common-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ jobs:
strategy:
matrix:
python-version: [3.13]

env:
REANIMATED_DIR: packages/react-native-reanimated
steps:
- uses: actions/checkout@v4

Expand All @@ -42,11 +43,15 @@ jobs:
pip install cpplint==1.6.1
- name: Install monorepo node dependencies
run: yarn install --immutable
- name: Build Reanimated
working-directory: ${{ env.REANIMATED_DIR }}
run: yarn build

- name: Lint Common
working-directory: packages/react-native-reanimated
working-directory: ${{ env.REANIMATED_DIR }}
run: yarn lint:common

- name: Disallow DEBUG macros
working-directory: ${{ env.REANIMATED_DIR }}
run: |
! egrep -r '(#if DEBUG|#ifdef DEBUG)' packages/react-native-reanimated/Common/cpp/ packages/react-native-reanimated/apple/ packages/react-native-reanimated/android/src/main/cpp/
! egrep -r '(#if DEBUG|#ifdef DEBUG)' Common/cpp/ apple/ android/src/main/cpp/
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Worklets & Reanimated Android compilation checks
env:
YARN_ENABLE_HARDENED_MODE: 0
on:
pull_request:
paths:
- .github/workflows/worklets-reanimated-android-compilation-checks.yml
- packages/react-native-reanimated/android/**
- packages/react-native-reanimated/Common/**
- packages/react-native-worklets/**
merge_group:
branches:
- main
push:
branches:
- main
paths:
- .github/workflows/worklets-reanimated-android-compilation-checks.yml
- packages/react-native-reanimated/android/**
- packages/react-native-reanimated/Common/**
- packages/react-native-worklets/**
workflow_call:
workflow_dispatch:

jobs:
android-with-external-worklets-build:
if: github.repository == 'software-mansion/react-native-reanimated'
uses: ./.github/workflows/example-android-build-check.yml
with:
use-external-worklets: true
42 changes: 42 additions & 0 deletions .github/workflows/worklets-reanimated-apple-compilation-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Worklets & Reanimated Apple compilation checks
env:
YARN_ENABLE_HARDENED_MODE: 0
on:
pull_request:
paths:
- .github/workflows/worklets-reanimated-apple-compilation-checks.yml
- packages/react-native-reanimated/apple/**
- packages/react-native-reanimated/Common/**
- packages/react-native-worklets/**
merge_group:
branches:
- main
push:
branches:
- main
paths:
- .github/workflows/worklets-reanimated-apple-compilation-checks.yml
- packages/react-native-reanimated/apple/**
- packages/react-native-reanimated/Common/**
- packages/react-native-worklets/**
workflow_call:
workflow_dispatch:

jobs:
ios-with-external-worklets-build:
if: github.repository == 'software-mansion/react-native-reanimated'
uses: ./.github/workflows/example-ios-build-check.yml
with:
use-external-worklets: true

macos-with-external-worklets-build:
if: github.repository == 'software-mansion/react-native-reanimated'
uses: ./.github/workflows/example-macos-build-check.yml
with:
use-external-worklets: true

tvos-with-external-worklets-build:
if: github.repository == 'software-mansion/react-native-reanimated'
uses: ./.github/workflows/example-tvos-build-check.yml
with:
use-external-worklets: true
Loading
Loading