Skip to content

Commit 0f142f1

Browse files
committed
cleaned up build script + deleted unnecessary files
1 parent 7a2c7bf commit 0f142f1

File tree

11 files changed

+147
-134
lines changed

11 files changed

+147
-134
lines changed

.gitignore

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
**/*.suo
22
**/*.user
33
**/*.sln*
4-
bin
5-
obj
64
_ReSharper*
7-
dist
8-
output
9-
build
105

116
*.DotSettings.user
127
*.csproj.user
13-
src/packages
14-
158
*.resharper.user
169
*.resharper
1710

@@ -23,7 +16,14 @@ src/packages
2316
*.ncrunchproject
2417
*.swp
2518
TestResult.xml
19+
Gemfile.lock
2620

27-
TestResult.xml
28-
build/
29-
*.nupkg
21+
src/packages
22+
bin
23+
obj
24+
dist
25+
output
26+
build
27+
*.nupkg
28+
logs/
29+
src/CommonAssemblyInfo.cs

.svn-authors

Lines changed: 0 additions & 11 deletions
This file was deleted.

FluentNHibernate.Net35.nuspec

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version='1.0'?>
2+
<package xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
3+
<metadata xmlns='http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd'>
4+
<id>FluentNHibernate.Net35</id>
5+
<version>1.4.1.0</version>
6+
<authors>James Gregory and contributors</authors>
7+
<owners>jagregory, chester89</owners>
8+
<licenseUrl>http://github.com/jagregory/fluent-nhibernate/raw/master/LICENSE.txt</licenseUrl>
9+
<projectUrl>http://fluentnhibernate.org</projectUrl>
10+
<dependencies>
11+
<dependency id='NHibernate' version='[3.3.1.4000,4.0)' />
12+
</dependencies>
13+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
14+
<description>Fluent, XML-less, compile safe, automated, convention-based mappings for NHibernate.</description>
15+
<summary>Fluent NHibernate provides a conventient way to configure NHibernate - no XML involved.</summary>
16+
<tags>orm dal nhibernate conventions</tags>
17+
<language>en-US</language>
18+
</metadata>
19+
<files>
20+
<file src='..\src\FluentNHibernate\bin\Release\FluentNHibernate.*' target='lib\net35' />
21+
</files>
22+
</package>

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
source 'https://rubygems.org'
22

3-
gem 'rake'
4-
gem 'albacore'
3+
source 'https://rubygems.org'
4+
gem 'albacore', '~>1.0.0.rc2'

RakeFile

Lines changed: 93 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
require 'fileutils'
2+
require 'rexml/document'
3+
require 'json'
24
require 'albacore'
3-
require './tools/albacore/nuspec_patch'
45

5-
NH_VERSION = '3.x'
6+
PROPS = 'src/CommonAssemblyInfo.cs'
7+
SLN = 'src/FluentNHibernate.sln'
8+
CONFIG = 'config.json'
69

710
module Platform
811

@@ -24,13 +27,24 @@ module Platform
2427
sw + arg
2528
end
2629

30+
def self.config
31+
JSON.parse(File.read(CONFIG))
32+
end
33+
2734
end
2835

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+
2943
def get_version
30-
ENV['BUILD_NUMBER'] || '1.3.0.0'
44+
ENV['BUILD_NUMBER'] || Platform.config['default_version_number']
3145
end
3246

33-
task :default => 'build:all'
47+
task :default => ['ripple:restore', 'source:update_version', 'build:all']
3448

3549
namespace :ci do
3650
task :run_ci_build => [
@@ -41,45 +55,52 @@ namespace :ci do
4155
end
4256

4357
namespace :ripple do
44-
ripple = Platform.runtime("buildsupport/ripple.exe")
45-
args = "restore"
46-
sh "#{ripple} #{args}"
58+
desc 'Restores NuGet package binaries'
59+
task :restore do |cmd|
60+
ripple = Platform.runtime("buildsupport/ripple.exe")
61+
args = "restore"
62+
sh "#{ripple} #{args}"
63+
end
4764
end
4865

4966
namespace :source do
5067
desc 'Update assembly info with latest version number'
51-
assemblyinfo :update_version do |asm|
52-
asm.output_file = 'src/CommonAssemblyInfo.cs'
68+
assemblyinfo :update_version do |info|
69+
info.output_file = PROPS
70+
71+
commit_hash = `git log -1 --format="%H%"`
5372

54-
asm.version = get_version
55-
asm.company_name = 'http://fluentnhibernate.org'
56-
asm.product_name = 'FluentNHibernate'
57-
asm.copyright = "Copyright 2008-#{Time.new.year} James Gregory and contributors (Paul Batum, Hudson Akridge et al). All rights reserved."
58-
asm.namespaces = ['System.Security']
59-
asm.custom_attributes :AllowPartiallyTrustedCallers => nil
73+
info.version = info.file_version = get_version
74+
info.company_name = 'http://fluentnhibernate.org'
75+
info.product_name = 'FluentNHibernate'
76+
info.description = commit_hash[0..(commit_hash.length - 3)]
77+
info.copyright = "Copyright 2008-#{Time.new.year} James Gregory and contributors (Paul Batum, Hudson Akridge et al). All rights reserved."
78+
info.namespaces = ['System.Security']
6079

61-
puts "The build number is #{asm.version}"
80+
puts "The new build number is #{info.version}"
6281
end
6382

6483
task :nhibernate_version, :nhibernate_version do |t,args|
6584
args.with_defaults :nhibernate_version => ENV['nhibernate_version'] || NH_VERSION
6685
end
6786

6887
desc 'Compile the source'
69-
msbuild :compile, [:nhibernate_version] => :nhibernate_version do |msb,args|
88+
msbuild :compile, [:nhibernate_version] => :nhibernate_version do |msbuild, args|
7089
args.with_defaults :nhibernate_version => ENV['nhibernate_version'] || NH_VERSION
7190

7291
nh_version_precompiler_switch = 'NH' + args.nhibernate_version.gsub('.', '')
7392

74-
puts nh_version_precompiler_switch
93+
puts 'Precompiler switch: ' + nh_version_precompiler_switch
7594

76-
msb.properties = {
95+
msbuild.properties = {
7796
configuration: :Release,
7897
DefineConstants: nh_version_precompiler_switch,
79-
WarningLevel: 0,
98+
WarningLevel: 0
8099
}
81-
msb.targets [:Clean, :Build]
82-
msb.solution = 'src/FluentNHibernate.sln'
100+
msbuild.targets [:Clean, :Build]
101+
msbuild.solution = SLN
102+
msbuild.verbosity = :minimal
103+
msbuild.parameters = ["/p:TargetFrameworkVersion=#{Platform.config['build']['msbuild_runtime']}"]
83104
end
84105
end
85106

@@ -89,14 +110,15 @@ namespace :specs do
89110

90111
desc 'Run MSpec specs'
91112
mspec :mspec do |mspec|
92-
mspec.command = 'src/packages/Machine.Specifications.0.5.15/tools/mspec.exe'
93-
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' ]
94115
end
95116

96117
desc 'Run NUnit tests'
97118
nunit :nunit do |nunit|
98119
nunit.command = 'src/packages/NUnit.2.5.7.10213/Tools/nunit-console-x86.exe'
99-
nunit.assemblies 'src/FluentNHibernate.Testing/bin/Release/FluentNHibernate.Testing.dll'
120+
nunit.assemblies = [ 'src/FluentNHibernate.Testing/bin/Release/FluentNHibernate.Testing.dll' ]
121+
nunit.parameters = [ "/framework:#{Platform.config['tests']['nunit_framework_runtime']}" ]
100122
end
101123
end
102124

@@ -117,7 +139,7 @@ namespace :docs do
117139
desc 'Create API docs'
118140
docu :build do |d|
119141
d.command = 'tools/docu/docu.exe'
120-
d.assemblies 'build/FluentNHibernate.dll'
142+
d.assemblies = [ 'build/FluentNHibernate.dll' ]
121143
end
122144
end
123145

@@ -159,39 +181,61 @@ namespace :package do
159181
zip.output_path = 'dist'
160182
end
161183

162-
nuspec do |nu|
163-
nu.id = 'FluentNHibernate'
164-
nu.version = get_version()
165-
nu.authors = 'James Gregory and contributors'
166-
nu.description = 'Fluent, XML-less, compile safe, automated, convention-based mappings for NHibernate.'
167-
nu.title = 'Fluent NHibernate'
168-
nu.language = 'en-US'
169-
nu.licenseUrl = 'http://github.com/jagregory/fluent-nhibernate/raw/master/LICENSE.txt'
170-
nu.projectUrl = 'http://fluentnhibernate.org'
171-
nu.dependency 'NHibernate', '[3.3.1.4000,4.0)'
172-
nu.working_directory = 'build'
173-
nu.output_file = 'fluentnhibernate.nuspec'
174-
nu.file 'FluentNHibernate.dll', 'lib'
175-
nu.file 'FluentNHibernate.xml', 'lib'
176-
nu.tags = 'orm dal nhibernate conventions'
177-
end
178-
179-
nugetpack do |nu|
184+
task :nuspec do |nu|
185+
config = Platform.config['nuspec']
186+
187+
puts "Updating #{NUSPEC}"
188+
update_xml NUSPEC do |xml|
189+
# Override the version number in the nuspec file with the one from this rake file (set above)
190+
xml.root.elements["metadata/version"].text = get_version
191+
192+
xml.root.elements["metadata/dependencies/dependency[@id='NHibernate']"].attributes['version'] = config['nhibernate_version_interval']
193+
194+
xml.root.elements["metadata/authors"].text = "James Gregory and contributors"
195+
xml.root.elements["metadata/owners"].text = "jagregory, chester89"
196+
xml.root.elements["metadata/language"].text = "en-US"
197+
xml.root.elements["metadata/description"].text = "Fluent, XML-less, compile safe, automated, convention-based mappings for NHibernate."
198+
xml.root.elements["metadata/licenseUrl"].text = "http://github.com/jagregory/fluent-nhibernate/raw/master/LICENSE.txt"
199+
xml.root.elements["metadata/projectUrl"].text = "http://fluentnhibernate.org"
200+
xml.root.elements["metadata/tags"].text = "orm dal nhibernate conventions"
201+
202+
xml.root.elements["files/file[contains(@src, 'bin\\Release\\FluentNHibernate.*')]"].attributes['target'] = "lib\\#{config['binaries_folder']}"
203+
end
204+
end
205+
206+
nugetpack :nupack do |nu|
180207
nu.command = 'tools/nuget/NuGet.exe'
181-
nu.nuspec = 'build/fluentnhibernate.nuspec'
182-
nu.base_folder = 'build'
208+
nu.nuspec = NUSPEC
209+
nu.base_folder = 'Release'
183210
nu.output = 'dist'
184211
end
185212

186213
desc 'Create nuget spec and package'
187-
task :nuget => [:nuspec, :nugetpack]
214+
task :nuget => [:nuspec, :nupack]
188215

189216
desc 'Package everything (src, bin, docs, nuget)'
190217
task :all => [:source, :binaries, :docs, :nuget]
191218
end
192219

220+
def update_xml(xml_path)
221+
#Open up the xml file
222+
xml_file = File.new(xml_path)
223+
xml = REXML::Document.new xml_file
224+
225+
#Allow caller to make the changes
226+
yield xml
227+
228+
xml_file.close
229+
230+
#Save the changes
231+
xml_file = File.open(xml_path, "w")
232+
formatter = REXML::Formatters::Default.new(5)
233+
formatter.write(xml, xml_file)
234+
xml_file.close
235+
end
236+
193237
task :sln do
194238
Thread.new do
195-
system "devenv src/FluentNHibernate.sln"
239+
system "devenv #{SLN}"
196240
end
197-
end
241+
end

config.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"framework_version": 3.5,
3+
"default_version_number": "1.4.1.0",
4+
"build":
5+
{
6+
"nh_precompiler_switch": "3.x",
7+
"msbuild_runtime": "v3.5"
8+
},
9+
"tests":
10+
{
11+
"nunit_framework_runtime": "net-3.5",
12+
"mspec_exec_suffix": ""
13+
},
14+
"nuspec":
15+
{
16+
"filename": "FluentNHibernate.Net35.nuspec",
17+
"nhibernate_version_interval": "[3.3.1.4000,4.0)",
18+
"binaries_folder": "net35"
19+
}
20+
}

src/CommonAssemblyInfo.cs

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/FluentNHibernate.Testing/FluentNHibernate.Testing.csproj

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,12 @@
77
<SchemaVersion>2.0</SchemaVersion>
88
<ProjectGuid>{F5DC3221-827E-4CB4-B61C-5F50EB4D32EA}</ProjectGuid>
99
<OutputType>Library</OutputType>
10-
<AppDesignerFolder>Properties</AppDesignerFolder>
1110
<RootNamespace>FluentNHibernate.Testing</RootNamespace>
1211
<AssemblyName>FluentNHibernate.Testing</AssemblyName>
1312
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
1413
<FileAlignment>512</FileAlignment>
1514
<SignAssembly>false</SignAssembly>
1615
<AssemblyOriginatorKeyFile>..\FluentKey.snk</AssemblyOriginatorKeyFile>
17-
<FileUpgradeFlags>
18-
</FileUpgradeFlags>
19-
<OldToolsVersion>3.5</OldToolsVersion>
20-
<UpgradeBackupLocation />
21-
<PublishUrl>publish\</PublishUrl>
22-
<Install>true</Install>
23-
<InstallFrom>Disk</InstallFrom>
24-
<UpdateEnabled>false</UpdateEnabled>
25-
<UpdateMode>Foreground</UpdateMode>
26-
<UpdateInterval>7</UpdateInterval>
27-
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
28-
<UpdatePeriodically>false</UpdatePeriodically>
29-
<UpdateRequired>false</UpdateRequired>
30-
<MapFileExtensions>true</MapFileExtensions>
31-
<ApplicationRevision>0</ApplicationRevision>
3216
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
3317
<IsWebBootstrapper>false</IsWebBootstrapper>
3418
<UseApplicationTrust>false</UseApplicationTrust>
@@ -416,12 +400,9 @@
416400
<Compile Include="Testing\Values\ReferencePropertySpecs.cs" />
417401
<Compile Include="Testing\Values\PropertySpecs.cs" />
418402
<Compile Include="Testing\Values\Entities.cs" />
419-
420403
<Compile Include="Utils\ReflectionHelperTests.cs" />
421404
<Compile Include="Testing\XmlWriterTestHelper.cs" />
422-
423405
<Compile Include="Utils\TypeReferenceEqualityTests.cs" />
424-
<Compile Include="Properties\AssemblyInfo.cs" />
425406
<Compile Include="Visitors\ComponentColumnPrefixVisitorSpecs.cs" />
426407
<Compile Include="Visitors\ComponentReferenceResolutionVisitorSpecs.cs" />
427408
<Compile Include="Xml\MappingXmlTestHelper.cs" />

src/FluentNHibernate.Testing/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)