1
1
require 'fileutils'
2
2
require 'rexml/document'
3
+ require 'json'
3
4
require 'albacore'
4
5
5
- NH_VERSION = '4.x'
6
- NUSPEC_PATH = 'src/FluentNHibernate.nuspec'
7
- SLN_PATH = 'src/FluentNHibernate.sln'
8
-
9
- # Albacore.configure do |config|
10
- # config.log_level = :verbose
11
- # end
6
+ PROPS = 'src/CommonAssemblyInfo.cs'
7
+ SLN = 'src/FluentNHibernate.sln'
8
+ CONFIG = 'config.json'
12
9
13
10
module Platform
14
11
@@ -30,10 +27,21 @@ module Platform
30
27
sw + arg
31
28
end
32
29
30
+ def self.config
31
+ JSON.parse(File.read(CONFIG))
32
+ end
33
+
33
34
end
34
35
36
+ NH_VERSION = Platform.config['build']['nh_precompiler_switch']
37
+ NUSPEC = Platform.config['nuspec']['filename']
38
+
39
+ # Albacore.configure do |config|
40
+ # config.log_level = :verbose
41
+ # end
42
+
35
43
def get_version
36
- ENV['BUILD_NUMBER'] || '2.0.0.1'
44
+ ENV['BUILD_NUMBER'] || Platform.config['default_version_number']
37
45
end
38
46
39
47
task :default => ['ripple:restore', 'source:update_version', 'build:all']
58
66
namespace :source do
59
67
desc 'Update assembly info with latest version number'
60
68
assemblyinfo :update_version do |info|
61
- info.output_file = 'src/CommonAssemblyInfo.cs'
69
+ info.output_file = PROPS
62
70
63
71
commit_hash = `git log -1 --format="%H%"`
64
72
@@ -90,9 +98,9 @@ namespace :source do
90
98
WarningLevel: 0
91
99
}
92
100
msbuild.targets [:Clean, :Build]
93
- msbuild.solution = SLN_PATH
101
+ msbuild.solution = SLN
94
102
msbuild.verbosity = :minimal
95
- msbuild.parameters = ["/p:TargetFrameworkVersion=v4.0 "]
103
+ msbuild.parameters = ["/p:TargetFrameworkVersion=#{Platform.config['build']['msbuild_runtime']} "]
96
104
end
97
105
end
98
106
@@ -102,15 +110,15 @@ namespace :specs do
102
110
103
111
desc 'Run MSpec specs'
104
112
mspec :mspec do |mspec|
105
- mspec.command = ' src/packages/Machine.Specifications.0.5.15/tools/mspec-clr4.exe'
106
- mspec.assemblies 'src/FluentNHibernate.Specs/bin/Release/FluentNHibernate.Specs.dll'
113
+ mspec.command = " src/packages/Machine.Specifications.0.5.15/tools/mspec#{Platform.config['tests']['mspec_exec_suffix']}.exe"
114
+ mspec.assemblies = [ 'src/FluentNHibernate.Specs/bin/Release/FluentNHibernate.Specs.dll' ]
107
115
end
108
116
109
117
desc 'Run NUnit tests'
110
118
nunit :nunit do |nunit|
111
119
nunit.command = 'src/packages/NUnit.2.5.7.10213/Tools/nunit-console-x86.exe'
112
- nunit.assemblies 'src/FluentNHibernate.Testing/bin/Release/FluentNHibernate.Testing.dll'
113
- nunit.parameters = [ "/framework:net-4.0 " ]
120
+ nunit.assemblies = [ 'src/FluentNHibernate.Testing/bin/Release/FluentNHibernate.Testing.dll' ]
121
+ nunit.parameters = [ "/framework:#{Platform.config['tests']['nunit_framework_runtime']} " ]
114
122
end
115
123
end
116
124
@@ -131,7 +139,7 @@ namespace :docs do
131
139
desc 'Create API docs'
132
140
docu :build do |d|
133
141
d.command = 'tools/docu/docu.exe'
134
- d.assemblies 'build/FluentNHibernate.dll'
142
+ d.assemblies = [ 'build/FluentNHibernate.dll' ]
135
143
end
136
144
end
137
145
@@ -174,12 +182,14 @@ namespace :package do
174
182
end
175
183
176
184
task :nuspec do |nu|
177
- puts "Updating #{NUSPEC_PATH}"
178
- update_xml NUSPEC_PATH do |xml|
185
+ config = Platform.config['nuspec']
186
+
187
+ puts "Updating #{NUSPEC}"
188
+ update_xml NUSPEC do |xml|
179
189
# Override the version number in the nuspec file with the one from this rake file (set above)
180
190
xml.root.elements["metadata/version"].text = get_version
181
191
182
- xml.root.elements["metadata/dependencies/dependency[@id='NHibernate']"].attributes['version'] = '4.0'
192
+ xml.root.elements["metadata/dependencies/dependency[@id='NHibernate']"].attributes['version'] = config['nhibernate_version_interval']
183
193
184
194
xml.root.elements["metadata/authors"].text = "James Gregory and contributors"
185
195
xml.root.elements["metadata/owners"].text = "jagregory, chester89"
@@ -189,13 +199,13 @@ namespace :package do
189
199
xml.root.elements["metadata/projectUrl"].text = "http://fluentnhibernate.org"
190
200
xml.root.elements["metadata/tags"].text = "orm dal nhibernate conventions"
191
201
192
- xml.root.elements["files/file[contains(@src, 'bin\\Release\\FluentNHibernate.*')]"].attributes['target'] = ' lib\net40'
202
+ xml.root.elements["files/file[contains(@src, 'bin\\Release\\FluentNHibernate.*')]"].attributes['target'] = " lib\\#{config['binaries_folder']}"
193
203
end
194
204
end
195
205
196
206
nugetpack :nupack do |nu|
197
207
nu.command = 'tools/nuget/NuGet.exe'
198
- nu.nuspec = NUSPEC_PATH
208
+ nu.nuspec = NUSPEC
199
209
nu.base_folder = 'Release'
200
210
nu.output = 'dist'
201
211
end
226
236
227
237
task :sln do
228
238
Thread.new do
229
- system "devenv #{SLN_PATH }"
239
+ system "devenv #{SLN }"
230
240
end
231
241
end
0 commit comments