Class: CocoaPodsMPaaS::PostInstallHookProcessor
- Inherits:
-
Object
- Object
- CocoaPodsMPaaS::PostInstallHookProcessor
- Defined in:
- lib/cocoapods-mPaaS/post_install_hook_processor.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Instance Method Summary collapse
- #apply_excluded_archs_to_pods_project ⇒ Object
- #apply_excluded_archs_to_user_project_targets ⇒ Object
-
#initialize(post_install_context) ⇒ PostInstallHookProcessor
constructor
A new instance of PostInstallHookProcessor.
Constructor Details
#initialize(post_install_context) ⇒ PostInstallHookProcessor
Returns a new instance of PostInstallHookProcessor.
7 8 9 |
# File 'lib/cocoapods-mPaaS/post_install_hook_processor.rb', line 7 def initialize(post_install_context) @context = post_install_context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
5 6 7 |
# File 'lib/cocoapods-mPaaS/post_install_hook_processor.rb', line 5 def context @context end |
Instance Method Details
#apply_excluded_archs_to_pods_project ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/cocoapods-mPaaS/post_install_hook_processor.rb', line 11 def apply_excluded_archs_to_pods_project LogTools.p "[cocoapods-mPaaS] Applying EXCLUDED_ARCHS to Pods project..." @context.pods_project.build_configurations.each do |config| config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" end @context.pods_project.save LogTools.p "[cocoapods-mPaaS] Applied EXCLUDED_ARCHS for simulator to Pods project." rescue => e LogTools.p_yellow "⚠️ [cocoapods-mPaaS] Failed to apply EXCLUDED_ARCHS to Pods project: #{e.}" end |
#apply_excluded_archs_to_user_project_targets ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/cocoapods-mPaaS/post_install_hook_processor.rb', line 22 def apply_excluded_archs_to_user_project_targets LogTools.p "[cocoapods-mPaaS] Applying EXCLUDED_ARCHS to user project targets..." @context.umbrella_targets.each do |umbrella_target_description| user_project = umbrella_target_description.user_project if user_project.nil? # 使用 cocoapods_target_label 来唯一标识 umbrella_target_description LogTools.p_yellow "⚠️ [cocoapods-mPaaS] Could not find user project for umbrella target: #{umbrella_target_description.cocoapods_target_label}!" next end # 使用 user_project.path.basename 来获取项目名称 project_name = user_project.path.basename.to_s LogTools.v "[cocoapods-mPaaS] Found user project: #{project_name} (Umbrella Target: #{umbrella_target_description.cocoapods_target_label})" if user_project.targets.empty? LogTools.p_yellow "[cocoapods-mPaaS] User project '#{project_name}' has no targets to modify!" next end user_project.targets.each do |target| LogTools.v " - Processing target: #{target.name} in project #{project_name}" target.build_configurations.each do |config| config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" end LogTools.v " - Applied EXCLUDED_ARCHS to target: #{target.name}" end user_project.save LogTools.v " [cocoapods-mPaaS] User project '#{project_name}' targets updated with EXCLUDED_ARCHS for simulator." end LogTools.p "✅ [cocoapods-mPaaS] All user project targets (across all umbrella targets) updated with EXCLUDED_ARCHS for simulator." rescue => e LogTools.p_yellow "⚠️ [cocoapods-mPaaS] Failed to apply EXCLUDED_ARCHS to user project targets: #{e.}" LogTools.p_yellow "⚠️ [cocoapods-mPaaS] Backtrace: #{e.backtrace.join("\n")}" end |