diff --git a/CHANGELOG.md b/CHANGELOG.md index b96b9b51f..047dd37e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,8 @@ _None_ ### Internal Changes -_None_ +- Improved efficiency and refined the logs of the `promo_screenshots` action. [#685] +- Updated minimum Fastlane requirement to 2.231.0. [#685] ## 13.8.1 diff --git a/Gemfile.lock b/Gemfile.lock index 63da3e27c..895febed5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,7 +6,7 @@ PATH buildkit (~> 1.5) chroma (= 0.2.0) diffy (~> 3.3) - fastlane (~> 2.213) + fastlane (~> 2.231) git (~> 1.3) google-cloud-storage (~> 1.31) java-properties (~> 0.3.0) @@ -22,10 +22,8 @@ PATH GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.7) - base64 - nkf - rexml + CFPropertyList (3.0.8) + abbrev (0.1.2) activesupport (7.2.2.1) base64 benchmark (>= 0.3) @@ -38,8 +36,8 @@ GEM minitest (>= 5.1) securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) - addressable (2.8.7) - public_suffix (>= 2.0.2, < 7.0) + addressable (2.8.8) + public_suffix (>= 2.0.2, < 8.0) algoliasearch (1.27.5) httpclient (~> 2.8, >= 2.8.3) json (>= 1.5.1) @@ -47,8 +45,8 @@ GEM ast (2.4.2) atomos (0.1.3) aws-eventstream (1.4.0) - aws-partitions (1.1196.0) - aws-sdk-core (3.240.0) + aws-partitions (1.1206.0) + aws-sdk-core (3.241.4) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) @@ -56,19 +54,19 @@ GEM bigdecimal jmespath (~> 1, >= 1.6.1) logger - aws-sdk-kms (1.118.0) - aws-sdk-core (~> 3, >= 3.239.1) + aws-sdk-kms (1.121.0) + aws-sdk-core (~> 3, >= 3.241.4) aws-sigv4 (~> 1.5) - aws-sdk-s3 (1.208.0) - aws-sdk-core (~> 3, >= 3.234.0) + aws-sdk-s3 (1.212.0) + aws-sdk-core (~> 3, >= 3.241.4) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.5) aws-sigv4 (1.12.1) aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) - base64 (0.3.0) + base64 (0.2.0) benchmark (0.4.0) - bigdecimal (3.1.9) + bigdecimal (4.0.1) buildkit (1.6.1) sawyer (>= 0.6) buildkite-test_collector (2.9.0) @@ -129,6 +127,7 @@ GEM crack (1.0.0) bigdecimal rexml + csv (3.3.5) danger (9.5.1) base64 (~> 0.2) claide (~> 1.0) @@ -179,16 +178,16 @@ GEM faraday-rack (~> 1.0) faraday-retry (~> 1.0) ruby2_keywords (>= 0.0.4) - faraday-cookie_jar (0.0.7) + faraday-cookie_jar (0.0.8) faraday (>= 0.8.0) - http-cookie (~> 1.0.0) + http-cookie (>= 1.0.0) faraday-em_http (1.0.0) - faraday-em_synchrony (1.0.0) + faraday-em_synchrony (1.0.1) faraday-excon (1.1.0) faraday-http-cache (2.5.1) faraday (>= 0.8) faraday-httpclient (1.0.1) - faraday-multipart (1.1.0) + faraday-multipart (1.2.0) multipart-post (~> 2.0) faraday-net_http (1.0.2) faraday-net_http_persistent (1.2.0) @@ -198,15 +197,18 @@ GEM faraday_middleware (1.2.1) faraday (~> 1.0) fastimage (2.4.0) - fastlane (2.227.0) + fastlane (2.231.0) CFPropertyList (>= 2.3, < 4.0.0) + abbrev (~> 0.1.2) addressable (>= 2.8, < 3.0.0) artifactory (~> 3.0) aws-sdk-s3 (~> 1.0) babosa (>= 1.0.3, < 2.0.0) - bundler (>= 1.12.0, < 3.0.0) + base64 (~> 0.2.0) + bundler (>= 1.17.3, < 5.0.0) colored (~> 1.2) commander (~> 4.6) + csv (~> 3.3) dotenv (>= 2.1.1, < 3.0.0) emoji_regex (>= 0.1, < 4.0) excon (>= 0.71.0, < 1.0.0) @@ -224,9 +226,12 @@ GEM http-cookie (~> 1.0.5) json (< 3.0.0) jwt (>= 2.1.0, < 3) + logger (>= 1.6, < 2.0) mini_magick (>= 4.9.4, < 5.0.0) multipart-post (>= 2.0.0, < 3.0.0) + mutex_m (~> 0.3.0) naturally (~> 2.2) + nkf (~> 0.2.0) optparse (>= 0.1.1, < 1.0.0) plist (>= 3.1.0, < 4.0.0) rubyzip (>= 2.0.0, < 3.0.0) @@ -238,7 +243,7 @@ GEM tty-spinner (>= 0.8.0, < 1.0.0) word_wrap (~> 1.0.0) xcodeproj (>= 1.13.0, < 2.0.0) - xcpretty (~> 0.4.0) + xcpretty (~> 0.4.1) xcpretty-travis-formatter (>= 0.0.3, < 2.0.0) fastlane-sirp (1.0.0) sysrandom (~> 1.0) @@ -295,8 +300,8 @@ GEM concurrent-ruby (~> 1.0) java-properties (0.3.0) jmespath (1.6.2) - json (2.10.2) - jwt (2.10.1) + json (2.18.0) + jwt (2.10.2) base64 kramdown (2.5.1) rexml (>= 3.3.9) @@ -304,19 +309,19 @@ GEM kramdown (~> 2.0) language_server-protocol (3.17.0.4) lint_roller (1.1.0) - logger (1.6.6) + logger (1.7.0) method_source (0.9.2) mini_magick (4.13.2) mini_mime (1.1.5) mini_portile2 (2.8.9) minitest (5.25.5) molinillo (0.8.0) - multi_json (1.15.0) + multi_json (1.19.1) multipart-post (2.4.1) mutex_m (0.3.0) nanaimo (0.4.0) nap (1.1.0) - naturally (2.2.1) + naturally (2.3.0) netrc (0.11.0) nkf (0.2.0) nokogiri (1.18.9) @@ -328,7 +333,7 @@ GEM sawyer (~> 0.9) open4 (1.3.4) options (2.3.2) - optparse (0.6.0) + optparse (0.8.1) os (1.1.4) parallel (1.26.3) parser (3.3.7.1) @@ -346,7 +351,7 @@ GEM public_suffix (4.0.7) racc (1.8.1) rainbow (3.1.1) - rake (13.2.1) + rake (13.3.1) rake-compiler (1.2.9) rake rchardet (1.9.0) @@ -356,7 +361,7 @@ GEM trailblazer-option (>= 0.1.1, < 0.2.0) uber (< 0.2.0) retriable (3.1.2) - rexml (3.4.2) + rexml (3.4.4) rmagick (5.5.0) observer (~> 0.1) pkg-config (~> 1.4) @@ -400,10 +405,10 @@ GEM faraday (>= 0.17.3, < 3) securerandom (0.4.1) security (0.1.5) - signet (0.19.0) + signet (0.21.0) addressable (~> 2.8) faraday (>= 0.17.5, < 3.a) - jwt (>= 1.5, < 3.0) + jwt (>= 1.5, < 4.0) multi_json (~> 1.10) simctl (1.6.10) CFPropertyList @@ -440,7 +445,7 @@ GEM colored2 (~> 3.1) nanaimo (~> 0.4.0) rexml (>= 3.3.6, < 4.0) - xcpretty (0.4.0) + xcpretty (0.4.1) rouge (~> 3.28.0) xcpretty-travis-formatter (1.0.1) xcpretty (~> 0.2, >= 0.0.7) diff --git a/fastlane-plugin-wpmreleasetoolkit.gemspec b/fastlane-plugin-wpmreleasetoolkit.gemspec index 045b252f4..cf8b14ce3 100644 --- a/fastlane-plugin-wpmreleasetoolkit.gemspec +++ b/fastlane-plugin-wpmreleasetoolkit.gemspec @@ -30,7 +30,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'buildkit', '~> 1.5' spec.add_dependency 'chroma', '0.2.0' spec.add_dependency 'diffy', '~> 3.3' - spec.add_dependency 'fastlane', '~> 2.213' + spec.add_dependency 'fastlane', '~> 2.231' spec.add_dependency 'git', '~> 1.3' spec.add_dependency 'java-properties', '~> 0.3.0' spec.add_dependency 'nokogiri', '~> 1.11' diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/promo_screenshots_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/promo_screenshots_action.rb index 2fa613079..131222984 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/promo_screenshots_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/promo_screenshots_action.rb @@ -62,6 +62,8 @@ def self.run(params) UI.message("Unable to find device #{entry['device']}.") if device.nil? + UI.verbose("Processing entry:\n#{JSON.pretty_generate(entry)}") + width = device['canvas_size'][0] height = device['canvas_size'][1] @@ -93,7 +95,7 @@ def self.confirm_directory_overwrite(path, description) FileUtils.rm_rf(path) Dir.mkdir(path) else - UI.user_error!("Exiting to avoid overwriting #{description}.") + UI.abort_with_message!("Exiting to avoid overwriting #{description}.") end else Dir.mkdir(path) diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb index 38fdab80c..7dae1559d 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb @@ -33,7 +33,13 @@ def initialize UI.user_error!(message) end - UI.user_error!('`drawText` not found – install it using `brew install automattic/build-tools/drawText`.') unless system('command -v drawText') + UI.user_error!('`drawText` not found – install it using `brew install automattic/build-tools/drawText`.') unless self.class.draw_text_available? + end + + def self.draw_text_available? + return @draw_text_available if defined?(@draw_text_available) + + @draw_text_available = system('command -v drawText', %i[out err] => File::NULL) end def read_config(config_file_path) @@ -287,7 +293,17 @@ def draw_text_to_canvas(canvas, text, width, height, x_position, y_position, fon begin temp_text_file = Tempfile.new - Action.sh('drawText', "html=#{text}", "maxWidth=#{width}", "maxHeight=#{height}", "output=#{temp_text_file.path}", "fontSize=#{font_size}", "stylesheet=#{stylesheet_path}", "alignment=#{position}") + Actions.sh( + 'drawText', + "html=#{text}", + "maxWidth=#{width}", + "maxHeight=#{height}", + "output=#{temp_text_file.path}", + "fontSize=#{font_size}", + "stylesheet=#{stylesheet_path}", + "alignment=#{position}", + log: false + ) text_content = open_image(temp_text_file.path).trim text_frame = create_image(width, height) @@ -407,8 +423,8 @@ def create_image(width, height, background = 'transparent') working_background = background.frozen? ? background.dup : background working_background.paint.to_hex - Image.new(width, height) do - self.background_color = working_background + Image.new(width, height) do |info| + info.background_color = working_background end end @@ -432,8 +448,12 @@ def resolve_path(path) return resolved_path if !resolved_path.nil? && resolved_path.exist? end - message = "Unable to locate #{path}" - UI.crash!(message) + message = <<~MESSAGE + Unable to locate #{path}. + + Did you run the automation to generate the screenshots? + MESSAGE + UI.user_error!(message) end def resolve_text_into_path(text, locale) @@ -444,6 +464,7 @@ def resolve_text_into_path(text, locale) elsif can_resolve_path(localized_file) resolve_path(localized_file).realpath.to_s else + UI.important("Could not identify '#{localized_file}' as a file path or the file was not found. Will use its value as a raw string. This may result in undesired annotations.") format(text, 'source') end end