From e66c7e9b713c54f6f390c86140a24c1ec0f53f99 Mon Sep 17 00:00:00 2001 From: Joshua Flanagan Date: Mon, 14 Mar 2011 20:19:20 -0500 Subject: [PATCH] Official build versions are based on the teamcity.codebetter.com build number - Major/minor/revision components stored in VERSION.txt --- VERSION.txt | 1 + rakefile.rb | 44 ++++++++++++-------------------------------- 2 files changed, 13 insertions(+), 32 deletions(-) create mode 100644 VERSION.txt diff --git a/VERSION.txt b/VERSION.txt new file mode 100644 index 0000000000..c9378f4cc5 --- /dev/null +++ b/VERSION.txt @@ -0,0 +1 @@ +BUILD_VERSION = "0.4.0" \ No newline at end of file diff --git a/rakefile.rb b/rakefile.rb index e040ca32c9..281bed61f0 100644 --- a/rakefile.rb +++ b/rakefile.rb @@ -3,50 +3,37 @@ include FileTest require 'albacore' +load "VERSION.txt" RESULTS_DIR = "results" -BUILD_NUMBER_BASE = "0.4.0" PRODUCT = "FubuMVC" COPYRIGHT = 'Copyright 2008-2010 Chad Myers, Jeremy D. Miller, Joshua Flanagan, et al. All rights reserved.'; COMMON_ASSEMBLY_INFO = 'src/CommonAssemblyInfo.cs'; CLR_TOOLS_VERSION = "v4.0.30319" -props = { :stage => File.expand_path("build"), :artifacts => File.expand_path("artifacts") } - -desc "Displays a list of tasks" -task :help do - taskHash = Hash[*(`rake.bat -T`.split(/\n/).collect { |l| l.match(/rake (\S+)\s+\#\s(.+)/).to_a }.collect { |l| [l[1], l[2]] }).flatten] - - indent = " " - - puts "rake #{indent}#Runs the 'default' task" - - taskHash.each_pair do |key, value| - if key.nil? - next - end - puts "rake #{key}#{indent.slice(0, indent.length - key.length)}##{value}" - end -end +tc_build_number = ENV["BUILD_NUMBER"] +build_revision = tc_build_number || Time.new.strftime('5%H%M') +build_number = "#{BUILD_VERSION}.#{build_revision}" -desc "Compiles, unit tests, generates the database" -task :all => [:default] +props = { :stage => File.expand_path("build"), :artifacts => File.expand_path("artifacts") } desc "**Default**, compiles and runs tests" task :default => [:compile, :unit_test] +desc "Target used for the CI server" +task :ci => [:default,:package,:nuget] + desc "Update the version information for the build" assemblyinfo :version do |asm| - asm_version = BUILD_NUMBER_BASE + ".0" + asm_version = BUILD_VERSION + ".0" begin commit = `git log -1 --pretty=format:%H` rescue commit = "git unavailable" end - build_number = getBuildNumber - tc_build_number = ENV["BUILD_NUMBER"] - puts "##teamcity[buildNumber '#{build_number}-#{tc_build_number}']" unless tc_build_number.nil? + puts "##teamcity[buildNumber '#{build_number}']" unless tc_build_number.nil? + puts "Version: #{build_number}" if tc_build_number.nil? asm.trademark = commit asm.product_name = PRODUCT asm.description = build_number @@ -56,10 +43,6 @@ asm.copyright = COPYRIGHT asm.output_file = COMMON_ASSEMBLY_INFO end - -def getBuildNumber - "#{BUILD_NUMBER_BASE}.#{Date.today.strftime('%y%j')}" -end desc "Prepares the working directory for a new build" task :clean do @@ -131,9 +114,6 @@ def copyOutputFiles(fromDir, filePattern, outDir) sh "src/fubu/bin/#{COMPILE_TARGET}/fubu.exe createvdir src/FubuMVC.HelloSpark hellospark" end -desc "Target used for the CI server" -task :ci => [:default,:package,:nuget] - desc "ZIPs up the build results" zip :package do |zip| zip.directories_to_zip = [props[:stage]] @@ -144,5 +124,5 @@ def copyOutputFiles(fromDir, filePattern, outDir) desc "Build the nuget package" task :nuget do - sh "lib/nuget.exe pack packaging/nuget/fubumvc.nuspec -o artifacts -Version #{getBuildNumber}" + sh "lib/nuget.exe pack packaging/nuget/fubumvc.nuspec -o #{props[:artifacts]} -Version #{build_number}" end