Podfile 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. require 'pathname'
  2. # Uncomment the next two lines for pre-release testing on internal repo
  3. #source 'sso://cpdc-internal/firebase'
  4. #source 'https://cdn.cocoapods.org/'
  5. source 'https://cdn.cocoapods.org/'
  6. use_frameworks!
  7. install! 'cocoapods',
  8. :generate_multiple_pod_projects => true,
  9. :incremental_installation => true,
  10. # Disable input/output path checking for generated frameworks to make
  11. # incremental builds work properly. Without this, changes to the framework
  12. # may not be picked up in between test runs.
  13. #
  14. # See:
  15. # https://github.com/CocoaPods/CocoaPods/issues/8073
  16. # https://www.ralfebert.de/ios/blog/cocoapods-clean-input-output-files/
  17. :disable_input_output_paths => true
  18. post_install do |installer|
  19. sync = Pathname.new(__FILE__).dirname.join('../../scripts/sync_project.rb')
  20. system('ruby', sync.to_s)
  21. if !$?.success?
  22. raise "sync_project.rb failed with status #{$?.exitstatus}"
  23. end
  24. end
  25. # Returns true if the user has explicitly requested local sources or if this is
  26. # a non-PR Travis build.
  27. def use_local_sources()
  28. return ENV.has_key?('USE_LOCAL_SOURCES') || ENV['TRAVIS_PULL_REQUEST'] == 'false'
  29. end
  30. def xcode_major_version()
  31. version = `xcodebuild -version`
  32. if version =~ /^Xcode\s*(\d+)\./
  33. return $1.to_i
  34. else
  35. raise "Could not find Xcode version in '$version'"
  36. end
  37. end
  38. # Adds a `pod name, :path => ../..` declaration to use local sources if the
  39. # Podfile has been configured to operate that way.
  40. def maybe_local_pod(name)
  41. if use_local_sources()
  42. pod name, :path => '../..'
  43. end
  44. end
  45. # Adds local pod declarations for all Firestore's transitive dependencies if
  46. # required.
  47. def configure_local_pods()
  48. # Firestore is always local; that's what's under development here.
  49. pod 'FirebaseFirestore', :path => '../../'
  50. pod 'GoogleUtilities', :path => '../..'
  51. # FirebaseCore must always be a local pod so that CI builds that make changes
  52. # to its podspec can still function. See Firestore-*-xcodebuild in
  53. # scripts/install_prereqs.sh for more details.
  54. pod 'FirebaseCore', :path => '../..'
  55. # Pull in local sources conditionally.
  56. maybe_local_pod 'FirebaseAuth'
  57. maybe_local_pod 'FirebaseAuthInterop'
  58. if xcode_major_version() >= 9
  59. # Firestore still compiles with Xcode 8 to help verify general conformance
  60. # with C++11 by using an older compiler that doesn't have as many
  61. # extensions from later versions of the language. However, Firebase as a
  62. # whole does not support this environment and @available checks in
  63. # GoogleDataTransport would otherwise break this build.
  64. #
  65. # Firestore doesn't depend on GoogleDataTransport directly--it comes in as
  66. # a dependency of FirebaseCoreDiagnostics. Luckily, FirebaseCore does not
  67. # strongly depend on this, so we can edit the dependency out in the podspec
  68. # and then avoid adding those dependencies here to prevent CocoaPods from
  69. # importing it.
  70. #
  71. # This list should include the transitive closure of all dependencies of
  72. # FirebaseCoreDiagnostics, except GoogleUtilities which we otherwise need.
  73. maybe_local_pod 'FirebaseCoreDiagnostics'
  74. maybe_local_pod 'FirebaseCoreDiagnosticsInterop'
  75. maybe_local_pod 'GoogleDataTransport'
  76. maybe_local_pod 'GoogleDataTransportCCTSupport'
  77. end
  78. end
  79. # Reads the value of the PLATFORM environment variable, converts it to the
  80. # equivalent symbol (e.g. 'iOS' => :ios, 'macOS' => :osx) and returns true if
  81. # the argument matches.
  82. def is_platform(symbol)
  83. platform = ENV['PLATFORM'] || 'all'
  84. platform = platform.downcase # If set, will be frozen.
  85. if platform == 'macos'
  86. # CocoaPods calls this osx
  87. platform = 'osx'
  88. end
  89. platform = platform.to_sym
  90. if symbol == platform || platform == :all
  91. puts "Adding #{symbol} targets to the project"
  92. return true
  93. else
  94. return false
  95. end
  96. end
  97. if is_platform(:ios)
  98. target 'Firestore_Example_iOS' do
  99. platform :ios, '8.0'
  100. # The next line is the forcing function for the Firebase pod. The Firebase
  101. # version's subspecs should depend on the component versions in their
  102. # corresponding podspecs.
  103. pod 'Firebase/CoreOnly', '6.13.0'
  104. configure_local_pods()
  105. target 'Firestore_Tests_iOS' do
  106. inherit! :search_paths
  107. pod 'GoogleBenchmark', :podspec => 'GoogleBenchmark.podspec'
  108. pod 'GoogleTest', :podspec => 'GoogleTest.podspec'
  109. pod 'ProtobufCpp', :podspec => 'ProtobufCpp.podspec'
  110. pod 'leveldb-library'
  111. end
  112. target 'Firestore_Benchmarks_iOS' do
  113. inherit! :search_paths
  114. pod 'GoogleBenchmark', :podspec => 'GoogleBenchmark.podspec'
  115. end
  116. target 'Firestore_IntegrationTests_iOS' do
  117. inherit! :search_paths
  118. pod 'FirebaseFirestoreSwift', :path => '../../'
  119. pod 'GoogleBenchmark', :podspec => 'GoogleBenchmark.podspec'
  120. pod 'GoogleTest', :podspec => 'GoogleTest.podspec'
  121. pod 'ProtobufCpp', :podspec => 'ProtobufCpp.podspec'
  122. pod 'leveldb-library'
  123. end
  124. target 'Firestore_SwiftTests_iOS' do
  125. pod 'FirebaseFirestoreSwift', :path => '../../'
  126. end
  127. target 'Firestore_FuzzTests_iOS' do
  128. inherit! :search_paths
  129. platform :ios, '9.0'
  130. pod 'LibFuzzer', :podspec => 'LibFuzzer.podspec', :inhibit_warnings => true
  131. end
  132. end
  133. end
  134. if is_platform(:osx)
  135. target 'Firestore_Example_macOS' do
  136. platform :osx, '10.11'
  137. configure_local_pods()
  138. target 'Firestore_Tests_macOS' do
  139. inherit! :search_paths
  140. pod 'GoogleBenchmark', :podspec => 'GoogleBenchmark.podspec'
  141. pod 'GoogleTest', :podspec => 'GoogleTest.podspec'
  142. pod 'ProtobufCpp', :podspec => 'ProtobufCpp.podspec'
  143. pod 'leveldb-library'
  144. end
  145. target 'Firestore_IntegrationTests_macOS' do
  146. inherit! :search_paths
  147. pod 'FirebaseFirestoreSwift', :path => '../../'
  148. pod 'GoogleBenchmark', :podspec => 'GoogleBenchmark.podspec'
  149. pod 'GoogleTest', :podspec => 'GoogleTest.podspec'
  150. pod 'ProtobufCpp', :podspec => 'ProtobufCpp.podspec'
  151. pod 'leveldb-library'
  152. end
  153. end
  154. end
  155. if is_platform(:tvos)
  156. target 'Firestore_Example_tvOS' do
  157. platform :tvos, '10.0'
  158. configure_local_pods()
  159. target 'Firestore_Tests_tvOS' do
  160. inherit! :search_paths
  161. pod 'GoogleBenchmark', :podspec => 'GoogleBenchmark.podspec'
  162. pod 'GoogleTest', :podspec => 'GoogleTest.podspec'
  163. pod 'ProtobufCpp', :podspec => 'ProtobufCpp.podspec'
  164. pod 'leveldb-library'
  165. end
  166. target 'Firestore_IntegrationTests_tvOS' do
  167. inherit! :search_paths
  168. pod 'FirebaseFirestoreSwift', :path => '../../'
  169. pod 'GoogleBenchmark', :podspec => 'GoogleBenchmark.podspec'
  170. pod 'GoogleTest', :podspec => 'GoogleTest.podspec'
  171. pod 'ProtobufCpp', :podspec => 'ProtobufCpp.podspec'
  172. pod 'leveldb-library'
  173. end
  174. end
  175. end