Skip to content

Commit

Permalink
Updated albacore and rakefile
Browse files Browse the repository at this point in the history
  • Loading branch information
jweber committed Aug 22, 2015
1 parent f3cae8f commit d09b70c
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 78 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
source 'https://rubygems.org'
gem 'rake'
gem 'rubyzip', '0.9.9'
gem 'albacore'
gem 'semver'
gem 'semver2'
gem 'rubyzip'
26 changes: 19 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
GEM
remote: https://rubygems.org/
specs:
albacore (0.3.5)
rubyzip
rake (10.1.1)
rubyzip (0.9.9)
semver (1.0.1)
albacore (2.5.3)
map (~> 6.5)
nokogiri (~> 1.5)
rake (~> 10)
semver2 (~> 3.4)
map (6.5.5)
mini_portile (0.6.2)
nokogiri (1.6.6.2-x64-mingw32)
mini_portile (~> 0.6.0)
nokogiri (1.6.6.2-x86-mingw32)
mini_portile (~> 0.6.0)
rake (10.4.2)
rubyzip (1.1.7)
semver2 (3.4.2)

PLATFORMS
x64-mingw32
Expand All @@ -14,5 +23,8 @@ PLATFORMS
DEPENDENCIES
albacore
rake
rubyzip (= 0.9.9)
semver
rubyzip
semver2

BUNDLED WITH
1.10.6
119 changes: 57 additions & 62 deletions rakefile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'semver'

CLR_TOOLS_VERSION = 'v4.0.30319'
ARTIFACTS_PATH = "build"
ARTIFACTS_PATH = File.expand_path("./build")
PROJECT_NAME = "WcfClientProxyGenerator"

$config = ENV['config'] || 'Debug'
Expand All @@ -12,18 +12,17 @@
task :default => :compile

desc 'Generate the VersionInfo.cs class'
assemblyinfo :version => [:versioning] do |asm|
asmver :version => [:versioning] do |a|
git_data = commit_data()
revision_hash = git_data[0]
revision_date = git_data[1]

asm.version = FORMAL_VERSION
asm.file_version = FORMAL_VERSION
asm.product_name = PROJECT_NAME
asm.description = "Git commit hash: #{revision_hash} - #{revision_date}"
asm.custom_attributes :AssemblyInformationalVersion => "#{BUILD_VERSION}"
asm.output_file = "source/VersionInfo.cs"
asm.namespaces 'System', 'System.Reflection'

a.file_path = "source/VersionInfo.cs"
a.attributes assembly_version: FORMAL_VERSION,
assembly_file_version: FORMAL_VERSION,
assembly_product: PROJECT_NAME,
assembly_description: "Git comit hash: #{revision_hash} - #{revision_date}",
assembly_informational_version: BUILD_VERSION
end

desc 'Compile the project'
Expand All @@ -35,23 +34,26 @@
task :all => [:net45] do
end

msbuild :net45 => ["nuget:restore", "version"] do |msb|
msb.properties :configuration => $config, :Framework => 'NET45'
msb.targets [:clean, :build]
msb.solution = "source/#{PROJECT_NAME}.sln"
build :net45 => ["nuget:restore", "version"] do |b|
b.prop 'configuration', $config
b.prop 'framework', 'NET45'
b.target = ['clean', 'rebuild']
b.file = "source/#{PROJECT_NAME}.sln"
end
end

desc 'Run tests'
nunit :test => :compile do |nunit|
test_runner :test => :compile do |tests|
include FileUtils
mkpath ARTIFACTS_PATH unless Dir.exists? ARTIFACTS_PATH

nunit.command = nunit_path
nunit.assemblies "source/#{PROJECT_NAME}.Tests/bin/#{$config}/#{PROJECT_NAME}.Tests.dll"
#nunit.options '/xml=nunit-console-output.xml'

nunit.options = "/framework=#{CLR_TOOLS_VERSION}", '/noshadow', '/nologo', '/labels', "\"/xml=#{File.join(ARTIFACTS_PATH, "nunit-test-results.xml")}\""

tests.files = FileList["source/#{PROJECT_NAME}.Tests/bin/#{$config}/#{PROJECT_NAME}.Tests.dll"]
tests.exe = nunit_path
tests.add_parameter "/framework=#{CLR_TOOLS_VERSION}"
tests.add_parameter "/noshadow"
tests.add_parameter "/nologo"
tests.add_parameter "/labels"
tests.add_parameter "/xml=#{File.join(ARTIFACTS_PATH, "nunit-test-results.xml")}"
end

