@@ -157,9 +157,10 @@ def self.podspec_source_download_prebuild_stable_tarball()
157157 end
158158
159159 rncore_log ( "Resolved stable ReactNativeCore-prebuilt version:" )
160- rncore_log ( " #{ Pathname . new ( destinationDebug ) . relative_path_from ( Pathname . pwd ) . to_s } " )
161- rncore_log ( " #{ Pathname . new ( destinationRelease ) . relative_path_from ( Pathname . pwd ) . to_s } " )
160+ rncore_log ( " #{ destinationDebug } " )
161+ rncore_log ( " #{ destinationRelease } " )
162162
163+ ensure_pods_symlink ( )
163164 return { :http => URI ::File . build ( path : destinationDebug ) . to_s }
164165 end
165166
@@ -185,17 +186,18 @@ def self.podspec_source_download_prebuilt_nightly_tarball()
185186 dSymsDebug = download_nightly_rncore ( @@react_native_path , @@react_native_version , :debug , true )
186187 dSymsRelease = download_nightly_rncore ( @@react_native_path , @@react_native_version , :release , true )
187188 rncore_log ( "Resolved nightly dSYMs" )
188- rncore_log ( " #{ Pathname . new ( dSymsDebug ) . relative_path_from ( Pathname . pwd ) . to_s } " )
189- rncore_log ( " #{ Pathname . new ( dSymsRelease ) . relative_path_from ( Pathname . pwd ) . to_s } " )
189+ rncore_log ( " #{ dSymsDebug } " )
190+ rncore_log ( " #{ dSymsRelease } " )
190191
191192 # Make sure that the dSYMs are processed
192193 process_dsyms ( destinationDebug , dSymsDebug )
193194 process_dsyms ( destinationRelease , dSymsRelease )
194195 end
195196
196197 rncore_log ( "Resolved nightly ReactNativeCore-prebuilt version:" )
197- rncore_log ( " #{ Pathname . new ( destinationDebug ) . relative_path_from ( Pathname . pwd ) . to_s } " )
198- rncore_log ( " #{ Pathname . new ( destinationRelease ) . relative_path_from ( Pathname . pwd ) . to_s } " )
198+ rncore_log ( " #{ destinationDebug } " )
199+ rncore_log ( " #{ destinationRelease } " )
200+ ensure_pods_symlink ( )
199201 return { :http => URI ::File . build ( path : destinationDebug ) . to_s }
200202 end
201203
@@ -410,11 +412,11 @@ def self.download_rncore_tarball(react_native_path, tarball_url, version, config
410412
411413 unless File . exist? ( destination_path )
412414 # Download to a temporary file first so we don't cache incomplete downloads.
413- rncore_log ( "Downloading ReactNativeCore-prebuilt #{ dsyms ? "dSYMs " : "" } #{ configuration ? configuration . to_s : "" } tarball from #{ tarball_url } to #{ Pathname . new ( destination_path ) . relative_path_from ( Pathname . pwd ) . to_s } " )
415+ rncore_log ( "Downloading ReactNativeCore-prebuilt #{ dsyms ? "dSYMs " : "" } #{ configuration ? configuration . to_s : "" } tarball from #{ tarball_url } to #{ destination_path } " )
414416 tmp_file = "#{ artifacts_dir ( ) } /reactnative-core.download"
415417 `mkdir -p "#{ artifacts_dir ( ) } " && curl "#{ tarball_url } " -Lo "#{ tmp_file } " && mv "#{ tmp_file } " "#{ destination_path } "`
416418 else
417- rncore_log ( "Using downloaded ReactNativeCore-prebuilt #{ dsyms ? "dSYMs " : "" } #{ configuration ? configuration . to_s : "" } tarball at #{ Pathname . new ( destination_path ) . relative_path_from ( Pathname . pwd ) . to_s } " )
419+ rncore_log ( "Using downloaded ReactNativeCore-prebuilt #{ dsyms ? "dSYMs " : "" } #{ configuration ? configuration . to_s : "" } tarball at #{ destination_path } " )
418420 end
419421
420422 return destination_path
@@ -429,7 +431,19 @@ def self.nightly_artifact_exists(version)
429431 end
430432
431433 def self . artifacts_dir ( )
432- return File . join ( Pod ::Config . instance . project_pods_root , "ReactNativeCore-artifacts" )
434+ return ENV [ 'RCT_PREBUILT_CACHE_DIR' ] || "/tmp/react-native-prebuilt"
435+ end
436+
437+ def self . ensure_pods_symlink ( )
438+ pods_artifacts = File . join ( Pod ::Config . instance . project_pods_root , "ReactNativeCore-artifacts" )
439+ if File . symlink? ( pods_artifacts )
440+ return if File . readlink ( pods_artifacts ) == artifacts_dir ( )
441+ FileUtils . rm ( pods_artifacts )
442+ elsif File . exist? ( pods_artifacts )
443+ FileUtils . rm_rf ( pods_artifacts )
444+ end
445+ FileUtils . mkdir_p ( File . dirname ( pods_artifacts ) )
446+ FileUtils . ln_sf ( artifacts_dir ( ) , pods_artifacts )
433447 end
434448
435449 # This function checks that ReactNativeCore artifact exists on the maven repo
0 commit comments