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
@@ -0,0 +1,100 @@
1
+ import Foundation
2
+ import Cocoa
3
+ import CoreText
4
+
5
+ class TextImage {
6
+
7
+ var color = "white"
8
+ var fontSize = 12 {
9
+ didSet {
10
+ stylesheet.fontSize = self.fontSize
11
+ }
12
+ }
13
+ var alignment: NSTextAlignment = .natural
14
+
15
+ lazy var stylesheet = Stylesheet(color: self.color, fontSize: self.fontSize)
16
+
17
+ internal var html: String = ""
18
+
19
+ internal let drawingOptions: NSString.DrawingOptions = [
20
+ .usesLineFragmentOrigin,
21
+ .usesFontLeading
22
+ ]
23
+
24
+ init(string: String) throws {
25
+
26
+ if isValidFilePath(path: string) {
27
+ html = try contentsOfFile(at: string).trimmingCharacters(in: .whitespacesAndNewlines)
28
+ }
29
+ else {
30
+ html = string
31
+ }
32
+ }
33
+
34
+ func draw(inSize size: CGSize) throws -> CGImage? {
35
+ let coreTextStack = try CoreTextStack(html: self.getHTMLData(), size: size, alignment: alignment)
36
+ var fontSize = stylesheet.fontSize
37
+
38
+ while(!coreTextStack.fits) {
39
+ fontSize -= 1
40
+ coreTextStack.setFontSize(CGFloat(fontSize))
41
+ }
42
+
43
+ return try coreTextStack.draw(inContext: try self.graphicsContext(forSize: size))
44
+ }
45
+
46
+ internal func getHTMLData(withConvertedNewlines: Bool = true) -> Data {
47
+ let html = withConvertedNewlines ? self.html.withNewlinesConvertedToBreakTags : self.html
48
+ let fullString = stylesheet.contents + html
49
+ return fullString.data(using: .utf16)!
50
+ }
51
+
52
+ func isValidFilePath(path: String) -> Bool {
53
+ return FileManager.default.fileExists(atPath: path)
54
+ }
55
+
56
+ private func contentsOfFile(at path: String) throws -> String {
57
+ return try String(contentsOfFile: path, encoding: .utf8)
58
+ }
59
+
60
+ private func graphicsContext(forSize size: CGSize) throws -> NSGraphicsContext {
61
+
62
+ let canvas = NSBitmapImageRep(
63
+ bitmapDataPlanes: nil,
64
+ pixelsWide: Int(size.width),
65
+ pixelsHigh: Int(size.height),
66
+ bitsPerSample: 8,
67
+ samplesPerPixel: 4,
68
+ hasAlpha: true,
69
+ isPlanar: false,
70
+ colorSpaceName: .calibratedRGB,
71
+ bitmapFormat: .alphaFirst,
72
+ bytesPerRow: 0,
73
+ bitsPerPixel: 0
74
+ )!
75
+
76
+ /// Set up the graphics context
77
+ guard let context = NSGraphicsContext(bitmapImageRep: canvas) else {
78
+ throw TextImageProcessingError(kind: .unableToInitializeGraphicsContext)
79
+ }
80
+
81
+ return context
82
+ }
83
+ }
84
+
85
+ struct TextImageProcessingError: Error {
86
+ enum ErrorKind: Int {
87
+ case unableToInitializeGraphicsContext
88
+ case unableToDrawImage
89
+ case unableToReadHTMLString
90
+ }
91
+
92
+ let kind: ErrorKind
93
+ var localizedDescription: String {
94
+ switch self.kind {
95
+ case .unableToInitializeGraphicsContext: return "Unable to initialize graphics context"
96
+ case .unableToDrawImage: return "Unable to draw image"
97
+ case .unableToReadHTMLString: return "Unable to read input HTML string. It may not be valid HTML"
98
+ }
99
+ }
100
+ }
@@ -0,0 +1,61 @@
1
+ import Foundation
2
+ import Cocoa
3
+
4
+ let args = readCommandLineArguments()
5
+
6
+ // Read the HTML string out of the args. This can either be raw HTML, or a path to an HTML file
7
+ guard let htmlString = args["html"] else {
8
+ printError("Unable to read HTML string")
9
+ printUsageAndExit()
10
+ }
11
+
12
+ guard let maxWidthString = args["maxWidth"] else {
13
+ printError("Missing maxWidth argument")
14
+ printUsageAndExit()
15
+ }
16
+
17
+ guard let maxHeightString = args["maxHeight"] else {
18
+ printError("Missing maxHeight argument")
19
+ printUsageAndExit()
20
+ }
21
+
22
+ guard let maxWidth = Int(maxWidthString) else {
23
+ printError("maxWidth must be an integer")
24
+ printUsageAndExit()
25
+ }
26
+
27
+ guard let maxHeight = Int(maxHeightString) else {
28
+ printError("maxHeight must be an integer")
29
+ printUsageAndExit()
30
+ }
31
+
32
+ do {
33
+ let textImage = try TextImage(string: htmlString)
34
+
35
+ if let color = args["color"] {
36
+ textImage.color = color
37
+ }
38
+
39
+ if let fontSize = args["fontSize"]?.digits {
40
+ textImage.fontSize = fontSize
41
+ }
42
+
43
+ if let alignment = args["alignment"] {
44
+ textImage.alignment = NSTextAlignment.fromString(alignment)
45
+ }
46
+
47
+ if let stylesheetPath = args["stylesheet"] {
48
+ textImage.stylesheet.updateWith(filePath: stylesheetPath)
49
+ }
50
+
51
+ let outputPath = args["output"] ?? "output.png"
52
+
53
+ let size = CGSize(width: maxWidth, height: maxHeight)
54
+ let image = try textImage.draw(inSize: size)!
55
+
56
+ File.write(image: image, toFileAtPath: outputPath)
57
+ }
58
+ catch let err {
59
+ print(err.localizedDescription)
60
+ exit(1)
61
+ }
@@ -33,4 +33,4 @@ FileUtils.cp(compiledPath, destinationPath)
33
33
 
