@@ -10,7 +10,7 @@ properties {
1010
1111
1212task default - depends local
13- task local - depends init , compile, test
13+ task local - depends compile, test
1414task ci - depends clean , release, local, benchmark
1515
1616task clean {
@@ -28,16 +28,23 @@ task release {
2828}
2929
3030task compile - depends clean {
31- $version = if ($env: APPVEYOR_BUILD_NUMBER -ne $NULL ) { $env: APPVEYOR_BUILD_NUMBER } else { ' 0' }
32- $version = " {0:D5}" -f [convert ]::ToInt32($version , 10 )
31+
32+ $branch = @ { $true = $env: APPVEYOR_REPO_BRANCH ; $false = $ (git symbolic- ref -- short - q HEAD) }[$env: APPVEYOR_REPO_BRANCH -ne $NULL ];
33+ $revision = @ { $true = " {0:00000}" -f [convert ]::ToInt32(" 0" + $env: APPVEYOR_BUILD_NUMBER , 10 ); $false = " local" }[$env: APPVEYOR_BUILD_NUMBER -ne $NULL ];
34+ $suffix = @ { $true = " " ; $false = " $ ( $branch.Substring (0 , [math ]::Min(10 , $branch.Length ))) -$revision " }[$branch -eq " master" -and $revision -ne " local" ]
35+ $commitHash = $ (git rev- parse -- short HEAD)
36+ $buildSuffix = @ { $true = " $ ( $suffix ) -$ ( $commitHash ) " ; $false = " $ ( $branch ) -$ ( $commitHash ) " }[$suffix -ne " " ]
37+
38+ echo " build: Package version suffix is $suffix "
39+ echo " build: Build version suffix is $buildSuffix "
3340
3441 exec { .\src\.nuget\nuget.exe restore $source_dir \AutoMapper.sln }
3542
3643 exec { dotnet restore $source_dir \AutoMapper.sln }
3744
38- exec { dotnet build $source_dir \AutoMapper.sln - c $config - v q / nologo }
45+ exec { dotnet build $source_dir \AutoMapper.sln - c $config -- version - suffix = $buildSuffix - v q / nologo }
3946
40- exec { dotnet pack $source_dir \AutoMapper - c $config -- version- suffix $version }
47+ exec { dotnet pack $source_dir \AutoMapper - c $config -- include - symbols -- no - build -- version- suffix= $suffix }
4148}
4249
4350task benchmark {
@@ -57,39 +64,3 @@ task test {
5764 exec { & $testRunner $source_dir / UnitTests/ bin/ $config / AutoMapper.UnitTests.Net4.dll }
5865 exec { & $testRunner $source_dir / IntegrationTests.Net4/ bin/ $config / AutoMapper.IntegrationTests.Net4.dll }
5966}
60-
61- function Install-Dotnet
62- {
63- $dotnetcli = where - is(' dotnet' )
64-
65- if ($dotnetcli -eq $null )
66- {
67- $dotnetPath = " $pwd \.dotnet"
68- $dotnetCliVersion = if ($env: DOTNET_CLI_VERSION -eq $null ) { ' Latest' } else { $env: DOTNET_CLI_VERSION }
69- $dotnetInstallScriptUrl = ' https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/install.ps1'
70- $dotnetInstallScriptPath = ' .\scripts\obtain\install.ps1'
71-
72- md - Force " .\scripts\obtain\" | Out-Null
73- curl $dotnetInstallScriptUrl - OutFile $dotnetInstallScriptPath
74- & .\scripts\obtain\install.ps1 - Channel " preview" - version $dotnetCliVersion - InstallDir $dotnetPath - NoPath
75- $env: Path = " $dotnetPath ;$env: Path "
76- }
77- }
78-
79- function where-is ($command ) {
80- (ls env:\path).Value.split(' ;' ) | `
81- where { $_ } | `
82- % { [System.Environment ]::ExpandEnvironmentVariables($_ ) } | `
83- where { test-path $_ } |`
84- % { ls " $_ \*" - include * .bat, * .exe, * cmd } | `
85- % { $file = $_.Name ; `
86- if ($file -and ($file -eq $command -or `
87- $file -eq ($command + ' .exe' ) -or `
88- $file -eq ($command + ' .bat' ) -or `
89- $file -eq ($command + ' .cmd' ))) `
90- { `
91- $_.FullName `
92- } `
93- } | `
94- select - unique
95- }
0 commit comments