Skip to content

Commit 3e29875

Browse files
committed
Tweaked build scripts
1 parent 664e6eb commit 3e29875

5 files changed

Lines changed: 34 additions & 13 deletions

File tree

src/build.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,12 @@
22
set -e
33
cd `dirname $0`
44

5-
dotnet msbuild -v:Quiet -t:Restore -t:Build -p:Configuration=Release -p:Version=${1:-1.0-dev}
5+
# Find dotnet
6+
if command -v dotnet > /dev/null 2> /dev/null; then
7+
dotnet="dotnet"
8+
else
9+
dotnet="../0install.sh run --version 3.1..!3.2 https://apps.0install.net/dotnet/core-sdk.xml"
10+
fi
11+
12+
# Build
13+
$dotnet msbuild -v:Quiet -t:Restore -t:Build -p:Configuration=Release -p:Version=${1:-1.0.0-pre}

src/test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ else
99
dotnet="../0install.sh run --version 3.1..!3.2 https://apps.0install.net/dotnet/core-sdk.xml"
1010
fi
1111

12-
# Unit tests (without .NET Framework)
13-
$dotnet test --no-build --logger junit --configuration Release --framework netcoreapp3.1 UnitTests/UnitTests.csproj
12+
# Unit tests
13+
$dotnet test --no-build --logger junit --configuration Release UnitTests/UnitTests.csproj

template/MyServiceBroker.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="OpenServiceBroker.Server" Version="0.4.0" />
11+
<PackageReference Include="OpenServiceBroker.Server" Version="1.0-dev" />
1212
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.11" />
1313
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
1414
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="5.6.3" />

template/build.ps1

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
Param ([string]$Version = "0.1-dev")
1+
Param ($Version = "1.0-dev")
22
$ErrorActionPreference = "Stop"
33
pushd $PSScriptRoot
44

5+
function Run-DotNet {
6+
if (Get-Command dotnet -ErrorAction SilentlyContinue) {
7+
dotnet @args
8+
} else {
9+
..\0install.ps1 run --batch --version 3.1..!3.2 https://apps.0install.net/dotnet/core-sdk.xml @args
10+
}
11+
if ($LASTEXITCODE -ne 0) {throw "Exit Code: $LASTEXITCODE"}
12+
}
13+
514
# Keep template and library version in-sync
6-
dotnet add MyServiceBroker.csproj package OpenServiceBroker.Server --version $Version
7-
if ($LASTEXITCODE -ne 0) {throw "Exit Code: $LASTEXITCODE"}
8-
dotnet build MyServiceBroker.csproj
9-
if ($LASTEXITCODE -ne 0) {throw "Exit Code: $LASTEXITCODE"}
15+
Run-DotNet add MyServiceBroker.csproj package OpenServiceBroker.Server --version $Version
16+
Run-DotNet build MyServiceBroker.csproj
1017

1118
# Generate template NuGet package
12-
dotnet restore .template.csproj
13-
dotnet msbuild .template.csproj -v:Quiet -t:Pack -p:Configuration=Release -p:Version=$Version
14-
if ($LASTEXITCODE -ne 0) {throw "Exit Code: $LASTEXITCODE"}
19+
Run-DotNet restore .template.csproj
20+
Run-DotNet msbuild .template.csproj /v:Quiet /t:Pack /p:Configuration=Release /p:Version=$Version
1521

1622
popd

template/build.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
#!/bin/sh
1+
#!/usr/bin/env bash
22
set -e
33
cd `dirname $0`
44

5+
# Find dotnet
6+
if command -v dotnet > /dev/null 2> /dev/null; then
7+
dotnet="dotnet"
8+
else
9+
dotnet="../0install.sh run --version 5.0..!5.1 https://apps.0install.net/dotnet/core-sdk.xml"
10+
fi
11+
512
# Keep template and library version in-sync
613
dotnet add MyServiceBroker.csproj package OpenServiceBroker.Server --version ${1:-1.0-dev}
714
dotnet build MyServiceBroker.csproj

0 commit comments

Comments
 (0)