-
Notifications
You must be signed in to change notification settings - Fork 16
/
rakefile.rb
149 lines (115 loc) · 4.81 KB
/
rakefile.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
begin
require 'bundler/setup'
require 'fuburake'
rescue LoadError
puts 'Bundler and all the gems need to be installed prior to running this rake script. Installing...'
system("gem install bundler --source http://rubygems.org")
sh 'bundle install'
system("bundle exec rake", *ARGV)
exit 0
end
@solution = FubuRake::Solution.new do |sln|
sln.compile = {
:solutionfile => 'src/Bottles.sln'
}
sln.assembly_info = {
:product_name => "Bottles",
:copyright => 'Copyright 2008-2013 Jeremy D. Miller, Dru Sellers, Joshua Flanagan, et al. All rights reserved.'
}
sln.options = {
:unit_test_projects => ['Bottles.Tests']
}
sln.ripple_enabled = true
sln.fubudocs_enabled = true
sln.bottles_enabled = false # needs to be done all special like in Bottles itself
# TODO -- put the integration testing back into the build. Has file cleanup problems now
sln.defaults = [:ilrepack]
sln.ci_steps = [:ilrepack, :archive_gem]
sln.compile_step :compile_console, 'src/Bottles.Console/Bottles.Console.csproj'
sln.compile_step :compile_bottle_project, 'bottles-staging/BottleProject.csproj'
sln.precompile = [:compile_console, :bottle_assembly_package]
sln.integration_test = ['Bottles.IntegrationTesting']
end
desc "**Mono**, compiles, merges and runs unit tests"
task :mono_ci => [:compile, :ilrepack, :unit_test]
desc "does the assembly bottling of the AssemblyPackage test project"
task :bottle_assembly_package do
bottles "assembly-pak src/AssemblyPackage"
end
desc "Merge dotnetzip assembly into Bottles projects"
task :ilrepack do
merge_ionic("src/Bottles/bin/#{@solution.compilemode}", 'Bottles.dll')
merge_fubucsproj("src/Bottles/bin/#{@solution.compilemode}", 'Bottles.dll')
merge_json("src/Bottles/bin/#{@solution.compilemode}", 'Bottles.dll')
end
require_relative 'ILRepack'
def merge_ionic(dir, assembly)
output = File.join(dir, assembly)
packer = ILRepack.new :out => output, :lib => dir
packer.merge :lib => dir, :refs => [assembly, 'Ionic.Zip.dll'], :clrversion => @solution.options[:clrversion]
end
def merge_fubucsproj(dir, assembly)
output = File.join(dir, assembly)
packer = ILRepack.new :out => output, :lib => dir
packer.merge :lib => dir, :refs => [assembly, 'FubuCsProjFile.dll'], :clrversion => @solution.options[:clrversion]
end
def merge_json(dir, assembly)
output = File.join(dir, assembly)
packer = ILRepack.new :out => output, :lib => dir
packer.merge :lib => dir, :refs => [assembly, 'Newtonsoft.Json.dll'], :clrversion => @solution.options[:clrversion]
end
def bottles(args)
sh Platform.runtime("src/Bottles.Console/bin/#{@solution.compilemode}/BottleRunner.exe #{args}", @solution.options[:clrversion])
end
desc "Replaces the existing installed gem with the new version for local testing"
task :local_gem => [:create_gem] do
Dir.chdir 'pkg' do
sh 'gem install bottles'
end
end
desc "Moves the gem to the archive folder"
task :archive_gem => [:create_gem] do
copyOutputFiles "pkg", "*.gem", "artifacts"
end
desc "Outputs the command line usage"
task :dump_usages => [:compile] do
bottles 'dump-usages bottles src/Bottles.Docs/bottles.cli.xml'
end
desc "Creates the gem for BottleRunner.exe"
task :create_gem => [:compile, :ilrepack] do
require "rubygems/package"
cleanDirectory 'bin';
cleanDirectory 'pkg'
Dir.mkdir 'bin' unless Dir.exists? 'bin'
Dir.mkdir 'pkg' unless Dir.exists? 'pkg'
copyOutputFiles "src/Bottles.Console/bin/#{@solution.compilemode}", '*.dll', 'bin'
copyOutputFiles "src/Bottles.Console/bin/#{@solution.compilemode}", '*BottleRunner.exe', 'bin/bottles.exe'
FileUtils.copy 'bottles', 'bin'
# letting the file system catch up, otherwise you occasionally
# get a gem w/ no binaries, and it always happens on CI
waitfor {exists?('bin/bottles.exe')}
waitfor {exists?('bin/Bottles.dll')}
waitfor {exists?('bin/FubuCore.dll')}
Dir.foreach('bin') do |item|
puts item
end
onthefly = Gem::Specification.new do |s|
s.name = 'bottles'
s.version = @solution.build_number
s.files = Dir.glob("bin/**/*").to_a
s.bindir = 'bin'
s.executables << 'bottles'
s.license = 'Apache 2'
s.summary = 'Command line tools for using Bottles'
s.description = 'Shared libraries for runtime and deployment packaging of .Net'
s.authors = ['Jeremy D. Miller', 'Josh Arnold', 'Chad Myers', 'Joshua Flanagan']
s.email = 'fubumvc-devel@googlegroups.com'
s.homepage = 'http://fubu-project.org'
s.rubyforge_project = 'bottles'
end
puts "ON THE FLY SPEC FILES"
puts onthefly.files
puts "=========="
Gem::Package::build onthefly, true
copyOutputFiles ".", "*.gem", "pkg"
end