基础库
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 

92 řádky
3.5 KiB

  1. # Uncomment this line to define a global platform for your project
  2. platform :ios, '9.0'
  3. source 'http://repo.baichuan-ios.taobao.com/baichuanSDK/AliBCSpecs.git'
  4. #source 'https://github.com/CocoaPods/Specs.git'
  5. source 'https://cdn.cocoapods.org/'
  6. # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
  7. ENV['COCOAPODS_DISABLE_STATS'] = 'true'
  8. project 'Runner', {
  9. 'Debug' => :debug,
  10. 'Profile' => :release,
  11. 'Release' => :release,
  12. }
  13. def parse_KV_file(file, separator='=')
  14. file_abs_path = File.expand_path(file)
  15. if !File.exists? file_abs_path
  16. return [];
  17. end
  18. generated_key_values = {}
  19. skip_line_start_symbols = ["#", "/"]
  20. File.foreach(file_abs_path) do |line|
  21. next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
  22. plugin = line.split(pattern=separator)
  23. if plugin.length == 2
  24. podname = plugin[0].strip()
  25. path = plugin[1].strip()
  26. podpath = File.expand_path("#{path}", file_abs_path)
  27. generated_key_values[podname] = podpath
  28. else
  29. puts "Invalid plugin specification: #{line}"
  30. end
  31. end
  32. generated_key_values
  33. end
  34. target 'Runner' do
  35. # Flutter Pod
  36. copied_flutter_dir = File.join(__dir__, 'Flutter')
  37. copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
  38. copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
  39. unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
  40. # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
  41. # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
  42. # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
  43. generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
  44. unless File.exist?(generated_xcode_build_settings_path)
  45. raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  46. end
  47. generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
  48. cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];
  49. unless File.exist?(copied_framework_path)
  50. FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
  51. end
  52. unless File.exist?(copied_podspec_path)
  53. FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
  54. end
  55. end
  56. # Keep pod path relative so it can be checked into Podfile.lock.
  57. pod 'Flutter', :path => 'Flutter'
  58. # Plugin Pods
  59. # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
  60. # referring to absolute paths on developers' machines.
  61. system('rm -rf .symlinks')
  62. system('mkdir -p .symlinks/plugins')
  63. plugin_pods = parse_KV_file('../.flutter-plugins')
  64. plugin_pods.each do |name, path|
  65. symlink = File.join('.symlinks', 'plugins', name)
  66. File.symlink(path, symlink)
  67. pod name, :path => File.join(symlink, 'ios')
  68. end
  69. end
  70. # Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
  71. install! 'cocoapods', :disable_input_output_paths => true
  72. post_install do |installer|
  73. installer.pods_project.targets.each do |target|
  74. target.build_configurations.each do |config|
  75. config.build_settings['ENABLE_BITCODE'] = 'NO'
  76. end
  77. end
  78. end