34
34
  # Delete and overwrite the bundle file
35
35
  FileUtils.rm_rf(File.join(libDirectory, 'drawText.bundle'))
36
- FileUtils.touch(File.join(compilationDirectory, 'drawText.' + RbConfig::CONFIG['DLEXT']))
36
+ FileUtils.touch(File.join(compilationDirectory, "drawText.#{RbConfig::CONFIG['DLEXT']}"))
@@ -0,0 +1,8 @@
1
+ build:
2
+ true
3
+
4
+ clean:
5
+ true
6
+
7
+ install:
8
+ true
@@ -1,5 +1,5 @@
1
1
  require 'fastlane/action'
2
- require_relative '../../helper/an_metadata_update_helper.rb'
2
+ require_relative '../../helper/an_metadata_update_helper'
3
3
 
4
4
  module Fastlane
5
5
  module Actions
@@ -23,7 +23,7 @@ module Fastlane
23
23
  # Verifies that all the source files are available
24
24
  # to this action
25
25
  def self.check_source_files(source_files)
26
- source_files.values.each do |file_path|
26
+ source_files.each_value do |file_path|
27
27
  UI.user_error!("Couldn't find file at path '#{file_path}'") unless File.exist?(file_path)
28
28
  end
29
29
  end
@@ -92,7 +92,7 @@ module Fastlane
92
92
  # Manages tags depending on the type
93
93
  def self.write_target_block(fw, line)
94
94
  if is_block_id(line)
95
- key = line.split(' ')[1].tr('\"', '')
95
+ key = line.split[1].tr('\"', '')
96
96
  @blocks.each do |block|
97
97
  @current_block = block if block.is_handler_for(key)
98
98
  end
@@ -5,25 +5,27 @@ module Fastlane
5
5
  UI.message "Skip confirm: #{params[:skip_confirm]}"
6
6
  UI.message "Work on version: #{params[:base_version]}" unless params[:base_version].nil?
7
7
 
