Class: Pindo::Command::Ios::Fixproj
- Inherits:
-
Pindo::Command::Ios
- Object
- CLAide::Command
- Pindo::Command
- Pindo::Command::Ios
- Pindo::Command::Ios::Fixproj
- Defined in:
- lib/pindo/command/ios/fixproj.rb
Constant Summary
Constants inherited from Pindo::Command
DEFAULT_OPTIONS, DEFAULT_ROOT_OPTIONS
Instance Attribute Summary
Attributes inherited from Pindo::Command
Class Method Summary collapse
- .option_items ⇒ Object
-
.options ⇒ Object
命令的选项列表.
Instance Method Summary collapse
- #fix_project(project_dir) ⇒ Object
-
#initialize(argv) ⇒ Fixproj
constructor
A new instance of Fixproj.
- #run ⇒ Object
- #validate! ⇒ Object
Methods inherited from Pindo::Command
command_name, #initialize_options, run, use_cache?
Methods included from Funlog::Mixin
Methods included from Pindoconfig::Mixin
Constructor Details
#initialize(argv) ⇒ Fixproj
Returns a new instance of Fixproj.
47 48 49 50 51 52 53 |
# File 'lib/pindo/command/ios/fixproj.rb', line 47 def initialize(argv) # 获取位置参数(项目路径) @project_path = argv.shift_argument @options = (argv) @auto_mode = @options[:allproj] || false super(argv) end |
Class Method Details
.option_items ⇒ Object
38 39 40 |
# File 'lib/pindo/command/ios/fixproj.rb', line 38 def self.option_items @option_items ||= Pindo::Options::IosToolOptions.select(:allproj) end |
.options ⇒ Object
命令的选项列表
43 44 45 |
# File 'lib/pindo/command/ios/fixproj.rb', line 43 def self. option_items.map(&:to_claide_option).concat(super) end |
Instance Method Details
#fix_project(project_dir) ⇒ Object
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/pindo/command/ios/fixproj.rb', line 97 def fix_project(project_dir) unless Dir.glob(File.join(project_dir, "*.xcodeproj")).any? puts "\n错误:未找到 Xcode 项目 (*.xcodeproj),跳过: #{project_dir}" return end puts "\n开始修复 Xcode 项目问题..." puts "项目路径: #{project_dir}\n" # 1. 修复 Xcode 26 的 linker flags 问题 puts "\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" puts " 修复 Xcode 26 Linker Flags" puts "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n" begin Pindo::XcodeBuildHelper.fix_xcode16_linker_flags(project_dir: project_dir) rescue => e puts " ⚠️ 修复 Xcode 26 linker flags 失败: #{e.}" end # 2. 删除 Unity-iPhone 项目中的 Firebase Crashlytics 脚本 puts "\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" puts " 删除 Firebase Crashlytics 脚本" puts "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n" begin Pindo::XcodeBuildHelper.delete_libtarget_firebase_shell(project_dir) rescue => e puts " ⚠️ 删除 Firebase Crashlytics 脚本失败: #{e.}" end end |
#run ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/pindo/command/ios/fixproj.rb', line 59 def run # 检查并关闭 Xcode 进程 system("killall Xcode > /dev/null 2>&1") if @auto_mode files = [] # check current dir current_dir = Dir.pwd files << current_dir if Dir.glob(File.join(current_dir, "*.xcodeproj")).any? # check GoodPlatform/BaseiOS base_ios_dir = File.join(current_dir, "GoodPlatform/BaseiOS") if File.directory?(base_ios_dir) files << base_ios_dir if Dir.glob(File.join(base_ios_dir, "*.xcodeproj")).any? end if files.empty? puts "未找到相关的 iOS 项目 (Checked: Current Dir & GoodPlatform/BaseiOS)" else files.each do |proj| fix_project(proj) end end else # 确定项目路径 project_dir = @project_path && !@project_path.empty? ? @project_path : Dir.pwd project_dir = File.(project_dir) unless File.directory?(project_dir) raise Informative, "项目路径不存在: #{project_dir}" end fix_project(project_dir) end puts "\n✅ 项目修复完成!\n" end |
#validate! ⇒ Object
55 56 57 |
# File 'lib/pindo/command/ios/fixproj.rb', line 55 def validate! super end |