pantograph 0.1.12 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/pantograph/lib/pantograph/actions/artifactory.rb +15 -15
  3. data/pantograph/lib/pantograph/actions/bundle_install.rb +33 -33
  4. data/pantograph/lib/pantograph/actions/changelog_from_git_commits.rb +14 -14
  5. data/pantograph/lib/pantograph/actions/cloc.rb +15 -15
  6. data/pantograph/lib/pantograph/actions/danger.rb +26 -26
  7. data/pantograph/lib/pantograph/actions/download.rb +3 -3
  8. data/pantograph/lib/pantograph/actions/ensure_git_branch.rb +4 -4
  9. data/pantograph/lib/pantograph/actions/ensure_git_status_clean.rb +10 -10
  10. data/pantograph/lib/pantograph/actions/erb.rb +12 -12
  11. data/pantograph/lib/pantograph/actions/get_github_release.rb +10 -10
  12. data/pantograph/lib/pantograph/actions/github_api.rb +20 -20
  13. data/pantograph/lib/pantograph/actions/gradle.rb +67 -85
  14. data/pantograph/lib/pantograph/actions/jira.rb +14 -14
  15. data/pantograph/lib/pantograph/actions/make_changelog_from_jenkins.rb +9 -9
  16. data/pantograph/lib/pantograph/actions/nexus_upload.rb +37 -37
  17. data/pantograph/lib/pantograph/actions/number_of_commits.rb +6 -6
  18. data/pantograph/lib/pantograph/actions/push_git_tags.rb +7 -7
  19. data/pantograph/lib/pantograph/actions/push_to_git_remote.rb +19 -19
  20. data/pantograph/lib/pantograph/actions/reset_git_repo.rb +9 -9
  21. data/pantograph/lib/pantograph/actions/rsync.rb +14 -14
  22. data/pantograph/lib/pantograph/actions/set_github_release.rb +19 -19
  23. data/pantograph/lib/pantograph/actions/slack.rb +28 -28
  24. data/pantograph/lib/pantograph/actions/sonar.rb +32 -32
  25. data/pantograph/lib/pantograph/actions/ssh.rb +22 -22
  26. data/pantograph/lib/pantograph/actions/twitter.rb +14 -14
  27. data/pantograph/lib/pantograph/actions/update_pantograph.rb +16 -16
  28. data/pantograph/lib/pantograph/actions/zip.rb +12 -12
  29. data/pantograph/lib/pantograph/helper/gradle_helper.rb +2 -3
  30. data/pantograph/lib/pantograph/junit_generator.rb +1 -1
  31. data/pantograph/lib/pantograph/lane_manager.rb +1 -1
  32. data/pantograph/lib/pantograph/plugins/template/.rubocop.yml +2 -0
  33. data/pantograph/lib/pantograph/setup/setup.rb +6 -6
  34. data/pantograph/lib/pantograph/version.rb +1 -1
  35. data/pantograph_core/lib/pantograph_core/helper.rb +1 -1
  36. data/pantograph_core/lib/pantograph_core/print_table.rb +1 -1
  37. data/pantograph_core/lib/pantograph_core/swag.rb +2 -2
  38. metadata +2 -2
@@ -26,7 +26,7 @@ module Pantograph
26
26
  #####################################################
27
27
 
28
28
  def self.description
29
- "Download a file from a remote server (e.g. JSON file)"
29
+ 'Download a file from a remote server (e.g. JSON file)'
30
30
  end
31
31
 
32
32
  def self.details
@@ -40,7 +40,7 @@ module Pantograph
40
40
  def self.available_options