8
- require_relative '../../helper/android/android_version_helper.rb'
9
- require_relative '../../helper/android/android_git_helper.rb'
8
+ require_relative '../../helper/android/android_version_helper'
9
+ require_relative '../../helper/android/android_git_helper'
10
10
 
11
11
  # Checkout develop and update
12
12
  Fastlane::Helper::GitHelper.checkout_and_pull('develop')
13
13
 
14
+ app = params[:app]
15
+
14
16
  # Check versions
15
- release_version = Fastlane::Helper::Android::VersionHelper.get_release_version
16
- message = "The following current version has been detected: #{release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}\n"
17
- alpha_release_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version
18
- message << "The following Alpha version has been detected: #{alpha_release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}\n" unless alpha_release_version.nil?
17
+ release_version = Fastlane::Helper::Android::VersionHelper.get_release_version(product_name: app)
18
+ message = "[#{app}] The following current version has been detected: #{release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}\n"
19
+ alpha_release_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version(app)
20
+ message << "[#{app}] The following Alpha version has been detected: #{alpha_release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}\n" unless alpha_release_version.nil?
19
21
 
20
22
  # Check branch
21
- app_version = Fastlane::Helper::Android::VersionHelper.get_public_version
23
+ app_version = Fastlane::Helper::Android::VersionHelper.get_public_version(app)
22
24
  UI.user_error!("#{message}Release branch for version #{app_version} doesn't exist. Abort.") unless !params[:base_version].nil? || Fastlane::Helper::GitHelper.checkout_and_pull(release: app_version)
23
25
 
24
26
  # Check user overwrite
25
27
  unless params[:base_version].nil?
26
- overwrite_version = get_user_build_version(params[:base_version], message)
28
+ overwrite_version = get_user_build_version(product_name: app, version: params[:base_version], message: message)
27
29
  release_version = overwrite_version[0]
28
30
  alpha_release_version = overwrite_version[1]
29
31
  end
@@ -34,10 +36,10 @@ module Fastlane
34
36
  # Verify
35
37
  message << "Updating branch to version: #{next_beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{next_beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}) "
36
38
  message << "and #{next_alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{next_alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}).\n" unless alpha_release_version.nil?
37
- if !params[:skip_confirm]
38
- UI.user_error!('Aborted by user request') unless UI.confirm("#{message}Do you want to continue?")
39
- else
39
+ if params[:skip_confirm]
40
40
  UI.message(message)
41
+ else
42
+ UI.user_error!('Aborted by user request') unless UI.confirm("#{message}Do you want to continue?")
41
43
  end
42
44
 
43
45
  # Check local repo status
@@ -47,11 +49,11 @@ module Fastlane
47
49
  [next_beta_version, next_alpha_version]
48
50
  end
49
51
 
50
- def self.get_user_build_version(version, message)
51
- UI.user_error!("Release branch for version #{version} doesn't exist. Abort.") unless Fastlane::Helper::GitHelper.checkout_and_pull(release: version)
52
- release_version = Fastlane::Helper::Android::VersionHelper.get_release_version
53
- message << "Looking at branch release/#{version} as requested by user. Detected version: #{release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}.\n"
54
- alpha_release_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version
52
+ def self.get_user_build_version(product_name:, version:, message:)
53
+ UI.user_error!("[#{app}] Release branch for version #{version} doesn't exist. Abort.") unless Fastlane::Helper::GitHelper.checkout_and_pull(release: version)
54
+ release_version = Fastlane::Helper::Android::VersionHelper.get_release_version(product_name: product_name)
55
+ message << "#{app}] Looking at branch release/#{version} as requested by user. Detected version: #{release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}.\n"
56
+ alpha_release_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version(product_name)
55
57
  message << "and Alpha Version: #{alpha_release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}\n" unless alpha_release_version.nil?
56
58
  [release_version, alpha_release_version]
57
59
  end
@@ -80,6 +82,10 @@ module Fastlane
80
82
  description: 'Skips confirmation',
81
83
  is_string: false, # true: verifies the input is a string, false: every kind of value
82
84
  default_value: false), # the default value if the user didn't provide one