desc 'Builds release package'
Expand All @@ -76,50 +78,38 @@

namespace :nuget do
desc 'Restores nuget packages'
task :restore do
solution_path = "source/#{PROJECT_NAME}.sln"

sh "#{nuget_path} restore #{solution_path} -verbosity normal"
nugets_restore :restore do |p|
p.out = "source/packages"
p.exe = nuget_path
end

desc 'Creates the nuspec file'
nuspec :spec => :version do |nuspec|
mkpath ARTIFACTS_PATH unless Dir.exists? ARTIFACTS_PATH
nugets_pack :pack => ['build:all'] do |p|
p.configuration = 'Release'
p.target = 'net45'
p.files = FileList['source/WcfClientProxyGenerator/WcfClientProxyGenerator.csproj']
p.exe = nuget_path
p.out = 'build'

nuspec.id = PROJECT_NAME
nuspec.version = ENV['NUGET_VERSION']
nuspec.authors = "j.weber"
nuspec.description = "Utility to generate fault tolerant and highly configurable client proxies for WCF services based on WCF ServiceContracts. Supports making async calls using non async-ready ServiceContracts."
nuspec.projectUrl = "https://github.com/jweber/WcfClientProxyGenerator"
nuspec.title = PROJECT_NAME
nuspec.tags = "wcf service client proxy dynamic async"
nuspec.file "..\\source\\#{PROJECT_NAME}\\bin\\#{$config}\\#{PROJECT_NAME}.dll", 'lib\net45'
nuspec.file "..\\source\\#{PROJECT_NAME}\\bin\\#{$config}\\#{PROJECT_NAME}.xml", 'lib\net45'

nuspec.working_directory = 'build'
nuspec.output_file = "#{PROJECT_NAME}.nuspec"
p.with_metadata do |m|
m.id = PROJECT_NAME
m.version = ENV['NUGET_VERSION']
m.authors = "j.weber"
m.description = "Utility to generate fault tolerant and highly configurable client proxies for WCF services based on WCF ServiceContracts. Supports making async calls using non async-ready ServiceContracts."
m.project_url = "https://github.com/jweber/WcfClientProxyGenerator"
m.title = PROJECT_NAME
m.tags = "wcf service client proxy dynamic async"
end
end

desc 'Build nupkg'
nugetpack :pack => ['build:all', :spec] do |nuget|
nuget.command = nuget_path
nuget.nuspec = "build\\#{PROJECT_NAME}.nuspec"
nuget.base_folder = 'build'
nuget.output = 'build'
end

nugetpush :push => [:pack] do |nuget|

task :push => [:pack] do
raise "No NuGet API key was defined" unless $nuget_api_key

nuget.command = nuget_path
nuget.package = "build\\#{PROJECT_NAME}.#{ENV['NUGET_VERSION']}.nupkg"
nuget.create_only = false
nuget.apikey = $nuget_api_key
nuget.create_only = false

nuget_package = "build\\#{PROJECT_NAME}.#{ENV['NUGET_VERSION']}.nupkg"
sh "#{nuget_path} push #{nuget_package} #{$nuget_api_key} -NonInteractive"
end
end

desc 'Builds version environment variables'
task :versioning do
ver = SemVer.find
#revision = (ENV['BUILD_NUMBER'] || ver.patch).to_i
Expand All @@ -146,11 +136,16 @@ def nuget_path()
end

def zip_directory(assemble_path, output_path)
zip = ZipDirectory.new
zip.directories_to_zip assemble_path
zip.output_path = File.dirname(output_path)
zip.output_file = File.basename(output_path)
zip.execute
require 'albacore/tools/zippy'

zf = Zippy.new assemble_path, output_path
zf.write

# zip = ZipDirectory.new
# zip.directories_to_zip assemble_path
# zip.output_path = File.dirname(output_path)
# zip.output_file = File.basename(output_path)
# zip.execute
end

def commit_data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,12 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Framework)' == 'NET45'">
<PropertyGroup>
<DefineConstants>NET45</DefineConstants>
<OutputPath>bin\$(Configuration)</OutputPath>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<DocumentationFile>bin\$(Configuration)\WcfClientProxyGenerator.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Framework)' == 'NET40'">
<DefineConstants>NET40</DefineConstants>
<OutputPath>bin\$(Configuration)\net-4.0</OutputPath>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<DocumentationFile>bin\$(Configuration)\net-4.0\WcfClientProxyGenerator.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Configuration" />
Expand Down

0 comments on commit d09b70c

Please sign in to comment.