From d09b70cb76340e345891ea1d5c5981a6a3a3351c Mon Sep 17 00:00:00 2001 From: John Weber Date: Fri, 21 Aug 2015 22:15:58 -0700 Subject: [PATCH] Updated albacore and rakefile --- Gemfile | 4 +- Gemfile.lock | 26 ++-- rakefile.rb | 119 +++++++++--------- .../WcfClientProxyGenerator.csproj | 8 +- 4 files changed, 79 insertions(+), 78 deletions(-) diff --git a/Gemfile b/Gemfile index 6ad12b7..4819884 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,5 @@ source 'https://rubygems.org' gem 'rake' -gem 'rubyzip', '0.9.9' gem 'albacore' -gem 'semver' +gem 'semver2' +gem 'rubyzip' diff --git a/Gemfile.lock b/Gemfile.lock index c18648d..dc9ec79 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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 @@ -14,5 +23,8 @@ PLATFORMS DEPENDENCIES albacore rake - rubyzip (= 0.9.9) - semver + rubyzip + semver2 + +BUNDLED WITH + 1.10.6 diff --git a/rakefile.rb b/rakefile.rb index ebd9850..2460c5a 100644 --- a/rakefile.rb +++ b/rakefile.rb @@ -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' @@ -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' @@ -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' @@ -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 @@ -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 diff --git a/source/WcfClientProxyGenerator/WcfClientProxyGenerator.csproj b/source/WcfClientProxyGenerator/WcfClientProxyGenerator.csproj index 0291fcb..f96565d 100644 --- a/source/WcfClientProxyGenerator/WcfClientProxyGenerator.csproj +++ b/source/WcfClientProxyGenerator/WcfClientProxyGenerator.csproj @@ -31,18 +31,12 @@ prompt 4 - + NET45 bin\$(Configuration) v4.5 bin\$(Configuration)\WcfClientProxyGenerator.xml - - NET40 - bin\$(Configuration)\net-4.0 - v4.0 - bin\$(Configuration)\net-4.0\WcfClientProxyGenerator.xml -