Podfile 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. # Copyright 2017 Google LLC
  2. require 'pathname'
  3. # Uncomment the next two lines for pre-release testing on internal repo
  4. #source 'sso://cpdc-internal/firebase'
  5. #source 'https://cdn.cocoapods.org/'
  6. source 'https://github.com/firebase/SpecsDev.git'
  7. source 'https://github.com/firebase/SpecsStaging.git'
  8. source 'https://cdn.cocoapods.org/'
  9. use_frameworks!
  10. install! 'cocoapods',
  11. :generate_multiple_pod_projects => true,
  12. :incremental_installation => true,
  13. # Disable input/output path checking for generated frameworks to make
  14. # incremental builds work properly. Without this, changes to the framework
  15. # may not be picked up in between test runs.
  16. #
  17. # See:
  18. # https://github.com/CocoaPods/CocoaPods/issues/8073
  19. # https://www.ralfebert.de/ios/blog/cocoapods-clean-input-output-files/
  20. :disable_input_output_paths => true
  21. # Invoke sync_project.rb after installation to force all tests to be a part of
  22. # the project.
  23. post_install do |installer|
  24. sync = Pathname.new(__FILE__).dirname.join('../../scripts/sync_project.rb')
  25. system('ruby', sync.to_s)
  26. if !$?.success?
  27. raise "sync_project.rb failed with status #{$?.exitstatus}"
  28. end
  29. end
  30. # Returns true if the user has explicitly requested local sources or if this is
  31. # a non-PR Travis build.
  32. def use_local_sources()
  33. return ENV.has_key?('USE_LOCAL_SOURCES') || ENV['TRAVIS_PULL_REQUEST'] == 'false'
  34. end
  35. # Adds a `pod name, :path => ../..` declaration to use local sources if the
  36. # Podfile has been configured to operate that way.
  37. #
  38. # This is a build optimization that allows most CI builds to run more quickly
  39. # by just using local sources but allows for nightly and other builds to
  40. # validate that Firestore remains compatible with existing published pods.
  41. def maybe_local_pod(name)
  42. if use_local_sources()
  43. pod name, :path => '../..'
  44. end
  45. end
  46. # Adds local pod declarations for all Firestore's transitive dependencies if
  47. # required.
  48. def configure_local_pods()
  49. # Firestore is always local; that's what's under development here.
  50. pod 'FirebaseFirestore', :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. pod 'FirebaseCoreDiagnostics', :path => '../..'
  56. # Pull in local sources conditionally.
  57. maybe_local_pod 'FirebaseAuth'
  58. maybe_local_pod 'FirebaseCoreDiagnostics'
  59. end
  60. # Reads the value of the PLATFORM environment variable, converts it to the
  61. # equivalent symbol (e.g. 'iOS' => :ios, 'macOS' => :osx) and returns true if
  62. # the argument matches.
  63. def is_platform(symbol)
  64. platform = ENV['PLATFORM'] || 'all'
  65. platform = platform.downcase # If set, will be frozen.
  66. if platform == 'macos'
  67. # CocoaPods calls this osx
  68. platform = 'osx'
  69. end
  70. platform = platform.to_sym
  71. if symbol == platform || platform == :all
  72. puts "Adding #{symbol} targets to the project"
  73. return true
  74. else
  75. return false
  76. end
  77. end
  78. if is_platform(:ios)
  79. target 'Firestore_Example_iOS' do
  80. platform :ios, '10.0'
  81. configure_local_pods()
  82. target 'Firestore_Tests_iOS' do
  83. inherit! :search_paths
  84. pod 'GoogleBenchmark', :podspec => 'GoogleBenchmark.podspec'
  85. pod 'GoogleTest', :podspec => 'GoogleTest.podspec'
  86. pod 'ProtobufCpp', :podspec => 'ProtobufCpp.podspec'
  87. pod 'leveldb-library'
  88. end
  89. target 'Firestore_Benchmarks_iOS' do
  90. inherit! :search_paths
  91. pod 'GoogleBenchmark', :podspec => 'GoogleBenchmark.podspec'
  92. end
  93. target 'Firestore_IntegrationTests_iOS' do
  94. inherit! :search_paths
  95. pod 'FirebaseFirestoreSwift', :path => '../../'
  96. pod 'GoogleBenchmark', :podspec => 'GoogleBenchmark.podspec'
  97. pod 'GoogleTest', :podspec => 'GoogleTest.podspec'
  98. pod 'ProtobufCpp', :podspec => 'ProtobufCpp.podspec'
  99. pod 'leveldb-library'
  100. end
  101. target 'Firestore_FuzzTests_iOS' do
  102. inherit! :search_paths
  103. platform :ios, '10.0'
  104. pod 'LibFuzzer', :podspec => 'LibFuzzer.podspec', :inhibit_warnings => true
  105. end
  106. end
  107. end
  108. if is_platform(:osx)
  109. target 'Firestore_Example_macOS' do
  110. platform :osx, '10.12'
  111. configure_local_pods()
  112. target 'Firestore_Tests_macOS' do
  113. inherit! :search_paths
  114. pod 'GoogleBenchmark', :podspec => 'GoogleBenchmark.podspec'
  115. pod 'GoogleTest', :podspec => 'GoogleTest.podspec'
  116. pod 'ProtobufCpp', :podspec => 'ProtobufCpp.podspec'
  117. pod 'leveldb-library'
  118. end
  119. target 'Firestore_IntegrationTests_macOS' do
  120. inherit! :search_paths
  121. pod 'FirebaseFirestoreSwift', :path => '../../'
  122. pod 'GoogleBenchmark', :podspec => 'GoogleBenchmark.podspec'
  123. pod 'GoogleTest', :podspec => 'GoogleTest.podspec'
  124. pod 'ProtobufCpp', :podspec => 'ProtobufCpp.podspec'
  125. pod 'leveldb-library'
  126. end
  127. end
  128. end
  129. if is_platform(:tvos)
  130. target 'Firestore_Example_tvOS' do
  131. platform :tvos, '10.0'
  132. configure_local_pods()
  133. target 'Firestore_Tests_tvOS' do
  134. inherit! :search_paths
  135. pod 'GoogleBenchmark', :podspec => 'GoogleBenchmark.podspec'
  136. pod 'GoogleTest', :podspec => 'GoogleTest.podspec'
  137. pod 'ProtobufCpp', :podspec => 'ProtobufCpp.podspec'
  138. pod 'leveldb-library'
  139. end
  140. target 'Firestore_IntegrationTests_tvOS' do
  141. inherit! :search_paths
  142. pod 'FirebaseFirestoreSwift', :path => '../../'
  143. pod 'GoogleBenchmark', :podspec => 'GoogleBenchmark.podspec'
  144. pod 'GoogleTest', :podspec => 'GoogleTest.podspec'
  145. pod 'ProtobufCpp', :podspec => 'ProtobufCpp.podspec'
  146. pod 'leveldb-library'
  147. end
  148. end
  149. end