85
+ FastlaneCore::ConfigItem.new(key: :app,
86
+ env_name: 'PROJECT_NAME',
87
+ description: 'The name of the app to get the release version for',
88
+ is_string: true), # true: verifies the input is a string, false: every kind of value
83
89
  ]
84
90
  end
85
91
 
@@ -2,26 +2,28 @@ module Fastlane
2
2
  module Actions
3
3
  class AndroidBuildPrechecksAction < Action
4
4
  def self.run(params)
5
- require_relative '../../helper/android/android_version_helper.rb'
5
+ require_relative '../../helper/android/android_version_helper'
6
+ require_relative '../../helper/git_helper'
6
7
 
7
8
  UI.user_error!("Can't build beta and final at the same time!") if params[:final] && params[:beta]
8
9
 
9
10
  Fastlane::Helper::GitHelper.ensure_on_branch!('release') unless other_action.is_ci()
10
11
 
12
+ app = params[:app]
11
13
  message = ''
12
- beta_version = Fastlane::Helper::Android::VersionHelper.get_release_version() unless !params[:beta] && !params[:final]
13
- alpha_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version() if params[:alpha]
14
+ beta_version = Fastlane::Helper::Android::VersionHelper.get_release_version(product_name: app) unless !params[:beta] && !params[:final]
15
+ alpha_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version(app) if params[:alpha]
14
16
 
15
17
  UI.user_error!("Can't build a final release out of this branch because it's configured as a beta release!") if params[:final] && Fastlane::Helper::Android::VersionHelper.is_beta_version?(beta_version)
16
18
 
17
- message << "Building version #{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}) (for upload to Release Channel)\n" if params[:final]
18
- message << "Building version #{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}) (for upload to Beta Channel)\n" if params[:beta]
19
- message << "Building version #{alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}) (for upload to Alpha Channel)\n" if params[:alpha]
19
+ message << "[#{app}] Building version #{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}) (for upload to Release Channel)\n" if params[:final]
20
+ message << "[#{app}] Building version #{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}) (for upload to Beta Channel)\n" if params[:beta]
21
+ message << "[#{app}] Building version #{alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}) (for upload to Alpha Channel)\n" if params[:alpha]
20
22
 
21
- if !params[:skip_confirm]
22
- UI.user_error!('Aborted by user request') unless UI.confirm("#{message}Do you want to continue?")
23
- else
23
+ if params[:skip_confirm]
24
24
  UI.message(message)
25
+ else
26
+ UI.user_error!('Aborted by user request') unless UI.confirm("#{message}Do you want to continue?")
25
27
  end
26
28
 
27
29
  # Check local repo status
@@ -62,6 +64,10 @@ module Fastlane
62
64
  description: 'True if this is for a final build',
63
65
  is_string: false,
64
66
  default_value: false),
67
+ FastlaneCore::ConfigItem.new(key: :app,
68
+ env_name: 'PROJECT_NAME',
69
+ description: 'The name of the app to get the release version for',
70
+ is_string: true), # true: verifies the input is a string, false: every kind of value
65
71
  ]
66
72
  end
67
73
 
@@ -4,15 +4,26 @@ module Fastlane
4
4
  def self.run(params)
5
5
  UI.message 'Bumping app release version...'
6
6
 
7
- require_relative '../../helper/android/android_git_helper.rb'
8
- require_relative '../../helper/android/android_version_helper.rb'
7
+ require_relative '../../helper/android/android_git_helper'
8
+ require_relative '../../helper/android/android_version_helper'
9
9
 
10
10
  Fastlane::Helper::GitHelper.ensure_on_branch!('release')
11
- create_config()
12
- show_config()
11
+ app = params[:app]
13
12
 
