diff --git a/.gitignore b/.gitignore index 5dd61f94..9f3b9ff4 100644 --- a/.gitignore +++ b/.gitignore @@ -287,3 +287,6 @@ __pycache__/ *.xsd.cs .DS_Store + +# ci.global.json is used in CI; local builds are unconstrained +global.json diff --git a/Build.ps1 b/Build.ps1 index 29f5ea0f..94ae7fcc 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -78,16 +78,32 @@ function Publish-Docs($version) if($LASTEXITCODE -ne 0) { throw "Build failed" } } +function Remove-GlobalJson +{ + if(Test-Path ./global.json) { rm ./global.json } +} + +function Create-GlobalJson +{ + # It's very important that SeqCli use the same .NET SDK version as its matching Seq version, to avoid + # container and installer bloat. But, highly-restrictive global.json files are annoying during development. So, + # we create a temporary global.json from ci.global.json to use during CI builds. + Remove-GlobalJson + cp ./ci.global.json global.json +} + Write-Output "Building version $version" $env:Path = "$pwd/.dotnetcli;$env:Path" Clean-Output Create-ArtifactDir +Create-GlobalJson Restore-Packages Publish-Archives($version) Publish-DotNetTool($version) Execute-Tests($version) Publish-Docs($version) +Remove-GlobalJson Pop-Location diff --git a/Setup.ps1 b/Setup.ps1 index e775d1f1..2cef90f3 100644 --- a/Setup.ps1 +++ b/Setup.ps1 @@ -1,6 +1,6 @@ $ErrorActionPreference = "Stop" -$RequiredDotnetVersion = $(cat ./global.json | convertfrom-json).sdk.version +$RequiredDotnetVersion = $(cat ./ci.global.json | convertfrom-json).sdk.version New-Item -ItemType Directory -Force "./build/" | Out-Null diff --git a/global.json b/ci.global.json similarity index 100% rename from global.json rename to ci.global.json diff --git a/seqcli.sln b/seqcli.sln index 6c6104c5..2bc38226 100644 --- a/seqcli.sln +++ b/seqcli.sln @@ -10,7 +10,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sln", "sln", "{2EA56595-519 .gitignore = .gitignore appveyor.yml = appveyor.yml Build.ps1 = Build.ps1 - global.json = global.json LICENSE = LICENSE README.md = README.md setup.sh = setup.sh @@ -18,6 +17,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sln", "sln", "{2EA56595-519 docker-publish.ps1 = docker-publish.ps1 Setup.ps1 = Setup.ps1 CONTRIBUTING.md = CONTRIBUTING.md + ci.global.json = ci.global.json EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{3587B633-0C03-4235-8903-6226900328F1}" diff --git a/setup.sh b/setup.sh index aefb1b48..8477bc42 100755 --- a/setup.sh +++ b/setup.sh @@ -7,7 +7,7 @@ set -o pipefail sudo apt-get update || true sudo apt-get install -y --no-install-recommends jq -RequiredDotnetVersion=$(jq -r '.sdk.version' global.json) +RequiredDotnetVersion=$(jq -r '.sdk.version' ci.global.json) curl https://dot.net/v1/dotnet-install.sh -sSfL --output dotnet-install.sh chmod +x dotnet-install.sh