fastlane-plugin-wpmreleasetoolkit 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +339 -0
  3. data/README.md +38 -0
  4. data/bin/drawText +19 -0
  5. data/ext/drawText/extconf.rb +36 -0
  6. data/lib/fastlane/plugin/wpmreleasetoolkit.rb +16 -0
  7. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/README.md +20 -0
  8. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_localize_libs_action.rb +53 -0
  9. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_update_metadata_source_action.rb +171 -0
  10. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_validate_lib_strings_action.rb +63 -0
  11. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb +103 -0
  12. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_build_prechecks.rb +83 -0
  13. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_build_preflight.rb +54 -0
  14. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_beta.rb +69 -0
  15. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_final_release.rb +58 -0
  16. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_hotfix.rb +77 -0
  17. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_release.rb +89 -0
  18. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_codefreeze_prechecks.rb +79 -0
  19. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_completecodefreeze_prechecks.rb +68 -0
  20. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_xml_release_notes.rb +63 -0
  21. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_current_branch_is_hotfix.rb +44 -0
  22. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_file_by_version.rb +79 -0
  23. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_translations_action.rb +115 -0
  24. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb +71 -0
  25. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_alpha_version.rb +44 -0
  26. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_app_version.rb +44 -0
  27. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_release_version.rb +44 -0
  28. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_hotifx_prechecks.rb +78 -0
  29. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_merge_translators_strings.rb +106 -0
  30. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_tag_build.rb +51 -0
  31. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_metadata.rb +52 -0
  32. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_release_notes.rb +56 -0
  33. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/circleci_trigger_job_action.rb +63 -0
  34. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/close_milestone_action.rb +56 -0
  35. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_new_milestone_action.rb +59 -0
  36. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_action.rb +91 -0
  37. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/extract_release_notes_for_version_action.rb +89 -0
  38. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_list_action.rb +64 -0
  39. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_downloadmetadata_action.rb +90 -0
  40. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_update_metadata_source.rb +170 -0
  41. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/promo_screenshots_action.rb +247 -0
  42. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/removebranchprotection_action.rb +57 -0
  43. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/setbranchprotection_action.rb +56 -0
  44. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/setfrozentag_action.rb +81 -0
  45. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_add_files_to_copy_action.rb +96 -0
  46. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_apply_action.rb +139 -0
  47. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_download_action.rb +57 -0
  48. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_setup_action.rb +86 -0
  49. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_update_action.rb +139 -0
  50. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_validate_action.rb +134 -0
  51. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_development_certificates_to_provisioning_profiles.rb +77 -0
  52. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_devices_to_provisioning_profiles.rb +79 -0
  53. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_betabuild_prechecks.rb +92 -0
  54. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_build_prechecks.rb +74 -0
  55. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_build_preflight.rb +78 -0
  56. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_beta.rb +68 -0
  57. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_hotfix.rb +87 -0
  58. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb +114 -0
  59. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_check_beta_deps.rb +62 -0
  60. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_clear_intermediate_tags.rb +60 -0
  61. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_codefreeze_prechecks.rb +70 -0
  62. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_completecodefreeze_prechecks.rb +63 -0
  63. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_current_branch_is_hotfix.rb +40 -0
  64. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_final_tag.rb +52 -0
  65. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_finalize_prechecks.rb +64 -0
  66. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_app_version.rb +47 -0
  67. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_build_version.rb +60 -0
  68. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb +121 -0
  69. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_hotifx_prechecks.rb +78 -0
  70. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb +167 -0
  71. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_localize_project.rb +44 -0
  72. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_merge_translators_strings.rb +93 -0
  73. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_tag_build.rb +44 -0
  74. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata.rb +40 -0
  75. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata_source.rb +81 -0
  76. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_release_notes.rb +56 -0
  77. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_validate_ci_build.rb +46 -0
  78. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/an_metadata_update_helper.rb +152 -0
  79. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_git_helper.rb +44 -0
  80. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb +359 -0
  81. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_version_helper.rb +475 -0
  82. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ci_helper.rb +91 -0
  83. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb +282 -0
  84. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/encryption_helper.rb +51 -0
  85. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/filesystem_helper.rb +93 -0
  86. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb +224 -0
  87. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb +135 -0
  88. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_adc_app_sizes_helper.rb +74 -0
  89. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_git_helper.rb +80 -0
  90. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_helper.rb +208 -0
  91. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_version_helper.rb +348 -0
  92. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_download_helper.rb +107 -0
  93. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_update_helper.rb +182 -0
  94. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb +399 -0
  95. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/release_notes_helper.rb +21 -0
  96. data/lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb +40 -0
  97. data/lib/fastlane/plugin/wpmreleasetoolkit/models/file_reference.rb +86 -0
  98. data/lib/fastlane/plugin/wpmreleasetoolkit/version.rb +5 -0
  99. metadata +449 -0
