class Fastlane::Actions::XamarinBuildAction
Constants
- BUILD_TYPES
- BUILD_UTIL
- MDTOOL
- MSBUILD
- PRINT_ALL
- VSTOOL
- XBUILD
Public Class Methods
available_options()
click to toggle source
# File lib/fastlane/plugin/incloud_xamarin_build/actions/incloud_xamarin_build_action.rb, line 185 def self.available_options [ FastlaneCore::ConfigItem.new( key: :solution, env_name: 'FL_XAMARIN_BUILD_SOLUTION', description: 'path to Xamarin .sln/.csproj file', verify_block: proc do |value| UI.user_error!("File #{value} not found from #{Dir.pwd}".red) unless File.file? value end ), FastlaneCore::ConfigItem.new( key: :platform, env_name: 'FL_XAMARIN_BUILD_PLATFORM', description: 'build platform', type: String, optional: true ), FastlaneCore::ConfigItem.new( key: :build_type, env_name: 'FL_XAMARIN_BUILD_TYPE', description: 'Release or Debug', type: String ), FastlaneCore::ConfigItem.new( key: :target, env_name: 'FL_XAMARIN_BUILD_TARGET', description: 'Target build type (Debug|Release|Clean|SignAndroidPackage)', type: String ), FastlaneCore::ConfigItem.new( key: :print_all, env_name: 'FL_XAMARIN_BUILD_PRINT_ALL', description: 'Print std out', default_value: false, is_string: false, optional: true, verify_block: proc do |value| UI.user_error!("Unsupported value! Use one of #{PRINT_ALL.join '\' '}".red) unless PRINT_ALL.include? value end ), FastlaneCore::ConfigItem.new( key: :build_util, env_name: 'FL_XAMARIN_BUILD_BUILD_UTIL', description: 'Build util which use to build project. vstool', default_value: 'vstool', is_string: false, optional: true, verify_block: proc do |value| UI.user_error!("Unsupported build util (#{value})!\n\t Accepted utils: #{BUILD_UTIL.join '/'}".red) unless BUILD_UTIL.include? value end ), FastlaneCore::ConfigItem.new( key: :project, env_name: 'FL_XAMARIN_BUILD_PROJECT', description: 'Project to build or clean', is_string: true, optional: true ), FastlaneCore::ConfigItem.new( key: :projects, env_name: 'FL_XAMARIN_BUILD_PROJECTS', description: 'Projects to build or clean, separated by ,', is_string: true, optional: true ), FastlaneCore::ConfigItem.new( key: :file_log, env_name: 'FL_XAMARIN_BUILD_FILE_LOG', description: 'Log toincloud_xamarin_build_*.log file in the current directory', default_value: true, is_string: false, optional: true ), FastlaneCore::ConfigItem.new( key: :android_keystore, env_name: 'FL_XAMARIN_BUILD_ANDROID_KEYSTORE', description: '', default_value: false, is_string: false, optional: true ), FastlaneCore::ConfigItem.new( key: :android_signing_key_alias, env_name: 'FL_XAMARIN_BUILD_ANDROID_SIGNING_ALIAS_KEY', description: '', is_string: true, optional: true ), FastlaneCore::ConfigItem.new( key: :android_signing_key_pass, env_name: 'FL_XAMARIN_BUILD_ANDROID_SIGNING_KEY_PASS', description: '', is_string: true, optional: true ), FastlaneCore::ConfigItem.new( key: :android_signing_keystore, env_name: 'FL_XAMARIN_BUILD_ANDROID_SIGNING_KEYSTORE', description: '', default_value: true, is_string: false, optional: true ), FastlaneCore::ConfigItem.new( key: :android_signing_store_pass, env_name: 'FL_XAMARIN_BUILD_ANDROID_SIGNING_STORE_PASS', description: 'Log toincloud_xamarin_build_*.log file in the current directory', default_value: true, is_string: false, optional: true ) ] end
build_artifacts(platform, build_type, solution)
click to toggle source
# File lib/fastlane/plugin/incloud_xamarin_build/actions/incloud_xamarin_build_action.rb, line 158 def self.build_artifacts(platform, build_type, solution) build_path = get_build_path(platform, build_type, solution) if build_path and !platform.nil? extension = ".ipa" if platform.casecmp("android").zero? extension = ".apk" end return Dir.glob(File.join(build_path, "*#{extension}")) end return nil end
build_project(command, params)
click to toggle source
# File lib/fastlane/plugin/incloud_xamarin_build/actions/incloud_xamarin_build_action.rb, line 119 def self.build_project(command, params) @logger.debug "Start XamarinBuildHelper" Helper::XamarinBuildHelper.bash(command, !params[:print_all], params[:file_log]) end
build_projects(tool, options_str, params, projects)
click to toggle source
# File lib/fastlane/plugin/incloud_xamarin_build/actions/incloud_xamarin_build_action.rb, line 101 def self.build_projects(tool, options_str, params, projects) command = "#{tool} #{options_str}" if projects.size.zero? @logger.debug "Building single project" build_project(command, params) end projects.each do |project| @logger.debug "Building project #{project}" if (tool == MDTOOL || tool == VSTOOL) && projects.size > 0 @logger.debug "Pass project flag to #{tool}: #{project}" command << " -p:#{project}" end build_project(command, params) end end
create_option_string(params)
click to toggle source
# File lib/fastlane/plugin/incloud_xamarin_build/actions/incloud_xamarin_build_action.rb, line 91 def self.create_option_string(params) platform = params[:platform] build_type = params[:build_type] target = params[:target] solution = params[:solution] configuration = "--configuration:#{build_type}|#{platform}" return "build -t:#{target} #{solution} \"#{configuration}\"" end
description()
click to toggle source
# File lib/fastlane/plugin/incloud_xamarin_build/actions/incloud_xamarin_build_action.rb, line 173 def self.description 'Build xamarin android and ios projects' end
get_build_path(platform, build_type, solution)
click to toggle source
Returns bin path for given platform and build_type or nil
# File lib/fastlane/plugin/incloud_xamarin_build/actions/incloud_xamarin_build_action.rb, line 140 def self.get_build_path(platform, build_type, solution) root = File.dirname(solution) if platform.nil? platform = "*" end builds = Dir.glob(File.join(root, "*/bin/#{platform}/#{build_type}/")) if builds.size > 0 build = builds[0] @logger.debug "build artifact path #{build}".blue return build else return nil end end
is_supported?(platform)
click to toggle source
# File lib/fastlane/plugin/incloud_xamarin_build/actions/incloud_xamarin_build_action.rb, line 312 def self.is_supported?(platform) # android not tested %i[ios android].include?(platform) end
mdtool_build_projects(params, projects)
click to toggle source
# File lib/fastlane/plugin/incloud_xamarin_build/actions/incloud_xamarin_build_action.rb, line 62 def self.mdtool_build_projects(params, projects) options_str = create_option_string(params) @logger.debug "Using following options: #{options_str}" build_projects(MDTOOL, options_str, params, projects) end
msbuild_build_projects(params, projects)
click to toggle source
# File lib/fastlane/plugin/incloud_xamarin_build/actions/incloud_xamarin_build_action.rb, line 68 def self.msbuild_build_projects(params, projects) platform = params[:platform] build_type = params[:build_type] target = params[:target] solution = params[:solution] options = [MSBUILD] options.push "\"/t:#{target}\"" unless target.nil? options.push "\"/p:Platform=#{platform}\"" unless platform.nil? options.push "\"/p:Configuration=#{build_type}\"" unless build_type.nil? if params[:android_keystore] options.push "\"/p:AndroidKeyStore=#{params[:android_keystore]}\"" options.push "\"/p:AndroidSigningKeyAlias=#{params[:android_signing_key_alias]}\"" options.push "\"/p:AndroidSigningKeyPass=#{params[:android_signing_key_pass]}\"" options.push "\"/p:AndroidSigningKeyStore=#{params[:android_signing_keystore]}\"" options.push "\"/p:AndroidSigningStorePass=#{params[:android_signing_store_pass]}\"" end options.push solution command = options.join " " build_project(command, params) end
run(params)
click to toggle source
# File lib/fastlane/plugin/incloud_xamarin_build/actions/incloud_xamarin_build_action.rb, line 12 def self.run(params) if params[:print_all] @logger.level = :debug else @logger.level = :warn end if params[:file_log] @logger.add_appenders Logging.appenders.file('fastlane-plugin-incloud_xamarin_build.log') end @logger.debug "Runincloud_xamarin_build with #{params}" platform = params[:platform] project = params[:project] projects = (params[:projects] or '').split(',').select do |item| item.size > 0 end projects << project unless project.nil? @logger.debug "Following projects were found: #{projects}" projects = projects.uniq @logger.debug "Following unique projects were found: #{projects}" @logger.debug "Using #{params[:build_util]} to build #{projects}" if params[:build_util] == 'vstool' vstool_build_projects(params, projects) elsif params[:build_util] == 'mdtool' mdtool_build_projects(params, projects) elsif params[:build_util] == 'msbuild' msbuild_build_projects(params, projects) else if projects.size > 0 @logger.error "not supported yet" else xbuild_build_solution(params) end end build_type = params[:build_type] solution = params[:solution] get_build_path(platform, build_type, solution) end
vstool_build_projects(params, projects)
click to toggle source
# File lib/fastlane/plugin/incloud_xamarin_build/actions/incloud_xamarin_build_action.rb, line 56 def self.vstool_build_projects(params, projects) options_str = create_option_string(params) @logger.debug "Using following options: #{options_str}" build_projects(VSTOOL, options_str, params, projects) end
xbuild_build_solution(params)
click to toggle source
# File lib/fastlane/plugin/incloud_xamarin_build/actions/incloud_xamarin_build_action.rb, line 124 def self.xbuild_build_solution(params) platform = params[:platform] build_type = params[:build_type] target = params[:target] solution = params[:solution] command = "#{XBUILD} " command << "/target:#{target} " unless target.nil? command << "/p:Platform=#{platform} " unless platform.nil? command << "/p:Configuration=#{build_type} " unless build_type.nil? command << solution build_project(command, params) end