Skip to content

New NPM#665

Open
CedricGuillemet wants to merge 414 commits intoBabylonJS:masterfrom
CedricGuillemet:NewNPM
Open

New NPM#665
CedricGuillemet wants to merge 414 commits intoBabylonJS:masterfrom
CedricGuillemet:NewNPM

Conversation

@CedricGuillemet
Copy link
Contributor

@CedricGuillemet CedricGuillemet commented Jun 6, 2025

WIP

Goal

Deliver 1 single self contained package with sources (no fetch, no secondary download) for all platform, for all RN versions.
Deprecated existing (Playground, tests, build script) in favor of a single RNTA Playground and simpler tooling.

Building the new NPM

  • Gather all sources (BabylonNative and dependencies) needed by Android/iOS/Windows builds
  • Remove unncessary dependencies (bgfx examples) and generate glue CMake files
  • Bundle previous iosAndroid and Windows Packages into a single NPM along gathered sources

Testing

  • Build RNTA for iOS, Android and Windows
  • Publish an artifact so it can be tested locally

PR Changes

  • Removed old system
  • Renamed BRNPlayground -> Playground
  • Moved react-native-iosandroid and react-native-windows content into Modules/@babylonjs/react-native folder
  • Added buildBabylonNativeSourceTree gulp export to gather BN sources
  • Update Android Gradle to use fetched content and build BabylonNative instead of using static libraries

TODO

  • Android Build
  • Windows Build
  • iOS Build
  • NPM Test publish job
  • Build .ts
  • Publish testable artifacts
  • Remove bgfx example/3rdparty folders
  • Permissions
  • Env var to disable XR and/or Camera plugins (BABYLON_NATIVE_PLUGIN_NATIVECAMERA=0, BABYLON_NATIVE_PLUGIN_NATIVEXR=0)
  • Webp
    - [ ] Script to change RN version for RNTA Left to users to get a working node environment
  • Documentation/Readme
  • Missing CI scripts (publish)
  • Test Playground Android
  • Test Playground iOS
  • Test Playground Windows
  • Test Package Android
  • Test Package iOS
  • Test Package Windows
  • Link error with react-native :
ld.lld: error: undefined symbol: facebook::react::CallInvokerHolder::getCallInvoker()
  >>> referenced by BabylonNativeInterop.cpp:39 (/Users/cedricguillemet/dev/BRNAnd/Apps/Playground/node_modules/@babylonjs/react-native/android/src/main/cpp/BabylonNativeInterop.cpp:39)
  >>>               CMakeFiles/BabylonNative.dir/src/main/cpp/BabylonNativeInterop.cpp.o:(Java_com_babylonreactnative_BabylonNativeInterop_00024BabylonNative_initialize)

issue with RN 0.78. fixed with RN 0.80. not tested with previous versions. To fix (if it happens) on user side.

Notes:

  • Android debug build asserts in spirv shader compilation. It works fine in release.
  • Android XR not tested because of missing ARCore dependency. I guess it should be part of the app and not the package. To confirm!
  • ios XR working correctly

Pros/Cons of sources in package

Pros

  • smaller disk footprint. no need to clear up space : https://github.com/BabylonJS/BabylonReactNative/tree/master/.github/workflows/macos_freespace
  • 1 single NPM package for all platforms and RN versions instead of 21
  • smaller NPMs (Windows is 700Mb per RN version)
  • put breakpoints anywhere
  • simpler builds (Android is handled by CMake, no need for Windows build scripts)
  • support for ABI breaking changes
  • unity build not needed anymore (windows binary size issue not relevant)
  • gulp script is reduced in scope
  • more precise control on components used (no more BASE_KIT package)
  • same podspec for dev and NPM
  • faster PR build/publish: ~15min Vs 1h
  • asserts firing!

Cons

  • need to build BN source with same toolchain flags as BRN (but same for prebuilt static libraries)
  • slower build for users (?). need testing for that
  • Xcode builds need CMake

Sizes

Binary packages

TS : 23Kb
Windows: 102Mb (700Mb Unzipped)
iOS-Android: 21Mb (65Mb Unzipped)

Source package

13Mb (74Mb Unzipped)

@CedricGuillemet CedricGuillemet marked this pull request as ready for review July 2, 2025 12:29
* Test build

* no rnta

* typo

* BN update

* update libraries after bgfx update

* graphics warnings

* disable warnings for Windows build

* xcode scheme

* no nativexr for Windows, add schemes for iOS in validation step

* no xr for msvc

* removed Windows XR support

* NDK min is 23.1.7779620

* disable warnings xr android

* no warning nativeCamera Android

* disable XMLHttpRequest warnings

* even less warnings

* brings back rnta

* windows rnta

* action cache version

* windows build link path

* bimg and bx path

* removed nativexr from linking

* xr leftovers

* lib webp windows

* disable webp windows

* Scheduling

* scheduling path

* actions/download-artifact version

* test Xcode 16.2

* Test Node 18

* up cmake version

* bump to 0.71

* no webp

* removed webp

* moved back to a version that should build

* windows 2019 is deprecated

* vs 2022

* windows sdk version

* missing scheduling lib

* WindowsTargetPlatformVersion test

* disable windows

* BN commit id

* Blob.xcscheme
Copy link
Contributor

@bghgary bghgary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a quick scan. Looks good to me, but @ryantrem probably should approve before you merge.

CedricGuillemet added a commit to BabylonJS/AndroidExtensions that referenced this pull request Jan 12, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 227 out of 962 changed files in this pull request and generated no new comments.

Files not reviewed (3)
  • Apps/PackageTest/0.63.1/ios/PackageTest.xcworkspace/contents.xcworkspacedata: Language not supported
  • Apps/PackageTest/0.64.0/ios/PackageTest.xcworkspace/contents.xcworkspacedata: Language not supported
  • Apps/PackageTest/0.65.0/ios/PackageTest.xcworkspace/contents.xcworkspacedata: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants