dev
text 60 lines 2.08 KB
Raw
1 platform :osx, '12.0'
2
3 # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
4 ENV['COCOAPODS_DISABLE_STATS'] = 'true'
5
6 project 'Runner', {
7 'Debug' => :debug,
8 'Profile' => :release,
9 'Release' => :release,
10 }
11
12 def flutter_root
13 generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
14 unless File.exist?(generated_xcode_build_settings_path)
15 raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
16 end
17
18 File.foreach(generated_xcode_build_settings_path) do |line|
19 matches = line.match(/FLUTTER_ROOT\=(.*)/)
20 return matches[1].strip if matches
21 end
22 raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
23 end
24
25 require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
26
27 flutter_macos_podfile_setup
28
29 target 'Runner' do
30 use_frameworks!
31 use_modular_headers!
32
33 flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
34 end
35
36 post_install do |installer|
37 installer.pods_project.targets.each do |target|
38 flutter_additional_macos_build_settings(target)
39
40 target.build_configurations.each do |config|
41 config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '12.0'
42 end
43 end
44
45 installer.aggregate_targets.each do |target|
46 target.xcconfigs.each do |variant, xcconfig|
47 xcconfig_path = target.client_root + target.xcconfig_relative_path(variant)
48 IO.write(xcconfig_path, IO.read(xcconfig_path).gsub("DT_TOOLCHAIN_DIR", "TOOLCHAIN_DIR"))
49 end
50 end
51
52 installer.pods_project.targets.each do |target|
53 target.build_configurations.each do |config|
54 if config.base_configuration_reference.is_a? Xcodeproj::Project::Object::PBXFileReference
55 xcconfig_path = config.base_configuration_reference.real_path
56 IO.write(xcconfig_path, IO.read(xcconfig_path).gsub("DT_TOOLCHAIN_DIR", "TOOLCHAIN_DIR"))
57 end
58 end
59 end
60 end