41
41
  [
42
42
  PantographCore::ConfigItem.new(key: :url,
43
- env_name: "FL_DOWNLOAD_URL",
43
+ env_name: 'DOWNLOAD_URL',
44
44
  description: "The URL that should be downloaded",
45
45
  verify_block: proc do |value|
46
46
  UI.important("The URL doesn't start with http or https") unless value.start_with?("http")
@@ -65,7 +65,7 @@ module Pantograph
65
65
  end
66
66
 
67
67
  def self.authors
68
- ["KrauseFx"]
68
+ ['KrauseFx']
69
69
  end
70
70
 
71
71
  def self.is_supported?(platform)
@@ -20,20 +20,20 @@ module Pantograph
20
20
  #####################################################
21
21
 
22
22
  def self.description
23
- "Raises an exception if not on a specific git branch"
23
+ 'Raises an exception if not on a specific git branch'
24
24
  end
25
25
 
26
26
  def self.details
27
27
  [
28
- "This action will check if your git repo is checked out to a specific branch.",
29
- "You may only want to make releases from a specific branch, so `ensure_git_branch` will stop a lane if it was accidentally executed on an incorrect branch."
28
+ 'This action will check if your git repo is checked out to a specific branch.',
29
+ 'You may only want to make releases from a specific branch, so `ensure_git_branch` will stop a lane if it was accidentally executed on an incorrect branch.'
30
30
  ].join("\n")
31
31
  end
32
32
 
33
33
  def self.available_options
34
34
  [
35
35
  PantographCore::ConfigItem.new(key: :branch,
36
- env_name: "FL_ENSURE_GIT_BRANCH_NAME",
36
+ env_name: 'ENSURE_GIT_BRANCH_NAME',
37
37
  description: "The branch that should be checked for. String that can be either the full name of the branch or a regex to match",
38
38
  type: String,
39
39
  default_value: 'master')
@@ -14,7 +14,7 @@ module Pantograph
14
14
  UI.success('Git status is clean, all good! 💪')
15
15
  Actions.lane_context[SharedValues::GIT_REPO_WAS_CLEAN_ON_START] = true
16
16
  else
17
- error_message = "Git repository is dirty! Please ensure the repo is in a clean state by committing/stashing/discarding all changes first."
17
+ error_message = 'Git repository is dirty! Please ensure the repo is in a clean state by committing/stashing/discarding all changes first.'
18
18
  error_message += "\nUncommitted changes:\n#{repo_status}" if params[:show_uncommitted_changes]
19
19
  if params[:show_diff]
20
20
  repo_diff = Actions.sh("git diff")
@@ -25,14 +25,14 @@ module Pantograph
25
25
  end
26
26
 
27
27
  def self.description
28
- "Raises an exception if there are uncommitted git changes"
28
+ 'Raises an exception if there are uncommitted git changes'
29
29
  end
30
30
 
31
31
  def self.details
32
32
  [
33
- "A sanity check to make sure you are working in a repo that is clean.",
34
- "Especially useful to put at the beginning of your Pantfile in the `before_all` block, if some of your other actions will touch your filesystem, do things to your git repo, or just as a general reminder to save your work.",
35
- "Also needed as a prerequisite for some other actions like `reset_git_repo`."
33
+ 'A sanity check to make sure you are working in a repo that is clean.',
34
+ 'Especially useful to put at the beginning of your Pantfile in the `before_all` block, if some of your other actions will touch your filesystem, do things to your git repo, or just as a general reminder to save your work.',
35
+ 'Also needed as a prerequisite for some other actions like `reset_git_repo`.'
36
36
  ].join("\n")
37
37
  end
38
38
 
@@ -43,7 +43,7 @@ module Pantograph
43
43
  end
44
44
 
45
45
  def self.author
46
- ["lmirosevic", "antondomashnev"]
46
+ ['lmirosevic', 'antondomashnev']
47
47
  end
48
48
 
49
49
  def self.example_code
@@ -55,14 +55,14 @@ module Pantograph
55
55
  def self.available_options
56
56
  [
57
57
  PantographCore::ConfigItem.new(key: :show_uncommitted_changes,
58
- env_name: "FL_ENSURE_GIT_STATUS_CLEAN_SHOW_UNCOMMITTED_CHANGES",
59
- description: "The flag whether to show uncommitted changes if the repo is dirty",
58
+ env_name: 'ENSURE_GIT_STATUS_CLEAN_SHOW_UNCOMMITTED_CHANGES',
59
+ description: 'The flag whether to show uncommitted changes if the repo is dirty',
60
60
  optional: true,
61
61
  default_value: false,
62
62
  is_string: false),
63
63
  PantographCore::ConfigItem.new(key: :show_diff,
64
- env_name: "FL_ENSURE_GIT_STATUS_CLEAN_SHOW_DIFF",
65
- description: "The flag whether to show the git diff if the repo is dirty",
64
+ env_name: 'ENSURE_GIT_STATUS_CLEAN_SHOW_DIFF',
65
+ description: 'The flag whether to show the git diff if the repo is dirty',
66
66
  optional: true,
67
67
  default_value: false,
68
68
  is_string: false)
@@ -14,13 +14,13 @@ module Pantograph
14
14
  #####################################################
15
15
 
16
16
  def self.description
17
- "Allows to Generate output files based on ERB templates"
17
+ 'Allows to Generate output files based on ERB templates'
18
18
  end
19
19
 
20
20
  def self.details
21
21
  [
22
- "Renders an ERB template with `:placeholders` given as a hash via parameter.",
23
- "If no `:destination` is set, it returns the rendered template as string."
22
+ 'Renders an ERB template with `:placeholders` given as a hash via parameter.',
23
+ 'If no `:destination` is set, it returns the rendered template as string.'
24
24
  ].join("\n")
25
25
  end
26
26
 
@@ -28,21 +28,21 @@ module Pantograph
28
28
  [
29
29
 
30
30
  PantographCore::ConfigItem.new(key: :template,
31
- short_option: "-T",
32
- env_name: "FL_ERB_SRC",
33
- description: "ERB Template File",
31
+ short_option: '-T',
32
+ env_name: 'ERB_SRC',
33
+ description: 'ERB Template File',
34
34
  optional: false,
35
35
  type: String),
36
36
  PantographCore::ConfigItem.new(key: :destination,
37
- short_option: "-D",
38
- env_name: "FL_ERB_DST",
39
- description: "Destination file",
37
+ short_option: '-D',
38
+ env_name: 'ERB_DST',
39
+ description: 'Destination file',
40
40
  optional: true,
41
41
  type: String),
42
42
  PantographCore::ConfigItem.new(key: :placeholders,
43
- short_option: "-p",
44
- env_name: "FL_ERB_PLACEHOLDERS",
45
- description: "Placeholders given as a hash",
43
+ short_option: '-p',
44
+ env_name: 'ERB_PLACEHOLDERS',
45
+ description: 'Placeholders given as a hash',
46
46
  default_value: {},
47
47
  is_string: false,
48
48
  type: Hash)
@@ -95,7 +95,7 @@ module Pantograph
95
95
  SAMPLE
96
96
 
97
97
  [
98
- "This will return all information about a release. For example:".markdown_preserve_newlines,
98
+ 'This will return all information about a release. For example:'.markdown_preserve_newlines,
99
99
  sample
100
100
  ].join("\n")
101
101
  end
@@ -109,27 +109,27 @@ module Pantograph
109
109
  def self.available_options
110
110
  [
111
111
  PantographCore::ConfigItem.new(key: :url,
112
- env_name: "FL_GET_GITHUB_RELEASE_URL",
113
- description: "The path to your repo, e.g. 'KrauseFx/pantograph'",
112
+ env_name: 'GET_GITHUB_RELEASE_URL',
113
+ description: "The path to your repo, e.g. 'johnknapprs/pantograph'",
114
114
  verify_block: proc do |value|
115
- UI.user_error!("Please only pass the path, e.g. 'KrauseFx/pantograph'") if value.include?("github.com")
115
+ UI.user_error!("Please only pass the path, e.g. 'KrauseFx/pantograph'") if value.include?('github.com')
116
116
  UI.user_error!("Please only pass the path, e.g. 'KrauseFx/pantograph'") if value.split('/').count != 2
117
117
  end),
118
118
  PantographCore::ConfigItem.new(key: :server_url,
119
- env_name: "FL_GITHUB_RELEASE_SERVER_URL",
119
+ env_name: 'GITHUB_RELEASE_SERVER_URL',
120
120
  description: "The server url. e.g. 'https://your.github.server/api/v3' (Default: 'https://api.github.com')",
121
121
  default_value: "https://api.github.com",
122
122
  optional: true,
123
123
  verify_block: proc do |value|
124
- UI.user_error!("Please include the protocol in the server url, e.g. https://your.github.server") unless value.include?("//")
124
+ UI.user_error!('Please include the protocol in the server url, e.g. https://your.github.server') unless value.include?("//")
125
125
  end),
126
126
  PantographCore::ConfigItem.new(key: :version,
127
- env_name: "FL_GET_GITHUB_RELEASE_VERSION",
128
- description: "The version tag of the release to check"),
127
+ env_name: 'GET_GITHUB_RELEASE_VERSION',
128
+ description: 'The version tag of the release to check'),
129
129
  PantographCore::ConfigItem.new(key: :api_token,
130
- env_name: "FL_GITHUB_RELEASE_API_TOKEN",
130
+ env_name: 'GITHUB_RELEASE_API_TOKEN',
131
131
  sensitive: true,
132
- description: "GitHub Personal Token (required for private repositories)",
132
+ description: 'GitHub Personal Token (required for private repositories)',
133
133
  optional: true)
134
134
  ]
135
135
  end
@@ -79,26 +79,26 @@ module Pantograph
79
79
  def available_options
80
80
  [
81
81
  PantographCore::ConfigItem.new(key: :server_url,
82
- env_name: "FL_GITHUB_API_SERVER_URL",
82
+ env_name: 'GITHUB_API_SERVER_URL',
83
83
  description: "The server url. e.g. 'https://your.internal.github.host/api/v3' (Default: 'https://api.github.com')",
84
- default_value: "https://api.github.com",
84
+ default_value: 'https://api.github.com',
85
85
  optional: true,
86
86
  verify_block: proc do |value|
87
87
  UI.user_error!("Please include the protocol in the server url, e.g. https://your.github.server/api/v3") unless value.include?("//")
88
88
  end),
89
89
  PantographCore::ConfigItem.new(key: :api_token,
90
- env_name: "FL_GITHUB_API_TOKEN",
91
- description: "Personal API Token for GitHub - generate one at https://github.com/settings/tokens",
90
+ env_name: 'GITHUB_API_TOKEN',
91
+ description: 'Personal API Token for GitHub - generate one at https://github.com/settings/tokens',
92
92
  sensitive: true,
93
93
  code_gen_sensitive: true,
94
94
  type: String,
95
- default_value: ENV["GITHUB_API_TOKEN"],
95
+ default_value: ENV['GITHUB_API_TOKEN'],
96
96
  default_value_dynamic: true,
97
97
  optional: false),
98
98
  PantographCore::ConfigItem.new(key: :http_method,
99
- env_name: "FL_GITHUB_API_HTTP_METHOD",
100
- description: "The HTTP method. e.g. GET / POST",
101
- default_value: "GET",
99
+ env_name: 'GITHUB_API_HTTP_METHOD',
100
+ description: 'The HTTP method. e.g. GET / POST',
101
+ default_value: 'GET',
102
102
  optional: true,
103
103
  verify_block: proc do |value|
104
104
  unless %w(GET POST PUT DELETE HEAD CONNECT PATCH).include?(value.to_s.upcase)
@@ -106,22 +106,22 @@ module Pantograph
106
106
  end
107
107
  end),
108
108
  PantographCore::ConfigItem.new(key: :body,
109
- env_name: "FL_GITHUB_API_REQUEST_BODY",
110
- description: "The request body in JSON or hash format",
109
+ env_name: 'GITHUB_API_REQUEST_BODY',
110
+ description: 'The request body in JSON or hash format',
111
111
  is_string: false,
112
112
  default_value: {},
113
113
  optional: true),
114
114
  PantographCore::ConfigItem.new(key: :raw_body,
115
- env_name: "FL_GITHUB_API_REQUEST_RAW_BODY",
116
- description: "The request body taken verbatim instead of as JSON, useful for file uploads",
115
+ env_name: 'GITHUB_API_REQUEST_RAW_BODY',
116
+ description: 'The request body taken verbatim instead of as JSON, useful for file uploads',
117
117
  type: String,
118
118
  optional: true),
119
119
  PantographCore::ConfigItem.new(key: :path,
120
- env_name: "FL_GITHUB_API_PATH",
120
+ env_name: 'GITHUB_API_PATH',
121
121
  description: "The endpoint path. e.g. '/repos/:owner/:repo/readme'",
122
122
  optional: true),
123
123
  PantographCore::ConfigItem.new(key: :url,
124
- env_name: "FL_GITHUB_API_URL",
124
+ env_name: 'GITHUB_API_URL',
125
125
  description: "The complete full url - used instead of path. e.g. 'https://uploads.github.com/repos/pantograph...'",
126
126
  optional: true,
127
127
  verify_block: proc do |value|
@@ -133,13 +133,13 @@ module Pantograph
133
133
  default_value: {},
134
134
  optional: true),
135
135
  PantographCore::ConfigItem.new(key: :headers,
136
- description: "Optional headers to apply",
136
+ description: 'Optional headers to apply',
137
137
  is_string: false,
138
138
  default_value: {},
139
139
  optional: true),
140
140
  PantographCore::ConfigItem.new(key: :secure,
141
- env_name: "FL_GITHUB_API_SECURE",
142
- description: "Optionally disable secure requests (ssl_verify_peer)",
141
+ env_name: 'GITHUB_API_SECURE',
142
+ description: 'Optionally disable secure requests (ssl_verify_peer)',
143
143
  type: Boolean,
144
144
  default_value: true,
145
145
  optional: true)
@@ -155,11 +155,11 @@ module Pantograph
155
155
  end
156
156
 
157
157
  def return_value
158
- "A hash including the HTTP status code (:status), the response body (:body), and if valid JSON has been returned the parsed JSON (:json)."
158
+ 'A hash including the HTTP status code (:status), the response body (:body), and if valid JSON has been returned the parsed JSON (:json).'
159
159
  end
160
160
 
161
161
  def authors
162
- ["tommeier"]
162
+ ['tommeier']
163
163
  end
164
164
 
165
165
  def example_code
@@ -227,7 +227,7 @@ module Pantograph
227
227
  elsif body.kind_of?(Array)
228
228
  body.to_json
229
229
  else
230
- UI.user_error!("Please provide valid JSON, or a hash as request body") unless parse_json(body)
230
+ UI.user_error!('Please provide valid JSON, or a hash as request body') unless parse_json(body)
231
231
  body
232
232
  end
233
233
  end
@@ -4,27 +4,20 @@ require 'shellwords'
4
4
  module Pantograph
5
5
  module Actions
6
6
  module SharedValues
7
- GRADLE_APK_OUTPUT_PATH = :GRADLE_APK_OUTPUT_PATH
8
- GRADLE_ALL_APK_OUTPUT_PATHS = :GRADLE_ALL_APK_OUTPUT_PATHS
9
- GRADLE_AAB_OUTPUT_PATH = :GRADLE_AAB_OUTPUT_PATH
10
- GRADLE_ALL_AAB_OUTPUT_PATHS = :GRADLE_ALL_AAB_OUTPUT_PATHS
11
- GRADLE_OUTPUT_JSON_OUTPUT_PATH = :GRADLE_OUTPUT_JSON_OUTPUT_PATH
12
- GRADLE_ALL_OUTPUT_JSON_OUTPUT_PATHS = :GRADLE_ALL_OUTPUT_JSON_OUTPUT_PATHS
13
- GRADLE_FLAVOR = :GRADLE_FLAVOR
14
- GRADLE_BUILD_TYPE = :GRADLE_BUILD_TYPE
7
+ GRADLE_ARTIFACT_OUTPUT_PATH = :GRADLE_ARTIFACT_OUTPUT_PATH
8
+ GRADLE_FLAVOR = :GRADLE_FLAVOR
9
+ GRADLE_BUILD_TYPE = :GRADLE_BUILD_TYPE
15
10
  end
16
11
 
17
12
  class GradleAction < Action
18
13
  def self.run(params)
19
- task = params[:task]
20
- flavor = params[:flavor]
21
- build_type = params[:build_type]
22
-
14
+ task = params[:task]
15
+ flavor = params[:flavor]
16
+ build_type = params[:build_type]
23
17
  gradle_task = [task, flavor, build_type].join
24
18
 
25
- project_dir = params[:project_dir]
26
-
27
- gradle_path_param = params[:gradle_path] || './gradlew'
19
+ project_dir = params[:project_dir]
20
+ gradle_path_param = params[:gradle_path]
28
21
 
29
22
  # Get the path to gradle, if it's an absolute path we take it as is, if it's relative we assume it's relative to the project_dir
30
23
  gradle_path = if Pathname.new(gradle_path_param).absolute?
@@ -39,8 +32,15 @@ module Pantograph
39
32
  # Construct our flags
40
33
  flags = []
41
34
  flags << "-p #{project_dir.shellescape}"
42
- flags << params[:properties].map { |k, v| "-P#{k.to_s.shellescape}=#{v.to_s.shellescape}" }.join(' ') unless params[:properties].nil?
43
- flags << params[:system_properties].map { |k, v| "-D#{k.to_s.shellescape}=#{v.to_s.shellescape}" }.join(' ') unless params[:system_properties].nil?
35
+
36
+ unless params[:properties].nil?
37
+ flags << params[:properties].map { |k, v| "-P#{k.to_s.shellescape}=#{v.to_s.shellescape}" }.join(' ')
38
+ end
39
+
40
+ unless params[:system_properties].nil?
41
+ flags << params[:system_properties].map { |k, v| "-D#{k.to_s.shellescape}=#{v.to_s.shellescape}" }.join(' ')
42
+ end
43
+
44
44
  flags << params[:flags] unless params[:flags].nil?
45
45
 
46
46
  # Run the actual gradle task
@@ -51,45 +51,30 @@ module Pantograph
51
51
  Actions.lane_context[SharedValues::GRADLE_FLAVOR] = flavor if flavor
52
52
 
53
53
  # We run the actual gradle task
54
- result = gradle.trigger(task: gradle_task,
55
- serial: params[:serial],
56
- flags: flags.join(' '),
57
- print_command: params[:print_command],
58
- print_command_output: params[:print_command_output])
59
-
60
- # If we didn't build, then we return now, as it makes no sense to search for apk's in a non-`assemble` or non-`build` scenario
61
- return result unless task =~ /\b(assemble)/ || task =~ /\b(bundle)/
62
-
63
- apk_search_path = File.join(project_dir, '**', 'build', 'outputs', 'apk', '**', '*.apk')
64
- aab_search_path = File.join(project_dir, '**', 'build', 'outputs', 'bundle', '**', '*.aab')
65
- output_json_search_path = File.join(project_dir, '**', 'build', 'outputs', 'apk', '**', 'output.json')
66
-
67
- # Our apk/aab is now built, but there might actually be multiple ones that were built if a flavor was not specified in a multi-flavor project (e.g. `assembleRelease`)
68
- # However, we're not interested in unaligned apk's...
69
- new_apks = Dir[apk_search_path].reject { |path| path =~ /^.*-unaligned.apk$/i }
70
- new_apks = new_apks.map { |path| File.expand_path(path) }
71
- new_aabs = Dir[aab_search_path]
72
- new_aabs = new_aabs.map { |path| File.expand_path(path) }
73
- new_output_jsons = Dir[output_json_search_path]
74
- new_output_jsons = new_output_jsons.map { |path| File.expand_path(path) }
75
-
76
- # We expose all of these new apks and aabs
77
- Actions.lane_context[SharedValues::GRADLE_ALL_APK_OUTPUT_PATHS] = new_apks
78
- Actions.lane_context[SharedValues::GRADLE_ALL_AAB_OUTPUT_PATHS] = new_aabs
79
- Actions.lane_context[SharedValues::GRADLE_ALL_OUTPUT_JSON_OUTPUT_PATHS] = new_output_jsons
80
-
81
- # We also take the most recent apk and aab to return as SharedValues::GRADLE_APK_OUTPUT_PATH and SharedValues::GRADLE_AAB_OUTPUT_PATH
54
+ result = gradle.trigger(
55
+ task: gradle_task,
56
+ flags: flags.join(' '),
57
+ print_command: params[:print_command],
58
+ print_command_output: params[:print_command_output]
59
+ )
60
+
61
+ # If we didn't build, then we return now, as it makes no sense to search for artifacts's in a non-`assemble` or non-`build` scenario
62
+ return result unless task =~ /\b(assemble)/ || task =~ /\b(build)/
63
+
64
+ artifact_search_path = File.join(project_dir, '**', 'build', '**', "*.#{params[:artifact_extension].gsub('.', '')}")
65
+
66
+ # Our artifact is now built, but there might actually be multiple ones that were built if a flavor was not specified in a multi-flavor project (e.g. `assembleRelease`)
67
+ new_artifacts = Dir[artifact_search_path].map { |path| File.expand_path(path) }
68
+
69
+ # We also take the most recent artifact to return as SharedValues::GRADLE_ARTIFACT_OUTPUT_PATH
82
70
  # This is the one that will be relevant for most projects that just build a single build variant (flavor + build type combo).
83
71
  # In multi build variants this value is undefined
84
- last_apk_path = new_apks.sort_by(&File.method(:mtime)).last
85
- last_aab_path = new_aabs.sort_by(&File.method(:mtime)).last
86
- last_output_json_path = new_output_jsons.sort_by(&File.method(:mtime)).last
87
- Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH] = File.expand_path(last_apk_path) if last_apk_path
88
- Actions.lane_context[SharedValues::GRADLE_AAB_OUTPUT_PATH] = File.expand_path(last_aab_path) if last_aab_path
89
- Actions.lane_context[SharedValues::GRADLE_OUTPUT_JSON_OUTPUT_PATH] = File.expand_path(last_output_json_path) if last_output_json_path
72
+ last_artifact_path = new_artifacts.sort_by(&File.method(:mtime)).last
73
+ Actions.lane_context[SharedValues::GRADLE_ARTIFACT_OUTPUT_PATH] = File.expand_path(last_artifact_path) if last_artifact_path
90
74
 
91
- # Give a helpful message in case there were no new apks or aabs. Remember we're only running this code when assembling, in which case we certainly expect there to be an apk or aab
92
- UI.message('Couldn\'t find any new signed apk files...') if new_apks.empty? && new_aabs.empty?
75
+ # Give a helpful message in case there were no new artifacts.
76
+ # Remember we're only running this code when assembling, in which case we certainly expect there to be an artifact
77
+ UI.message('Couldn\'t find any new artifact files...') if new_artifacts.empty?
93
78
 
94
79
  return result
95
80
  end
@@ -99,7 +84,7 @@ module Pantograph
99
84
  #####################################################
100
85
 
101
86
  def self.description
102
- 'All gradle related actions, including building and testing your Android app'
87
+ 'All gradle related actions, including building and testing your application'
103
88
  end
104
89
 
105
90
  def self.details
@@ -109,57 +94,59 @@ module Pantograph
109
94
  def self.available_options
110
95
  [
111
96
  PantographCore::ConfigItem.new(key: :task,
112
- env_name: 'FL_GRADLE_TASK',
97
+ env_name: 'GRADLE_TASK',
113
98
  description: 'The gradle task you want to execute, e.g. `assemble`, `bundle` or `test`. For tasks such as `assembleMyFlavorRelease` you should use gradle(task: \'assemble\', flavor: \'Myflavor\', build_type: \'Release\')',
114
99
  optional: false,
115
100
  type: String),
116
101
  PantographCore::ConfigItem.new(key: :flavor,
117
- env_name: 'FL_GRADLE_FLAVOR',
102
+ env_name: 'GRADLE_FLAVOR',
118
103
  description: 'The flavor that you want the task for, e.g. `MyFlavor`. If you are running the `assemble` task in a multi-flavor project, and you rely on Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH] then you must specify a flavor here or else this value will be undefined',
119
104
  optional: true,
120
105
  type: String),
121
106
  PantographCore::ConfigItem.new(key: :build_type,
122
- env_name: 'FL_GRADLE_BUILD_TYPE',
107
+ env_name: 'GRADLE_BUILD_TYPE',
123
108
  description: 'The build type that you want the task for, e.g. `Release`. Useful for some tasks such as `assemble`',
124
109
  optional: true,
125
110
  type: String),
126
111
  PantographCore::ConfigItem.new(key: :flags,
127
- env_name: 'FL_GRADLE_FLAGS',
112
+ env_name: 'GRADLE_FLAGS',
128
113
  description: 'All parameter flags you want to pass to the gradle command, e.g. `--exitcode --xml file.xml`',
129
114
  optional: true,
130
115
  type: String),
131
116
  PantographCore::ConfigItem.new(key: :project_dir,
132
- env_name: 'FL_GRADLE_PROJECT_DIR',
117
+ env_name: 'GRADLE_PROJECT_DIR',
133
118
  description: 'The root directory of the gradle project',
134
119
  default_value: '.',
135
120
  type: String),
136
121
  PantographCore::ConfigItem.new(key: :gradle_path,
137
- env_name: 'FL_GRADLE_PATH',
122
+ env_name: 'GRADLE_PATH',
138
123
  description: 'The path to your `gradlew`. If you specify a relative path, it is assumed to be relative to the `project_dir`',
139
124
  optional: true,
140
- type: String),
125
+ type: String,
126
+ default_value: './gradlew'),
141
127
  PantographCore::ConfigItem.new(key: :properties,
142
- env_name: 'FL_GRADLE_PROPERTIES',
128
+ env_name: 'GRADLE_PROPERTIES',
143
129
  description: 'Gradle properties to be exposed to the gradle script',
144
130
  optional: true,
145
131
  is_string: false),
132
+ PantographCore::ConfigItem.new(key: :artifact_extension,
133
+ env_name: 'GRADLE_ARTIFACT_EXTENSION',
134
+ description: 'Gradle build output filetype extension',
135
+ optional: true,
136
+ is_string: true,
137
+ default_value: 'jar'),
146
138
  PantographCore::ConfigItem.new(key: :system_properties,
147
- env_name: 'FL_GRADLE_SYSTEM_PROPERTIES',
139
+ env_name: 'GRADLE_SYSTEM_PROPERTIES',
148
140
  description: 'Gradle system properties to be exposed to the gradle script',
149
141
  optional: true,
150
142
  is_string: false),
151
- PantographCore::ConfigItem.new(key: :serial,
152
- env_name: 'FL_ANDROID_SERIAL',
153
- description: 'Android serial, which device should be used for this command',
154
- type: String,
155
- default_value: ''),
156
143
  PantographCore::ConfigItem.new(key: :print_command,
157
- env_name: 'FL_GRADLE_PRINT_COMMAND',
144
+ env_name: 'GRADLE_PRINT_COMMAND',
158
145
  description: 'Control whether the generated Gradle command is printed as output before running it (true/false)',
159
146
  is_string: false,
160
147
  default_value: true),
161
148
  PantographCore::ConfigItem.new(key: :print_command_output,
162
- env_name: 'FL_GRADLE_PRINT_COMMAND_OUTPUT',
149
+ env_name: 'GRADLE_PRINT_COMMAND_OUTPUT',
163
150
  description: 'Control whether the output produced by given Gradle command is printed while running (true/false)',
164
151
  is_string: false,
165
152
  default_value: true)
@@ -168,14 +155,9 @@ module Pantograph
168
155
 
169
156
  def self.output
170
157
  [
171
- ['GRADLE_APK_OUTPUT_PATH', 'The path to the newly generated apk file. Undefined in a multi-variant assemble scenario'],
172
- ['GRADLE_ALL_APK_OUTPUT_PATHS', 'When running a multi-variant `assemble`, the array of signed apk\'s that were generated'],
158
+ ['GRADLE_ARTIFACT_OUTPUT_PATH', 'The path to the newly generated artifact file. Undefined in a multi-variant assemble scenario'],
173
159
  ['GRADLE_FLAVOR', 'The flavor, e.g. `MyFlavor`'],
174
- ['GRADLE_BUILD_TYPE', 'The build type, e.g. `Release`'],
175
- ['GRADLE_AAB_OUTPUT_PATH', 'The path to the most recent Android app bundle'],
176
- ['GRADLE_ALL_AAB_OUTPUT_PATHS', 'The paths to the most recent Android app bundles'],
177
- ['GRADLE_OUTPUT_JSON_OUTPUT_PATH', 'The path to the most recent output.json file'],
178
- ['GRADLE_ALL_OUTPUT_JSON_OUTPUT_PATHS', 'The path to the newly generated output.json files']
160
+ ['GRADLE_BUILD_TYPE', 'The build type, e.g. `Release`']
179
161
  ]
180
162
  end
181
163
 
@@ -184,11 +166,11 @@ module Pantograph
184
166
  end
185
167
 
186
168
  def self.authors
187
- ['KrauseFx', 'lmirosevic']
169
+ ['KrauseFx', 'lmirosevic', 'johnknapprs']
188
170
  end
189
171
 
190
172
  def self.is_supported?(platform)
191
- [:ios, :android].include?(platform) # we support iOS as cross platforms apps might want to call `gradle` also
173
+ true
192
174
  end
193
175
 
194
176
  def self.example_code
@@ -222,17 +204,17 @@ module Pantograph
222
204
  )
223
205
  ```
224
206
 
225
- You can use this to automatically [sign and zipalign](https://developer.android.com/studio/publish/app-signing.html) your app:
207
+ You can use this to automatically [sign and zipalign] your app:
226
208
  ```ruby
227
209
  gradle(
228
210
  task: "assemble",
229
211
  build_type: "Release",
230
212
  print_command: false,
231
213
  properties: {
232
- "android.injected.signing.store.file" => "keystore.jks",
233
- "android.injected.signing.store.password" => "store_password",
234
- "android.injected.signing.key.alias" => "key_alias",
235
- "android.injected.signing.key.password" => "key_password",
214
+ "app.injected.signing.store.file" => "keystore.jks",
215
+ "app.injected.signing.store.password" => "store_password",
216
+ "app.injected.signing.key.alias" => "key_alias",
217
+ "app.injected.signing.key.password" => "key_password",
236
218
  }
237
219
  )
238
220
  ```
@@ -262,7 +244,7 @@ module Pantograph
262
244
  )
263
245
  ```
264
246
 
265
- Delete the build directory, generated APKs and AABs
247
+ Delete the build directory, generated artifacts
266
248
  ```ruby
267
249
  gradle(
268
250
  task: "clean"