Skip to content
Newer
Older
100644 127 lines (101 sloc) 3.85 KB
6f4d517 @jmarnold 'seeding'
authored Nov 15, 2012
1 COMPILE_TARGET = ENV['config'].nil? ? "Debug" : ENV['config'] # Keep this in sync w/ VS settings since Mono is case-sensitive
2 CLR_TOOLS_VERSION = "v4.0.30319"
3
4 buildsupportfiles = Dir["#{File.dirname(__FILE__)}/buildsupport/*.rb"]
5
6 if( ! buildsupportfiles.any? )
7 # no buildsupport, let's go get it for them.
8 sh 'git submodule update --init' unless buildsupportfiles.any?
9 buildsupportfiles = Dir["#{File.dirname(__FILE__)}/buildsupport/*.rb"]
10 end
11
12 # nope, we still don't have buildsupport. Something went wrong.
13 raise "Run `git submodule update --init` to populate your buildsupport folder." unless buildsupportfiles.any?
14
15 buildsupportfiles.each { |ext| load ext }
16
17 include FileTest
18 require 'albacore'
19 load "VERSION.txt"
20
21 RESULTS_DIR = "results"
22 PRODUCT = "SystemStateExample"
23 COPYRIGHT = 'Copyright 2012 SystemStateExample. All rights reserved.';
24 COMMON_ASSEMBLY_INFO = 'src/CommonAssemblyInfo.cs';
25 BUILD_DIR = File.expand_path("build")
26 ARTIFACTS = File.expand_path("artifacts")
27
28 tc_build_number = ENV["BUILD_NUMBER"]
29 build_revision = tc_build_number || Time.new.strftime('5%H%M')
30 BUILD_NUMBER = "#{BUILD_VERSION}.#{build_revision}"
31
32 props = { :stage => BUILD_DIR, :artifacts => ARTIFACTS }
33
34 desc "**Default**, compiles and runs tests"
35 task :default => [:compile, :unit_test]
36
37 desc "Target used for the CI server"
38 task :ci => [:update_all_dependencies, :default, :history, :package]
39
40 desc "Update the version information for the build"
41 assemblyinfo :version do |asm|
42 asm_version = BUILD_VERSION + ".0"
43
44 begin
45 commit = `git log -1 --pretty=format:%H`
46 rescue
47 commit = "git unavailable"
48 end
49 puts "##teamcity[buildNumber '#{BUILD_NUMBER}']" unless tc_build_number.nil?
50 puts "Version: #{BUILD_NUMBER}" if tc_build_number.nil?
51 asm.trademark = commit
52 asm.product_name = PRODUCT
53 asm.description = BUILD_NUMBER
54 asm.version = asm_version
55 asm.file_version = BUILD_NUMBER
56 asm.custom_attributes :AssemblyInformationalVersion => asm_version
57 asm.copyright = COPYRIGHT
58 asm.output_file = COMMON_ASSEMBLY_INFO
59 end
60
61 desc "Prepares the working directory for a new build"
62 task :clean => [:update_buildsupport] do
63
64 FileUtils.rm_rf props[:stage]
65 # work around nasty latency issue where folder still exists for a short while after it is removed
66 waitfor { !exists?(props[:stage]) }
67 Dir.mkdir props[:stage]
68
69 Dir.mkdir props[:artifacts] unless exists?(props[:artifacts])
70 end
71
72 def waitfor(&block)
73 checks = 0
74 until block.call || checks >10
75 sleep 0.5
76 checks += 1
77 end
78 raise 'waitfor timeout expired' if checks > 10
79 end
80
81 desc "Compiles the app"
82 task :compile => [:restore_if_missing, :clean, :version] do
83 MSBuildRunner.compile :compilemode => COMPILE_TARGET, :solutionfile => 'src/SystemStateExample.sln', :clrversion => CLR_TOOLS_VERSION
84
85 target = COMPILE_TARGET.downcase
86 end
87
88 def copyOutputFiles(fromDir, filePattern, outDir)
89 Dir.glob(File.join(fromDir, filePattern)){|file|
90 copy(file, outDir, :preserve => true) if File.file?(file)
91 }
92 end
93
94 desc "Runs unit tests"
95 task :test => [:unit_test]
96
97 desc "Run unit tests"
98 task :unit_test do
99 runner = NUnitRunner.new :compilemode => COMPILE_TARGET, :source => 'src', :platform => 'x86'
100 tests = Array.new
101 file = File.new("TESTS.txt", "r")
102 assemblies = file.readlines()
103 assemblies.each do |a|
104 test = a.gsub("\r\n", "").gsub("\n", "")
105 tests.push(test)
106 end
107 file.close
108
109 runner.executeTests tests
110 end
111
112 def self.bottles(args)
113 bottles = Platform.runtime(Nuget.tool("Bottles", "BottleRunner.exe"))
114 sh "#{bottles} #{args}"
115 end
116
117
118 def self.fubu(args)
119 fubu = Platform.runtime("src/fubu/bin/#{COMPILE_TARGET}/fubu.exe")
120 sh "#{fubu} #{args}"
5d28145 @jmarnold Initial commit
authored Nov 16, 2012
121 end
122
123 desc "Runs the StoryTeller UI"
124 task :run_st => [:restore_if_missing] do
125 st = Platform.runtime(Nuget.tool("Storyteller2", "StorytellerUI.exe"))
126 sh st
6f4d517 @jmarnold 'seeding'
authored Nov 16, 2012
127 end
Something went wrong with that request. Please try again.