14
- UI.message 'Updating build.gradle...'
15
- Fastlane::Helper::Android::VersionHelper.update_versions(@new_version_beta, @new_version_alpha)
13
+ current_version = Fastlane::Helper::Android::VersionHelper.get_release_version(product_name: app)
14
+ current_version_alpha = Fastlane::Helper::Android::VersionHelper.get_alpha_version(app)
15
+ new_version_beta = Fastlane::Helper::Android::VersionHelper.calc_next_beta_version(current_version, current_version_alpha)
16
+ new_version_alpha = current_version_alpha.nil? ? nil : Fastlane::Helper::Android::VersionHelper.calc_next_alpha_version(new_version_beta, current_version_alpha)
17
+
18
+ vname = Fastlane::Helper::Android::VersionHelper::VERSION_NAME
19
+ vcode = Fastlane::Helper::Android::VersionHelper::VERSION_CODE
20
+ UI.message("Current version[#{app}]: #{current_version[vname]}(#{current_version[vcode]})")
21
+ UI.message("Current alpha version[#{app}]: #{current_version_alpha[vname]}(#{current_version_alpha[vcode]})") unless current_version_alpha.nil?
22
+ UI.message("New beta version[#{app}]: #{new_version_beta[vname]}(#{new_version_beta[vcode]})")
23
+ UI.message("New alpha version[#{app}]: #{new_version_alpha[vname]}(#{new_version_alpha[vcode]})") unless current_version_alpha.nil?
24
+
25
+ UI.message 'Updating app version...'
26
+ Fastlane::Helper::Android::VersionHelper.update_versions(app, new_version_beta, new_version_alpha)
16
27
  UI.message 'Done!'
17
28
 
18
29
  Fastlane::Helper::Android::GitHelper.commit_version_bump()
@@ -23,14 +34,21 @@ module Fastlane
23
34
  #####################################################
24
35
 
25
36
  def self.description
26
- 'Bumps the version of the app for a new beta'
37
+ 'Bumps the version of the app for a new beta. Requires the `updateVersionProperties` gradle task to update the keys if you are using a `version.properties` file.'
27
38
  end
28
39
 
29
40
  def self.details
30
- 'Bumps the version of the app for a new beta'
41
+ 'Bumps the version of the app for a new beta. Requires the `updateVersionProperties` gradle task to update the keys if you are using a `version.properties` file.'
31
42
  end
32
43
 
33
44
  def self.available_options
45
+ # Define all options your action supports.
46
+ [
47
+ FastlaneCore::ConfigItem.new(key: :app,
48
+ env_name: 'PROJECT_NAME',
49
+ description: 'The name of the app to get the release version for',
50
+ is_string: true), # true: verifies the input is a string, false: every kind of value
51
+ ]
34
52
  end
35
53
 
36
54
  def self.output
@@ -46,24 +64,6 @@ module Fastlane
46
64
  def self.is_supported?(platform)
47
65
  platform == :android
48
66
  end
49
-
50
- private
51
-
52
- def self.create_config
53
- @current_version = Fastlane::Helper::Android::VersionHelper.get_release_version()
54
- @current_version_alpha = Fastlane::Helper::Android::VersionHelper.get_alpha_version()
55
- @new_version_beta = Fastlane::Helper::Android::VersionHelper.calc_next_beta_version(@current_version, @current_version_alpha)
56
- @new_version_alpha = ENV['HAS_ALPHA_VERSION'].nil? ? nil : Fastlane::Helper::Android::VersionHelper.calc_next_alpha_version(@new_version_beta, @current_version_alpha)
57
- end
58
-
59
- def self.show_config
60
- vname = Fastlane::Helper::Android::VersionHelper::VERSION_NAME
61
- vcode = Fastlane::Helper::Android::VersionHelper::VERSION_CODE
62
- UI.message("Current version: #{@current_version[vname]}(#{@current_version[vcode]})")
63
- UI.message("Current alpha version: #{@current_version_alpha[vname]}(#{@current_version_alpha[vcode]})") unless ENV['HAS_ALPHA_VERSION'].nil?
64
- UI.message("New beta version: #{@new_version_beta[vname]}(#{@new_version_beta[vcode]})")
65
- UI.message("New alpha version: #{@new_version_alpha[vname]}(#{@new_version_alpha[vcode]})") unless ENV['HAS_ALPHA_VERSION'].nil?
66
- end
67
67
  end
68
68
  end
69
69
  end
@@ -4,15 +4,24 @@ module Fastlane
4
4
  def self.run(params)
