Class: Compile

Inherits:
Object
  • Object
show all
Defined in:
lib/rakeoff/compile.rb

Instance Method Summary collapse

Instance Method Details

#execute(name, session, options) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rakeoff/compile.rb', line 4

def execute(name, session, options)
  print_heading name
  
       matches = Dir.glob("#{session.working_dir}/*.sln", File::FNM_CASEFOLD)
       
       if matches.empty? 
        raise NoSolutionFile, "No *.sln file found in #{session.working_dir}".red
       end

  if matches.length > 1
    raise MultipleSolutionFiles, "Multiple solution files found at #{session.working_dir}. Don't know which one to build!".red
  end
       
  match = matches.first

       multi_core = session.framework_version[1,1].to_i > 2 ? '/m' : ''
  msbuild_path = "%windir%/microsoft.net/framework/#{session.framework_version}/msbuild.exe"

       sh "#{msbuild_path} /t:Clean;Build /p:Configuration=#{session.configuration} #{options} /p:TrackFileAccess=false #{multi_core} /consoleloggerparameters:ErrorsOnly #{match}"
end