基础组件库
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 

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