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
RJS-2101: "Build optimizations" for iOS and Android #6650
Draft
kraenhansen
wants to merge
65
commits into
main
Choose a base branch
from
kh/build-optimizations-squashed
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kraenhansen
force-pushed
the
kh/build-optimizations-squashed
branch
2 times, most recently
from
May 3, 2024 12:22
e0482ca
to
0b3a7e7
Compare
kraenhansen
force-pushed
the
kh/build-optimizations-squashed
branch
4 times, most recently
from
May 23, 2024 12:00
23d87f0
to
973e0ad
Compare
commit 17e1661 Author: Andrew Meyer <[email protected]> Date: Tue Feb 6 13:18:02 2024 +0000 Lint the shell script commit 78b3ae7 Author: Andrew Meyer <[email protected]> Date: Mon Feb 5 11:49:56 2024 +0000 Add all scripts to the package commit e334dca Author: Andrew Meyer <[email protected]> Date: Sun Feb 4 15:20:20 2024 +0100 Fix potential release issues commit fa5a982 Author: Andrew Meyer <[email protected]> Date: Sun Feb 4 15:16:21 2024 +0100 Refactor integration tests jsi dep commit efab94a Author: Andrew Meyer <[email protected]> Date: Sun Feb 4 15:13:58 2024 +0100 Revert wireit action change commit 49d87c6 Author: Andrew Meyer <[email protected]> Date: Sun Feb 4 15:11:22 2024 +0100 Add CHANGELOG entry commit 1a92fb4 Author: Andrew Meyer <[email protected]> Date: Sun Feb 4 13:58:41 2024 +0100 PR suggestions, etc * Rename generate script * Various Cleanup * Fix up the dependencies for the integration tests commit 6cd3b15 Author: Andrew Meyer <[email protected]> Date: Sun Feb 4 13:47:49 2024 +0100 Apply suggestions from code review Co-authored-by: Kræn Hansen <[email protected]> Co-authored-by: Kenneth Geisshirt <[email protected]> Co-authored-by: LJ <[email protected]> commit 89c5c0f Author: Andrew Meyer <[email protected]> Date: Sun Feb 4 13:40:18 2024 +0100 Refactor Android builds for React Native (#6400) * Build Realm Android from Source * Derive React Native version from local RN package * Implement prefab to handle react native dependencies. Refactor where possible * Refactor CI for Android * Fix pack issues * Possible ios cache issue * Fixed issue where build starts before ts is generated * disable wireit cache * refactor wireit cache and optimize workflow * Cleanup packagin commit 8e01fbf Author: Andrew Meyer <[email protected]> Date: Wed Jan 31 15:37:16 2024 +0100 Revert upgrade to upload-artifact commit 7477a81 Author: Andrew Meyer <[email protected]> Date: Wed Jan 31 14:41:10 2024 +0100 Add cache for pod-install:ci commit 8379c28 Author: Andrew Meyer <[email protected]> Date: Mon Jan 29 14:52:07 2024 +0100 Attempt to fix CI Update node16 actions Refactor bundle step into generate artifact step commit 58d62ff Author: Andrew Meyer <[email protected]> Date: Mon Jan 29 14:47:53 2024 +0100 PR feedback commit 91e3a5f Author: Andrew Meyer <[email protected]> Date: Mon Jan 29 14:45:22 2024 +0100 Apply suggestions from code review Co-authored-by: LJ <[email protected]> Co-authored-by: Kræn Hansen <[email protected]> commit cb4df32 Author: Andrew Meyer <[email protected]> Date: Mon Jan 29 14:44:31 2024 +0100 Incorporate PR feedback commit 43f7670 Author: Andrew Meyer <[email protected]> Date: Thu Jan 25 13:34:38 2024 +0100 Fixes after review commit c7ccfcf Author: Andrew Meyer <[email protected]> Date: Thu Jan 25 11:05:43 2024 +0100 Cleanup commit 9e3d7c0 Author: Andrew Meyer <[email protected]> Date: Thu Jan 25 10:52:56 2024 +0100 Updates from Review commit 06ef7a9 Author: Andrew Meyer <[email protected]> Date: Wed Jan 24 12:45:50 2024 +0100 Only generate jsi for react native builds commit 33f29b0 Author: Andrew Meyer <[email protected]> Date: Wed Jan 24 12:33:57 2024 +0100 PR comments and etc * Fixed some build issues * Reactivate ccache for integration tests builds commit b67a299 Author: Andrew Meyer <[email protected]> Date: Fri Jan 19 14:59:23 2024 +0100 Final fixes to iOS building from source commit 0c66006 Author: Andrew Meyer <[email protected]> Date: Fri Jan 19 10:41:52 2024 +0100 More documentation updates commit 5ac6267 Author: Andrew Meyer <[email protected]> Date: Fri Jan 19 09:37:19 2024 +0100 Prepare for public consumption * update the packed contents of the package * update relevant documentation commit de9300f Author: Andrew Meyer <[email protected]> Date: Wed Jan 17 16:39:07 2024 +0100 Use an BUILD_REALM_CORE env var to build core from source commit 14d9de6 Author: Andrew Meyer <[email protected]> Date: Wed Jan 17 16:24:14 2024 +0100 Refactor ios builds * build from core prebuilds * phase script only called when input and outputs have changes * reinstalling pods will wipe build files, forcing a rebuild * generate input file list so that core can be rebuilt on changes * generate dummy libraries so that libraries can be generated * create build option which forces core to build from source * build from source if prebuild url is not reachable commit 02ba32d Author: Andrew Meyer <[email protected]> Date: Thu Jan 4 17:56:33 2024 +0100 Remove xcframework and just use static libraries commit d370cba Author: Andrew Meyer <[email protected]> Date: Sat Dec 30 11:09:10 2023 +0100 Make builds for iOS work without downloading prebuilds
kraenhansen
force-pushed
the
kh/build-optimizations-squashed
branch
from
May 23, 2024 12:12
973e0ad
to
12c3a02
Compare
kraenhansen
force-pushed
the
kh/build-optimizations-squashed
branch
from
May 23, 2024 14:50
943dabc
to
29868fe
Compare
kraenhansen
changed the title
"Build optimizations" for iOS and Android
RJS-2101: "Build optimizations" for iOS and Android
May 24, 2024
7 tasks
kraenhansen
commented
May 24, 2024
Comment on lines
-438
to
-443
- uses: actions/setup-java@v3 | ||
if: ${{ matrix.variant.os == 'android' }} | ||
with: | ||
distribution: 'zulu' # See 'Supported distributions' for available options | ||
java-version: '17' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kraenhansen
commented
May 24, 2024
Comment on lines
-123
to
-136
- name: Setup Java | ||
if: ${{ matrix.variant.os == 'android' }} | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'zulu' # See 'Supported distributions' for available options | ||
java-version: '11' | ||
|
||
- name: Setup Android SDK | ||
if: ${{ matrix.variant.os == 'android' }} | ||
uses: android-actions/setup-android@v2 | ||
|
||
- name: Install NDK | ||
if: ${{ matrix.variant.os == 'android' }} | ||
run: sdkmanager --install "ndk;${{ env.NDK_VERSION }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These were moved into a separate Android specific prebuild-android
job.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What, How & Why?
Important
With this change, our SDK is no longer pinned to a specific ABI of JSI and we expect the next release of our SDK (after merging this PR) to be backwards and forwards compatible with many past versions of React Native.
This is my friendly takeover of #6396, by reverting the compilation of Realm Core from source and instead distributing prebuilds via our NPM package:
npm run prebuild-apple --workspace realm
):npm run prebuild-android --workspace realm
):npm run prebuild-node --workspace realm
).This also moves all binding related code (prebuilt or not), including that previously in
packages/realm/react-native
intopackages/realm/binding
in platform specific directories.We won't support compiling our prebuilds from from the NPM archive as users still need to
git clone
our mono-repository to produce a build from source.It's worth mentioning that this PR introduce an internal CLI incapsulating the complexity of invoking the CMake scripts for Android and Apple platforms. I imagine we could extend this to wrap cmake-js to provide a single cohesive experience for building our prebuilds in the future: This is a replacement for the
packages/realm/scripts
for Android and iOS that we currently use.Here's a bit more context on this change and why we choose the approach we did:
As we started implementing out "React Native SDK Build Optimizations" project we realized a few things:
In the context of the above, if we choose to include prebuild binaries for iOS and Android of Realm Core in the NPM package, which will be ABI independent on the React Native version (except for the caveat of NDK version, which has a default that I'd expect 95+% to leave unchanged) ... do we actually need to support compiling from source when installing the realm package via NPM as the original project scope suggests? I'd expect the need for that to be very rare (as it is right now) and it does come with drawbacks:
The alternative is to ask developers that want to consume Realm JS and Realm Core from source to perform a checkout of the repository, run the relevant build script and npm pack the SDK package themselves.
☑️ ToDos
Compatibility
label is updated or copied from previous entryCOMPATIBILITY.md
package.json
s (if updating internal packages)Breaking
label has been applied or is not necessary