Class: Fastlane::Actions::RmDerivedDataAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::RmDerivedDataAction
- Defined in:
- lib/fastlane/plugin/rm_derived_data/actions/rm_derived_data_action.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .return_value ⇒ Object
- .rm_files ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
78 79 80 |
# File 'lib/fastlane/plugin/rm_derived_data/actions/rm_derived_data_action.rb', line 78 def self. ["xiongzenghui"] end |
.available_options ⇒ Object
90 91 92 93 94 95 96 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 |
# File 'lib/fastlane/plugin/rm_derived_data/actions/rm_derived_data_action.rb', line 90 def self. [ FastlaneCore::ConfigItem.new( key: :derived_data, description: '/path/to/DerivedData/*. like: ~/Library/Developer/Xcode/DerivedData/', optional: true, conflicting_options: [:workspace, :xcodeproj] ), FastlaneCore::ConfigItem.new( key: :xcodeproj, description: '/path/to/xx.xcodeproj', optional: true, conflicting_options: [:workspace] ), FastlaneCore::ConfigItem.new( key: :workspace, description: '/path/to/xx.xcworkspace', optional: true, conflicting_options: [:xcodeproj] ), FastlaneCore::ConfigItem.new( key: :scheme, description: 'The project or workspace scheme', optional: true ), FastlaneCore::ConfigItem.new( key: :module_cache_noindex, description: '~/Library/Developer/Xcode/DerivedData/ModuleCache.noindex', optional: true, is_string: false, default_value: false ) ] end |
.description ⇒ Object
74 75 76 |
# File 'lib/fastlane/plugin/rm_derived_data/actions/rm_derived_data_action.rb', line 74 def self.description "after build finish remove xx.xcworkspace/xx.xcodeproj specify DerivedDatagst/*" end |
.details ⇒ Object
86 87 88 |
# File 'lib/fastlane/plugin/rm_derived_data/actions/rm_derived_data_action.rb', line 86 def self.details "after build finish remove xx.xcworkspace/xx.xcodeproj specify DerivedDatagst/xx" end |
.is_supported?(platform) ⇒ Boolean
125 126 127 |
# File 'lib/fastlane/plugin/rm_derived_data/actions/rm_derived_data_action.rb', line 125 def self.is_supported?(platform) platform == :ios end |
.return_value ⇒ Object
82 83 84 |
# File 'lib/fastlane/plugin/rm_derived_data/actions/rm_derived_data_action.rb', line 82 def self.return_value # If your method provides a return value, you can describe here what it does end |
.rm_files ⇒ Object
71 72 |
# File 'lib/fastlane/plugin/rm_derived_data/actions/rm_derived_data_action.rb', line 71 def self.rm_files end |
.run(params) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 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 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/fastlane/plugin/rm_derived_data/actions/rm_derived_data_action.rb', line 7 def self.run(params) require 'json' require 'fileutils' derived_data = params[:derived_data] xcodeproj = params[:xcodeproj] workspace = params[:workspace] scheme = params[:scheme] module_cache_noindex = params[:module_cache_noindex] UI.success("derived_data=#{derived_data}") UI.success("xcodeproj=#{xcodeproj}") UI.success("workspace=#{workspace}") UI.success("scheme=#{scheme}") UI.success("module_cache_noindex=#{module_cache_noindex}") if derived_data FileUtils.rm_rf(derived_data) UI.success("[RmDerivedDataAction] remove DerivedData success ✅") return true end if !xcodeproj && !workspace UI.user_error!("xcodeproj or workspace must give one ❌") end UI.user_error!("no scheme given ❌") unless scheme if xcodeproj # xcodebuild -showBuildSettings -project xx.xcodeproj -scheme xx -json str = Actions.sh("xcodebuild -showBuildSettings -project #{xcodeproj} -scheme #{scheme} -json") end if workspace # xcodebuild -showBuildSettings -workspace xx.xcworkspace -scheme xx -json str = Actions.sh("xcodebuild -showBuildSettings -workspace #{workspace} -scheme #{scheme} -json") end arr = JSON.parse(str) # UI.success(arr) if arr.empty? UI.user_error!("#{scheme} no buildSettings found ❌") return false end build_settings = arr[0]['buildSettings'] # UI.success(build_settings) ## DerivedData/DemoHaha-aojcutdqufwalmdppnjqhcygatiz build_root = build_settings['BUILD_ROOT'] build_root = build_root.gsub('/Build/Products', '') UI.important("[RmDerivedDataAction] remove DerivedData: #{build_root} ... 🔵") FileUtils.rm_rf(build_root) UI.success("[RmDerivedDataAction] remove DerivedData success ✅") ## DerivedData/ModuleCache.noindex if module_cache_noindex module_cache_noindex_dir = build_settings['MODULE_CACHE_DIR'] UI.important("[RmDerivedDataAction] remove ModuleCache.noindex: #{module_cache_noindex_dir} ... 🔵") FileUtils.rm_rf(module_cache_noindex_dir) UI.success("[RmDerivedDataAction] remove ModuleCache.noindex success ✅") end return true end |