Permalink
Browse files

Creating NuGet packages as part of the build

Changing the build to use semantic versioning
1 parent 0c8ba33 commit 75457834ed67c2f042c7e3e2a05d87da04b5aa28 @jbogard jbogard committed Jul 3, 2011
Showing with 66 additions and 322 deletions.
  1. +7 −0 LICENSE.txt
  2. +54 −1 default.ps1
  3. +0 −59 src/AutoMapper.3.5.sln
  4. +5 −5 src/CommonAssemblyInfo.cs
  5. +0 −257 template.ps1
  6. BIN tools/NuGet.exe
View
7 LICENSE.txt
@@ -0,0 +1,7 @@
+Copyright (c) 2010 Jimmy Bogard
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
55 default.ps1
@@ -1,4 +1,5 @@
$framework = '4.0'
+$version = '2.0.0'
properties {
$base_dir = resolve-path .
@@ -9,7 +10,7 @@ properties {
$test_dir = "$build_dir\test"
$result_dir = "$build_dir\results"
$lib_dir = "$base_dir\lib"
- $buildNumber = if ($env:build_number -ne $NULL) { $env:build_number } else { '2.0.9999.0' }
+ $buildNumber = if ($env:build_number -ne $NULL) { $version + '.' + $env:build_number } else { $version + '.0' }
$config = "debug"
$framework_dir = Get-FrameworkDirectory
}
@@ -52,6 +53,13 @@ task dist {
copy_files "$build_dir\$config\AutoMapper" "$build_dir\dist" $exclude
zip_directory "$build_dir\dist" "$dist_dir\AutoMapper-unmerged.zip"
copy-item "$build_dir\dist-merged\AutoMapper.dll" "$dist_dir"
+ create-merged-nuspec "$buildNumber"
+ create-unmerged-nuspec "$buildNumber"
+
+ exec { & $tools_dir\NuGet.exe pack $build_dir\AutoMapper.nuspec }
+ exec { & $tools_dir\NuGet.exe pack $build_dir\AutoMapper.UnMerged.nuspec }
+
+ move-item "*.nupkg" "$dist_dir"
}
# -------------------------------------------------------------------------------------------------------------
@@ -122,4 +130,49 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCompanyAttribute("""")]
[assembly: AssemblyConfigurationAttribute(""release"")]
[assembly: AssemblyInformationalVersionAttribute(""$version"")]" | out-file $filename -encoding "ASCII"
+}
+
+function global:create-merged-nuspec()
+{
+ "<?xml version=""1.0""?>
+<package xmlns=""http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"">
+ <metadata>
+ <id>AutoMapper</id>
+ <version>$version</version>
+ <authors>Jimmy Bogard</authors>
+ <owners>Jimmy Bogard</owners>
+ <licenseUrl>http://automapper.codeplex.com/license</licenseUrl>
+ <projectUrl>http://automapper.codeplex.com</projectUrl>
+ <iconUrl>https://s3.amazonaws.com/automapper/icon.png</iconUrl>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <description>A convention-based object-object mapper. AutoMapper uses a fluent configuration API to define an object-object mapping strategy. AutoMapper uses a convention-based matching algorithm to match up source to destination values. Currently, AutoMapper is geared towards model projection scenarios to flatten complex object models to DTOs and other simple objects, whose design is better suited for serialization, communication, messaging, or simply an anti-corruption layer between the domain and application layer.</description>
+ </metadata>
+ <files>
+ <file src=""$build_dir\dist-merged\AutoMapper.dll"" target=""lib"" />
+ </files>
+</package>" | out-file $build_dir\AutoMapper.nuspec -encoding "ASCII"
+}
+
+function global:create-unmerged-nuspec()
+{
+ "<?xml version=""1.0""?>
+<package xmlns=""http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"">
+ <metadata>
+ <id>AutoMapper.UnMerged</id>
+ <version>$version</version>
+ <authors>Jimmy Bogard</authors>
+ <owners>Jimmy Bogard</owners>
+ <licenseUrl>http://automapper.codeplex.com/license</licenseUrl>
+ <projectUrl>http://automapper.codeplex.com</projectUrl>
+ <iconUrl>https://s3.amazonaws.com/automapper/icon.png</iconUrl>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <description>A convention-based object-object mapper. AutoMapper uses a fluent configuration API to define an object-object mapping strategy. AutoMapper uses a convention-based matching algorithm to match up source to destination values. Currently, AutoMapper is geared towards model projection scenarios to flatten complex object models to DTOs and other simple objects, whose design is better suited for serialization, communication, messaging, or simply an anti-corruption layer between the domain and application layer.</description>
+ <dependencies>
+ <dependency id=""Castle.Core"" version=""2.5.1"" />
+ </dependencies>
+ </metadata>
+ <files>
+ <file src=""$build_dir\dist\AutoMapper.dll"" target=""lib"" />
+ </files>
+</package>" | out-file $build_dir\AutoMapper.UnMerged.nuspec -encoding "ASCII"
}
View
59 src/AutoMapper.3.5.sln
@@ -1,59 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "UnitTests\UnitTests.csproj", "{002075C5-6517-4794-BC99-9B17B9E884E7}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0691ABF2-B3C7-43BF-9862-2D8D1299CE58}"
- ProjectSection(SolutionItems) = preProject
- ..\.gitignore = ..\.gitignore
- ..\AutoMapper.build = ..\AutoMapper.build
- ..\AutoMapper.exclude = ..\AutoMapper.exclude
- ..\default.ps1 = ..\default.ps1
- ..\go.bat = ..\go.bat
- ..\template.ps1 = ..\template.ps1
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoMapper", "AutoMapper\AutoMapper.csproj", "{DDF551F9-B27D-4283-BFA0-E7068E05967D}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoMapperSamples", "AutoMapperSamples\AutoMapperSamples.csproj", "{277C689D-B1C1-43EA-B20D-C1155C4B2EA7}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Benchmark", "Benchmark\Benchmark.csproj", "{B8051389-CB47-46FB-B234-9D49506704AA}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- AutomatedDebug|Any CPU = AutomatedDebug|Any CPU
- AutomatedRelease|Any CPU = AutomatedRelease|Any CPU
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {002075C5-6517-4794-BC99-9B17B9E884E7}.AutomatedDebug|Any CPU.ActiveCfg = AutomatedDebug|Any CPU
- {002075C5-6517-4794-BC99-9B17B9E884E7}.AutomatedDebug|Any CPU.Build.0 = AutomatedDebug|Any CPU
- {002075C5-6517-4794-BC99-9B17B9E884E7}.AutomatedRelease|Any CPU.ActiveCfg = AutomatedRelease|Any CPU
- {002075C5-6517-4794-BC99-9B17B9E884E7}.AutomatedRelease|Any CPU.Build.0 = AutomatedRelease|Any CPU
- {002075C5-6517-4794-BC99-9B17B9E884E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {002075C5-6517-4794-BC99-9B17B9E884E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {002075C5-6517-4794-BC99-9B17B9E884E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {002075C5-6517-4794-BC99-9B17B9E884E7}.Release|Any CPU.Build.0 = Release|Any CPU
- {DDF551F9-B27D-4283-BFA0-E7068E05967D}.AutomatedDebug|Any CPU.ActiveCfg = AutomatedDebug|Any CPU
- {DDF551F9-B27D-4283-BFA0-E7068E05967D}.AutomatedDebug|Any CPU.Build.0 = AutomatedDebug|Any CPU
- {DDF551F9-B27D-4283-BFA0-E7068E05967D}.AutomatedRelease|Any CPU.ActiveCfg = AutomatedRelease|Any CPU
- {DDF551F9-B27D-4283-BFA0-E7068E05967D}.AutomatedRelease|Any CPU.Build.0 = AutomatedRelease|Any CPU
- {DDF551F9-B27D-4283-BFA0-E7068E05967D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {DDF551F9-B27D-4283-BFA0-E7068E05967D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {DDF551F9-B27D-4283-BFA0-E7068E05967D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {DDF551F9-B27D-4283-BFA0-E7068E05967D}.Release|Any CPU.Build.0 = Release|Any CPU
- {277C689D-B1C1-43EA-B20D-C1155C4B2EA7}.AutomatedDebug|Any CPU.ActiveCfg = Debug|Any CPU
- {277C689D-B1C1-43EA-B20D-C1155C4B2EA7}.AutomatedRelease|Any CPU.ActiveCfg = Release|Any CPU
- {277C689D-B1C1-43EA-B20D-C1155C4B2EA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {277C689D-B1C1-43EA-B20D-C1155C4B2EA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {277C689D-B1C1-43EA-B20D-C1155C4B2EA7}.Release|Any CPU.Build.0 = Release|Any CPU
- {B8051389-CB47-46FB-B234-9D49506704AA}.AutomatedDebug|Any CPU.ActiveCfg = Debug|Any CPU
- {B8051389-CB47-46FB-B234-9D49506704AA}.AutomatedRelease|Any CPU.ActiveCfg = Release|Any CPU
- {B8051389-CB47-46FB-B234-9D49506704AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B8051389-CB47-46FB-B234-9D49506704AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B8051389-CB47-46FB-B234-9D49506704AA}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
View
10 src/CommonAssemblyInfo.cs
@@ -13,11 +13,11 @@
//------------------------------------------------------------------------------
[assembly: ComVisibleAttribute(false)]
-[assembly: AssemblyVersionAttribute("2.0.9999.0")]
-[assembly: AssemblyFileVersionAttribute("2.0.9999.0")]
-[assembly: AssemblyCopyrightAttribute("Copyright Jimmy Bogard 2008-2010")]
+[assembly: AssemblyVersionAttribute("2.0.0.0")]
+[assembly: AssemblyFileVersionAttribute("2.0.0.0")]
+[assembly: AssemblyCopyrightAttribute("Copyright Jimmy Bogard 2008-2011")]
[assembly: AssemblyProductAttribute("AutoMapper")]
-[assembly: AssemblyTrademarkAttribute("8aa331f7b0a98312ce7630a40ffad732db8771ed")]
+[assembly: AssemblyTrademarkAttribute("f56f10a7a68ca2b8e55de85a11dfc40d19cec928")]
[assembly: AssemblyCompanyAttribute("")]
[assembly: AssemblyConfigurationAttribute("release")]
-[assembly: AssemblyInformationalVersionAttribute("2.0.9999.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.0.0")]
View
257 template.ps1
@@ -1,257 +0,0 @@
-properties {
- $projectName = "CodeCampServer"
- $base_dir = resolve-path .
- $build_dir = "$base_dir\build"
- $package_dir = "$build_dir\package"
- $package_file = "$base_dir\latestVersion\" + $projectName +"Package.exe"
- $source_dir = "$base_dir\src\"
- $test_dir = "$build_dir\test\"
- $result_dir = "$build_dir\results\"
- $buildNumber = 99
-
- $databaseName = $projectName
- $databaseServer = ".\SqlExpress"
- $databaseScripts = "$source_dir\Database"
-}
-
-task default -depends Clean, CommonAssemblyInfo, Database, Compile
-task privateBuild -depends default, Test
-task integrationBuild -depends default, Test,Inspection, Package
-
-<#
-Poke HIbernate Config
-Create Database Migration
- #>
-task CreateSolutionTemplate {
- $newsolution ="CcsArchitecture"
- $templatedir = "..\_CcsTemplate"
-
- .\lib\solutionfactory\SolutionFactory-console.exe export $source_dir$projectName.sln $templatedir
- delete_directory "$templatedir\template\build"
- delete_directory "$templatedir\template\src\_ReSharper.CodeCampServer"
- delete_file "$templatedir\template\latestversion\safesolutionnamepackage.exe"
- delete_file "$templatedir\template\readme.txt"
-
- copy_files ".\lib\solutionfactory\" "$templatedir\"
- write "Creating $package_dir"
- create_directory $package_dir
- zip_directory $templatedir\template\ $package_dir\VisualStudioTemplate.exe
-}
-
-task Database {
- exec { .\lib\tarantino\DatabaseDeployer.exe Rebuild $databaseServer $databaseName $databaseScripts}
-}
-
-task CommonAssemblyInfo {
- $version = "1.0.$buildNumber.0"
- create-commonAssemblyInfo "$version" $projectName "$source_dir\CommonAssemblyInfo.cs"
-}
-
-task Test {
- copy_all_assemblies_for_test $test_dir
- run_nunit "$projectName.UnitTests.dll"
- run_nunit "$projectName.IntegrationTests.dll"
- load_test_data "$projectName.IntegrationTests.dll"
-}
-
-task Compile -depends Clean {
- exec { msbuild /t:build $source_dir$projectName.sln }
-}
-
-task Clean {
- delete_file $package_file
- delete_directory $build_dir
- create_directory $test_dir
- create_directory $result_dir
- exec { msbuild /t:clean $source_dir\$projectName.sln }
-}
-
-task TestWithCoverage {
- copy_all_assemblies_for_test $test_dir
- run_nunit_with_coverage "$projectName.UnitTests.dll"
- run_nunit_with_coverage "$projectName.IntegrationTests.dll"
-}
-
-task Inspection {
- run_fxcop
- run_source_monitor
-}
-
-task Package {
- delete_directory $package_dir
- copy_website_files "$source_dir\UI" "$package_dir\website"
- copy_files "$source_dir\Database" "$package_dir\Database"
- copy_files "$base_dir\lib\tarantino" "$source_dir\Database\Tools" @("*.pdb")
- copy_all_assemblies_for_test "$package_dir\Tests"
- copy_files "$base_dir\lib\cassini" "$package_dir\tests\tools\cassini"
- copy_files "$base_dir\lib\nunit" "$package_dir\tests\tools\nunit"
- copy_files "$base_dir\lib\gallio" "$package_dir\tests\tools\gallio"
- copy_files "$base_dir\lib\nant" "$package_dir\nant" @( '*.pdb','*.xml')
- copy_files "$base_dir\deployment" "$package_dir"
-
- $agents_dir = "$package_dir\agents"
- copy_files "$base_dir\lib\tinoBatchJobs" $agents_dir
- copy_files "$source_dir\Ui\bin" $agents_dir
- Copy_and_flatten $source_dir *.config $agents_dir
-
- zip_directory $package_dir $package_file
-}
-
-# -------------------------------------------------------------------------------------------------------------
-# generalized functions
-# --------------------------------------------------------------------------------------------------------------
-function global:zip_directory($directory,$file)
-{
- delete_file $file
- cd $directory
- &"$base_dir\lib\7zip\7za.exe" a -mx=9 -r -sfx $file *.*
- cd $base_dir
-}
-
-function global:delete_file($file)
-{
- if($file) {
- remove-item $file -force -ErrorAction SilentlyContinue | out-null}
-}
-
-function global:run_fxcop
-{
- & .\lib\FxCop\FxCopCmd.exe /out:$result_dir"FxCopy.xml" /file:$test_dir$projectname".*.dll" /quiet /d:$test_dir /c /summary | out-file $result_dir"fxcop.log"
-}
-function global:run_source_monitor
-{
-$command = $result_dir + "command.xml"
-
-"<?xml version=""1.0"" encoding=""UTF-8"" ?>
-<sourcemonitor_commands>
- <write_log>true</write_log>
- <command>
- <project_file>build\results\sm_project.smp</project_file>
- <project_language>CSharp</project_language>
- <source_directory>src</source_directory>
- <include_subdirectories>true</include_subdirectories>
- <checkpoint_name>0</checkpoint_name>
- <export>
- <export_file>build\results\sm_summary.xml</export_file>
- <export_type>1</export_type>
- </export>
- </command>
- <command>
- <project_file>build\results\sm_project.smp</project_file>
- <checkpoint_name>0</checkpoint_name>
- <export>
- <export_file>build\results\sm_details.xml</export_file>
- <export_type>2</export_type>
- </export>
- </command>
-</sourcemonitor_commands>" | out-file $command -encoding "ASCII"
-
- .\lib\sourcemonitor\sourcemonitor.exe /C $command | out-null
- Convert-WithXslt -originalXmlFilePath $result_dir"sm_details.xml" -xslFilePath "lib\sourcemonitor\SourceMonitorSummaryGeneration.xsl" -outputFilePath $result_dir"sm_top15.xml"
-
-}
-
-
-function global:delete_directory($directory_name)
-{
- rd $directory_name -recurse -force -ErrorAction SilentlyContinue | out-null
-}
-
-function global:create_directory($directory_name)
-{
- mkdir $directory_name -ErrorAction SilentlyContinue | out-null
-}
-
-function global:run_nunit ($test_assembly)
-{
- exec { & lib\nunit\nunit-console-x86.exe $test_dir$test_assembly /nologo /nodots /xml=$result_dir$test_assembly.xml /exclude=DataLoader}
-}
-
-function global:load_test_data ($test_assembly)
-{
- exec { & lib\nunit\nunit-console-x86.exe $test_dir$test_assembly /nologo /nodots /include=DataLoader}
-}
-
-
-function global:run_nunit_with_coverage($test_assembly)
-{
- exec { .\lib\ncover\NCover.Console.exe $base_dir\lib\nunit\nunit-console.exe $test_dir$test_assembly /noshadow /nologo /nodots /xml=$result_dir$test_assembly.xml //x $result_dir"$test_assembly.Coverage.xml" //ias $projectName".Core;"$projectName".UI;"$projectName".Infrastructure;"$projectName".DependencyInjection" //w $test_dir //h $result_dir //reg}
-
-}
-
-function global:Copy_and_flatten ($source,$filter,$dest)
-{
- ls $source -filter $filter -r | cp -dest $dest
-}
-
-function global:copy_all_assemblies_for_test($destination){
- create_directory $destination
- Copy_and_flatten $source_dir *.dll $destination
- Copy_and_flatten $source_dir *.config $destination
- Copy_and_flatten $source_dir *.xml $destination
- Copy_and_flatten $source_dir *.pdb $destination
-}
-
-function global:copy_website_files($source,$destination){
- $exclude = @('*.user','*.dtd','*.tt','*.cs','*.csproj')
- copy_files $source $destination $exclude
-}
-
-function global:copy_files($source,$destination,$exclude=@()){
- create_directory $destination
- Get-ChildItem $source -Recurse -Exclude $exclude | Copy-Item -Destination {Join-Path $destination $_.FullName.Substring($source.length)}
-}
-
-function global:Convert-WithXslt($originalXmlFilePath, $xslFilePath, $outputFilePath)
-{
- ## Simplistic error handling
- $xslFilePath = resolve-path $xslFilePath
- if( -not (test-path $xslFilePath) ) { throw "Can't find the XSL file" }
- $originalXmlFilePath = resolve-path $originalXmlFilePath
- if( -not (test-path $originalXmlFilePath) ) { throw "Can't find the XML file" }
- #$outputFilePath = resolve-path $outputFilePath -ErrorAction SilentlyContinue
- if( -not (test-path (split-path $originalXmlFilePath)) ) { throw "Can't find the output folder" }
-
- ## Get an XSL Transform object (try for the new .Net 3.5 version first)
- $EAP = $ErrorActionPreference
- $ErrorActionPreference = "SilentlyContinue"
- $script:xslt = new-object system.xml.xsl.xslcompiledtransform
- trap [System.Management.Automation.PSArgumentException]
- { # no 3.5, use the slower 2.0 one
- $ErrorActionPreference = $EAP
- $script:xslt = new-object system.xml.xsl.xsltransform
- }
- $ErrorActionPreference = $EAP
-
- ## load xslt file
- $xslt.load( $xslFilePath )
-
- ## transform
- $xslt.Transform( $originalXmlFilePath, $outputFilePath )
-}
-
-function global:create-commonAssemblyInfo($version,$applicationName,$filename)
-{
- "using System;
- using System.Reflection;
- using System.Runtime.InteropServices;
-
- //------------------------------------------------------------------------------
- // <auto-generated>
- // This code was generated by a tool.
- // Runtime Version:2.0.50727.4927
- //
- // Changes to this file may cause incorrect behavior and will be lost if
- // the code is regenerated.
- // </auto-generated>
- //------------------------------------------------------------------------------
-
- [assembly: ComVisibleAttribute(false)]
- [assembly: AssemblyVersionAttribute(""$version"")]
- [assembly: AssemblyFileVersionAttribute(""$version"")]
- [assembly: AssemblyCopyrightAttribute(""Copyright 2010"")]
- [assembly: AssemblyProductAttribute(""$applicationName"")]
- [assembly: AssemblyCompanyAttribute("""")]
- [assembly: AssemblyConfigurationAttribute(""release"")]
- [assembly: AssemblyInformationalVersionAttribute(""$version"")]" | out-file $filename -encoding "ASCII"
-}
View
BIN tools/NuGet.exe
Binary file not shown.

0 comments on commit 7545783

Please sign in to comment.