fastlane-plugin-wpmreleasetoolkit 1.0.0 → 1.3.1

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 +4 -4
  2. data/bin/drawText +1 -0
  3. data/ext/drawText/drawText Tests/DigitParsingTests.swift +21 -0
  4. data/ext/drawText/drawText Tests/ExtensionsTests.swift +5 -0
  5. data/ext/drawText/drawText Tests/Info.plist +22 -0
  6. data/ext/drawText/drawText Tests/StylesheetTests.swift +31 -0
  7. data/ext/drawText/drawText Tests/Test Cases/default-stylesheet.txt +10 -0
  8. data/ext/drawText/drawText Tests/Test Cases/external-styles-sample.css +3 -0
  9. data/ext/drawText/drawText Tests/Test Cases/external-styles-test.txt +13 -0
  10. data/ext/drawText/drawText Tests/Test Cases/large-text-block.txt +1 -0
  11. data/ext/drawText/drawText Tests/Test Cases/regular-text-block.txt +2 -0
  12. data/ext/drawText/drawText Tests/Test Cases/rtl-text-block.txt +2 -0
  13. data/ext/drawText/drawText Tests/Test Cases/text-size-adjustment-test.txt +10 -0
  14. data/ext/drawText/drawText Tests/TextImageTests.swift +99 -0
  15. data/ext/drawText/drawText Tests/drawText_Tests.swift +14 -0
  16. data/ext/drawText/drawText.xcodeproj/project.pbxproj +508 -0
  17. data/ext/drawText/drawText.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  18. data/ext/drawText/drawText.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  19. data/ext/drawText/drawText.xcodeproj/xcshareddata/xcschemes/drawText Tests.xcscheme +57 -0
  20. data/ext/drawText/drawText.xcodeproj/xcshareddata/xcschemes/drawText.xcscheme +109 -0
  21. data/ext/drawText/drawText/Assets/style.css +1 -0
  22. data/ext/drawText/drawText/CoreTextStack.swift +113 -0
  23. data/ext/drawText/drawText/Helpers/CommandLineHelpers.swift +36 -0
  24. data/ext/drawText/drawText/Helpers/Extensions.swift +27 -0
  25. data/ext/drawText/drawText/Helpers/FileSystemHelper.swift +24 -0
  26. data/ext/drawText/drawText/Stylesheet.swift +48 -0
  27. data/ext/drawText/drawText/TextImage.swift +100 -0
  28. data/ext/drawText/drawText/main.swift +61 -0
  29. data/ext/drawText/extconf.rb +1 -1
  30. data/ext/drawText/makefile.example +8 -0
  31. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_update_metadata_source_action.rb +3 -3
  32. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb +22 -16
  33. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_build_prechecks.rb +15 -9
  34. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_beta.rb +26 -26
  35. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_final_release.rb +27 -24
  36. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_hotfix.rb +21 -23
  37. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_release.rb +31 -40
  38. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_codefreeze_prechecks.rb +16 -9
  39. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_completecodefreeze_prechecks.rb +10 -4
  40. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_xml_release_notes.rb +2 -2
  41. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_current_branch_is_hotfix.rb +10 -2
  42. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_file_by_version.rb +1 -1
  43. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_translations_action.rb +2 -2
  44. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb +11 -7
  45. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_alpha_version.rb +8 -2
  46. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_app_version.rb +8 -2
  47. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_release_version.rb +8 -2
  48. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_hotifx_prechecks.rb +5 -5
  49. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_merge_translators_strings.rb +1 -1
  50. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_tag_build.rb +11 -5
  51. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_metadata.rb +1 -1
  52. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_release_notes.rb +3 -3
  53. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_for_toolkit_updates_action.rb +99 -0
  54. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_translation_progress.rb +147 -0
  55. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/circleci_trigger_job_action.rb +1 -1
  56. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_downloadmetadata_action.rb +1 -1
  57. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_update_metadata_source.rb +6 -5
  58. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/promo_screenshots_action.rb +2 -2
  59. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/removebranchprotection_action.rb +3 -3
  60. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/setbranchprotection_action.rb +3 -3
  61. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/setfrozentag_action.rb +1 -1
  62. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_betabuild_prechecks.rb +5 -5
  63. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_build_prechecks.rb +4 -4
  64. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_beta.rb +2 -2
  65. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_hotfix.rb +1 -1
  66. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb +5 -5
  67. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_check_beta_deps.rb +2 -2
  68. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_clear_intermediate_tags.rb +1 -1
  69. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_codefreeze_prechecks.rb +4 -4
  70. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_completecodefreeze_prechecks.rb +5 -5
  71. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_current_branch_is_hotfix.rb +1 -1
  72. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_final_tag.rb +2 -2
  73. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_finalize_prechecks.rb +5 -5
  74. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_app_version.rb +1 -1
  75. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_build_version.rb +1 -1
  76. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb +1 -1
  77. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_hotifx_prechecks.rb +5 -5
  78. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb +1 -1
  79. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_localize_project.rb +1 -1
  80. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_merge_translators_strings.rb +4 -4
  81. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_tag_build.rb +2 -2
  82. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata.rb +1 -1
  83. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_release_notes.rb +3 -3
  84. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_validate_ci_build.rb +2 -2
  85. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/an_metadata_update_helper.rb +3 -3
  86. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_git_helper.rb +14 -5
  87. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb +11 -2
  88. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_version_helper.rb +133 -55
  89. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ci_helper.rb +1 -1
  90. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb +2 -2
  91. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/encryption_helper.rb +1 -1
  92. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb +4 -6
  93. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/glotpress_helper.rb +79 -0
  94. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_adc_app_sizes_helper.rb +3 -3
  95. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_helper.rb +3 -4
  96. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_update_helper.rb +1 -1
  97. data/lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb +2 -2
  98. data/lib/fastlane/plugin/wpmreleasetoolkit/version.rb +1 -1
  99. metadata +45 -15
