mirror of
https://github.com/zhigang1992/fir-cli.git
synced 2026-01-12 22:47:23 +08:00
Merge branch 'feature/gradle_support' into develop
This commit is contained in:
@@ -60,6 +60,7 @@ module FIR
|
||||
method_option :branch, type: :string, aliases: '-B', desc: 'Set branch if project is a git repo, the default is `master`'
|
||||
method_option :output, type: :string, aliases: '-o', desc: 'APK output path, the default is: BUILD_DIR/build/outputs/apk'
|
||||
method_option :publish, type: :boolean, aliases: '-p', desc: 'true/false if publish to fir.im'
|
||||
method_option :flavor, type: :string, aliases: '-f', desc: 'Set flavor if have productFlavors'
|
||||
method_option :short, type: :string, aliases: '-s', desc: 'Set custom short link if publish to fir.im'
|
||||
method_option :name, type: :string, aliases: '-n', desc: 'Set custom apk name when builded'
|
||||
method_option :changelog, type: :string, aliases: '-c', desc: 'Set changelog if publish to fir.im, support string/file'
|
||||
|
||||
@@ -5,16 +5,14 @@ module FIR
|
||||
|
||||
def build_apk(*args, options)
|
||||
initialize_build_common_options(args, options)
|
||||
set_flavor(options)
|
||||
|
||||
Dir.chdir(@build_dir)
|
||||
|
||||
@build_cmd = initialize_apk_build_cmd
|
||||
|
||||
logger_info_and_run_build_command
|
||||
|
||||
output_apk
|
||||
@builded_app_path = Dir["#{@output_path}/*.apk"].first
|
||||
|
||||
publish_build_app if options.publish?
|
||||
|
||||
logger_info_blank_line
|
||||
@@ -22,11 +20,21 @@ module FIR
|
||||
|
||||
private
|
||||
|
||||
def set_flavor(options)
|
||||
unless options.flavor.blank?
|
||||
@flavor = options.flavor
|
||||
unless @flavor =~ /^assemble(.+)/
|
||||
@flavor = "assemble#{@flavor}Release"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def initialize_apk_build_cmd
|
||||
check_build_gradle_exist
|
||||
|
||||
apk_build_cmd = 'gradle clean;gradle build'
|
||||
apk_build_cmd
|
||||
cmd = "./gradlew build"
|
||||
cmd = "./gradlew #{@flavor}" unless @flavor.blank?
|
||||
cmd
|
||||
end
|
||||
|
||||
def gradle_build_path
|
||||
@@ -44,15 +52,11 @@ module FIR
|
||||
|
||||
check_no_output_apk
|
||||
|
||||
apk_info = FIR.apk_info(@builded_apk)
|
||||
apk_info = FIR.apk_info(@builded_apk)
|
||||
@apk_name = @name.blank? ? "#{apk_info[:name]}-#{apk_info[:version]}-Build-#{apk_info[:build]}" : @name
|
||||
|
||||
if @name.blank?
|
||||
apk_name = "#{apk_info[:name]}-#{apk_info[:version]}-Build-#{apk_info[:build]}"
|
||||
else
|
||||
apk_name = @name
|
||||
end
|
||||
|
||||
FileUtils.cp(@builded_apk, "#{@output_path}/#{apk_name}.apk")
|
||||
@builded_app_path = "#{@output_path}/#{@apk_name}.apk"
|
||||
FileUtils.cp(@builded_apk, @builded_app_path)
|
||||
end
|
||||
|
||||
def check_no_output_apk
|
||||
|
||||
@@ -12,7 +12,6 @@ module FIR
|
||||
logger_info_and_run_build_command
|
||||
|
||||
output_ipa_and_dsym
|
||||
|
||||
publish_build_app if options.publish?
|
||||
upload_build_dsym_mapping_file if options.mapping?
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# encoding: utf-8
|
||||
|
||||
module FIR
|
||||
VERSION = '1.4.4'
|
||||
VERSION = '1.4.4.1'
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user