require 'fileutils'
include FileUtils
version = 'v3.5'
compile_target = ENV.include?('target') ? ENV['target'] : 'Debug'
project = "MyProject"
framework_dir = File.join(ENV['windir'].dup, 'Microsoft.NET', 'Framework', version)
msbuild = File.join(framework_dir, 'msbuild.exe')
team_city = ENV.include?('teamcity_build') ? '/re:TeamCityExtension,Gallio.TeamCityIntegration' : ''
task :default => :build
task :build => [:compile, :test]
task :compile do
sh "#{msbuild} #{project}.sln /property:Configuration=#{compile_target}"
end
task :test do
runner = 'tools\\Gallio\\Gallio.Echo.exe'
assembly = "Test\\bin\\#{compile_target}\\MyProject.Test.dll"
sh "#{runner} #{assembly} #{team_city}"
end
desc "Rebuild"
task :rebuild do
sh "#{msbuild} #{project}.sln /t:Rebuild /property:Configuration=#{compile_target}"
end
desc "Clean"
task :clean do
sh "#{msbuild} #{project}.sln /t:Clean /property:Configuration=#{compile_target}"
end