class Fastlane::Actions::MsbuildAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/msbuild/actions/msbuild_action.rb, line 28
def self.authors
  ["fuzzybinary"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/msbuild/actions/msbuild_action.rb, line 36
def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :solution,
        env_name: 'FL_MSBUILD_SOLUTION',
        description: 'path to .sln file',
        verify_block: proc do |value|
          UI.user_error!('File not found'.red) unless File.file? value
        end
    ),

    FastlaneCore::ConfigItem.new(
      key: :targets,
      env_name: 'FL_MSBUILD_TARGET',
      description: 'Targets to build',
      type: Array,
      verify_block: proc do |value|
        UI.user_error!('Must supply one target to msbuild'.red) unless value.length > 0
      end
    ),

    FastlaneCore::ConfigItem.new(
      key: :platform,
      optional: true,
      env_name: 'FL_MSBUILD_PLATFORM',
      description: 'build platform (usually iPhone, iPhoneSimulator, or Android)',
      type: String
    ),

    FastlaneCore::ConfigItem.new(
      key: :configuration,
      env_name: 'FL_MSBUILD_CONFIGURATION',
      description: 'Configuration build type',
      type: String
    ),

    FastlaneCore::ConfigItem.new(
      key: :additional_arguments,
      optional: true,
      env_name: 'FL_MSBUILD_ADDITIONAL_ARGS',
      description: "An array of Additional arguments to msbuild",
      type: Array,
      default_value: []
    ),

    FastlaneCore::ConfigItem.new(
      key: :android_home,
      env_name: 'ANDROID_HOME',
      description: 'Location of the Anrdoid SDK (defaults to $ANDROID_HOME)',
      type: String
    ),

    FastlaneCore::ConfigItem.new(
      key: :msbuild_path,
      env_name: 'MSBUILD_PATH',
      description: "Location of msbuild",
      optional: true,
      type: String,
      default_value: nil
    )
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/msbuild/actions/msbuild_action.rb, line 24
def self.description
  "Build a Xamarin.iOS or Xamarin.Android project using msbuild"
end
details() click to toggle source
# File lib/fastlane/plugin/msbuild/actions/msbuild_action.rb, line 32
def self.details
  "Build a Xamarin.iOS or Xamarin.Android project using msbuild"
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/msbuild/actions/msbuild_action.rb, line 99
def self.is_supported?(platform)
  true
end
run(params) click to toggle source
# File lib/fastlane/plugin/msbuild/actions/msbuild_action.rb, line 4
def self.run(params)
  configuration = params[:configuration]
  platform = params[:platform]
  solution = params[:solution]

  msbuild = params[:msbuild_path] ? File.join(params[:msbuild_path], "msbuild") : "msbuild"
  command = "#{msbuild} \"#{solution}\""
  params[:targets].each do |target|
    command << " /t:\"#{target}\""
  end
  command << " /p:Configuration=\"#{configuration}\""
  command << " /p:Platform=\"#{platform}\"" if platform
  command << " /p:AndroidSdkDirectory=\"#{params[:android_home]}\"" if params[:android_home]
  params[:additional_arguments].each do |param|
    command << " #{param}"
  end

  FastlaneCore::CommandExecutor.execute(command: command, print_all: true, print_command: true)
end