55require "semantic"
66require_relative "github_actions_helper"
77require_relative "git_helper"
8+ require_relative "embedded_files_helper"
89
910module Fastlane
1011 UI = FastlaneCore ::UI unless Fastlane . const_defined? ( :UI )
1112
1213 module Helper
13- # This class exceeds the maximum allowed length, so we should refactor it to reduce complexity.
14- # The rubocop exception has been added in a PR which only added one line to the class, so the
15- # work to refactor could be hardly justified, but we should prioritise refactoring in a dedicated
16- # PR or as soon as we touch this file with bigger changes.
17- # rubocop:disable Metrics/ClassLength
1814 class DdgAppleAutomationHelper
1915 DEFAULT_BRANCH = 'main'
2016 RELEASE_BRANCH = 'release'
@@ -27,21 +23,6 @@ class DdgAppleAutomationHelper
2723 VERSION_CONFIG_DEFINITION = 'MARKETING_VERSION'
2824 BUILD_NUMBER_CONFIG_DEFINITION = 'CURRENT_PROJECT_VERSION'
2925
30- UPGRADABLE_EMBEDDED_FILES = {
31- "ios" => Set . new ( [
32- 'Core/AppPrivacyConfigurationDataProvider.swift' ,
33- 'Core/AppTrackerDataSetProvider.swift' ,
34- 'Core/ios-config.json' ,
35- 'Core/trackerData.json'
36- ] ) ,
37- "macos" => Set . new ( [
38- 'DuckDuckGo/ContentBlocker/AppPrivacyConfigurationDataProvider.swift' ,
39- 'DuckDuckGo/ContentBlocker/AppTrackerDataSetProvider.swift' ,
40- 'DuckDuckGo/ContentBlocker/trackerData.json' ,
41- 'DuckDuckGo/ContentBlocker/macos-config.json'
42- ] )
43- } . freeze
44-
4526 def self . release_branch_name ( platform , version )
4627 "#{ RELEASE_BRANCH } /#{ platform } /#{ version } "
4728 end
@@ -232,37 +213,7 @@ def self.create_release_branch(platform, version)
232213 end
233214
234215 def self . update_embedded_files ( platform , other_action )
235- pre_update_embedded_tests
236- Actions . sh ( "./scripts/update_embedded.sh" )
237-
238- # Verify no unexpected files were modified
239- git_status = Actions . sh ( 'git' , 'status' )
240- modified_files = git_status . split ( "\n " ) . select { |line | line . include? ( 'modified:' ) }
241- modified_files = modified_files . map { |str | str . split ( ':' ) [ 1 ] . strip . delete_prefix ( '../' ) }
242-
243- modified_files . each do |modified_file |
244- UI . abort_with_message! ( "Unexpected change to #{ modified_file } ." ) unless UPGRADABLE_EMBEDDED_FILES [ platform ] . any? do |s |
245- s . include? ( modified_file )
246- end
247- end
248-
249- # Run tests (CI will run them separately)
250- # run_tests(scheme: 'DuckDuckGo Privacy Browser') unless Helper.is_ci?
251-
252- # Everything looks good: commit and push
253- unless modified_files . empty?
254- modified_files . each { |modified_file | Actions . sh ( 'git' , 'add' , modified_file . to_s ) }
255- Actions . sh ( 'git' , 'commit' , '-m' , 'Update embedded files' )
256- other_action . ensure_git_status_clean
257- end
258- end
259-
260- def pre_update_embedded_tests
261- tds_perf_test_result = other_action . tds_perf_test
262-
263- unless tds_perf_test_result
264- UI . important ( "TDS performance tests failed. Proceeding with caution." )
265- end
216+ Helper ::EmbeddedFilesHelper . update_embedded_files ( platform , other_action )
266217 end
267218
268219 def self . increment_build_number ( platform , options , other_action )
@@ -436,7 +387,6 @@ def self.load_file(file)
436387 end
437388 end
438389 end
439- # rubocop:enable Metrics/ClassLength
440390end
441391
442392module FastlaneCore
0 commit comments