-
Notifications
You must be signed in to change notification settings - Fork 0
/
_rakefiletemplate
44 lines (35 loc) · 1.32 KB
/
_rakefiletemplate
1
2
3
4
5
6
7
8
9
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
require 'albacore'
require 'FileUtils'
COMPILE_TARGET = "debug" unless defined?(COMPILE_TARGET)
build_dir = "#{File.dirname(__FILE__)}/build"
# Change these two to match your solution and project
solution_file = "SolutionFile.sln"
project_directory = "ProjectRootDirectory"
task :default => ['build']
desc "Prepares the working directory for a new build"
task :clean do
unless defined?(GLOBAL_BUILD_DIR) then
FileUtils.rm_rf build_dir
Dir.mkdir build_dir
end
end
desc "Compile the project"
msbuild :compile do |msb|
msb.properties :configuration => COMPILE_TARGET
msb.targets :Clean, :Build
msb.solution = File.dirname(__FILE__) + "/#{solution_file}"
msb.path_to_command = File.join(ENV['windir'], 'Microsoft.NET', 'Framework', 'v4.0.30319', 'MSBuild.exe')
end
task :build => [:clean, :compile] do
if defined?(GLOBAL_BUILD_DIR) then
copyOutputFiles File.dirname(__FILE__)+ "/#{project_directory}/bin/#{COMPILE_TARGET}", "*.{dll,exe,config,pdb}", "#{GLOBAL_BUILD_DIR}/#{project_directory}"
else
copyOutputFiles File.dirname(__FILE__)+ "/#{project_directory}/bin/#{COMPILE_TARGET}", "*.{dll,exe,config,pdb}", build_dir
end
end
def copyOutputFiles(fromDir, filePattern, outDir)
mkdir outDir unless File.exists? outDir
Dir.glob(File.join(fromDir, filePattern)){|file|
copy(file, outDir) if File.file?(file)
}
end