Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
115 lines (97 sloc) 3.3 KB
require 'fileutils'
require 'albacore'
require 'AlbacoreExtensions.rb'
def get_version
ENV['BUILD_NUMBER'] || '1.0.0.0'
end
task :default => 'build:all'
namespace :setup do
task :ensure_gemcutter_source do
puts 'Ensuring gemcutter.org is registered as a gem source'
unless `gem source -l`.include? 'http://gemcutter.org'
puts 'Setting Gemcutter as a gem source'
`gem source -a http://gemcutter.org`
end
end
end
namespace :ci do
task :run_ci_build => [
'build:all',
'docs:build',
'package:all',
]
end
namespace :source do
desc 'Update assembly info with latest version number'
assemblyinfotask :update_version do |asm|
asm.output_file = 'src/CommonAssemblyInfo.cs'
asm.version = get_version
asm.company_name = 'http://fluentnhibernate.org'
asm.product_name = 'FluentNHibernate'
asm.copyright = 'Copyright 2008-2009 James Gregory and contributors (Paul Batum, Andrew Stewart, Hudson Akridge, Stuart Childs et al). All rights reserved.'
asm.namespaces = ['System.Security']
asm.custom_attributes :AllowPartiallyTrustedCallers => nil
puts "The build number is #{asm.version}"
end
desc 'Compile the source'
msbuildtask :compile do |msb|
msb.properties = { :configuration => :Release }
msb.targets [:Clean, :Build]
msb.solution = 'src/FluentNHibernate.sln'
end
end
namespace :specs do
desc 'Run NUnit tests'
nunittask :run do |nunit|
nunit.path_to_command = 'tools/nunit/nunit-console-x86.exe'
nunit.assemblies << 'src/FluentNHibernate.Testing/bin/Release/FluentNHibernate.Testing.dll'
end
end
namespace :build do
desc 'Run full build including tests'
task :all => ['source:update_version', 'source:compile', 'specs:run'] do
puts 'Copying output to build directory'
Dir.mkdir 'build' unless File.exist? 'build'
Dir.glob 'src/FluentNHibernate/bin/Release/*.{dll,pdb,xml}' do |path|
copy path, 'build' if File.file? path
end
puts 'Build complete'
end
end
namespace :docs do
desc 'Create API docs'
docu :build do |d|
d.path_to_command = 'tools/docu/docu.exe'
d.assemblies << 'build/FluentNHibernate.dll'
end
end
namespace :package do
task :prepare_dist_directory do
Dir.mkdir 'dist' unless File.exists? 'dist'
end
desc 'Create zip of source-tree'
ziptask :source => :prepare_dist_directory do |zip|
zip.directories_to_zip = ['./']
zip.output_file = "fluentnhibernate-source-#{get_version}.zip"
zip.output_path = 'dist'
zip.exclusions = [/.git/, /build/, /dist/, /results/, /_ReSharper/, /bin/, /obj/, /.user/, /.suo/, /.resharper/, /.cache/, /output/]
end
desc 'Create zip of binaries'
ziptask :binaries => :prepare_dist_directory do |zip|
zip.directories_to_zip = ['build']
zip.output_file = "fluentnhibernate-binary-#{get_version}.zip"
zip.output_path = 'dist'
end
desc 'Create zip of API docs'
ziptask :docs => :prepare_dist_directory do |zip|
zip.directories_to_zip = ['output']
zip.output_file = "fluentnhibernate-docs-#{get_version}.zip"
zip.output_path = 'dist'
end
task :all => [:source, :binaries, :docs]
end
task :sln do
Thread.new do
system "devenv src/FluentNHibernate.sln"
end
end
Something went wrong with that request. Please try again.