基础组件库
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.
 
 
 
 
 

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