Class: Fastlane::Actions::GradleAction
- Inherits:
-
Fastlane::Action
- Object
- Fastlane::Action
- Fastlane::Actions::GradleAction
- Defined in:
- lib/fastlane/actions/gradle.rb
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .return_value ⇒ Object
Class Method Summary collapse
Methods inherited from Fastlane::Action
action_name, author, sh, step_text
Class Method Details
.authors ⇒ Object
84 85 86 |
# File 'lib/fastlane/actions/gradle.rb', line 84 def self. ["KrauseFx"] end |
.available_options ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/fastlane/actions/gradle.rb', line 52 def self. [ FastlaneCore::ConfigItem.new(key: :task, env_name: "FL_GRADLE_TASK", description: "The gradle task you want to execute", is_string: true), FastlaneCore::ConfigItem.new(key: :flags, env_name: "FL_GRADLE_FLAGS", description: "All parameter flags you want to pass to the gradle command, e.g. `--exitcode --xml file.xml`", optional: true, is_string: true), FastlaneCore::ConfigItem.new(key: :gradle_path, env_name: "FL_GRADLE_PATH", description: "The path to your `gradlew`", is_string: true, default_value: Dir["./gradlew"].last, # Using Dir to be nil when the file doesn't exist (import for validation) verify_block: proc do |value| raise "Couldn't find gradlew at path '#{File.(value)}'".red unless File.exist?(value) end) ] end |
.description ⇒ Object
42 43 44 |
# File 'lib/fastlane/actions/gradle.rb', line 42 def self.description "All gradle related actions, including building and testing your Android app" end |
.details ⇒ Object
46 47 48 49 50 |
# File 'lib/fastlane/actions/gradle.rb', line 46 def self.details [ "Run `./gradlew tasks` to get a list of all available gradle tasks for your project" ].join("\n") end |
.is_supported?(platform) ⇒ Boolean
88 89 90 |
# File 'lib/fastlane/actions/gradle.rb', line 88 def self.is_supported?(platform) platform == :android end |
.output ⇒ Object
74 75 76 77 78 |
# File 'lib/fastlane/actions/gradle.rb', line 74 def self.output [ ['APK_OUTPUT_PATH', 'The path to the newly generated apk file'] ] end |
.return_value ⇒ Object
80 81 82 |
# File 'lib/fastlane/actions/gradle.rb', line 80 def self.return_value "The output of running the gradle task" end |
.run(params) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/fastlane/actions/gradle.rb', line 9 def self.run(params) task = params[:task] gradle = Helper::GradleHelper.new(gradle_path: params[:gradle_path]) result = gradle.trigger(task: task, flags: params[:flags]) return result unless task.start_with?("assemble") # We built our app. Store the path to the apk flavor = task.match(/assemble(\w*)/) if flavor and flavor[1] flavor = flavor[1].downcase # Release => release apk_path = Dir[File.join("app", "build", "outputs", "apk", "*-#{flavor}.apk")].last if apk_path Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH] = File.(apk_path) else Helper.log.info "Couldn't find signed apk file at path '#{apk_path}'...".red if flavor == 'release' Helper.log.info "Make sure to enable code signing in your gradle task: ".red Helper.log.info "https://stackoverflow.com/questions/18328730/how-to-create-a-release-signed-apk-file-using-gradle".red end end Actions.lane_context[SharedValues::GRADLE_FLAVOR] = flavor end return result end |