Skip to content

Commit

Permalink
Add script for creating and packaging a build
Browse files Browse the repository at this point in the history
  • Loading branch information
ZimbiX committed Feb 14, 2015
1 parent aee45a5 commit fe87d90
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions build-and-package-release.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env ruby

solution_name = "ConcurrencyUtilities"

project_dirs = %w[
CigaretteSmokers
ConcurrencyUtilities
DiningPhilosophers
HilzerBarbershop
RiverCrossing
TestConcurrencyUtilities
ZorkServer
]

def sep
puts '', '-' * 80, ''
end



if __FILE__ == $0

if ARGV[0] != '-s' # Check if we need to skip building
puts "Removing all existing builds..."
system "rm -rf */bin/Debug"

puts "Building projects from source..."
project_dirs.each do |project_dir|
sep
puts "Building projects for: #{project_dir}...", ''
Dir.chdir project_dir do
system "xbuild"
if $?.exitstatus != 0
sep
puts "Build error detected; exiting"
exit 1
end
end
end
end

sep
puts "Completed building projects from source"

time = Time.now.strftime "%Y-%m-%d_%H-%M-%S"
zip_file = "#{solution_name}_build_#{time}.zip"
puts "Compressing builds to: #{zip_file}..."
dirs = project_dirs.map { |dir| "#{dir}/bin/Debug" }.join(' ')
system "zip -r -0 -v #{zip_file} #{dirs}"

sep
puts "Finished building and packaging release: #{zip_file}"
end

0 comments on commit fe87d90

Please sign in to comment.