97 lines
3.4 KiB
Ruby
97 lines
3.4 KiB
Ruby
platform :ios, '12.0'
|
|
|
|
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
|
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
|
|
|
project 'Runner', {
|
|
'Debug' => :debug,
|
|
'Profile' => :release,
|
|
'Release' => :release,
|
|
}
|
|
|
|
def flutter_root
|
|
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
|
|
unless File.exist?(generated_xcode_build_settings_path)
|
|
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
|
|
end
|
|
|
|
File.foreach(generated_xcode_build_settings_path) do |line|
|
|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
|
|
return matches[1].strip if matches
|
|
end
|
|
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
|
|
end
|
|
|
|
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
|
|
|
|
flutter_ios_podfile_setup
|
|
|
|
target 'Runner' do
|
|
use_frameworks!
|
|
use_modular_headers!
|
|
|
|
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
|
|
|
|
# Unity集成
|
|
pod 'UnityLibrary', :path => 'UnityLibrary'
|
|
|
|
target 'RunnerTests' do
|
|
inherit! :search_paths
|
|
end
|
|
|
|
# 添加UnityLibrary的特殊配置
|
|
post_install do |installer|
|
|
installer.pods_project.targets.each do |target|
|
|
flutter_additional_ios_build_settings(target)
|
|
|
|
# Unity资源复制配置
|
|
if target.name == 'UnityLibrary'
|
|
target.build_phases.each do |phase|
|
|
if phase.respond_to?(:name) && phase.name == 'Copy Bundle Resources'
|
|
phase.files_references.uniq!
|
|
end
|
|
end
|
|
end
|
|
|
|
# 为所有目标添加必要的iOS设置
|
|
target.build_configurations.each do |config|
|
|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
|
|
|
|
# 禁用位码
|
|
config.build_settings['ENABLE_BITCODE'] = 'NO'
|
|
|
|
# Unity和Flutter集成配置
|
|
if ['flutter_unity_widget', 'UnityLibrary'].include?(target.name)
|
|
config.build_settings['CLANG_ENABLE_MODULES'] = 'YES'
|
|
config.build_settings['DEFINES_MODULE'] = 'YES'
|
|
config.build_settings['SWIFT_INCLUDE_PATHS'] = [
|
|
'$(inherited)',
|
|
'${PODS_ROOT}/../UnityLibrary',
|
|
'${PODS_ROOT}/../UnityLibrary/UnityFramework'
|
|
]
|
|
|
|
config.build_settings['HEADER_SEARCH_PATHS'] = [
|
|
'$(inherited)',
|
|
'${PODS_ROOT}/../UnityLibrary',
|
|
'${PODS_ROOT}/../UnityLibrary/UnityFramework',
|
|
'${PODS_ROOT}/../UnityLibrary/Classes'
|
|
]
|
|
|
|
config.build_settings['FRAMEWORK_SEARCH_PATHS'] = [
|
|
'$(inherited)',
|
|
'${PODS_ROOT}/../UnityLibrary',
|
|
'${PODS_ROOT}/../UnityLibrary/Frameworks'
|
|
]
|
|
|
|
# 模块相关设置
|
|
config.build_settings['MODULEMAP_FILE'] = '${PODS_ROOT}/../UnityLibrary/UnityFramework/module.modulemap'
|
|
config.build_settings['PRODUCT_MODULE_NAME'] = 'UnityFramework'
|
|
|
|
# 其他必要设置
|
|
config.build_settings['SWIFT_VERSION'] = '5.0'
|
|
config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'YES'
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end |