5
5
  UI.message 'Bumping app release version...'
6
6
 
7
- require_relative '../../helper/android/android_git_helper.rb'
8
- require_relative '../../helper/android/android_version_helper.rb'
7
+ require_relative '../../helper/android/android_git_helper'
8
+ require_relative '../../helper/android/android_version_helper'
9
9
 
10
10
  Fastlane::Helper::GitHelper.ensure_on_branch!('release')
11
- create_config()
12
- show_config()
11
+ app = params[:app]
13
12
 
14
- UI.message 'Updating gradle.properties...'
15
- Fastlane::Helper::Android::VersionHelper.update_versions(@final_version, @current_version_alpha)
13
+ current_version = Fastlane::Helper::Android::VersionHelper.get_release_version(product_name: app)
14
+ current_version_alpha = Fastlane::Helper::Android::VersionHelper.get_alpha_version(app)
15
+ final_version = Fastlane::Helper::Android::VersionHelper.calc_final_release_version(current_version, current_version_alpha)
16
+
17
+ vname = Fastlane::Helper::Android::VersionHelper::VERSION_NAME
18
+ vcode = Fastlane::Helper::Android::VersionHelper::VERSION_CODE
19
+ UI.message("Current version[#{app}]: #{current_version[vname]}(#{current_version[vcode]})")
20
+ UI.message("Current alpha version[#{app}]: #{current_version_alpha[vname]}(#{current_version_alpha[vcode]})") unless current_version_alpha.nil?
21
+ UI.message("New release version[#{app}]: #{final_version[vname]}(#{final_version[vcode]})")
22
+
23
+ UI.message 'Updating app version...'
24
+ Fastlane::Helper::Android::VersionHelper.update_versions(app, final_version, current_version_alpha)
16
25
  UI.message 'Done!'
17
26
 
18
27
  Fastlane::Helper::Android::GitHelper.commit_version_bump()
@@ -23,11 +32,21 @@ module Fastlane
23
32
  #####################################################
24
33
 
25
34
  def self.description
26
- 'Bumps the version of the app for a new beta'
35
+ 'Bumps the version of the app for a new beta. Requires the `updateVersionProperties` gradle task to update the keys if you are using a `version.properties` file.'
27
36
  end
28
37
 
29
38
  def self.details
30
- 'Bumps the version of the app for a new beta'
39
+ 'Bumps the version of the app for a new beta. Requires the `updateVersionProperties` gradle task to update the keys if you are using a `version.properties` file.'
40
+ end
41
+
42
+ def self.available_options
43
+ # Define all options your action supports.
44
+ [
45
+ FastlaneCore::ConfigItem.new(key: :app,
46
+ env_name: 'PROJECT_NAME',
47
+ description: 'The name of the app to get the release version for',
48
+ is_string: true), # true: verifies the input is a string, false: every kind of value
49
+ ]
31
50
  end
32
51
 
33
52
  def self.authors
@@ -37,22 +56,6 @@ module Fastlane
37
56
  def self.is_supported?(platform)
38
57
  platform == :android
39
58
  end
40
-
41
- private
42
-
43
- def self.create_config
44
- @current_version = Fastlane::Helper::Android::VersionHelper.get_release_version()
45
- @current_version_alpha = Fastlane::Helper::Android::VersionHelper.get_alpha_version()
46
- @final_version = Fastlane::Helper::Android::VersionHelper.calc_final_release_version(@current_version, @current_version_alpha)
47
- end
48
-
49
- def self.show_config
50
- vname = Fastlane::Helper::Android::VersionHelper::VERSION_NAME
51
- vcode = Fastlane::Helper::Android::VersionHelper::VERSION_CODE
52
- UI.message("Current version: #{@current_version[vname]}(#{@current_version[vcode]})")
53
- UI.message("Current alpha version: #{@current_version_alpha[vname]}(#{@current_version_alpha[vcode]})") unless ENV['HAS_ALPHA_VERSION'].nil?
54
- UI.message("New release version: #{@final_version[vname]}(#{@final_version[vcode]})")
55
- end
56
59
  end
57
60
  end
58
61
  end