Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed buildsupport. Done with rakefile cleaning

  • Loading branch information...
commit fdd6eaabe7a6e9f1cd81a48d65999895102c14ef 1 parent fe3363f
@statianzo statianzo authored
Showing with 9 additions and 108 deletions.
  1. +9 −22 Rakefile
  2. +0 −86 support/buildUtils.rb
View
31 Rakefile
@@ -5,7 +5,6 @@ load 'support/platform.rb'
load 'VERSION.txt'
ROOT_NAMESPACE = 'Fleck'
-RESULTS_DIR = 'build/test-reports'
PRODUCT = ROOT_NAMESPACE
COPYRIGHT = 'Copyright Jason Staten 2010-2011. All rights reserved.';
COMMON_ASSEMBLY_INFO = 'src/CommonAssemblyInfo.cs';
@@ -13,9 +12,8 @@ COMPILE_TARGET = 'Debug'
COMPILE_PLATFORM = 'Any CPU'
CLR_TOOLS_VERSION = 'v4.0.30319'
BUILD_RUNNER = Platform.nix? ? 'xbuild' : 'msbuild'
-
-props = { :archive => 'artifacts', :stage => 'stage' }
-
+ARCHIVE_DIR = 'artifacts'
+RESULTS_DIR = 'artifacts/test-reports'
desc 'Compiles and runs unit tests'
task :all => [:default]
@@ -25,7 +23,7 @@ task :default => [:build, :test]
desc 'Build application'
task :build => [:clean, :version, :compile] do
- copyOutputFiles "src/#{ROOT_NAMESPACE}/bin/#{COMPILE_TARGET}", "*.{dll,pdb}", props[:archive]
+ copyOutputFiles "src/#{ROOT_NAMESPACE}/bin/#{COMPILE_TARGET}", "*.{dll,pdb}", ARCHIVE_DIR
end
desc 'Update the version information for the build'
@@ -57,10 +55,9 @@ end
desc 'Prepares the working directory for a new build'
task :clean do
Rake::Task["clean:#{BUILD_RUNNER}"].execute
- buildDir = props[:archive]
- rm_r buildDir if Dir.exists?(buildDir)
+ rm_r ARCHIVE_DIR if Dir.exists?(ARCHIVE_DIR)
rm_r RESULTS_DIR if Dir.exists?(RESULTS_DIR)
- mkdir_p buildDir
+ mkdir_p ARCHIVE_DIR
mkdir_p RESULTS_DIR
end
@@ -82,17 +79,6 @@ namespace :clean do
end
end
-desc 'Prepares the working directory for a new build'
-task :clean do
- Rake::Task["clean:#{BUILD_RUNNER}"].execute
- buildDir = props[:archive]
- rm_r buildDir if Dir.exists?(buildDir)
- rm_r RESULTS_DIR if Dir.exists?(RESULTS_DIR)
- mkdir_p buildDir
- mkdir_p RESULTS_DIR
-end
-
-desc 'Compiles the app'
task :compile do
Rake::Task["compile:#{BUILD_RUNNER}"].execute
end
@@ -114,15 +100,16 @@ namespace :compile do
end
end
-task :test do |nunit|
+desc 'Run tests'
+task :test do
runner = Dir['**/nunit-console.exe'].first
raise "nunit-console.exe not found" if runner.nil?
assemblies = Dir["**/#{COMPILE_TARGET}/*.Tests.dll"].reject{|a|a =~ /\/obj\//}
+ output = File.join(RESULTS_DIR, 'TestResults.xml')
- sh "#{Platform.runtime(runner)} #{assemblies.join}"
+ sh "#{Platform.runtime(runner)} #{assemblies.join} #{Platform.switch('xml:')}#{output}"
end
def copyOutputFiles(fromDir, filePattern, outDir)
copy Dir[File.join(fromDir, filePattern)], outDir
end
-
View
86 support/buildUtils.rb
@@ -1,86 +0,0 @@
-require 'erb'
-
-class NUnitRunner
-
- def initialize(paths)
- @sourceDir = paths.fetch(:source, 'source')
- @resultsDir = paths.fetch(:results, 'results')
- @compilePlatform = paths.fetch(:platform, '')
- @compileTarget = paths.fetch(:compilemode, 'debug')
-
- @nunitExe = tool("NUnit", "nunit-console#{(@compilePlatform.empty? ? '' : "-#{@compilePlatform}")}.exe") + Platform.switch("nothread")
- end
-
- def executeTests(assemblies)
- mkdir_p @resultsDir
-
- assemblies.each do |assem|
- file = File.expand_path("#{@sourceDir}/#{assem}/bin/#{@compileTarget}/#{assem}.dll")
- sh Platform.runtime("#{@nunitExe} \"#{file}\"")
- end
- end
-
- def tool(package, tool)
- File.join(Dir.glob(File.join(package_root,"#{package}.*")).sort.last, "tools", tool)
- end
-
- def package_root
- root = nil
- ["src", "source"].each do |d|
- packroot = File.join d, "packages"
- root = packroot if File.directory? packroot
- end
- raise "No NuGet package root found" unless root
- root
- end
-end
-
-class MSBuildRunner
- def self.compile(attributes)
- compileTarget = attributes.fetch(:compilemode, 'debug')
- solutionFile = attributes[:solutionfile]
-
- attributes[:projFile] = solutionFile
- attributes[:properties] ||= []
- attributes[:properties] << "Configuration=#{compileTarget}"
- attributes[:extraSwitches] = ["v:m", "t:rebuild"]
- attributes[:extraSwitches] << "maxcpucount:2" unless Platform.is_nix
-
- self.runProjFile(attributes);
- end
-
- def self.runProjFile(attributes)
- version = attributes.fetch(:clrversion, 'v4.0.30319')
- compileTarget = attributes.fetch(:compilemode, 'debug')
- projFile = attributes[:projFile]
-
- if Platform.is_nix
- msbuildFile = `which xbuild`.chop
- else
- frameworkDir = File.join(ENV['windir'].dup, 'Microsoft.NET', 'Framework', version)
- msbuildFile = File.join(frameworkDir, 'msbuild.exe')
- end
-
- properties = attributes.fetch(:properties, [])
-
- switchesValue = ""
-
- properties.each do |prop|
- switchesValue += " /property:#{prop}"
- end
-
- extraSwitches = attributes.fetch(:extraSwitches, [])
-
- extraSwitches.each do |switch|
- switchesValue += " /#{switch}"
- end
-
- targets = attributes.fetch(:targets, [])
- targetsValue = ""
- targets.each do |target|
- targetsValue += " /t:#{target}"
- end
-
- sh "#{msbuildFile} #{projFile} #{targetsValue} #{switchesValue}"
- end
-end
Please sign in to comment.
Something went wrong with that request. Please try again.