Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 112 lines (96 sloc) 4.094 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
properties {
$base_dir = resolve-path .
$build_dir = "$base_dir\build"
$dist_dir = "$base_dir\release"
$source_dir = "$base_dir\src"
$tools_dir = "$base_dir\tools"
$test_dir = "$build_dir\test"
$result_dir = "$build_dir\results"
$buildNumber = 9999
$config = "debug"
}

task local -depends compile, test
task full -depends local, merge, dist
task ci -depends clean, commonAssemblyInfo, local, merge, dist

task clean {
delete_directory "$build_dir"
delete_directory "$dist_dir"
}

task compile -depends clean {
    exec { msbuild /t:Clean /t:Build /p:Configuration=Automated$config /v:q /nologo $source_dir\AutoMapper.sln }
}

task commonAssemblyInfo {
    $version = "2.0.$buildNumber.0"
    create-commonAssemblyInfo "$version" "$source_dir\CommonAssemblyInfo.cs"
}

task merge {
create_directory "$build_dir\merge"
exec { & $tools_dir\ILMerge\ilmerge.exe /v2 /log /out:"$build_dir\merge\AutoMapper.dll" /internalize:AutoMapper.exclude "$build_dir\$config\AutoMapper\AutoMapper.dll" "$build_dir\$config\AutoMapper\Castle.Core.dll" "$build_dir\$config\AutoMapper\Castle.DynamicProxy2.dll" /keyfile:"$source_dir\AutoMapper.snk" }
}

task test {
create_directory "$build_dir\results"
    exec { & $tools_dir\nunit\nunit-console-x86.exe $build_dir/$config/UnitTests/AutoMapper.UnitTests.dll /nologo /nodots /xml=$result_dir\AutoMapper.xml }
}

task dist {
create_directory $dist_dir
$exclude = @('*.pdb')
copy_files "$build_dir\merge" "$build_dir\dist-merged" $exclude
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"
}

# -------------------------------------------------------------------------------------------------------------
# generalized functions
# --------------------------------------------------------------------------------------------------------------
function global:zip_directory($directory, $file)
{
    delete_file $file
    cd $directory
    exec { & "$tools_dir\7-zip\7za.exe" a $file *.* }
    cd $base_dir
}

function global:delete_directory($directory_name)
{
  rd $directory_name -recurse -force -ErrorAction SilentlyContinue | out-null
}

function global:delete_file($file)
{
    if($file) {
        remove-item $file -force -ErrorAction SilentlyContinue | out-null}
}

function global:create_directory($directory_name)
{
  mkdir $directory_name -ErrorAction SilentlyContinue | out-null
}

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:run_nunit ($test_assembly)
{
    exec { & $tools_dir\nunit\nunit-console-x86.exe $test_dir$test_assembly /nologo /nodots /xml=$result_dir$test_assembly.xml }
}

function global:create-commonAssemblyInfo($version, $filename)
{
$date = Get-Date
    "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 Jimmy Bogard 2008-" + $date.Year + """)]
[assembly: AssemblyProductAttribute(""AutoMapper"")]
[assembly: AssemblyCompanyAttribute("""")]
[assembly: AssemblyConfigurationAttribute(""release"")]
[assembly: AssemblyInformationalVersionAttribute(""$version"")]" | out-file $filename -encoding "ASCII"
}
Something went wrong with that request. Please try again.