Podfile 5.5 KB

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