@@ -2,17 +2,17 @@ module Fastlane
2
2
  module Actions
3
3
  class IosBuildPrechecksAction < Action
4
4
  def self.run(params)
5
- require_relative '../../helper/ios/ios_version_helper.rb'
5
+ require_relative '../../helper/ios/ios_version_helper'
6
6
 
7
7
  message = ''
8
8
  message << "Building version #{Fastlane::Helper::Ios::VersionHelper.get_internal_version()} and uploading to App Center\n" if params[:internal]
9
9
  message << "Building version #{Fastlane::Helper::Ios::VersionHelper.get_build_version()} and uploading to App Center\n" if params[:internal_on_single_version]
10
10
  message << "Building version #{Fastlane::Helper::Ios::VersionHelper.get_build_version()} and uploading to TestFlight\n" if params[:external]
11
11
 
12
- if !params[:skip_confirm]
13
- UI.user_error!('Aborted by user request') unless UI.confirm("#{message}Do you want to continue?")
14
- else
12
+ if params[:skip_confirm]
15
13
  UI.message(message)
14
+ else
15
+ UI.user_error!('Aborted by user request') unless UI.confirm("#{message}Do you want to continue?")
16
16
  end
17
17
 
18
18
  # Check local repo status
@@ -4,8 +4,8 @@ module Fastlane
4
4
  def self.run(params)
5
5
  UI.message 'Bumping app release version...'
6
6
 
7
- require_relative '../../helper/ios/ios_git_helper.rb'
8
- require_relative '../../helper/ios/ios_version_helper.rb'
7
+ require_relative '../../helper/ios/ios_git_helper'
8
+ require_relative '../../helper/ios/ios_version_helper'
9
9
 
10
10
  Fastlane::Helper::GitHelper.ensure_on_branch!('release')
11
11
  create_config()
@@ -4,7 +4,7 @@ module Fastlane
4
4
  def self.run(params)
5
5
  UI.message 'Bumping app release version for hotfix...'
6
6
 
7
- require_relative '../../helper/ios/ios_git_helper.rb'
7
+ require_relative '../../helper/ios/ios_git_helper'
8
8
  Fastlane::Helper::GitHelper.create_branch("release/#{params[:version]}", from: params[:previous_version])
9
9
  create_config(params[:previous_version], params[:version])
10
10
  show_config()
@@ -5,8 +5,8 @@ module Fastlane
5
5
  # fastlane will take care of reading in the parameter and fetching the environment variable:
6
6
  UI.message 'Bumping app release version...'
7
7
 
8
- require_relative '../../helper/ios/ios_version_helper.rb'
9
- require_relative '../../helper/ios/ios_git_helper.rb'
8
+ require_relative '../../helper/ios/ios_version_helper'
9
+ require_relative '../../helper/ios/ios_git_helper'
10
10
 
11
11
  other_action.ensure_git_branch(branch: 'develop')
12
12
 
@@ -21,12 +21,12 @@ module Fastlane
21
21
  UI.message 'Done!'
22
22
 
23
23
  UI.message 'Updating glotPressKeys...' unless params[:skip_glotpress]
24
- update_glotpress_key unless params [:skip_glotpress]
25
- UI.message 'Done' unless params [:skip_glotpress]
24
+ update_glotpress_key unless params[:skip_glotpress]
25
+ UI.message 'Done' unless params[:skip_glotpress]
26
26
 
27
27
  UI.message 'Updating Fastlane deliver file...' unless params[:skip_deliver]
28
28
  Fastlane::Helper::Ios::VersionHelper.update_fastlane_deliver(@new_short_version) unless params[:skip_deliver]
29
- UI.message 'Done!' unless params [:skip_deliver]
29
+ UI.message 'Done!' unless params[:skip_deliver]
30
30
 
31
31
  UI.message 'Updating XcConfig...'
32
32
  Fastlane::Helper::Ios::VersionHelper.update_xc_configs(@new_version, @new_short_version, @new_version_internal)
@@ -2,8 +2,8 @@ module Fastlane
2
2
  module Actions
3
3
  class IosCheckBetaDepsAction < Action
4
4
  def self.run(params)
5
- require_relative '../../helper/ios/ios_version_helper.rb'
6
- require_relative '../../helper/ios/ios_git_helper.rb'
5
+ require_relative '../../helper/ios/ios_version_helper'
6
+ require_relative '../../helper/ios/ios_git_helper'
7
7
 
8
8
  beta_pods = []
9
9
  File.open(params[:podfile]).each do |li|
@@ -4,7 +4,7 @@ module Fastlane
4
4
  def self.run(params)
5
5
  UI.message("Deleting tags for version: #{params[:version]}")
6
6
 
