-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrakefile.rb
More file actions
66 lines (52 loc) · 2.04 KB
/
rakefile.rb
File metadata and controls
66 lines (52 loc) · 2.04 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
def read_version(file_name)
version = '0.0.0.0'
text = File.read(file_name)
version = $1 if text =~ /Identity\sId=\".*?Version=\"(\d+[\.\d+]+)\"/
end
def make_msbuild_command_line(solution_file, target, configuration, platform)
cmdline = "\"%VS120COMNTOOLS%\\..\\..\\VC\\vcvarsall.bat\" x86_amd64"
cmdline += " & msbuild /m #{solution_file}"
cmdline += " /t:#{target}"
cmdline += " /p:Configuration=#{configuration}"
cmdline += " /p:Platform=\"#{platform}\""
end
################################################################################
$project_name = 'BoostTestVSPackage'
$solution_file = 'BoostTestAddin.sln'
$staging_area_dir = 'staging_area'
$version = read_version('BoostTestVSPackage/source.extension.vsixmanifest')
$configuration = ENV['build_config'] || 'Release'
$platform = ENV['build_platform'] || 'Any CPU'
case $platform
when 'Any CPU'
$build_output_dir = File.join($project_name, 'bin', $configuration)
when 'x86', 'x64'
$build_output_dir = File.join($project_name,'bin', $platform, $configuration)
end
puts
puts "Building #{$solution_file}..."
puts "Configuration: #{$configuration}"
puts "Platform: #{$platform}"
puts "Version: #{$version}"
puts
################################################################################
task :default do
puts `rake -T`
end
desc 'Build and rename the generated file for distribution'
task :distrib => [:rebuild] do
output_file = File.join($build_output_dir, 'BoostTestVSPackage.vsix')
distributed_name = "BoostTestVSPackage-#{$version}.vsix"
FileUtils.copy_entry(output_file, distributed_name, :remove_destination => true)
puts "Created #{distributed_name}"
end
desc 'Build whole solution'
task :build do |t|
sh make_msbuild_command_line($solution_file, "Build", $configuration, $platform)
end
desc 'Clean whole solution'
task :clean do |t|
sh make_msbuild_command_line($solution_file, "Clean", $configuration, $platform)
end
desc 'Run a clean build of the whole solution'
task :rebuild => [:clean, :build]