基础组件库
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

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