7
- require_relative '../../helper/git_helper.rb'
7
+ require_relative '../../helper/git_helper'
8
8
 
9
9
  # Download all the remote tags prior to starting – that way we don't miss any on the server
10
10
  Fastlane::Helper::GitHelper.fetch_all_tags
@@ -5,8 +5,8 @@ module Fastlane
5
5
  # fastlane will take care of reading in the parameter and fetching the environment variable:
6
6
  UI.message "Skip confirm on code freeze: #{params[:skip_confirm]}"
7
7
 
8
- require_relative '../../helper/ios/ios_version_helper.rb'
9
- require_relative '../../helper/ios/ios_git_helper.rb'
8
+ require_relative '../../helper/ios/ios_version_helper'
9
+ require_relative '../../helper/ios/ios_git_helper'
10
10
 
11
11
  # Checkout develop and update
12
12
  Fastlane::Helper::GitHelper.checkout_and_pull('develop')
@@ -17,8 +17,8 @@ module Fastlane
17
17
  next_version = Fastlane::Helper::Ios::VersionHelper.calc_next_release_version(current_version)
18
18
 
19
19
  # Ask user confirmation
20
- unless params[:skip_confirm]
21
- UI.user_error!('Aborted by user request') unless UI.confirm("Building a new release branch starting from develop.\nCurrent version is #{current_version} (#{current_build_version}).\nAfter codefreeze the new version will be: #{next_version}.\nDo you want to continue?")
20
+ unless params[:skip_confirm] || UI.confirm("Building a new release branch starting from develop.\nCurrent version is #{current_version} (#{current_build_version}).\nAfter codefreeze the new version will be: #{next_version}.\nDo you want to continue?")
21
+ UI.user_error!('Aborted by user request')
22
22
  end
23
23
 
24
24
  # Check local repo status
@@ -4,17 +4,17 @@ module Fastlane
4
4
  def self.run(params)
5
5
  UI.message "Skip confirm: #{params[:skip_confirm]}"
6
6
 
7
- require_relative '../../helper/ios/ios_version_helper.rb'
8
- require_relative '../../helper/ios/ios_git_helper.rb'
7
+ require_relative '../../helper/ios/ios_version_helper'
8
+ require_relative '../../helper/ios/ios_git_helper'
9
9
 
10
10
  UI.user_error!('This is not a release branch. Abort.') unless other_action.git_branch.start_with?('release/')
11
11
 
12
12
  version = Fastlane::Helper::Ios::VersionHelper.get_public_version
13
13
  message = "Completing code freeze for: #{version}\n"
14
- if !params[:skip_confirm]
15
- UI.user_error!('Aborted by user request') unless UI.confirm("#{message}Do you want to continue?")
16
- else
14
+ if params[:skip_confirm]
17
15
  UI.message(message)
16
+ else
17
+ UI.user_error!('Aborted by user request') unless UI.confirm("#{message}Do you want to continue?")
18
18
  end
19
19
 
20
20
  # Check local repo status
@@ -2,7 +2,7 @@ module Fastlane
2
2
  module Actions
3
3
  class IosCurrentBranchIsHotfixAction < Action
4
4
  def self.run(params)
5
- require_relative '../../helper/ios/ios_version_helper.rb'
5
+ require_relative '../../helper/ios/ios_version_helper'
6
6
  Fastlane::Helper::Ios::VersionHelper.is_hotfix?(Fastlane::Helper::Ios::VersionHelper.get_public_version)
7
7
  end
8
8
 
@@ -2,8 +2,8 @@ module Fastlane
2
2
  module Actions
3
3
  class IosFinalTagAction < Action
4
4
  def self.run(params)
5
- require_relative '../../helper/ios/ios_git_helper.rb'
6
- require_relative '../../helper/ios/ios_version_helper.rb'
5
+ require_relative '../../helper/ios/ios_git_helper'
6
+ require_relative '../../helper/ios/ios_version_helper'
7
7
  version = Fastlane::Helper::Ios::VersionHelper.get_public_version
8
8
 
9
9
  UI.message("Tagging final #{version}...")
@@ -4,17 +4,17 @@ module Fastlane
4
4
  def self.run(params)
5
5
  UI.message "Skip confirm: #{params[:skip_confirm]}"
6
6
 
7
- require_relative '../../helper/ios/ios_version_helper.rb'
8
- require_relative '../../helper/ios/ios_git_helper.rb'
7
+ require_relative '../../helper/ios/ios_version_helper'
8
+ require_relative '../../helper/ios/ios_git_helper'
9
9
 
10
10
  UI.user_error!('This is not a release branch. Abort.') unless other_action.git_branch.start_with?('release/')
11
11
 
12
12
  version = Fastlane::Helper::Ios::VersionHelper.get_public_version
13
13
  message = "Finalizing release: #{version}\n"
14
- if !params[:skip_confirm]
15
- UI.user_error!('Aborted by user request') unless UI.confirm("#{message}Do you want to continue?")
16
- else
14
+ if params[:skip_confirm]
17
15
  UI.message(message)
16
+ else
17
+ UI.user_error!('Aborted by user request') unless UI.confirm("#{message}Do you want to continue?")
18
18
  end
19
19
 
20
20
  # Check local repo status
@@ -2,7 +2,7 @@ module Fastlane
2
2
  module Actions
