Skip to content

Commit

Permalink
Use an BUILD_REALM_CORE env var to build core from source
Browse files Browse the repository at this point in the history
  • Loading branch information
takameyer committed Jan 24, 2024
1 parent bb71bb4 commit 17e0dfa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
6 changes: 0 additions & 6 deletions integration-tests/environments/react-native/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions packages/realm/RealmJS.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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!" ...
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions packages/realm/scripts/generate-ios-libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 17e0dfa

Please sign in to comment.