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

Basekit #598

Merged
merged 16 commits into from
Sep 20, 2023
Merged
7 changes: 6 additions & 1 deletion .github/workflows/ios_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,9 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: 'Assembled-iOSAndroid${{ inputs.react-native-version }}'
path: Package/Assembled-iOSAndroid
path: Package/Assembled-iOSAndroid
- name: Upload Assembled iOS Android BaseKit Folder
uses: actions/upload-artifact@v2
with:
name: 'Assembled-BaseKit-iOSAndroid${{ inputs.react-native-version }}'
path: Package/Assembled-BaseKit-iOSAndroid
76 changes: 75 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ jobs:
with:
react-native-version: '0.64'
release-version: ${GITHUB_REF/refs\/tags\//}

build-windows-065:
uses: ./.github/workflows/windows.yml
with:
Expand Down Expand Up @@ -133,6 +132,38 @@ jobs:
with:
name: 'Assembled-Windows0.71'
path: Package/Assembled-Windows0.71
#BaseKit
- name: Download Assembled-BaseKit-iOSAndroid 0.69 Folder
uses: actions/download-artifact@v2
with:
name: 'Assembled-BaseKit-iOSAndroid0.69'
path: Package/Assembled-BaseKit-iOSAndroid0.69
- name: Download Assembled-BaseKit-iOSAndroid 0.70 Folder
uses: actions/download-artifact@v2
with:
name: 'Assembled-BaseKit-iOSAndroid0.70'
path: Package/Assembled-BaseKit-iOSAndroid0.70
- name: Download Assembled-BaseKit-iOSAndroid 0.71 Folder
uses: actions/download-artifact@v2
with:
name: 'Assembled-BaseKit-iOSAndroid0.71'
path: Package/Assembled-BaseKit-iOSAndroid0.71
- name: Download Assembled-BaseKit-Windows 0.69 Folder
uses: actions/download-artifact@v2
with:
name: 'Assembled-BaseKit-Windows0.69'
path: Package/Assembled-Windows0.69
- name: Download Assembled-BaseKit-Windows 0.70 Folder
uses: actions/download-artifact@v2
with:
name: 'Assembled-Windows0.70'
path: Package/Assembled-Windows0.70
- name: Download Assembled-BaseKit-Windows 0.71 Folder
uses: actions/download-artifact@v2
with:
name: 'Assembled-BaseKit-Windows0.71'
path: Package/Assembled-Windows0.71

- name: Display structure of downloaded Assembled and Assembled-Windows folders
run: ls -R
- name: Setup Node.js
Expand Down Expand Up @@ -220,3 +251,46 @@ jobs:
working-directory: ./Package/Assembled-Windows0.71
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
#BaseKit
- name: Version & Publish Package @babylonjs/react-native-basekit-iosandroid-0-69
run: |
npm version --no-git-tag-version ${GITHUB_REF/refs\/tags\//}
npm publish --access public
working-directory: ./Package/Assembled-BaseKit-iOSAndroid0.69
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Version & Publish Package @babylonjs/react-native-basekit-iosandroid-0-70
run: |
npm version --no-git-tag-version ${GITHUB_REF/refs\/tags\//}
npm publish --access public
working-directory: ./Package/Assembled-BaseKit-iOSAndroid0.70
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Version & Publish Package @babylonjs/react-native-basekit-iosandroid-0-71
run: |
npm version --no-git-tag-version ${GITHUB_REF/refs\/tags\//}
npm publish --access public
working-directory: ./Package/Assembled-BaseKit-iOSAndroid0.71
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Version & Publish Package @babylonjs/react-native-basekit-windows-0-69
run: |
npm version --no-git-tag-version ${GITHUB_REF/refs\/tags\//}
npm publish --access public
working-directory: ./Package/Assembled-BaseKit-Windows0.69
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Version & Publish Package @babylonjs/react-native-basekit-windows-0-70
run: |
npm version --no-git-tag-version ${GITHUB_REF/refs\/tags\//}
npm publish --access public
working-directory: ./Package/Assembled-BaseKit-Windows0.70
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Version & Publish Package @babylonjs/react-native-basekit-windows-0-71
run: |
npm version --no-git-tag-version ${GITHUB_REF/refs\/tags\//}
npm publish --access public
working-directory: ./Package/Assembled-BaseKit-Windows0.71
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
76 changes: 76 additions & 0 deletions .github/workflows/publish_preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,38 @@ jobs:
with:
name: 'Assembled-Windows0.71'
path: Package/Assembled-Windows0.71
#BaseKit
- name: Download Assembled-BaseKit-iOSAndroid 0.69 Folder
uses: actions/download-artifact@v2
with:
name: 'Assembled-BaseKit-iOSAndroid0.69'
path: Package/Assembled-BaseKit-iOSAndroid0.69
- name: Download Assembled-BaseKit-iOSAndroid 0.70 Folder
uses: actions/download-artifact@v2
with:
name: 'Assembled-BaseKit-iOSAndroid0.70'
path: Package/Assembled-BaseKit-iOSAndroid0.70
- name: Download Assembled-BaseKit-iOSAndroid 0.71 Folder
uses: actions/download-artifact@v2
with:
name: 'Assembled-BaseKit-iOSAndroid0.71'
path: Package/Assembled-BaseKit-iOSAndroid0.71
- name: Download Assembled-BaseKit-Windows 0.69 Folder
uses: actions/download-artifact@v2
with:
name: 'Assembled-BaseKit-Windows0.69'
path: Package/Assembled-BaseKit-Windows0.69
- name: Download Assembled-BaseKit-Windows 0.70 Folder
uses: actions/download-artifact@v2
with:
name: 'Assembled-BaseKit-Windows0.70'
path: Package/Assembled-BaseKit-Windows0.70
- name: Download Assembled-BaseKit-Windows 0.71 Folder
uses: actions/download-artifact@v2
with:
name: 'Assembled-BaseKit-Windows0.71'
path: Package/Assembled-BaseKit-Windows0.71

- name: Display structure of downloaded Assembled and Assembled-Windows folders
run: ls -R
- name: Setup Node.js
Expand Down Expand Up @@ -230,3 +262,47 @@ jobs:
working-directory: ./Package/Assembled-Windows0.71
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

#BaseKit
- name: Version & Publish Package @babylonjs/react-native-basekit-iosandroid-0-69
run: |
npm version --no-git-tag-version ${{ github.event.inputs.release_version }}
npm publish --access public --tag ${{ github.event.inputs.NPM_tag }}
working-directory: ./Package/Assembled-BaseKit-iOSAndroid0.69
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Version & Publish Package @babylonjs/react-native-basekit-iosandroid-0-70
run: |
npm version --no-git-tag-version ${{ github.event.inputs.release_version }}
npm publish --access public --tag ${{ github.event.inputs.NPM_tag }}
working-directory: ./Package/Assembled-BaseKit-iOSAndroid0.70
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Version & Publish Package @babylonjs/react-native-basekit-iosandroid-0-71
run: |
npm version --no-git-tag-version ${{ github.event.inputs.release_version }}
npm publish --access public --tag ${{ github.event.inputs.NPM_tag }}
working-directory: ./Package/Assembled-BaseKit-iOSAndroid0.71
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Version & Publish Package @babylonjs/react-native-basekit-windows-0-69
run: |
npm version --no-git-tag-version ${{ github.event.inputs.release_version }}
npm publish --access public --tag ${{ github.event.inputs.NPM_tag }}
working-directory: ./Package/Assembled-BaseKit-Windows0.69
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Version & Publish Package @babylonjs/react-native-basekit-windows-0-70
run: |
npm version --no-git-tag-version ${{ github.event.inputs.release_version }}
npm publish --access public --tag ${{ github.event.inputs.NPM_tag }}
working-directory: ./Package/Assembled-BaseKit-Windows0.70
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Version & Publish Package @babylonjs/react-native-basekit-windows-0-71
run: |
npm version --no-git-tag-version ${{ github.event.inputs.release_version }}
npm publish --access public --tag ${{ github.event.inputs.NPM_tag }}
working-directory: ./Package/Assembled-BaseKit-Windows0.71
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
7 changes: 6 additions & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,9 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: 'Assembled-Windows${{ inputs.react-native-version }}'
path: Package/Assembled-Windows
path: Package/Assembled-Windows
- name: Upload Assembled-BaseKit-Windows Folder
uses: actions/upload-artifact@v2
with:
name: 'Assembled-BaseKit-Windows${{ inputs.react-native-version }}'
path: Package/Assembled-BaseKit-Windows
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ add_library(BabylonNative SHARED
src/main/cpp/BabylonNativeInterop.cpp
${SHARED_SOURCES})

if (${BASEKIT_BUILD})
target_compile_definitions(BabylonNative PRIVATE BASEKIT_BUILD)
endif()

set(TURBOMODULE_DIR "${REACTNATIVE_DIR_CMAKE}/ReactAndroid/src/main/jni/react/turbomodule/")
if (EXISTS "${TURBOMODULE_DIR}/CMakeLists.txt")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ if ( propertiesFile.isFile() ) {

def cpp_distribution = (REACT_VERSION >= 71) ? "c++_shared" : "c++_static";

def basekitBuild = 0
if (project.hasProperty("BASEKIT_BUILD")) {
basekitBuild = project.getProperty("BASEKIT_BUILD")
}

if (REACT_VERSION >= 71) {
DEFAULT_NDK_VERSION = '23.1.7779620'
}
Expand Down Expand Up @@ -81,7 +86,8 @@ android {
"-DARCORE_LIBPATH=${extractedLibDir}/core-1.22.0.aar/jni",
"-DFBJNI_INCPATH=${extractedLibDir}/fbjni-0.3.0-headers.jar/",
"-DFBJNI_LIBPATH=${extractedLibDir}/fbjni-0.3.0.aar/jni",
"-DREACTNATIVE_DIR=${rootDir}/../node_modules/react-native/"
"-DREACTNATIVE_DIR=${rootDir}/../node_modules/react-native/",
"-DBASEKIT_BUILD=${basekitBuild}"
}
}
ndk {
Expand Down
4 changes: 4 additions & 0 deletions Modules/@babylonjs/react-native-iosandroid/ios/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ add_subdirectory(${BABYLON_REACT_NATIVE_SHARED_DIR} ${CMAKE_CURRENT_BINARY_DIR}/
add_library(BabylonNative
${SHARED_SOURCES})

if (${BASEKIT_BUILD})
target_compile_definitions(BabylonNative PRIVATE BASEKIT_BUILD)
endif()

target_include_directories(BabylonNative PRIVATE ${SHARED_INCLUDES})
target_include_directories(BabylonNative PUBLIC ${CMAKE_CURRENT_LIST_DIR})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ add_subdirectory(${BABYLON_NATIVE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/BabylonNative
add_library(BabylonNative
${SHARED_SOURCES})

if (${BASEKIT_BUILD})
target_compile_definitions(BabylonNative PRIVATE BASEKIT_BUILD)
endif()

target_include_directories(BabylonNative PRIVATE ${SHARED_INCLUDES})

target_link_libraries(BabylonNative
Expand Down
13 changes: 10 additions & 3 deletions Modules/@babylonjs/react-native/shared/BabylonNative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

#include <Babylon/Graphics/Device.h>
#include <Babylon/JsRuntime.h>
#ifndef BASEKIT_BUILD
#include <Babylon/Plugins/NativeCamera.h>
#include <Babylon/Plugins/NativeXr.h>
#endif
#include <Babylon/Plugins/NativeCapture.h>
#include <Babylon/Plugins/NativeEngine.h>
#include <Babylon/Plugins/NativeInput.h>
#include <Babylon/Plugins/NativeOptimizations.h>
#include <Babylon/Plugins/NativeTracing.h>
#include <Babylon/Plugins/NativeXr.h>
#include <Babylon/Polyfills/Window.h>
#include <Babylon/Polyfills/XMLHttpRequest.h>
#include <Babylon/Polyfills/Canvas.h>
Expand Down Expand Up @@ -48,13 +50,15 @@ namespace BabylonNative
Babylon::JsRuntime::CreateForJavaScript(m_env, Babylon::CreateJsRuntimeDispatcher(m_env, jsiRuntime, m_jsDispatcher, m_isRunning));

// Initialize Babylon Native plugins
#ifndef BASEKIT_BUILD
m_nativeXr.emplace(Babylon::Plugins::NativeXr::Initialize(m_env));
m_nativeXr->SetSessionStateChangedCallback([isXRActive{ m_isXRActive }](bool isSessionActive) { *isXRActive = isSessionActive; });
Babylon::Plugins::NativeCamera::Initialize(m_env);
#endif
Babylon::Plugins::NativeCapture::Initialize(m_env);
m_nativeInput = &Babylon::Plugins::NativeInput::CreateForJavaScript(m_env);
Babylon::Plugins::NativeOptimizations::Initialize(m_env);
Babylon::Plugins::NativeTracing::Initialize(m_env);
Babylon::Plugins::NativeCamera::Initialize(m_env);

// Initialize Babylon Native polyfills
Babylon::Polyfills::Window::Initialize(m_env);
Expand Down Expand Up @@ -211,7 +215,9 @@ namespace BabylonNative
#if defined(__APPLE__) || defined(ANDROID)
void UpdateXRView(WindowType window)
{
#ifndef BASEKIT_BUILD
m_nativeXr->UpdateWindow(window);
#endif
}
#endif

Expand Down Expand Up @@ -262,8 +268,9 @@ namespace BabylonNative
bool m_isRenderingEnabled{};
std::once_flag m_isGraphicsInitialized{};
Babylon::Plugins::NativeInput* m_nativeInput{};
#ifndef BASEKIT_BUILD
std::optional<Babylon::Plugins::NativeXr> m_nativeXr{};

#endif
Babylon::Graphics::Configuration m_graphicsConfig{};

std::shared_ptr<bool> m_isXRActive{};
Expand Down
Loading
Loading