3
3
  class IosGetAppVersionAction < Action
4
4
  def self.run(params)
5
- require_relative '../../helper/ios/ios_version_helper.rb'
5
+ require_relative '../../helper/ios/ios_version_helper'
6
6
 
7
7
  UI.user_error!('You need to set at least the PUBLIC_CONFIG_FILE env var to the path to the public xcconfig file') unless ENV['PUBLIC_CONFIG_FILE']
8
8
 
@@ -2,7 +2,7 @@ module Fastlane
2
2
  module Actions
3
3
  class IosGetBuildVersionAction < Action
4
4
  def self.run(params)
5
- require_relative '../../helper/ios/ios_version_helper.rb'
5
+ require_relative '../../helper/ios/ios_version_helper'
6
6
 
7
7
  UI.user_error!('You need to set at least the PUBLIC_CONFIG_FILE env var to the path to the public xcconfig file') unless ENV['PUBLIC_CONFIG_FILE']
8
8
 
@@ -1,4 +1,4 @@
1
- require_relative '../../helper/ios/ios_adc_app_sizes_helper.rb'
1
+ require_relative '../../helper/ios/ios_adc_app_sizes_helper'
2
2
 
3
3
  module Fastlane
4
4
  module Actions
@@ -5,8 +5,8 @@ module Fastlane
5
5
  UI.message "Skip confirm: #{params[:skip_confirm]}"
6
6
  UI.message ''
7
7
 
8
- require_relative '../../helper/ios/ios_version_helper.rb'
9
- require_relative '../../helper/ios/ios_git_helper.rb'
8
+ require_relative '../../helper/ios/ios_version_helper'
9
+ require_relative '../../helper/ios/ios_git_helper'
10
10
 
11
11
  # Evaluate previous tag
12
12
  new_ver = params[:version]
@@ -16,10 +16,10 @@ module Fastlane
16
16
  message = "Requested Hotfix version: #{new_ver}\n"
17
17
  message << "Branching from: #{prev_ver}\n"
18
18
 
19
- if !params[:skip_confirm]
20
- UI.user_error!('Aborted by user request') unless UI.confirm("#{message}Do you want to continue?")
21
- else
19
+ if params[:skip_confirm]
22
20
  UI.message(message)
21
+ else
22
+ UI.user_error!('Aborted by user request') unless UI.confirm("#{message}Do you want to continue?")
23
23
  end
24
24
 
25
25
  # Check tags
@@ -17,7 +17,7 @@ module Fastlane
17
17
  def self.run_linter(params)
18
18
  UI.message 'Linting localizations for parameter placeholders consistency...'
19
19
 
