-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathRakefile.rb
248 lines (205 loc) · 8.61 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
$: << './'
require "rubygems"
require "bundler"
Bundler.setup
require 'albacore'
require 'version_bumper'
#-----------------------
# Local dependencies
#-----------------------
require File.expand_path(File.dirname(__FILE__)) + '/buildscripts/project_data'
require File.expand_path(File.dirname(__FILE__)) + '/buildscripts/paths'
require File.expand_path(File.dirname(__FILE__)) + '/buildscripts/hircine_task.rb'
#-----------------------
# Environment variables
#-----------------------
@env_buildconfigname = "Release"
def env_buildversion
bumper_version.to_s
end
#-----------------------
# Control Flow (meant to be called directly)
#-----------------------
desc "Creates a new build of Hircine"
task :default => [:build]
desc "Builds and tests Hircine without touching version \#"
task :test => [:integration_test]
desc "Builds Hircine with new build \#"
task :build => [:bump_build, :test]
desc "Builds Hircine with new revision \#"
task :build_revision => [:bump_revision, :test]
desc "Builds Hircine with new minor version \#"
task :build_minor => [:bump_minor, :test]
desc "Builds Hircine with new major version \#"
task :build_major => [:bump_major, :test]
desc "Packs the most recent build output into NuGet packages (does not bump versions)"
task :pack => [:test, :clean_output_folders, :create_output_folders, :core_pack, :app_pack]
#Note - relies on you having an accepted API key on your system
desc "Pushes updates of all packages to NuGet.org"
task :push => [:push_core, :push_app]
#-----------------------
# Building
#-----------------------
desc "Build"
msbuild :msbuild => [:assemblyinfo] do |msb|
msb.properties :configuration => :Release
msb.targets :Clean, :Build #Does the equivalent of a "Rebuild Solution"
msb.solution = File.join(Folders[:root], Files[:solution])
end
#----------------------------------
# Testing
#----------------------------------
desc "Test"
nunit :nunit_test => :msbuild do |nunit|
nunit.command = Commands[:nunit]
nunit.options '/framework v4.0.30319'
nunit.assemblies "#{Folders[:hircine_tests]}/bin/#{@env_buildconfigname}/#{Files[:hircine][:test]}", "#{Folders[:hircine_core_tests]}/bin/#{@env_buildconfigname}/#{Files[:hircine_core][:test]}"
end
desc "Runs an integration test against the currenly built version of hircine"
hircine :integration_test => [:nunit_test, :set_output_folders] do |hircine|
puts "Testing Hircine against embedded database..."
hircine.command = File.join(Folders[:hircine_bin], Files[:hircine][:bin])
puts "Command path %s" % hircine.command
hircine.run_embedded = true #use an emebedded RavenDB instance
hircine.assemblies File.join(Folders[:hircine_test_indexes_bin], Files[:hircine_test_indexes][:bin])
end
#----------------------------------
# Version Management
#----------------------------------
desc "Bumps a new build number of Hircine"
task :bump_build do
bumper_version.bump_build
bumper_version.write(File.join(Folders[:root], Files[:version]))
end
desc "Bumps a new revision number of Hircine"
task :bump_revision do
bumper_version.bump_revision
bumper_version.write(File.join(Folders[:root], Files[:version]))
end
desc "Bumps a minor release number of Hircine"
task :bump_minor do
bumper_version.bump_minor
bumper_version.write(File.join(Folders[:root], Files[:version]))
end
desc "Bumps a major release number of Hircine"
task :bump_major do
bumper_version.bump_major
bumper_version.write(File.join(Folders[:root], Files[:version]))
end
desc "Updates the assembly information for Hircine"
assemblyinfo :assemblyinfo do |asm|
assemblyInfoPath = File.join(Folders[:src], Files[:assembly_info])
asm.input_file = assemblyInfoPath
asm.output_file = assemblyInfoPath
asm.version = env_buildversion
asm.file_version = env_buildversion
end
#----------------------------------
# Output
#----------------------------------
desc "Sets the output / bin folders based on the current build configuration"
task :set_output_folders do
Folders[:hircine_bin] = File.join(Folders[:src], Projects[:hircine][:dir],"bin", @env_buildconfigname)
Folders[:hircine_core_bin] = File.join(Folders[:src], Projects[:hircine_core][:dir],"bin", @env_buildconfigname)
Folders[:hircine_test_indexes_bin] = File.join(Folders[:tests], Projects[:hircine_test_indexes][:dir],"bin", @env_buildconfigname)
end
desc "Wipes out the build folder so we have a clean slate to work with"
task :clean_output_folders => :set_output_folders do
puts "Flushing build folder..."
flush_dir(Folders[:out])
end
desc "Creates all of the output folders we need for ILMerge / NuGet"
task :create_output_folders => :set_output_folders do
create_dir(Folders[:out])
create_dir(Folders[:nuget_build])
create_dir(Folders[:hircine_nuspec][:root])
create_dir(Folders[:hircine_nuspec][:lib])
create_dir(Folders[:hircine_nuspec][:net40])
create_dir(Folders[:hircine_core_nuspec][:root])
create_dir(Folders[:hircine_core_nuspec][:lib])
create_dir(Folders[:hircine_core_nuspec][:net40])
end
output :core_static_output do |out|
out.from '.'
out.to Folders[:hircine_core_nuspec][:root]
out.file Files[:readme]
out.file Files[:license]
end
output :app_static_output do |out|
out.from Folders[:root]
out.to Folders[:hircine_nuspec][:root]
out.file Files[:readme]
out.file Files[:license]
end
output :core_net40_output => [:core_static_output] do |out|
out.from Folders[:hircine_core_bin]
create_dir(Folders[:hircine_core_nuspec][:lib])
out.to Folders[:hircine_core_nuspec][:net40]
out.file Files[:hircine_core][:bin]
end
output :app_net40_output => [:app_static_output] do |out|
out.from Folders[:hircine_bin]
create_dir(Folders[:hircine_nuspec][:lib])
out.to Folders[:hircine_nuspec][:net40]
out.file Files[:hircine][:bin], :as => 'hircine.exe'
Files[:nuspec_assemblies].each do |assembly|
puts assembly
out.file assembly
end
end
#----------------------------------
# NuSpec
#----------------------------------
nuspec :core_nuspec do |nuspec|
nuspec.id = Projects[:hircine_core][:id]
nuspec.version = env_buildversion
nuspec.authors = Projects[:hircine_core][:authors]
nuspec.description = Projects[:hircine_core][:description]
nuspec.title = Projects[:hircine_core][:title]
nuspec.language = Projects[:language]
nuspec.licenseUrl = Projects[:licenseUrl]
nuspec.projectUrl = Projects[:projectUrl]
nuspec.dependency "RavenDB.Embedded", "1.0.960"
nuspec.output_file = File.join(Folders[:nuget_build], "#{Projects[:hircine_core][:id]}-v#{env_buildversion}(#{@env_buildconfigname}).nuspec")
nuspec.tags = "ravendb, indexes, raven, index"
end
nuspec :app_nuspec do |nuspec|
nuspec.id = Projects[:hircine][:id]
nuspec.version = env_buildversion
nuspec.authors = Projects[:hircine][:authors]
nuspec.description = Projects[:hircine][:description]
nuspec.title = Projects[:hircine][:title]
nuspec.language = Projects[:language]
nuspec.licenseUrl = Projects[:licenseUrl]
nuspec.projectUrl = Projects[:projectUrl]
nuspec.output_file = File.join(Folders[:nuget_build], "#{Projects[:hircine][:id]}-v#{env_buildversion}(#{@env_buildconfigname}).nuspec")
nuspec.tags = "ravendb, indexes, raven, index"
end
#----------------------------------
# NuGet (Pack)
#----------------------------------
nugetpack :core_pack => [:test, :core_net40_output, :core_nuspec] do |nuget|
nuget.command = Commands[:nuget]
nuget.nuspec = File.join(Folders[:nuget_build], "#{Projects[:hircine_core][:id]}-v#{env_buildversion}(#{@env_buildconfigname}).nuspec")
nuget.base_folder = Folders[:hircine_core_nuspec][:root]
nuget.output = Folders[:nuget_build]
end
nugetpack :app_pack => [:test, :app_net40_output, :app_nuspec] do |nuget|
nuget.command = Commands[:nuget]
nuget.nuspec = File.join(Folders[:nuget_build], "#{Projects[:hircine][:id]}-v#{env_buildversion}(#{@env_buildconfigname}).nuspec")
nuget.base_folder = Folders[:hircine_nuspec][:root]
nuget.output = Folders[:nuget_build]
end
#----------------------------------
# NuGet (Push)
#----------------------------------
desc "Publishes a new verison of the Hircine package to NuGet"
nugetpush :push_app => [:pack] do |nuget|
nuget.command = Commands[:nuget]
nuget.package = File.join(Folders[:root], Folders[:nuget_build], "#{Projects[:hircine][:id]}.#{env_buildversion}.nupkg").gsub("/","\\")
end
desc "Publishes a new verison of the Hircine.Core package to NuGet"
nugetpush :push_core => [:pack] do |nuget|
nuget.command = Commands[:nuget]
nuget.package = File.join(Folders[:root], Folders[:nuget_build], "#{Projects[:hircine_core][:id]}.#{env_buildversion}.nupkg").gsub("/","\\")
end