@@ -0,0 +1,44 @@
1
+ module Fastlane
2
+ module Actions
3
+ class IosTagBuildAction < Action
4
+ def self.run(params)
5
+ require_relative '../../helper/ios/ios_version_helper.rb'
6
+ require_relative '../../helper/ios/ios_git_helper.rb'
7
+
8
+ itc_ver = Fastlane::Helper::Ios::VersionHelper.get_build_version()
9
+ int_ver = Fastlane::Helper::Ios::VersionHelper.get_internal_version() unless ENV['INTERNAL_CONFIG_FILE'].nil?
10
+ Fastlane::Helper::GitHelper.create_tag(itc_ver)
11
+ Fastlane::Helper::GitHelper.create_tag(int_ver) unless int_ver.nil?
12
+ end
13
+
14
+ #####################################################
15
+ # @!group Documentation
16
+ #####################################################
17
+
18
+ def self.description
19
+ 'Tags the current build'
20
+ end
21
+
22
+ def self.details
23
+ 'Tags the current build'
24
+ end
25
+
26
+ def self.available_options
27
+ end
28
+
29
+ def self.output
30
+ end
31
+
32
+ def self.return_value
33
+ end
34
+
35
+ def self.authors
36
+ ['loremattei']
37
+ end
38
+
39
+ def self.is_supported?(platform)
40
+ platform == :ios
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,40 @@
1
+ module Fastlane
2
+ module Actions
3
+ class IosUpdateMetadataAction < Action
4
+ def self.run(params)
5
+ require_relative '../../helper/ios/ios_git_helper.rb'
6
+
7
+ Fastlane::Helper::Ios::GitHelper.update_metadata()
8
+ end
9
+
10
+ #####################################################
11
+ # @!group Documentation
12
+ #####################################################
13
+
14
+ def self.description
15
+ 'Downloads translated metadata from the translation system'
16
+ end
17
+
18
+ def self.details
19
+ 'Downloads translated metadata from the translation system'
20
+ end
21
+
22
+ def self.available_options
23
+ end
24
+
25
+ def self.output
26
+ end
27
+
28
+ def self.return_value
29
+ end
30
+
31
+ def self.authors
32
+ ['loremattei']
33
+ end
34
+
35
+ def self.is_supported?(platform)
36
+ platform == :ios
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,81 @@
1
+ module Fastlane
2
+ module Actions
3
+ class IosUpdateMetadataSourceAction < Action
4
+ def self.run(params)
5
+ # Check local repo status
6
+ other_action.ensure_git_status_clean()
7
+
8
+ other_action.gp_update_metadata_source(po_file_path: params[:po_file_path],
9
+ source_files: params[:source_files],
10
+ release_version: params[:release_version])
11
+
12
+ Action.sh("git add #{params[:po_file_path]}")
13
+ params[:source_files].each do |_key, file|
14
+ Action.sh("git add #{file}")
15
+ end
16
+
17
+ repo_status = Actions.sh('git status --porcelain')
18
+ repo_clean = repo_status.empty?
19
+ unless repo_clean
20
+ Action.sh('git commit -m "Update metadata strings"')
21
+ Action.sh('git push')
22
+ end
23
+ end
24
+
25
+ #####################################################
26
+ # @!group Documentation
27
+ #####################################################
28
+
29
+ def self.description
30
+ 'Updates the AppStoreStrings.po file with the data from text source files'
31
+ end
32
+
33
+ def self.details
34
+ 'Updates the AppStoreStrings.po file with the data from text source files'
35
+ end
36
+
37
+ def self.available_options
38
+ # Define all options your action supports.
39
+
40
+ # Below a few examples
41
+ [
42
+ FastlaneCore::ConfigItem.new(key: :po_file_path,
43
+ env_name: 'FL_IOS_UPDATE_METADATA_SOURCE_PO_FILE_PATH',
44
+ description: 'The path of the .po file to update',
45
+ is_string: true,
46
+ verify_block: proc do |value|
47
+ UI.user_error!("No .po file path for UpdateMetadataSourceAction given, pass using `po_file_path: 'file path'`") unless value && (!value.empty?)
48
+ UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
49
+ end),
50
+ FastlaneCore::ConfigItem.new(key: :release_version,
51
+ env_name: 'FL_IOS_UPDATE_METADATA_SOURCE_RELEASE_VERSION',
52
+ description: 'The release version of the app (to use to mark the release notes)',
53
+ verify_block: proc do |value|
54
+ UI.user_error!("No relase version for UpdateMetadataSourceAction given, pass using `release_version: 'version'`") unless value && (!value.empty?)
55
+ end),
56
+ FastlaneCore::ConfigItem.new(key: :source_files,
57
+ env_name: 'FL_IOS_UPDATE_METADATA_SOURCE_SOURCE_FILES',
58
+ description: 'The hash with the path to the source files and the key to use to include their content',
59
+ is_string: false,
60
+ verify_block: proc do |value|
61
+ UI.user_error!("No source file hash for UpdateMetadataSourceAction given, pass using `source_files: 'source file hash'`") unless value && (!value.empty?)
62
+ end),
63
+ ]
64
+ end
65
+
66
+ def self.output
67
+ end
68
+
69
+ def self.return_value
70
+ end
71
+
72
+ def self.authors
73
+ ['loremattei']
74
+ end
75
+
76
+ def self.is_supported?(platform)
77
+ platform == :ios
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,56 @@
1
+ module Fastlane
2
+ module Actions
3
+ class IosUpdateReleaseNotesAction < Action
4
+ def self.run(params)
5
+ UI.message 'Updating the release notes...'
6
+
7
+ require_relative '../../helper/ios/ios_version_helper.rb'
8
+ require_relative '../../helper/release_notes_helper.rb'
9
+ require_relative '../../helper/git_helper.rb'
10
+
11
+ path = File.join(ENV['PROJECT_ROOT_FOLDER'] || '.', 'RELEASE-NOTES.txt')
12
+ next_version = Fastlane::Helper::Ios::VersionHelper.calc_next_release_version(params[:new_version])
13
+
14
+ Fastlane::Helper::ReleaseNotesHelper.add_new_section(path: path, section_title: next_version)
15
+ Fastlane::Helper::GitHelper.commit(message: "Release Notes: add new section for next version (#{next_version})", files: path, push: true)
16
+
17
+ UI.message 'Done.'
18
+ end
19
+
20
+ #####################################################
21
+ # @!group Documentation
22
+ #####################################################
23
+
24
+ def self.description
25
+ 'Updates the release notes file for the next app version'
26
+ end
27
+
28
+ def self.details
29
+ 'Updates the release notes file for the next app version'
30
+ end
31
+
32
+ def self.available_options
33
+ [
34
+ FastlaneCore::ConfigItem.new(key: :new_version,
35
+ env_name: 'FL_IOS_UPDATE_RELEASE_NOTES_VERSION',
36
+ description: 'The version we are currently freezing; An empty entry for the _next_ version after this one will be added to the release notes',
37
+ is_string: true),
38
+ ]
39
+ end
40
+
41
+ def self.output
42
+ end
43
+
44
+ def self.return_value
45
+ end
46
+
47
+ def self.authors
48
+ ['loremattei']
49
+ end
50
+
51
+ def self.is_supported?(platform)
52
+ platform == :ios
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,46 @@
1
+ module Fastlane
2
+ module Actions
3
+ class IosValidateCiBuildAction < Action
4
+ def self.run(params)
5
+ require_relative '../../helper/ios/ios_git_helper.rb'
6
+ require_relative '../../helper/ios/ios_version_helper.rb'
7
+
8
+ version = Fastlane::Helper::Ios::VersionHelper.get_public_version()
9
+ head_tags = Fastlane::Helper::GitHelper.list_tags_on_current_commit()
10
+ UI.user_error!('HEAD is not on tag. Aborting!') if head_tags.empty?
11
+
12
+ return head_tags.include?(version) # Current commit is tagged with "version" tag
13
+ end
14
+
15
+ #####################################################
16
+ # @!group Documentation
17
+ #####################################################
18
+
19
+ def self.description
20
+ 'Validate the build on CI environment'
21
+ end
22
+
23
+ def self.details
24
+ 'Validate the build on CI environment'
25
+ end
26
+
27
+ def self.available_options
28
+ []
29
+ end
30
+
31
+ def self.output
32
+ end
33
+
34
+ def self.return_value
35
+ end
36
+
37
+ def self.authors
38
+ ['loremattei']
39
+ end
40
+
41
+ def self.is_supported?(platform)
42
+ platform == :ios
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,152 @@
1
+ module Fastlane
2
+ module Helper
3
+ # Basic line handler
4
+ class MetadataBlock
5
+ attr_reader :block_key
6
+
7
+ def initialize(block_key)
8
+ @block_key = block_key
9
+ end
10
+
11
+ def handle_line(fw, line)
12
+ fw.puts(line) # Standard line handling: just copy
13
+ end
14
+
15
+ def is_handler_for(key)
16
+ true
17
+ end
18
+ end
19
+
20
+ class UnknownMetadataBlock < MetadataBlock
21
+ attr_reader :content_file_path
22
+
23
+ def initialize
24
+ super(nil)
25
+ end
26
+ end
27
+
28
+ class StandardMetadataBlock < MetadataBlock
29
+ attr_reader :content_file_path
30
+
31
+ def initialize(block_key, content_file_path)
32
+ super(block_key)
33
+ @content_file_path = content_file_path
34
+ end
35
+
36
+ def is_handler_for(key)
37
+ key == @block_key.to_s
38
+ end
39
+
40
+ def handle_line(fw, line)
41
+ # put the new content on block start
42
+ # and skip all the other content
43
+ generate_block(fw) if line.start_with?('msgctxt')
44
+ end
45
+
46
+ def generate_block(fw)
47
+ # init
48
+ fw.puts("msgctxt \"#{@block_key}\"")
49
+ line_count = File.foreach(@content_file_path).inject(0) { |c, _line| c + 1 }
50
+
51
+ if line_count <= 1
52
+ # Single line output
53
+ fw.puts("msgid \"#{File.open(@content_file_path, 'r').read}\"")
54
+ else
55
+ # Multiple line output
56
+ fw.puts('msgid ""')
57
+
58
+ # insert content
59
+ File.open(@content_file_path, 'r').each do |line|
60
+ fw.puts("\"#{line.strip}\\n\"")
61
+ end
62
+ end
63
+
64
+ # close
65
+ fw.puts('msgstr ""')
66
+ fw.puts('')
67
+ end
68
+ end
69
+
70
+ class ReleaseNoteMetadataBlock < StandardMetadataBlock
71
+ attr_reader :new_key, :keep_key, :rel_note_key, :release_version
72
+
73
+ def initialize(block_key, content_file_path, release_version)
74
+ super(block_key, content_file_path)
75
+ @rel_note_key = 'release_note'
76
+ @release_version = release_version
77
+ generate_keys(release_version)
78
+ end
79
+
80
+ def generate_keys(release_version)
81
+ values = release_version.split('.')
82
+ version_major = Integer(values[0])
83
+ version_minor = Integer(values[1])
84
+ @new_key = "#{@rel_note_key}_#{version_major.to_s.rjust(2, '0')}#{version_minor}"
85
+
86
+ version_major = version_major - 1 if version_minor == 0
87
+ version_minor = version_minor == 0 ? 9 : version_minor - 1
88
+
89
+ @keep_key = "#{@rel_note_key}_#{version_major.to_s.rjust(2, '0')}#{version_minor}"
90
+ end
91
+
92
+ def is_handler_for(key)
93
+ values = key.split('_')
94
+ key.start_with?(@rel_note_key) && values.length == 3 && is_int?(values[2].sub(/^[0]*/, ''))
95
+ end
96
+
97
+ def handle_line(fw, line)
98
+ # put content on block start or if copying the latest one
99
+ # and skip all the other content
100
+ if line.start_with?('msgctxt')
101
+ key = extract_key(line)
102
+ @is_copying = (key == @keep_key)
103
+ generate_block(fw) if @is_copying
104
+ end
105
+
106
+ fw.puts(line) if @is_copying
107
+ end
108
+
109
+ def generate_block(fw)
110
+ # init
111
+ fw.puts("msgctxt \"#{@new_key}\"")
112
+ fw.puts('msgid ""')
113
+ fw.puts("\"#{@release_version}:\\n\"")
114
+
115
+ # insert content
116
+ File.open(@content_file_path, 'r').each do |line|
117
+ fw.puts("\"#{line.strip}\\n\"")
118
+ end
119
+
120
+ # close
121
+ fw.puts('msgstr ""')
122
+ fw.puts('')
123
+ end
124
+
125
+ def extract_key(line)
126
+ line.split(' ')[1].tr('\"', '')
127
+ end
128
+
129
+ def is_int?(value)
130
+ true if Integer(value) rescue false
131
+ end
132
+ end
133
+
134
+ class ReleaseNoteShortMetadataBlock < ReleaseNoteMetadataBlock
135
+ def initialize(block_key, content_file_path, release_version)
136
+ super(block_key, content_file_path, release_version)
137
+ @rel_note_key = 'release_note_short'
138
+ @release_version = release_version
139
+ generate_keys(release_version)
140
+ end
141
+
142
+ def is_handler_for(key)
143
+ values = key.split('_')
144
+ key.start_with?(@rel_note_key) && values.length == 4 && is_int?(values[3].sub(/^[0]*/, ''))
145
+ end
146
+
147
+ def generate_block(fw)
148
+ super(fw) unless File.zero?(@content_file_path)
149
+ end
150
+ end
151
+ end
152
+ end
@@ -0,0 +1,44 @@
1
+ module Fastlane
2
+ module Helper
3
+ module Android
4
+ # Helper methods to execute git-related operations that are specific to Android projects
5
+ #
6
+ module GitHelper
7
+ # Commit and push the files that are modified when we bump version numbers on an iOS project
8
+ #
9
+ # This typically commits and pushes the `build.gradle` file inside the project subfolder.
10
+ #
11
+ # @env PROJECT_ROOT_FOLDER The path to the git root of the project
12
+ # @env PROJECT_NAME The name of the directory containing the project code (especially containing the `build.gradle` file)
13
+ #
14
+ def self.commit_version_bump
15
+ Fastlane::Helper::GitHelper.commit(
16
+ message: 'Bump version number',
17
+ files: File.join(ENV['PROJECT_ROOT_FOLDER'], ENV['PROJECT_NAME'], 'build.gradle'),
18
+ push: true
19
+ )
20
+ end
21
+
22
+ # Calls the `tools/update-translations.sh` script from the project repo, then lint them using the provided gradle task
23
+ #
24
+ # Deprecated. Use the `android_download_translations` action instead.
25
+ #
26
+ # @env PROJECT_ROOT_FOLDER The path to the git root of the project
27
+ # @env PROJECT_NAME The name of the directory containing the project code (especially containing the `build.gradle` file)
28
+ #
29
+ # @param [String] validate_translation_command The name of the gradle task to run to validate the translations
30
+ #
31
+ # @todo Remove this once every client has migrated to `android_download_translations` and we got rid of that legacy action.
32
+ #
33
+ def self.update_metadata(validate_translation_command)
34
+ Action.sh('./tools/update-translations.sh')
35
+ Action.sh('git', 'submodule', 'update', '--init', '--recursive')
36
+ Action.sh('./gradlew', validate_translation_command)
37
+
38
+ res_dir = File.join(ENV['PROJECT_ROOT_FOLDER'], ENV['PROJECT_NAME'], 'src', 'main', 'res')
39
+ Fastlane::Helper::GitHelper.commit(message: 'Update translations', files: res_dir, push: true)
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end