1 Star 1 Fork 0

芝麻科技 / Autofac

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
build.ps1 2.01 KB
一键复制 编辑 原始数据 按行查看 历史
Travis Illig 提交于 2018-05-09 11:01 . Fixed benchmark artifact copy.
########################
# THE BUILD!
########################
param (
[switch]$Bench = $false
)
Push-Location $PSScriptRoot
Import-Module $PSScriptRoot\Build\Autofac.Build.psd1 -Force
$artifactsPath = "$PSScriptRoot\artifacts"
$packagesPath = "$artifactsPath\packages"
$sdkVersion = (Get-Content "$PSScriptRoot\global.json" | ConvertFrom-Json).sdk.version
# Clean up artifacts folder
if (Test-Path $artifactsPath) {
Write-Message "Cleaning $artifactsPath folder"
Remove-Item $artifactsPath -Force -Recurse
}
# Install dotnet CLI
Write-Message "Installing .NET Core SDK version $sdkVersion"
Install-DotNetCli -Version $sdkVersion
# Write out dotnet information
& dotnet --info
# Set version suffix
$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL];
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
$versionSuffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "master" -and $revision -ne "local"]
Write-Message "Package version suffix is '$versionSuffix'"
# Package restore
Write-Message "Restoring packages"
Get-DotNetProjectDirectory -RootPath $PSScriptRoot | Restore-DependencyPackages
# Build/package
Write-Message "Building projects and packages"
Get-DotNetProjectDirectory -RootPath $PSScriptRoot\src | Invoke-DotNetPack -PackagesPath $packagesPath -VersionSuffix $versionSuffix
# Test
Write-Message "Executing unit tests"
Get-DotNetProjectDirectory -RootPath $PSScriptRoot\test | Where-Object { $_ -inotlike "*Autofac.Test.Scenarios.ScannedAssembly" } | Invoke-Test
# Benchmark
if ($Bench) {
Get-DotNetProjectDirectory -RootPath $PSScriptRoot\bench | Invoke-Test
Get-ChildItem -Path $PSScriptRoot\bench -Filter "BenchmarkDotNet.Artifacts" -Directory -Recurse | Move-Item -Destination "$PSScriptRoot\artifacts\benchmarks"
}
# Finished
Write-Message "Build finished"
Pop-Location
1
https://gitee.com/sesametech-group/Autofac.git
git@gitee.com:sesametech-group/Autofac.git
sesametech-group
Autofac
Autofac
master

搜索帮助