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
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/fastlane/plugin/sapfire/msbuild/runner.rb', line 10
def run
params = Msbuild.config.params
FastlaneCore::PrintTable.print_values(config: params, title: "Summary for msbuild")
UI.user_error!("Can't find MSBuild") unless Fastlane::Helper::SapfireHelper.msbuild_specified?
UI.user_error!("Can't find dotnet. You selected MSBuild as a library, so dotnet is required to work with it. ") if
Msbuild.config.msbuild_type == Msbuild::MsbuildType::LIBRARY && !Fastlane::Helper::SapfireHelper.dotnet_specified?
prev_cwd = Dir.pwd
working_directory = File.dirname(File.expand_path(params[:project]))
UI.message("Change working directory to #{working_directory}")
Dir.chdir(working_directory)
params[:jobs] = 1 if params[:jobs].zero?
msbuild_path = Msbuild.config.msbuild_path
msbuild_args = get_msbuild_args(params, Msbuild.config.overwritten_props)
cmd = "#{msbuild_path} #{msbuild_args.join(" ")}"
check_configuration_platform(params)
UI.command(cmd)
Open3.popen2(cmd) do |_, stdout, wait_thr|
until stdout.eof?
stdout.each do |l|
line = l.force_encoding("utf-8").chomp
puts line
end
end
UI.user_error!("MSBuild execution failed. See the log above.") unless wait_thr.value.success?
UI.success("MSBuild has ended successfully") if wait_thr.value.success?
end
rename_package(params)
UI.message("Change working directory back to #{prev_cwd}")
Dir.chdir(prev_cwd)
end
|