|
|
|
@ -40,6 +40,45 @@ target 'Runner' do |
|
|
|
end |
|
|
|
|
|
|
|
post_install do |installer| |
|
|
|
# ---- Auto patch: bump FlutterGeneratedPluginSwiftPackage iOS platform ---- |
|
|
|
# Flutter 生成的中介包总是写死 .iOS("12.0"),与 Podfile 中的 |
|
|
|
# platform :ios, '16.0' 不一致,会报 |
|
|
|
# "requires minimum platform version 15.0/16.0 ... but this target supports 12.0"。 |
|
|
|
# 这里自动同步为 16.0。 |
|
|
|
generated_pkg = File.expand_path( |
|
|
|
'Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage/Package.swift', __dir__) |
|
|
|
if File.exist?(generated_pkg) |
|
|
|
content = File.read(generated_pkg) |
|
|
|
new_content = content.gsub(/\.iOS\("\d+\.\d+"\)/, '.iOS("16.0")') |
|
|
|
if new_content != content |
|
|
|
File.write(generated_pkg, new_content) |
|
|
|
puts '[Podfile patch] Bumped FlutterGeneratedPluginSwiftPackage iOS platform to 16.0' |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
# ---- Auto patch: comment out illegal `<netinet6/in6.h>` imports in all Pods sources ---- |
|
|
|
# 新版 Xcode 模块校验禁止跨模块引用私有头 `<netinet6/in6.h>` |
|
|
|
# `<netinet/in.h>` 已包含全部 IPv6 定义,注释掉即可。 |
|
|
|
pods_dir = File.expand_path('Pods', __dir__) |
|
|
|
if Dir.exist?(pods_dir) |
|
|
|
patched_files = [] |
|
|
|
Dir.glob(File.join(pods_dir, '**', '*.{m,mm,h,hpp,c,cpp}')).each do |file| |
|
|
|
content = File.read(file) |
|
|
|
new_content = content.gsub( |
|
|
|
/^[ \t]*#\s*(?:import|include)\s*<netinet6\/in6\.h>.*$/, |
|
|
|
'// \0 // patched: private header, covered by <netinet/in.h>' |
|
|
|
) |
|
|
|
if new_content != content |
|
|
|
File.write(file, new_content) |
|
|
|
patched_files << file.sub(pods_dir + '/', '') |
|
|
|
end |
|
|
|
end |
|
|
|
unless patched_files.empty? |
|
|
|
puts "[Podfile patch] Commented out <netinet6/in6.h> imports in #{patched_files.size} file(s):" |
|
|
|
patched_files.each { |f| puts " - #{f}" } |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
installer.pods_project.targets.each do |target| |
|
|
|
flutter_additional_ios_build_settings(target) |
|
|
|
|
|
|
|
|