From 8c6257a0d9fe42e939cf6c12aef32cbdc794a563 Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Fri, 20 Dec 2024 10:58:07 +0100 Subject: [PATCH] fix: enable x86 for iOS and stop excluding x86 args on both platforms (#16) --- .github/workflows/android.yml | 4 +- .github/workflows/ios.yml | 7 +- example/Gemfile.lock | 117 ++++++++++++++++++ example/android/gradle.properties | 3 +- example/ios/Podfile | 7 -- example/ios/Podfile.lock | 2 +- .../project.pbxproj | 2 - package.json | 10 +- ubrn.yaml | 1 + 9 files changed, 129 insertions(+), 24 deletions(-) create mode 100644 example/Gemfile.lock diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index da3d25f..945125b 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -30,9 +30,7 @@ jobs: - name: Generate run: | - yarn ubrn:clean - yarn ubrn:checkout - yarn ubrn:android + yarn generate:android # Free up space for subsequent steps rm -rf rust_modules diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index cc5b4e3..a258c07 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -23,7 +23,7 @@ jobs: - name: Setup Rust uses: dtolnay/rust-toolchain@stable with: - targets: aarch64-apple-ios,aarch64-apple-ios-sim + targets: aarch64-apple-ios,aarch64-apple-ios-sim,x86_64-apple-ios - name: Write .xcode.env.local run: | @@ -35,10 +35,9 @@ jobs: run: | # Disabling NEON fixes linker error, see # https://github.com/unomed-dev/react-native-matrix-sdk/issues/12 + # TODO: Replace this with setting the reldbg profile once ubrn supports it export CARGO_FEATURE_NO_NEON=1 - yarn ubrn:clean - yarn ubrn:checkout - yarn ubrn:ios + yarn generate:ios # Free up space for subsequent steps rm -rf rust_modules diff --git a/example/Gemfile.lock b/example/Gemfile.lock new file mode 100644 index 0000000..2d4bf67 --- /dev/null +++ b/example/Gemfile.lock @@ -0,0 +1,117 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.7) + base64 + nkf + rexml + activesupport (7.2.2.1) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + logger (>= 1.4.2) + minitest (>= 5.1) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + algoliasearch (1.27.5) + httpclient (~> 2.8, >= 2.8.3) + json (>= 1.5.1) + atomos (0.1.3) + base64 (0.2.0) + benchmark (0.4.0) + bigdecimal (3.1.8) + claide (1.1.0) + cocoapods (1.15.2) + addressable (~> 2.8) + claide (>= 1.0.2, < 2.0) + cocoapods-core (= 1.15.2) + cocoapods-deintegrate (>= 1.0.3, < 2.0) + cocoapods-downloader (>= 2.1, < 3.0) + cocoapods-plugins (>= 1.0.0, < 2.0) + cocoapods-search (>= 1.0.0, < 2.0) + cocoapods-trunk (>= 1.6.0, < 2.0) + cocoapods-try (>= 1.1.0, < 2.0) + colored2 (~> 3.1) + escape (~> 0.0.4) + fourflusher (>= 2.3.0, < 3.0) + gh_inspector (~> 1.0) + molinillo (~> 0.8.0) + nap (~> 1.0) + ruby-macho (>= 2.3.0, < 3.0) + xcodeproj (>= 1.23.0, < 2.0) + cocoapods-core (1.15.2) + activesupport (>= 5.0, < 8) + addressable (~> 2.8) + algoliasearch (~> 1.0) + concurrent-ruby (~> 1.1) + fuzzy_match (~> 2.0.4) + nap (~> 1.0) + netrc (~> 0.11) + public_suffix (~> 4.0) + typhoeus (~> 1.0) + cocoapods-deintegrate (1.0.5) + cocoapods-downloader (2.1) + cocoapods-plugins (1.0.0) + nap + cocoapods-search (1.0.1) + cocoapods-trunk (1.6.0) + nap (>= 0.8, < 2.0) + netrc (~> 0.11) + cocoapods-try (1.2.0) + colored2 (3.1.2) + concurrent-ruby (1.3.4) + connection_pool (2.4.1) + drb (2.2.1) + escape (0.0.4) + ethon (0.16.0) + ffi (>= 1.15.0) + ffi (1.17.0) + fourflusher (2.3.1) + fuzzy_match (2.0.4) + gh_inspector (1.1.3) + httpclient (2.8.3) + i18n (1.14.6) + concurrent-ruby (~> 1.0) + json (2.9.1) + logger (1.6.4) + minitest (5.25.4) + molinillo (0.8.0) + nanaimo (0.3.0) + nap (1.1.0) + netrc (0.11.0) + nkf (0.2.0) + public_suffix (4.0.7) + rexml (3.4.0) + ruby-macho (2.5.1) + securerandom (0.4.1) + typhoeus (1.4.1) + ethon (>= 0.9.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + xcodeproj (1.25.1) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.3.0) + rexml (>= 3.3.6, < 4.0) + +PLATFORMS + ruby + +DEPENDENCIES + activesupport (>= 6.1.7.5, != 7.1.0) + cocoapods (>= 1.13, != 1.15.1, != 1.15.0) + xcodeproj (< 1.26.0) + +RUBY VERSION + ruby 3.3.5p100 + +BUNDLED WITH + 2.5.19 diff --git a/example/android/gradle.properties b/example/android/gradle.properties index e995251..3902665 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -25,8 +25,7 @@ android.useAndroidX=true # Use this property to specify which architecture you want to build. # You can also override it from the CLI using # ./gradlew -PreactNativeArchitectures=x86_64 -# TODO: Add back x86 and x86_64 once we figured out how to build them -reactNativeArchitectures=armeabi-v7a,arm64-v8a +reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64 # Use this property to enable support to the new architecture. # This will allow you to use TurboModules and the Fabric render in diff --git a/example/ios/Podfile b/example/ios/Podfile index 89ff760..23735df 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -43,12 +43,5 @@ target 'ReactNativeMatrixSdkExample' do :mac_catalyst_enabled => false, # :ccache_enabled => true ) - - # TODO: Remove (together with EXCLUDED_ARCHS build setting in workspace) once we've figured out how to build for x86 - installer.pods_project.targets.each do |target| - target.build_configurations.each do |config| - config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'x86_64' - end - end end end diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 50dbdda..bf15fcc 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1808,6 +1808,6 @@ SPEC CHECKSUMS: unomed-react-native-matrix-sdk: bb06ecb9acb6a29b2d7887acf50e7db6d92f3eb9 Yoga: db69236006b8b1c6d55ab453390c882306cbf219 -PODFILE CHECKSUM: f31d96f710b5116b3170327449261b387e616e6d +PODFILE CHECKSUM: 26c75fa7a8774e3435310ec3d6056a0c49f27cc8 COCOAPODS: 1.16.2 diff --git a/example/ios/ReactNativeMatrixSdkExample.xcodeproj/project.pbxproj b/example/ios/ReactNativeMatrixSdkExample.xcodeproj/project.pbxproj index 6707756..7a0a608 100644 --- a/example/ios/ReactNativeMatrixSdkExample.xcodeproj/project.pbxproj +++ b/example/ios/ReactNativeMatrixSdkExample.xcodeproj/project.pbxproj @@ -552,7 +552,6 @@ CXX = ""; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; - "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = x86_64; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -636,7 +635,6 @@ CXX = ""; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = x86_64; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; diff --git a/package.json b/package.json index f42dbcc..d64197b 100644 --- a/package.json +++ b/package.json @@ -38,17 +38,17 @@ "!**/.*" ], "scripts": { - "ubrn:android": "yarn ubrn:android:build --and-generate", "ubrn:android:build": "CARGO_TARGET_X86_64_LINUX_ANDROID_RUSTFLAGS=\"-L$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/17/lib/linux\" ubrn build android --config ubrn.yaml", "ubrn:android:build:release": "yarn ubrn:android:build --release", - "ubrn:ios": "yarn ubrn:ios:build --and-generate && (cd example/ios && pod install)", "ubrn:ios:build": "ubrn build ios --config ubrn.yaml", "ubrn:ios:build:release": "yarn ubrn:ios:build --release", + "ubrn:ios:generate": "ubrn generate all --config ubrn.yaml build/RnMatrixRustSdk.xcframework/ios-arm64/libmatrix_sdk_ffi.a && (cd example/ios && pod install)", "ubrn:checkout": "ubrn checkout --config ubrn.yaml", "ubrn:clean": "del-cli cpp android/src/main/java ios \"src/Native*\" src/generated \"src/index.ts*\"", - "ubrn:generate": "ubrn generate all --config ubrn.yaml build/RnMatrixRustSdk.xcframework/ios-arm64/libmatrix_sdk_ffi.a", - "generate": "yarn ubrn:clean && yarn ubrn:checkout && yarn ubrn:android && yarn ubrn:ios", - "generate:release": "yarn ubrn:clean && yarn ubrn:checkout && yarn ubrn:android:build:release && yarn ubrn:ios:build:release && yarn ubrn:generate && (cd example/ios && pod install)", + "generate": "yarn ubrn:clean && yarn ubrn:checkout && yarn ubrn:android:build && yarn ubrn:ios:build && yarn ubrn:ios:generate", + "generate:android": "yarn ubrn:clean && yarn ubrn:checkout && yarn ubrn:android:build --and-generate", + "generate:ios": "yarn ubrn:clean && yarn ubrn:checkout && yarn ubrn:ios:build && yarn ubrn:ios:generate", + "generate:release": "yarn ubrn:clean && yarn ubrn:checkout && yarn ubrn:android:build:release && yarn ubrn:ios:build:release && yarn ubrn:ios:generate", "format": "prettier -w '**/*.{ts,tsx}'", "example": "yarn workspace @unomed/react-native-matrix-sdk-example", "typecheck": "tsc", diff --git a/ubrn.yaml b/ubrn.yaml index 3027dd0..877deba 100644 --- a/ubrn.yaml +++ b/ubrn.yaml @@ -18,6 +18,7 @@ ios: targets: - aarch64-apple-ios - aarch64-apple-ios-sim + - x86_64-apple-ios xcodebuildExtras: [] frameworkName: build/RnMatrixRustSdk noOverwrite: []