diff --git a/integration-tests/environments/react-native/ios/Podfile b/integration-tests/environments/react-native/ios/Podfile index ea249d594aa..65db2b71bd2 100644 --- a/integration-tests/environments/react-native/ios/Podfile +++ b/integration-tests/environments/react-native/ios/Podfile @@ -66,12 +66,6 @@ target 'RealmReactNativeTests' do # Applying https://github.com/facebook/folly/issues/1470#issuecomment-943123653 config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'FOLLY_HAVE_CLOCK_GETTIME=1'] end - - if target.name == "RealmJS" - target.build_configurations.each do |config| - config.build_settings['BUILD_CORE'] = 'true' - end - end end end end diff --git a/packages/realm/RealmJS.podspec b/packages/realm/RealmJS.podspec index b34c53fa62d..ea5ae4f1c39 100644 --- a/packages/realm/RealmJS.podspec +++ b/packages/realm/RealmJS.podspec @@ -5,6 +5,8 @@ package = JSON.parse(File.read(File.expand_path('package.json', __dir__))) app_path = File.expand_path('../..', __dir__) +build_realm_core = ENV["BUILD_REALM_CORE"] == "1" + # There is no API to detect the use of "use_frameworks!" in the Podfile which depends on this Podspec. # The "React" framework is only available and should be used if the Podfile calls use_frameworks! # Therefore we make an assumption on the location of the Podfile and check if it contains "use_frameworks!" ... @@ -92,6 +94,7 @@ Pod::Spec.new do |s| :input_file_lists => ["#{__dir__}/react-native/ios/input-files.xcfilelist"], :output_file_lists => ["#{__dir__}/react-native/ios/output-files.xcfilelist"], :script => <<-EOS + BUILD_REALM_CORE="#{build_realm_core ? '1' : '0'}" CMAKE_PATH="#{CMAKE_PATH}" source "#{__dir__}/scripts/generate-ios-libs.sh" EOS diff --git a/packages/realm/scripts/generate-ios-libs.sh b/packages/realm/scripts/generate-ios-libs.sh index 19b6f14e906..e339c333920 100755 --- a/packages/realm/scripts/generate-ios-libs.sh +++ b/packages/realm/scripts/generate-ios-libs.sh @@ -30,10 +30,10 @@ CDN_URL="https://static.realm.io/downloads/core/v$CORE_VERSION/$PLATFORM_NAME/Re # Check if URL is valid and reachable if ! curl --output /dev/null --silent --head --fail "$CDN_URL"; then echo "URL $CDN_URL is not valid or reachable." - BUILD_CORE = "true" + BUILD_REALM_CORE = "1" fi -if $BUILD_CORE == "true"; then +if [ "$BUILD_REALM_CORE" == "1" ]; then echo "Building realm-core..." pushd $PROJECT_ROOT/bindgen/vendor/realm-core ./tools/build-apple-device.sh -p $PLATFORM_NAME -c $CONFIGURATION