20
- require_relative '../../helper/ios/ios_l10n_helper.rb'
20
+ require_relative '../../helper/ios/ios_l10n_helper'
21
21
  helper = Fastlane::Helper::Ios::L10nHelper.new(
22
22
  install_path: resolve_path(params[:install_path]),
23
23
  version: params[:version]
@@ -4,7 +4,7 @@ module Fastlane
4
4
  def self.run(params)
5
5
  UI.message 'Updating project localisation...'
6
6
 
7
- require_relative '../../helper/ios/ios_git_helper.rb'
7
+ require_relative '../../helper/ios/ios_git_helper'
8
8
  other_action.cocoapods()
9
9
  Fastlane::Helper::Ios::GitHelper.localize_project()
10
10
 
@@ -27,8 +27,8 @@ module Fastlane
27
27
  join_files.each do |join_strings|
28
28
  my_strings = File.read(join_strings).split("\n")
29
29
  my_strings.each do |string|
30
- if string[/^\"(.*)\" = \"(.*)\";$/]
31
- /^\"(?<string_key>.*)\" = \"/i =~ string
30
+ if string[/^"(.*)" = "(.*)";$/]
31
+ /^"(?<string_key>.*)" = "/i =~ string
32
32
  unless extra_keys.include?(string_key)
33
33
  extra_strings << string
34
34
  extra_keys << string_key
@@ -50,9 +50,9 @@ module Fastlane
50
50
  end
51
51
 
52
52
  def self.check_line(line, extra_keys)
53
- return line unless line[/^\"(.*)\" = \"(.*)\";$/]
53
+ return line unless line[/^"(.*)" = "(.*)";$/]
54
54
 
55
- /^\"(?<line_key>.*)\" = \"/i =~ line
55
+ /^"(?<line_key>.*)" = "/i =~ line
56
56
  return '' if extra_keys.include?(line_key)
57
57
 
58
58
  return line
@@ -2,8 +2,8 @@ module Fastlane
2
2
  module Actions
3
3
  class IosTagBuildAction < Action
4
4
  def self.run(params)
5
- require_relative '../../helper/ios/ios_version_helper.rb'
6
- require_relative '../../helper/ios/ios_git_helper.rb'
5
+ require_relative '../../helper/ios/ios_version_helper'
6
+ require_relative '../../helper/ios/ios_git_helper'
7
7
 
8
8
  itc_ver = Fastlane::Helper::Ios::VersionHelper.get_build_version()
9
9
  int_ver = Fastlane::Helper::Ios::VersionHelper.get_internal_version() unless ENV['INTERNAL_CONFIG_FILE'].nil?
@@ -2,7 +2,7 @@ module Fastlane
2
2
  module Actions
3
3
  class IosUpdateMetadataAction < Action
4
4
  def self.run(params)
5
- require_relative '../../helper/ios/ios_git_helper.rb'
5
+ require_relative '../../helper/ios/ios_git_helper'
6
6
 
7
7
  Fastlane::Helper::Ios::GitHelper.update_metadata()
8
8
  end
@@ -4,9 +4,9 @@ module Fastlane
4
4
  def self.run(params)
5
5
  UI.message 'Updating the release notes...'
6
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'
7
+ require_relative '../../helper/ios/ios_version_helper'
8
+ require_relative '../../helper/release_notes_helper'
9
+ require_relative '../../helper/git_helper'
10
10
 
11
11
  path = File.join(ENV['PROJECT_ROOT_FOLDER'] || '.', 'RELEASE-NOTES.txt')
12
12
  next_version = Fastlane::Helper::Ios::VersionHelper.calc_next_release_version(params[:new_version])
@@ -2,8 +2,8 @@ module Fastlane
2
2
  module Actions
3
3
  class IosValidateCiBuildAction < Action
4
4
  def self.run(params)
5
- require_relative '../../helper/ios/ios_git_helper.rb'
6
- require_relative '../../helper/ios/ios_version_helper.rb'
5
+ require_relative '../../helper/ios/ios_git_helper'
6
+ require_relative '../../helper/ios/ios_version_helper'
7
7
 
8
8
  version = Fastlane::Helper::Ios::VersionHelper.get_public_version()
9
9
  head_tags = Fastlane::Helper::GitHelper.list_tags_on_current_commit()
@@ -91,7 +91,7 @@ module Fastlane
91
91
 
92
92
  def is_handler_for(key)
93
93
  values = key.split('_')
94
- key.start_with?(@rel_note_key) && values.length == 3 && is_int?(values[2].sub(/^[0]*/, ''))
94
+ key.start_with?(@rel_note_key) && values.length == 3 && is_int?(values[2].sub(/^0*/, ''))
95
95
  end
96
96
 
97
97
  def handle_line(fw, line)
@@ -123,7 +123,7 @@ module Fastlane
123
123
  end
124
124
 
125
125
  def extract_key(line)
126
- line.split(' ')[1].tr('\"', '')
126
+ line.split[1].tr('\"', '')
127
127
  end
128
128
 
129
129
  def is_int?(value)
@@ -141,7 +141,7 @@ module Fastlane
141
141
 
142
142
  def is_handler_for(key)
143
143
  values = key.split('_')
144
- key.start_with?(@rel_note_key) && values.length == 4 && is_int?(values[3].sub(/^[0]*/, ''))
144
+ key.start_with?(@rel_note_key) && values.length == 4 && is_int?(values[3].sub(/^0*/, ''))
145
145
  end
146
146
 
147
147
  def generate_block(fw)
@@ -12,11 +12,20 @@ module Fastlane
12
12
  # @env PROJECT_NAME The name of the directory containing the project code (especially containing the `build.gradle` file)
13
13
  #
14
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
- )
15
+ require_relative './android_version_helper'
16
+ if Fastlane::Helper::Android::VersionHelper.properties_file_exists
17
+ Fastlane::Helper::GitHelper.commit(
18
+ message: 'Bump version number',
19
+ files: File.join(ENV['PROJECT_ROOT_FOLDER'], 'version.properties'),
20
+ push: true
21
+ )
22
+ else
23
+ Fastlane::Helper::GitHelper.commit(
24
+ message: 'Bump version number',
25
+ files: File.join(ENV['PROJECT_ROOT_FOLDER'], ENV['PROJECT_NAME'], 'build.gradle'),
26
+ push: true
27
+ )
28
+ end
20
29
  end
21
30
 
22
31
  # Calls the `tools/update-translations.sh` script from the project repo, then lint them using the provided gradle task
@@ -154,7 +154,7 @@ module Fastlane
154
154
  def self.verify_local_diff(main, library, main_strings, lib_strings)
155
155
  `git diff #{main}`.each_line do |line|
156
156
  if line.start_with?('+ ') || line.start_with?('- ')
157
- diffs = line.gsub(/\s+/m, ' ').strip.split(' ')
157
+ diffs = line.gsub(/\s+/m, ' ').strip.split
158
158
  diffs.each do |diff|
159
159
  verify_diff(diff, main_strings, lib_strings, library)
160
160
  end
@@ -165,7 +165,7 @@ module Fastlane
165
165
  def self.verify_pr_diff(main, library, main_strings, lib_strings, source_diff)
166
166
  source_diff.each_line do |line|
167
167
  if line.start_with?('+ ') || line.start_with?('- ')
168
- diffs = line.gsub(/\s+/m, ' ').strip.split(' ')
168
+ diffs = line.gsub(/\s+/m, ' ').strip.split
169
169
  diffs.each do |diff|
170
170
  verify_diff(diff, main_strings, lib_strings, library)
171
171
  end
@@ -299,6 +299,15 @@ module Fastlane
299
299
  #
300
300
  def self.apply_substitutions(tag)
301
301
  tag.content = tag.content.gsub('...', '…')
302
+
303
+ # Typography en-dash
304
+ if tag.content.include?('-')
305
+ tag.content = tag.content.gsub(/(\d+\s*)-(\s*\d+)/) do |str|
306
+ match = Regexp.last_match # of type `MatchData`. match[0] == str == whole match, match[1] = 1st capture group (left part of the range), match[2] = second capture group (right part of the range)
307
+ is_negative_number = match[2][0] != ' ' && match[1][-1] == ' ' # if right part of range does not start with a space (e.g. `-3`), but left part of range does end with space, it's not a range after all but more likely a list containing negative numbers in it (e.g. `2 -3`)
308
+ is_negative_number ? str : "#{match[1]}\u{2013}#{match[2]}"
309
+ end
310
+ end
302
311
  end
303
312
  private_class_method :apply_substitutions
304
313
 
@@ -26,26 +26,29 @@ module Fastlane
26
26
  # "1.2" # Assuming build.gradle contains versionName "1.2.0"
27
27
  # "1.2.3" # Assuming build.gradle contains versionName "1.2.3"
28
28
  #
29
+ # @param [String] app The name of the app to be used for beta and alpha version update
30
+ #
29
31
  # @return [String] The public-facing version number, extracted from the `versionName` of the `build.gradle` file.
30
32
  # - If this version is a hotfix (more than 2 parts and 3rd part is non-zero), returns the "X.Y.Z" formatted string
31
33
  # - Otherwise (not a hotfix / 3rd part of version is 0), returns "X.Y" formatted version number
32
34
  #
33
- def self.get_public_version
34
- version = get_release_version
35
+ def self.get_public_version(app)
36
+ version = get_release_version(product_name: app)
35
37
  vp = get_version_parts(version[VERSION_NAME])
36
38
  return "#{vp[MAJOR_NUMBER]}.#{vp[MINOR_NUMBER]}" unless is_hotfix?(version)
37
39
 
38
40
  "#{vp[MAJOR_NUMBER]}.#{vp[MINOR_NUMBER]}.#{vp[HOTFIX_NUMBER]}"
39
41
  end
40
42
 
41
- # Extract the version name and code from the `vanilla` flavor of the `$PROJECT_NAME/build.gradle file`
42
- # or for the defaultConfig if `HAS_ALPHA_VERSION` is not defined.
43
+ # Extract the version name and code from the release version of the app from `version.properties file`
43
44
  #
44
- # @env HAS_ALPHA_VERSION If set (with any value), indicates that the project uses `vanilla` flavor.
45
+ # @param [String] product_name The name of the app to be used for beta and alpha version update
45
46
  #
46
47
  # @return [Hash] A hash with 2 keys "name" and "code" containing the extracted version name and code, respectively
47
48
  #
48
- def self.get_release_version
49
+ def self.get_release_version(product_name:)
50
+ return get_version_from_properties(product_name: product_name) if properties_file_exists
51
+
49
52
  section = ENV['HAS_ALPHA_VERSION'].nil? ? 'defaultConfig' : 'vanilla {'
50
53
  gradle_path = self.gradle_path
51
54
  name = get_version_name_from_gradle_file(gradle_path, section)
@@ -53,12 +56,67 @@ module Fastlane
53
56
  return { VERSION_NAME => name, VERSION_CODE => code }
54
57
  end
55
58
 
56
- # Extract the version name and code from the `defaultConfig` of the `$PROJECT_NAME/build.gradle` file
59
+ def self.properties_file_exists
60
+ properties_file_path = File.join(ENV['PROJECT_ROOT_FOLDER'] || '.', 'version.properties')
61
+
62
+ return File.exist?(properties_file_path)
63
+ end
64
+
65
+ # Extract the version name and code from the `version.properties` file in the project root
66
+ #
67
+ # @param [String] product_name The name of the app to extract the version from e.g. wordpress, simplenote
68
+ # @param [Boolean] is_alpha true if the alpha version should be returned, false otherwise
69
+ #
70
+ # @return [Hash] A hash with 2 keys "name" and "code" containing the extracted version name and code, respectively
71
+ #
72
+ def self.get_version_from_properties(product_name:, is_alpha: false)
73
+ alpha_variant = is_alpha ? alpha_flavor_name : nil
74
+ version_name_key = [product_name, alpha_variant, 'versionName'].compact.join('.')
75
+ version_code_key = [product_name, alpha_variant, 'versionCode'].compact.join('.')
76
+
77
+ properties_file_path = File.join(ENV['PROJECT_ROOT_FOLDER'] || '.', 'version.properties')
78
+
79
+ return nil unless File.exist?(properties_file_path)
80
+
81
+ File.open(properties_file_path, 'r') do |f|
82
+ text = f.read
83
+ name = text.match(/#{version_name_key}=(\S*)/m)&.captures&.first
84
+ code = text.match(/#{version_code_key}=(\S*)/m)&.captures&.first
85
+
86
+ f.close
87
+
88
+ return nil if name.nil? || code.nil?
89
+
90
+ return { VERSION_NAME => name, VERSION_CODE => code.to_i }
91
+ end
92
+ end
93
+
94
+ # Returns the name of the flavor used for alpha builds
95
+ #
96
+ # @env HAS_ALPHA_VERSION Should contain the name of the flavor used for alpha
97
+ #
98
+ # @return [String] The flavor name as provided by the env var, defaulting to `zalpha` if the env var
99
+ # is not set or is set to '1' ('boolean' value used in legacy call sites)
100
+ def self.alpha_flavor_name
101
+ # TODO: Have each fastlane action which depends on this take the alpha flavor name as ConfigItem/parameter
102
+ # explicitly instead (and get rid of the HAS_ALPHA_VERSION global / env var after that)
103
+
104
+ # For now we pass the alpha flavor name by reusing the HAS_ALPHA_VERSION env var.
105
+ return ENV['HAS_ALPHA_VERSION'] if ENV['HAS_ALPHA_VERSION'] && ENV['HAS_ALPHA_VERSION'] != '1'
106
+
107
+ 'zalpha' # Default value if HAS_ALPHA_VERSION is not set or hasn't been updated at call site to the flavor name instead of '1'
108
+ end
109
+
110
+ # Extract the version name and code from the `version.properties` file in the project root
111
+ #
112
+ # @param [String] app The name of the app to be used for beta and alpha version update
57
113
  #
58
114
  # @return [Hash] A hash with 2 keys `"name"` and `"code"` containing the extracted version name and code, respectively,
59
115
  # or `nil` if `$HAS_ALPHA_VERSION` is not defined.
60
116
  #
61
- def self.get_alpha_version
117
+ def self.get_alpha_version(app)
118
+ return get_version_from_properties(product_name: app, is_alpha: true) if properties_file_exists
119
+
62
120
  return nil if ENV['HAS_ALPHA_VERSION'].nil?
63
121
 
64
122
  section = 'defaultConfig'
@@ -95,8 +153,8 @@ module Fastlane
95
153
  # - The final version name corresponds to the beta's versionName, without the `-rc` suffix
96
154
  # - The final version code corresponds to the versionCode for the alpha (or for the beta if alpha_version is nil) incremented by one.
97
155
  #
98
- # @param [Hash] beta_version The version hash for the beta (vanilla flavor), containing values for keys "name" and "code"
99
- # @param [Hash] alpha_version The version hash for the alpha (defaultConfig), containing values for keys "name" and "code",
156
+ # @param [Hash] beta_version The version hash for the beta, containing values for keys "name" and "code"
157
+ # @param [Hash] alpha_version The version hash for the alpha, containing values for keys "name" and "code",
100
158
  # or `nil` if no alpha version to consider.
101
159
  #
102
160
  # @return [Hash] A version hash with keys "name" and "code", containing the version name and code to use for final release.
@@ -254,11 +312,12 @@ module Fastlane
254
312
 
255
313
  # Prints the current and next release version names to stdout, then returns the next release version
256
314
  #
315
+ # @param [String] app The name of the app to be used for beta and alpha version update
257
316
  # @return [String] The next release version name to use after bumping the currently used release version.
258
317
  #
259
- def self.bump_version_release
318
+ def self.bump_version_release(app)
260
319
  # Bump release
261
- current_version = get_release_version()
320
+ current_version = get_release_version(product_name: app)
262
321
  UI.message("Current version: #{current_version[VERSION_NAME]}")
263
322
  new_version = calc_next_release_base_version(current_version)
264
323
  UI.message("New version: #{new_version[VERSION_NAME]}")
@@ -267,15 +326,30 @@ module Fastlane
267
326
  return verified_version
268
327
  end
269
328
 
270
- # Update the `build.gradle` file with new `versionName` and `versionCode` values, both or the `defaultConfig` and `vanilla` flavors
329
+ # Update the `version.properties` file with new `versionName` and `versionCode` values
271
330
  #
272
- # @param [Hash] new_version_beta The version hash for the beta (vanilla flavor), containing values for keys "name" and "code"
273
- # @param [Hash] new_version_alpha The version hash for the alpha (defaultConfig), containing values for keys "name" and "code"
274
- # @env HAS_ALPHA_VERSION If set (with any value), indicates that the project uses `vanilla` flavor.
331
+ # @param [String] app The name of the app to be used for beta and alpha version update
332
+ # @param [Hash] new_version_beta The version hash for the beta, containing values for keys "name" and "code"
333
+ # @param [Hash] new_version_alpha The version hash for the alpha , containing values for keys "name" and "code"
275
334
  #
276
- def self.update_versions(new_version_beta, new_version_alpha)
277
- self.update_version(new_version_beta, ENV['HAS_ALPHA_VERSION'].nil? ? 'defaultConfig' : 'vanilla {')
278
- self.update_version(new_version_alpha, 'defaultConfig') unless new_version_alpha.nil?
335
+ def self.update_versions(app, new_version_beta, new_version_alpha)
336
+ if properties_file_exists
337
+ new_version_name_beta_key = "#{app}.versionName"
338
+ new_version_code_beta_key = "#{app}.versionCode"
339
+ Action.sh('./gradlew', 'updateVersionProperties', "-Pkey=#{new_version_name_beta_key}", "-Pvalue=#{new_version_beta[VERSION_NAME]}")
340
+ Action.sh('./gradlew', 'updateVersionProperties', "-Pkey=#{new_version_code_beta_key}", "-Pvalue=#{new_version_beta[VERSION_CODE]}")
341
+
342
+ unless new_version_alpha.nil?
343
+ new_version_name_alpha_key = "#{app}.#{alpha_flavor_name}.versionName"
344
+ new_version_code_alpha_key = "#{app}.#{alpha_flavor_name}.versionCode"
345
+
346
+ Action.sh('./gradlew', 'updateVersionProperties', "-Pkey=#{new_version_name_alpha_key}", "-Pvalue=#{new_version_alpha[VERSION_NAME]}") unless new_version_alpha.nil?
347
+ Action.sh('./gradlew', 'updateVersionProperties', "-Pkey=#{new_version_code_alpha_key}", "-Pvalue=#{new_version_alpha[VERSION_CODE]}") unless new_version_alpha.nil?
348
+ end
349
+ else
350
+ self.update_version(new_version_beta, ENV['HAS_ALPHA_VERSION'].nil? ? 'defaultConfig' : 'vanilla {')
351
+ self.update_version(new_version_alpha, 'defaultConfig') unless new_version_alpha.nil?
352
+ end
279
353
  end
280
354
 
281
355
  # Compute the name of the previous hotfix version.
@@ -337,6 +411,37 @@ module Fastlane
337
411
  return parts
338
412
  end
339
413
 
414
+ # Ensure that a version string is correctly formatted (that is, each of its parts is a number) and returns the 2-parts version number
415
+ #
416
+ # @param [String] version The version string to verify
417
+ #
418
+ # @return [String] The "major.minor" version string, only with the first 2 components
419
+ # @raise [UserError] If any of the parts of the version string is not a number
420
+ #
421
+ def self.verify_version(version)
422
+ v_parts = get_version_parts(version)
423
+
424
+ v_parts.each do |part|
425
+ UI.user_error!('Version value can only contains numbers.') unless is_int?(part)
426
+ end
427
+
428
+ "#{v_parts[MAJOR_NUMBER]}.#{v_parts[MINOR_NUMBER]}"
429
+ end
430
+
431
+ # Check if a string is an integer.
432
+ #
433
+ # @param [String] string The string to test
434
+ #
435
+ # @return [Bool] true if the string is representing an integer value, false if not
436
+ #
437
+ def self.is_int? string
438
+ true if Integer(string) rescue false
439
+ end
440
+
441
+ #########
442
+ # Functions to support versioning through build.gradle - can be removed once all projects adopt version.properties
443
+ ########
444
+
340
445
  # Extract the versionName from a build.gradle file
341
446
  #
342
447
  # @param [String] file_path The path to the `.gradle` file
@@ -377,43 +482,16 @@ module Fastlane
377
482
  found_section = false
378
483
  File.open(file_path, 'r') do |file|
379
484
  file.each_line do |line|
380
- if !found_section
381
- found_section = true if line.include?(section)
485
+ if found_section
486
+ return line.split[1] if line.include?(keyword) && !line.include?("\"#{keyword}\"") && !line.include?("P#{keyword}")
382
487
  else
383
- return line.split(' ')[1] if line.include?(keyword) && !line.include?("\"#{keyword}\"") && !line.include?("P#{keyword}")
488
+ found_section = true if line.include?(section)
384
489
  end
385
490
  end
386
491
  end
387
492
  return nil
388
493
  end
389
494
 
390
- # Ensure that a version string is correctly formatted (that is, each of its parts is a number) and returns the 2-parts version number
391
- #
392
- # @param [String] version The version string to verify
393
- #
394
- # @return [String] The "major.minor" version string, only with the first 2 components
395
- # @raise [UserError] If any of the parts of the version string is not a number
396
- #
397
- def self.verify_version(version)
398
- v_parts = get_version_parts(version)
399
-
400
- v_parts.each do |part|
401
- UI.user_error!('Version value can only contains numbers.') unless is_int?(part)
402
- end
403
-
404
- "#{v_parts[MAJOR_NUMBER]}.#{v_parts[MINOR_NUMBER]}"
405
- end
406
-
407
- # Check if a string is an integer.
408
- #
409
- # @param [String] string The string to test
410
- #
411
- # @return [Bool] true if the string is representing an integer value, false if not
412
- #
413
- def self.is_int? string
414
- true if Integer(string) rescue false
415
- end
416
-
417
495
  # The path to the build.gradle file for the project.
418
496
  #
419
497
  # @env PROJECT_ROOT_FOLDER The path to the root of the project (the folder containing the `.git` directory).
@@ -442,24 +520,24 @@ module Fastlane
442
520
  version_updated = 0
443
521
  File.open(gradle_path, 'r') do |file|
444
522
  file.each_line do |line|
445
- if !found_section
446
- temp_file.puts line
447
- found_section = true if line.include? section
448
- else
523
+ if found_section
449
524
  if version_updated < 2
450
525
  if line.include?('versionName') && !line.include?('"versionName"') && !line.include?('PversionName')
451
- version_name = line.split(' ')[1].tr('\"', '')
526
+ version_name = line.split[1].tr('\"', '')
452
527
  line.sub!(version_name, version[VERSION_NAME].to_s)
453
528
  version_updated = version_updated + 1
454
529
  end
455
530
 
456
531
  if line.include? 'versionCode'
457
- version_code = line.split(' ')[1]
532
+ version_code = line.split[1]
458
533
  line.sub!(version_code, version[VERSION_CODE].to_s)
459
534
  version_updated = version_updated + 1
460
535
  end
461
536
  end
462
537
  temp_file.puts line
538
+ else
539
+ temp_file.puts line
540
+ found_section = true if line.include? section
463
541
  end
464
542
  end
465
543
  file.close