pantograph 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +1 -0
- data/LICENSE +21 -0
- data/README.md +197 -0
- data/bin/bin-proxy +19 -0
- data/bin/pantograph +23 -0
- data/pantograph/README.md +11 -0
- data/pantograph/lib/assets/ActionDetails.md.erb +106 -0
- data/pantograph/lib/assets/Actions.md.erb +43 -0
- data/pantograph/lib/assets/DefaultPantfileTemplate +20 -0
- data/pantograph/lib/assets/completions/completion.bash +23 -0
- data/pantograph/lib/assets/completions/completion.fish +39 -0
- data/pantograph/lib/assets/completions/completion.sh +12 -0
- data/pantograph/lib/assets/completions/completion.zsh +23 -0
- data/pantograph/lib/assets/custom_action_template.rb +80 -0
- data/pantograph/lib/assets/report_template.xml.erb +15 -0
- data/pantograph/lib/pantograph/action.rb +194 -0
- data/pantograph/lib/pantograph/action_collector.rb +35 -0
- data/pantograph/lib/pantograph/actions/README.md +3 -0
- data/pantograph/lib/pantograph/actions/actions_helper.rb +166 -0
- data/pantograph/lib/pantograph/actions/add_extra_platforms.rb +45 -0
- data/pantograph/lib/pantograph/actions/artifactory.rb +157 -0
- data/pantograph/lib/pantograph/actions/bundle_install.rb +156 -0
- data/pantograph/lib/pantograph/actions/changelog_from_git_commits.rb +197 -0
- data/pantograph/lib/pantograph/actions/clipboard.rb +52 -0
- data/pantograph/lib/pantograph/actions/cloc.rb +89 -0
- data/pantograph/lib/pantograph/actions/create_pull_request.rb +190 -0
- data/pantograph/lib/pantograph/actions/danger.rb +131 -0
- data/pantograph/lib/pantograph/actions/debug.rb +32 -0
- data/pantograph/lib/pantograph/actions/default_platform.rb +47 -0
- data/pantograph/lib/pantograph/actions/download.rb +76 -0
- data/pantograph/lib/pantograph/actions/echo.rb +14 -0
- data/pantograph/lib/pantograph/actions/ensure_bundle_exec.rb +59 -0
- data/pantograph/lib/pantograph/actions/ensure_env_vars.rb +58 -0
- data/pantograph/lib/pantograph/actions/ensure_git_branch.rb +69 -0
- data/pantograph/lib/pantograph/actions/ensure_git_status_clean.rb +81 -0
- data/pantograph/lib/pantograph/actions/erb.rb +88 -0
- data/pantograph/lib/pantograph/actions/get_build_number_repository.rb +120 -0
- data/pantograph/lib/pantograph/actions/get_github_release.rb +163 -0
- data/pantograph/lib/pantograph/actions/git_add.rb +93 -0
- data/pantograph/lib/pantograph/actions/git_branch.rb +58 -0
- data/pantograph/lib/pantograph/actions/git_commit.rb +80 -0
- data/pantograph/lib/pantograph/actions/git_pull.rb +53 -0
- data/pantograph/lib/pantograph/actions/git_submodule_update.rb +52 -0
- data/pantograph/lib/pantograph/actions/git_tag_exists.rb +74 -0
- data/pantograph/lib/pantograph/actions/github_api.rb +262 -0
- data/pantograph/lib/pantograph/actions/gradle.rb +278 -0
- data/pantograph/lib/pantograph/actions/import.rb +49 -0
- data/pantograph/lib/pantograph/actions/import_from_git.rb +71 -0
- data/pantograph/lib/pantograph/actions/is_ci.rb +51 -0
- data/pantograph/lib/pantograph/actions/jira.rb +115 -0
- data/pantograph/lib/pantograph/actions/lane_context.rb +60 -0
- data/pantograph/lib/pantograph/actions/last_git_commit.rb +58 -0
- data/pantograph/lib/pantograph/actions/last_git_tag.rb +51 -0
- data/pantograph/lib/pantograph/actions/make_changelog_from_jenkins.rb +81 -0
- data/pantograph/lib/pantograph/actions/min_pantograph_version.rb +57 -0
- data/pantograph/lib/pantograph/actions/nexus_upload.rb +230 -0
- data/pantograph/lib/pantograph/actions/notification.rb +75 -0
- data/pantograph/lib/pantograph/actions/number_of_commits.rb +75 -0
- data/pantograph/lib/pantograph/actions/opt_out_usage.rb +40 -0
- data/pantograph/lib/pantograph/actions/pantograph_version.rb +15 -0
- data/pantograph/lib/pantograph/actions/println.rb +14 -0
- data/pantograph/lib/pantograph/actions/prompt.rb +119 -0
- data/pantograph/lib/pantograph/actions/push_git_tags.rb +76 -0
- data/pantograph/lib/pantograph/actions/push_to_git_remote.rb +127 -0
- data/pantograph/lib/pantograph/actions/puts.rb +68 -0
- data/pantograph/lib/pantograph/actions/reset_git_repo.rb +121 -0
- data/pantograph/lib/pantograph/actions/rocket.rb +83 -0
- data/pantograph/lib/pantograph/actions/rsync.rb +74 -0
- data/pantograph/lib/pantograph/actions/ruby_version.rb +56 -0
- data/pantograph/lib/pantograph/actions/say.rb +56 -0
- data/pantograph/lib/pantograph/actions/scp.rb +114 -0
- data/pantograph/lib/pantograph/actions/set_github_release.rb +274 -0
- data/pantograph/lib/pantograph/actions/sh.rb +71 -0
- data/pantograph/lib/pantograph/actions/skip_docs.rb +52 -0
- data/pantograph/lib/pantograph/actions/slack.rb +288 -0
- data/pantograph/lib/pantograph/actions/sonar.rb +156 -0
- data/pantograph/lib/pantograph/actions/ssh.rb +162 -0
- data/pantograph/lib/pantograph/actions/twitter.rb +89 -0
- data/pantograph/lib/pantograph/actions/update_pantograph.rb +177 -0
- data/pantograph/lib/pantograph/actions/zip.rb +120 -0
- data/pantograph/lib/pantograph/auto_complete.rb +82 -0
- data/pantograph/lib/pantograph/boolean.rb +5 -0
- data/pantograph/lib/pantograph/cli_tools_distributor.rb +183 -0
- data/pantograph/lib/pantograph/command_line_handler.rb +43 -0
- data/pantograph/lib/pantograph/commands_generator.rb +344 -0
- data/pantograph/lib/pantograph/configuration_helper.rb +26 -0
- data/pantograph/lib/pantograph/core_ext/bundler_monkey_patch.rb +14 -0
- data/pantograph/lib/pantograph/documentation/actions_list.rb +214 -0
- data/pantograph/lib/pantograph/documentation/docs_generator.rb +95 -0
- data/pantograph/lib/pantograph/documentation/markdown_docs_generator.rb +221 -0
- data/pantograph/lib/pantograph/environment_printer.rb +282 -0
- data/pantograph/lib/pantograph/erb_template_helper.rb +30 -0
- data/pantograph/lib/pantograph/features.rb +4 -0
- data/pantograph/lib/pantograph/helper/README.md +29 -0
- data/pantograph/lib/pantograph/helper/dotenv_helper.rb +50 -0
- data/pantograph/lib/pantograph/helper/gem_helper.rb +26 -0
- data/pantograph/lib/pantograph/helper/git_helper.rb +135 -0
- data/pantograph/lib/pantograph/helper/gradle_helper.rb +62 -0
- data/pantograph/lib/pantograph/helper/sh_helper.rb +134 -0
- data/pantograph/lib/pantograph/junit_generator.rb +27 -0
- data/pantograph/lib/pantograph/lane.rb +97 -0
- data/pantograph/lib/pantograph/lane_list.rb +77 -0
- data/pantograph/lib/pantograph/lane_manager.rb +140 -0
- data/pantograph/lib/pantograph/lane_manager_base.rb +92 -0
- data/pantograph/lib/pantograph/markdown_table_formatter.rb +62 -0
- data/pantograph/lib/pantograph/new_action.rb +47 -0
- data/pantograph/lib/pantograph/one_off.rb +45 -0
- data/pantograph/lib/pantograph/other_action.rb +29 -0
- data/pantograph/lib/pantograph/pant_file.rb +377 -0
- data/pantograph/lib/pantograph/pantograph_require.rb +75 -0
- data/pantograph/lib/pantograph/plugins/plugin_fetcher.rb +55 -0
- data/pantograph/lib/pantograph/plugins/plugin_generator.rb +86 -0
- data/pantograph/lib/pantograph/plugins/plugin_generator_ui.rb +19 -0
- data/pantograph/lib/pantograph/plugins/plugin_info.rb +49 -0
- data/pantograph/lib/pantograph/plugins/plugin_info_collector.rb +159 -0
- data/pantograph/lib/pantograph/plugins/plugin_manager.rb +387 -0
- data/pantograph/lib/pantograph/plugins/plugin_search.rb +46 -0
- data/pantograph/lib/pantograph/plugins/plugin_update_manager.rb +70 -0
- data/pantograph/lib/pantograph/plugins/plugins.rb +12 -0
- data/pantograph/lib/pantograph/plugins/template/%gem_name%.gemspec.erb +35 -0
- data/pantograph/lib/pantograph/plugins/template/.circleci/config.yml +43 -0
- data/pantograph/lib/pantograph/plugins/template/.gitignore +12 -0
- data/pantograph/lib/pantograph/plugins/template/.rspec +5 -0
- data/pantograph/lib/pantograph/plugins/template/.rubocop.yml +179 -0
- data/pantograph/lib/pantograph/plugins/template/.travis.yml +4 -0
- data/pantograph/lib/pantograph/plugins/template/Gemfile +6 -0
- data/pantograph/lib/pantograph/plugins/template/LICENSE.erb +21 -0
- data/pantograph/lib/pantograph/plugins/template/README.md.erb +52 -0
- data/pantograph/lib/pantograph/plugins/template/Rakefile +9 -0
- data/pantograph/lib/pantograph/plugins/template/lib/pantograph/plugin/%plugin_name%/actions/%plugin_name%_action.rb.erb +47 -0
- data/pantograph/lib/pantograph/plugins/template/lib/pantograph/plugin/%plugin_name%/helper/%plugin_name%_helper.rb.erb +16 -0
- data/pantograph/lib/pantograph/plugins/template/lib/pantograph/plugin/%plugin_name%/version.rb.erb +5 -0
- data/pantograph/lib/pantograph/plugins/template/lib/pantograph/plugin/%plugin_name%.rb.erb +16 -0
- data/pantograph/lib/pantograph/plugins/template/pantograph/Pantfile.erb +3 -0
- data/pantograph/lib/pantograph/plugins/template/pantograph/Pluginfile.erb +1 -0
- data/pantograph/lib/pantograph/plugins/template/spec/%plugin_name%_action_spec.rb.erb +9 -0
- data/pantograph/lib/pantograph/plugins/template/spec/spec_helper.rb.erb +15 -0
- data/pantograph/lib/pantograph/runner.rb +371 -0
- data/pantograph/lib/pantograph/server/action_command.rb +61 -0
- data/pantograph/lib/pantograph/server/action_command_return.rb +14 -0
- data/pantograph/lib/pantograph/server/command_executor.rb +7 -0
- data/pantograph/lib/pantograph/server/command_parser.rb +36 -0
- data/pantograph/lib/pantograph/server/control_command.rb +23 -0
- data/pantograph/lib/pantograph/server/json_return_value_processor.rb +72 -0
- data/pantograph/lib/pantograph/server/socket_server.rb +232 -0
- data/pantograph/lib/pantograph/server/socket_server_action_command_executor.rb +101 -0
- data/pantograph/lib/pantograph/setup/setup.rb +290 -0
- data/pantograph/lib/pantograph/setup/setup_android.rb +64 -0
- data/pantograph/lib/pantograph/setup/setup_ios.rb +412 -0
- data/pantograph/lib/pantograph/shells.rb +6 -0
- data/pantograph/lib/pantograph/supported_platforms.rb +28 -0
- data/pantograph/lib/pantograph/tools.rb +10 -0
- data/pantograph/lib/pantograph/version.rb +5 -0
- data/pantograph/lib/pantograph.rb +51 -0
- data/pantograph_core/README.md +79 -0
- data/pantograph_core/lib/assets/XMLTemplate.xml.erb +12 -0
- data/pantograph_core/lib/pantograph_core/analytics/action_completion_context.rb +34 -0
- data/pantograph_core/lib/pantograph_core/analytics/action_launch_context.rb +38 -0
- data/pantograph_core/lib/pantograph_core/analytics/analytics_event_builder.rb +23 -0
- data/pantograph_core/lib/pantograph_core/analytics/analytics_ingester_client.rb +54 -0
- data/pantograph_core/lib/pantograph_core/analytics/analytics_session.rb +71 -0
- data/pantograph_core/lib/pantograph_core/cert_checker.rb +116 -0
- data/pantograph_core/lib/pantograph_core/command_executor.rb +99 -0
- data/pantograph_core/lib/pantograph_core/configuration/commander_generator.rb +103 -0
- data/pantograph_core/lib/pantograph_core/configuration/config_item.rb +314 -0
- data/pantograph_core/lib/pantograph_core/configuration/configuration.rb +332 -0
- data/pantograph_core/lib/pantograph_core/configuration/configuration_file.rb +182 -0
- data/pantograph_core/lib/pantograph_core/core_ext/shellwords.rb +63 -0
- data/pantograph_core/lib/pantograph_core/core_ext/string.rb +17 -0
- data/pantograph_core/lib/pantograph_core/env.rb +9 -0
- data/pantograph_core/lib/pantograph_core/feature/feature.rb +51 -0
- data/pantograph_core/lib/pantograph_core/features.rb +4 -0
- data/pantograph_core/lib/pantograph_core/globals.rb +27 -0
- data/pantograph_core/lib/pantograph_core/helper.rb +409 -0
- data/pantograph_core/lib/pantograph_core/keychain_importer.rb +74 -0
- data/pantograph_core/lib/pantograph_core/languages.rb +14 -0
- data/pantograph_core/lib/pantograph_core/module.rb +29 -0
- data/pantograph_core/lib/pantograph_core/pantograph_folder.rb +39 -0
- data/pantograph_core/lib/pantograph_core/pantograph_pty.rb +57 -0
- data/pantograph_core/lib/pantograph_core/pkg_file_analyser.rb +44 -0
- data/pantograph_core/lib/pantograph_core/print_table.rb +131 -0
- data/pantograph_core/lib/pantograph_core/string_filters.rb +51 -0
- data/pantograph_core/lib/pantograph_core/swag.rb +85 -0
- data/pantograph_core/lib/pantograph_core/tag_version.rb +31 -0
- data/pantograph_core/lib/pantograph_core/test_parser.rb +107 -0
- data/pantograph_core/lib/pantograph_core/ui/disable_colors.rb +17 -0
- data/pantograph_core/lib/pantograph_core/ui/errors/pantograph_common_error.rb +19 -0
- data/pantograph_core/lib/pantograph_core/ui/errors/pantograph_crash.rb +11 -0
- data/pantograph_core/lib/pantograph_core/ui/errors/pantograph_error.rb +25 -0
- data/pantograph_core/lib/pantograph_core/ui/errors/pantograph_exception.rb +19 -0
- data/pantograph_core/lib/pantograph_core/ui/errors/pantograph_shell_error.rb +11 -0
- data/pantograph_core/lib/pantograph_core/ui/errors.rb +1 -0
- data/pantograph_core/lib/pantograph_core/ui/github_issue_inspector_reporter.rb +62 -0
- data/pantograph_core/lib/pantograph_core/ui/implementations/shell.rb +159 -0
- data/pantograph_core/lib/pantograph_core/ui/interface.rb +205 -0
- data/pantograph_core/lib/pantograph_core/ui/pantograph_runner.rb +276 -0
- data/pantograph_core/lib/pantograph_core/ui/ui.rb +26 -0
- data/pantograph_core/lib/pantograph_core/update_checker/changelog.rb +37 -0
- data/pantograph_core/lib/pantograph_core/update_checker/update_checker.rb +107 -0
- data/pantograph_core/lib/pantograph_core.rb +45 -0
- metadata +987 -0
@@ -0,0 +1,278 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'shellwords'
|
3
|
+
|
4
|
+
module Pantograph
|
5
|
+
module Actions
|
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
|
15
|
+
end
|
16
|
+
|
17
|
+
class GradleAction < Action
|
18
|
+
def self.run(params)
|
19
|
+
task = params[:task]
|
20
|
+
flavor = params[:flavor]
|
21
|
+
build_type = params[:build_type]
|
22
|
+
|
23
|
+
gradle_task = [task, flavor, build_type].join
|
24
|
+
|
25
|
+
project_dir = params[:project_dir]
|
26
|
+
|
27
|
+
gradle_path_param = params[:gradle_path] || './gradlew'
|
28
|
+
|
29
|
+
# 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
|
+
gradle_path = if Pathname.new(gradle_path_param).absolute?
|
31
|
+
File.expand_path(gradle_path_param)
|
32
|
+
else
|
33
|
+
File.expand_path(File.join(project_dir, gradle_path_param))
|
34
|
+
end
|
35
|
+
|
36
|
+
# Ensure we ended up with a valid path to gradle
|
37
|
+
UI.user_error!("Couldn't find gradlew at path '#{File.expand_path(gradle_path)}'") unless File.exist?(gradle_path)
|
38
|
+
|
39
|
+
# Construct our flags
|
40
|
+
flags = []
|
41
|
+
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?
|
44
|
+
flags << params[:flags] unless params[:flags].nil?
|
45
|
+
|
46
|
+
# Run the actual gradle task
|
47
|
+
gradle = Helper::GradleHelper.new(gradle_path: gradle_path)
|
48
|
+
|
49
|
+
# If these were set as properties, then we expose them back out as they might be useful to others
|
50
|
+
Actions.lane_context[SharedValues::GRADLE_BUILD_TYPE] = build_type if build_type
|
51
|
+
Actions.lane_context[SharedValues::GRADLE_FLAVOR] = flavor if flavor
|
52
|
+
|
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
|
82
|
+
# This is the one that will be relevant for most projects that just build a single build variant (flavor + build type combo).
|
83
|
+
# 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
|
90
|
+
|
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?
|
93
|
+
|
94
|
+
return result
|
95
|
+
end
|
96
|
+
|
97
|
+
#####################################################
|
98
|
+
# @!group Documentation
|
99
|
+
#####################################################
|
100
|
+
|
101
|
+
def self.description
|
102
|
+
'All gradle related actions, including building and testing your Android app'
|
103
|
+
end
|
104
|
+
|
105
|
+
def self.details
|
106
|
+
'Run `./gradlew tasks` to get a list of all available gradle tasks for your project'
|
107
|
+
end
|
108
|
+
|
109
|
+
def self.available_options
|
110
|
+
[
|
111
|
+
PantographCore::ConfigItem.new(key: :task,
|
112
|
+
env_name: 'FL_GRADLE_TASK',
|
113
|
+
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
|
+
optional: false,
|
115
|
+
is_string: true),
|
116
|
+
PantographCore::ConfigItem.new(key: :flavor,
|
117
|
+
env_name: 'FL_GRADLE_FLAVOR',
|
118
|
+
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
|
+
optional: true,
|
120
|
+
is_string: true),
|
121
|
+
PantographCore::ConfigItem.new(key: :build_type,
|
122
|
+
env_name: 'FL_GRADLE_BUILD_TYPE',
|
123
|
+
description: 'The build type that you want the task for, e.g. `Release`. Useful for some tasks such as `assemble`',
|
124
|
+
optional: true,
|
125
|
+
is_string: true),
|
126
|
+
PantographCore::ConfigItem.new(key: :flags,
|
127
|
+
env_name: 'FL_GRADLE_FLAGS',
|
128
|
+
description: 'All parameter flags you want to pass to the gradle command, e.g. `--exitcode --xml file.xml`',
|
129
|
+
optional: true,
|
130
|
+
is_string: true),
|
131
|
+
PantographCore::ConfigItem.new(key: :project_dir,
|
132
|
+
env_name: 'FL_GRADLE_PROJECT_DIR',
|
133
|
+
description: 'The root directory of the gradle project',
|
134
|
+
default_value: '.',
|
135
|
+
is_string: true),
|
136
|
+
PantographCore::ConfigItem.new(key: :gradle_path,
|
137
|
+
env_name: 'FL_GRADLE_PATH',
|
138
|
+
description: 'The path to your `gradlew`. If you specify a relative path, it is assumed to be relative to the `project_dir`',
|
139
|
+
optional: true,
|
140
|
+
is_string: true),
|
141
|
+
PantographCore::ConfigItem.new(key: :properties,
|
142
|
+
env_name: 'FL_GRADLE_PROPERTIES',
|
143
|
+
description: 'Gradle properties to be exposed to the gradle script',
|
144
|
+
optional: true,
|
145
|
+
is_string: false),
|
146
|
+
PantographCore::ConfigItem.new(key: :system_properties,
|
147
|
+
env_name: 'FL_GRADLE_SYSTEM_PROPERTIES',
|
148
|
+
description: 'Gradle system properties to be exposed to the gradle script',
|
149
|
+
optional: true,
|
150
|
+
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
|
+
is_string: true,
|
155
|
+
default_value: ''),
|
156
|
+
PantographCore::ConfigItem.new(key: :print_command,
|
157
|
+
env_name: 'FL_GRADLE_PRINT_COMMAND',
|
158
|
+
description: 'Control whether the generated Gradle command is printed as output before running it (true/false)',
|
159
|
+
is_string: false,
|
160
|
+
default_value: true),
|
161
|
+
PantographCore::ConfigItem.new(key: :print_command_output,
|
162
|
+
env_name: 'FL_GRADLE_PRINT_COMMAND_OUTPUT',
|
163
|
+
description: 'Control whether the output produced by given Gradle command is printed while running (true/false)',
|
164
|
+
is_string: false,
|
165
|
+
default_value: true)
|
166
|
+
]
|
167
|
+
end
|
168
|
+
|
169
|
+
def self.output
|
170
|
+
[
|
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'],
|
173
|
+
['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']
|
179
|
+
]
|
180
|
+
end
|
181
|
+
|
182
|
+
def self.return_value
|
183
|
+
'The output of running the gradle task'
|
184
|
+
end
|
185
|
+
|
186
|
+
def self.authors
|
187
|
+
['KrauseFx', 'lmirosevic']
|
188
|
+
end
|
189
|
+
|
190
|
+
def self.is_supported?(platform)
|
191
|
+
[:ios, :android].include?(platform) # we support iOS as cross platforms apps might want to call `gradle` also
|
192
|
+
end
|
193
|
+
|
194
|
+
def self.example_code
|
195
|
+
[
|
196
|
+
'gradle(
|
197
|
+
task: "assemble",
|
198
|
+
flavor: "WorldDomination",
|
199
|
+
build_type: "Release"
|
200
|
+
)
|
201
|
+
```
|
202
|
+
|
203
|
+
To build an AAB use:
|
204
|
+
```ruby
|
205
|
+
gradle(
|
206
|
+
task: "bundle",
|
207
|
+
flavor: "WorldDomination",
|
208
|
+
build_type: "Release"
|
209
|
+
)
|
210
|
+
```
|
211
|
+
|
212
|
+
You can pass properties to gradle:
|
213
|
+
```ruby
|
214
|
+
gradle(
|
215
|
+
# ...
|
216
|
+
|
217
|
+
properties: {
|
218
|
+
"versionCode" => 100,
|
219
|
+
"versionName" => "1.0.0",
|
220
|
+
# ...
|
221
|
+
}
|
222
|
+
)
|
223
|
+
```
|
224
|
+
|
225
|
+
You can use this to automatically [sign and zipalign](https://developer.android.com/studio/publish/app-signing.html) your app:
|
226
|
+
```ruby
|
227
|
+
gradle(
|
228
|
+
task: "assemble",
|
229
|
+
build_type: "Release",
|
230
|
+
print_command: false,
|
231
|
+
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",
|
236
|
+
}
|
237
|
+
)
|
238
|
+
```
|
239
|
+
|
240
|
+
If you need to pass sensitive information through the `gradle` action, and don\'t want the generated command to be printed before it is run, you can suppress that:
|
241
|
+
```ruby
|
242
|
+
gradle(
|
243
|
+
# ...
|
244
|
+
print_command: false
|
245
|
+
)
|
246
|
+
```
|
247
|
+
|
248
|
+
You can also suppress printing the output generated by running the generated Gradle command:
|
249
|
+
```ruby
|
250
|
+
gradle(
|
251
|
+
# ...
|
252
|
+
print_command_output: false
|
253
|
+
)
|
254
|
+
```
|
255
|
+
|
256
|
+
To pass any other CLI flags to gradle use:
|
257
|
+
```ruby
|
258
|
+
gradle(
|
259
|
+
# ...
|
260
|
+
|
261
|
+
flags: "--exitcode --xml file.xml"
|
262
|
+
)
|
263
|
+
```
|
264
|
+
|
265
|
+
Delete the build directory, generated APKs and AABs
|
266
|
+
```ruby
|
267
|
+
gradle(
|
268
|
+
task: "clean"
|
269
|
+
)'
|
270
|
+
]
|
271
|
+
end
|
272
|
+
|
273
|
+
def self.category
|
274
|
+
:building
|
275
|
+
end
|
276
|
+
end
|
277
|
+
end
|
278
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Pantograph
|
2
|
+
module Actions
|
3
|
+
class ImportAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
# this is implemented in the pant_file.rb
|
6
|
+
end
|
7
|
+
|
8
|
+
#####################################################
|
9
|
+
# @!group Documentation
|
10
|
+
#####################################################
|
11
|
+
|
12
|
+
def self.description
|
13
|
+
"Import another Pantfile to use its lanes"
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.details
|
17
|
+
[
|
18
|
+
"This is useful if you have shared lanes across multiple apps and you want to store a Pantfile in a separate folder.",
|
19
|
+
"The path must be relative to the Pantfile this is called from."
|
20
|
+
].join("\n")
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.available_options
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.output
|
27
|
+
[]
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.authors
|
31
|
+
["KrauseFx"]
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.is_supported?(platform)
|
35
|
+
true
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.example_code
|
39
|
+
[
|
40
|
+
'import("./path/to/other/Pantfile")'
|
41
|
+
]
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.category
|
45
|
+
:misc
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module Pantograph
|
2
|
+
module Actions
|
3
|
+
class ImportFromGitAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
# this is implemented in the pant_file.rb
|
6
|
+
end
|
7
|
+
|
8
|
+
#####################################################
|
9
|
+
# @!group Documentation
|
10
|
+
#####################################################
|
11
|
+
|
12
|
+
def self.description
|
13
|
+
"Import another Pantfile from a remote git repository to use its lanes"
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.details
|
17
|
+
"This is useful if you have shared lanes across multiple apps and you want to store the Pantfile in a remote git repository."
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.available_options
|
21
|
+
[
|
22
|
+
PantographCore::ConfigItem.new(key: :url,
|
23
|
+
description: "The URL of the repository to import the Pantfile from",
|
24
|
+
default_value: nil),
|
25
|
+
PantographCore::ConfigItem.new(key: :branch,
|
26
|
+
description: "The branch or tag to check-out on the repository",
|
27
|
+
default_value: 'HEAD',
|
28
|
+
optional: true),
|
29
|
+
PantographCore::ConfigItem.new(key: :path,
|
30
|
+
description: "The path of the Pantfile in the repository",
|
31
|
+
default_value: 'pantograph/Pantfile',
|
32
|
+
optional: true),
|
33
|
+
PantographCore::ConfigItem.new(key: :version,
|
34
|
+
description: "The version to checkout on the repository. Optimistic match operator or multiple conditions can be used to select the latest version within constraints",
|
35
|
+
default_value: nil,
|
36
|
+
is_string: false,
|
37
|
+
optional: true)
|
38
|
+
]
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.authors
|
42
|
+
["fabiomassimo", "KrauseFx", "Liquidsoul"]
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.is_supported?(platform)
|
46
|
+
true
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.example_code
|
50
|
+
[
|
51
|
+
'import_from_git(
|
52
|
+
url: "git@github.com:pantograph/pantograph.git", # The URL of the repository to import the Pantfile from.
|
53
|
+
branch: "HEAD", # The branch to checkout on the repository
|
54
|
+
path: "pantograph/Pantfile", # The path of the Pantfile in the repository
|
55
|
+
version: "~> 1.0.0" # The version to checkout on the repository. Optimistic match operator can be used to select the latest version within constraints.
|
56
|
+
)',
|
57
|
+
'import_from_git(
|
58
|
+
url: "git@github.com:pantograph/pantograph.git", # The URL of the repository to import the Pantfile from.
|
59
|
+
branch: "HEAD", # The branch to checkout on the repository
|
60
|
+
path: "pantograph/Pantfile", # The path of the Pantfile in the repository
|
61
|
+
version: [">= 1.1.0", "< 2.0.0"] # The version to checkout on the repository. Multiple conditions can be used to select the latest version within constraints.
|
62
|
+
)'
|
63
|
+
]
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.category
|
67
|
+
:misc
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Pantograph
|
2
|
+
module Actions
|
3
|
+
class IsCiAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
Helper.ci?
|
6
|
+
end
|
7
|
+
|
8
|
+
#####################################################
|
9
|
+
# @!group Documentation
|
10
|
+
#####################################################
|
11
|
+
|
12
|
+
def self.description
|
13
|
+
"Is the current run being executed on a CI system, like Jenkins or Travis"
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.details
|
17
|
+
"The return value of this method is true if pantograph is currently executed on Travis, Jenkins, Circle or a similar CI service"
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.available_options
|
21
|
+
[]
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.return_type
|
25
|
+
:bool
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.authors
|
29
|
+
["KrauseFx"]
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.is_supported?(platform)
|
33
|
+
true
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.example_code
|
37
|
+
[
|
38
|
+
'if is_ci?
|
39
|
+
puts "I\'m a computer"
|
40
|
+
else
|
41
|
+
say "Hi Human!"
|
42
|
+
end'
|
43
|
+
]
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.category
|
47
|
+
:misc
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
module Pantograph
|
2
|
+
module Actions
|
3
|
+
class JiraAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
Actions.verify_gem!('jira-ruby')
|
6
|
+
require 'jira-ruby'
|
7
|
+
|
8
|
+
site = params[:url]
|
9
|
+
auth_type = :basic
|
10
|
+
context_path = params[:context_path]
|
11
|
+
username = params[:username]
|
12
|
+
password = params[:password]
|
13
|
+
ticket_id = params[:ticket_id]
|
14
|
+
comment_text = params[:comment_text]
|
15
|
+
|
16
|
+
options = {
|
17
|
+
site: site,
|
18
|
+
context_path: context_path,
|
19
|
+
auth_type: auth_type,
|
20
|
+
username: username,
|
21
|
+
password: password
|
22
|
+
}
|
23
|
+
|
24
|
+
client = JIRA::Client.new(options)
|
25
|
+
issue = client.Issue.find(ticket_id)
|
26
|
+
comment = issue.comments.build
|
27
|
+
comment.save({ 'body' => comment_text })
|
28
|
+
end
|
29
|
+
|
30
|
+
#####################################################
|
31
|
+
# @!group Documentation
|
32
|
+
#####################################################
|
33
|
+
|
34
|
+
def self.description
|
35
|
+
"Leave a comment on JIRA tickets"
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.available_options
|
39
|
+
[
|
40
|
+
PantographCore::ConfigItem.new(key: :url,
|
41
|
+
env_name: "FL_JIRA_SITE",
|
42
|
+
description: "URL for Jira instance",
|
43
|
+
verify_block: proc do |value|
|
44
|
+
UI.user_error!("No url for Jira given, pass using `url: 'url'`") if value.to_s.length == 0
|
45
|
+
end),
|
46
|
+
PantographCore::ConfigItem.new(key: :context_path,
|
47
|
+
env_name: "FL_JIRA_CONTEXT_PATH",
|
48
|
+
description: "Appends to the url (ex: \"/jira\")",
|
49
|
+
optional: true,
|
50
|
+
default_value: ""),
|
51
|
+
PantographCore::ConfigItem.new(key: :username,
|
52
|
+
env_name: "FL_JIRA_USERNAME",
|
53
|
+
description: "Username for JIRA instance",
|
54
|
+
verify_block: proc do |value|
|
55
|
+
UI.user_error!("No username") if value.to_s.length == 0
|
56
|
+
end),
|
57
|
+
PantographCore::ConfigItem.new(key: :password,
|
58
|
+
env_name: "FL_JIRA_PASSWORD",
|
59
|
+
description: "Password for Jira",
|
60
|
+
sensitive: true,
|
61
|
+
verify_block: proc do |value|
|
62
|
+
UI.user_error!("No password") if value.to_s.length == 0
|
63
|
+
end),
|
64
|
+
PantographCore::ConfigItem.new(key: :ticket_id,
|
65
|
+
env_name: "FL_JIRA_TICKET_ID",
|
66
|
+
description: "Ticket ID for Jira, i.e. IOS-123",
|
67
|
+
verify_block: proc do |value|
|
68
|
+
UI.user_error!("No Ticket specified") if value.to_s.length == 0
|
69
|
+
end),
|
70
|
+
PantographCore::ConfigItem.new(key: :comment_text,
|
71
|
+
env_name: "FL_JIRA_COMMENT_TEXT",
|
72
|
+
description: "Text to add to the ticket as a comment",
|
73
|
+
verify_block: proc do |value|
|
74
|
+
UI.user_error!("No comment specified") if value.to_s.length == 0
|
75
|
+
end)
|
76
|
+
]
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.return_value
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.authors
|
83
|
+
["iAmChrisTruman"]
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.is_supported?(platform)
|
87
|
+
true
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.example_code
|
91
|
+
[
|
92
|
+
'jira(
|
93
|
+
url: "https://bugs.yourdomain.com",
|
94
|
+
username: "Your username",
|
95
|
+
password: "Your password",
|
96
|
+
ticket_id: "Ticket ID, i.e. IOS-123",
|
97
|
+
comment_text: "Text to post as a comment"
|
98
|
+
)',
|
99
|
+
'jira(
|
100
|
+
url: "https://yourserverdomain.com",
|
101
|
+
context_path: "/jira",
|
102
|
+
username: "Your username",
|
103
|
+
password: "Your password",
|
104
|
+
ticket_id: "Ticket ID, i.e. IOS-123",
|
105
|
+
comment_text: "Text to post as a comment"
|
106
|
+
)'
|
107
|
+
]
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.category
|
111
|
+
:misc
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Pantograph
|
2
|
+
module Actions
|
3
|
+
class LaneContextAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
Actions.lane_context
|
6
|
+
end
|
7
|
+
|
8
|
+
#####################################################
|
9
|
+
# @!group Documentation
|
10
|
+
#####################################################
|
11
|
+
|
12
|
+
def self.description
|
13
|
+
"Access lane context values"
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.details
|
17
|
+
[
|
18
|
+
"Access the pantograph lane context values.",
|
19
|
+
"More information about how the lane context works: [https://docs.pantograph.tools/advanced/#lane-context](https://docs.pantograph.tools/advanced/#lane-context)."
|
20
|
+
].join("\n")
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.available_options
|
24
|
+
[]
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.output
|
28
|
+
[]
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.return_type
|
32
|
+
:hash
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.authors
|
36
|
+
["KrauseFx"]
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.is_supported?(platform)
|
40
|
+
true
|
41
|
+
end
|
42
|
+
|
43
|
+
# We don't want to show this as step
|
44
|
+
def self.step_text
|
45
|
+
nil
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.example_code
|
49
|
+
[
|
50
|
+
'lane_context[SharedValues::BUILD_NUMBER]',
|
51
|
+
'lane_context[SharedValues::IPA_OUTPUT_PATH]'
|
52
|
+
]
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.category
|
56
|
+
:misc
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module Pantograph
|
2
|
+
module Actions
|
3
|
+
class LastGitCommitAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
Actions.last_git_commit_dict
|
6
|
+
end
|
7
|
+
|
8
|
+
#####################################################
|
9
|
+
# @!group Documentation
|
10
|
+
#####################################################
|
11
|
+
|
12
|
+
def self.description
|
13
|
+
"Return last git commit hash, abbreviated commit hash, commit message and author"
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.return_value
|
17
|
+
"Returns the following dict: {commit_hash: \"commit hash\", abbreviated_commit_hash: \"abbreviated commit hash\" author: \"Author\", author_email: \"author email\", message: \"commit message\"}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.return_type
|
21
|
+
:hash_of_strings
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.author
|
25
|
+
"ngutman"
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.is_supported?(platform)
|
29
|
+
true
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.example_code
|
33
|
+
[
|
34
|
+
'commit = last_git_commit
|
35
|
+
crashlytics(notes: commit[:message]) # message of commit
|
36
|
+
author = commit[:author] # author of the commit
|
37
|
+
author_email = commit[:author_email] # email of the author of the commit
|
38
|
+
hash = commit[:commit_hash] # long sha of commit
|
39
|
+
short_hash = commit[:abbreviated_commit_hash] # short sha of commit'
|
40
|
+
]
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.category
|
44
|
+
:source_control
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.sample_return_value
|
48
|
+
{
|
49
|
+
message: "message",
|
50
|
+
author: "author",
|
51
|
+
author_email: "author_email",
|
52
|
+
commit_hash: "commit_hash",
|
53
|
+
abbreviated_commit_hash: "short_hash"
|
54
|
+
}
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|