Commit b1170c24 authored by Nick Craver's avatar Nick Craver

Move build to traversal

parent 577d2f98
<Project Sdk="Microsoft.Build.Traversal/2.0.24">
<ItemGroup>
<ProjectReference Include="*\*.csproj" />
</ItemGroup>
</Project>
\ No newline at end of file
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<GenerateDocumentationFile>false</GenerateDocumentationFile> <GenerateDocumentationFile>false</GenerateDocumentationFile>
<TargetFrameworks>net462;netcoreapp3.0</TargetFrameworks> <TargetFrameworks>net462;netcoreapp3.0</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Dapper\Dapper.csproj" /> <ProjectReference Include="..\Dapper\Dapper.csproj" />
......
...@@ -11,61 +11,33 @@ Write-Host " RunTests: $RunTests" ...@@ -11,61 +11,33 @@ Write-Host " RunTests: $RunTests"
Write-Host " dotnet --version:" (dotnet --version) Write-Host " dotnet --version:" (dotnet --version)
$packageOutputFolder = "$PSScriptRoot\.nupkgs" $packageOutputFolder = "$PSScriptRoot\.nupkgs"
$projectsToBuild =
'Dapper',
'Dapper.StrongName',
'Dapper.Contrib',
'Dapper.EntityFramework',
'Dapper.EntityFramework.StrongName',
'Dapper.Rainbow',
'Dapper.SqlBuilder'
$testsToRun =
'Dapper.Tests',
'Dapper.Tests.Contrib'
if ($PullRequestNumber) { if ($PullRequestNumber) {
Write-Host "Building for a pull request (#$PullRequestNumber), skipping packaging." -ForegroundColor Yellow Write-Host "Building for a pull request (#$PullRequestNumber), skipping packaging." -ForegroundColor Yellow
$CreatePackages = $false $CreatePackages = $false
} }
Write-Host "Restoring all projects..." -ForegroundColor "Magenta" Write-Host "Building all projects (Build.csproj traversal)..." -ForegroundColor "Magenta"
dotnet restore dotnet build ".\Build.csproj" -c Release /p:CI=true
Write-Host "Done restoring." -ForegroundColor "Green"
Write-Host "Building all projects..." -ForegroundColor "Magenta"
dotnet build -c Release --no-restore /p:CI=true
Write-Host "Done building." -ForegroundColor "Green" Write-Host "Done building." -ForegroundColor "Green"
if ($RunTests) { if ($RunTests) {
foreach ($project in $testsToRun) { Write-Host "Running tests: Build.csproj traversal (all frameworks)" -ForegroundColor "Magenta"
Write-Host "Running tests: $project (all frameworks)" -ForegroundColor "Magenta" dotnet test ".\Build.csproj" -c Release --no-build --logger trx
Push-Location ".\$project" if ($LastExitCode -ne 0) {
Write-Host "Error with tests, aborting build." -Foreground "Red"
dotnet test -c Release Exit 1
if ($LastExitCode -ne 0) {
Write-Host "Error with tests, aborting build." -Foreground "Red"
Pop-Location
Exit 1
}
Write-Host "Tests passed!" -ForegroundColor "Green"
Pop-Location
} }
Write-Host "Tests passed!" -ForegroundColor "Green"
} }
if ($CreatePackages) { if ($CreatePackages) {
mkdir -Force $packageOutputFolder | Out-Null New-Item -ItemType Directory -Path $packageOutputFolder -Force | Out-Null
Write-Host "Clearing existing $packageOutputFolder..." -NoNewline Write-Host "Clearing existing $packageOutputFolder..." -NoNewline
Get-ChildItem $packageOutputFolder | Remove-Item Get-ChildItem $packageOutputFolder | Remove-Item
Write-Host "done." -ForegroundColor "Green" Write-Host "done." -ForegroundColor "Green"
Write-Host "Building all packages" -ForegroundColor "Green" Write-Host "Building all packages" -ForegroundColor "Green"
dotnet pack ".\Build.csproj" --no-build -c Release /p:PackageOutputPath=$packageOutputFolder /p:CI=true
foreach ($project in $projectsToBuild) {
Write-Host "Packing $project (dotnet pack)..." -ForegroundColor "Magenta"
dotnet pack ".\$project\$project.csproj" --no-build -c Release /p:PackageOutputPath=$packageOutputFolder /p:NoPackageAnalysis=true /p:CI=true
Write-Host ""
}
} }
Write-Host "Build Complete." -ForegroundColor "Green" Write-Host "Build Complete." -ForegroundColor "Green"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment