Skip to content

Commit

Permalink
Ubuntu vs Windows #3
Browse files Browse the repository at this point in the history
Let's try again...
  • Loading branch information
dustinmoris committed Oct 18, 2018
1 parent 1211612 commit ee1f0a2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 36 deletions.
63 changes: 29 additions & 34 deletions .psscripts/build-functions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -131,30 +131,6 @@ function Test-CompareVersions ($version, [string]$gitTag)
# .NET Core functions
# ----------------------------------------------

function dotnet-info { Invoke-Cmd "dotnet --info" }
function dotnet-version { Invoke-Cmd "dotnet --version" }
function dotnet-restore ($project, $argv) { Invoke-Cmd "dotnet restore $project $argv" }
function dotnet-build ($project, $argv) { Invoke-Cmd "dotnet build $project $argv" }
function dotnet-run ($project, $argv) { Invoke-Cmd "dotnet run --project $project $argv" }
function dotnet-pack ($project, $argv) { Invoke-Cmd "dotnet pack $project $argv" }
function dotnet-publish ($project, $argv) { Invoke-Cmd "dotnet publish $project $argv" }

function Get-DotNetRuntimeVersion
{
<#
.DESCRIPTION
Runs the dotnet --info command and extracts the .NET Core Runtime version number.
.NOTES
The .NET Core Runtime version can sometimes be useful for other dotnet CLI commands (e.g. dotnet xunit -fxversion ".NET Core Runtime version").
#>

$info = dotnet-info
[System.Array]::Reverse($info)
$version = $info | Where-Object { $_.Contains("Version") } | Select-Object -First 1
$version.Split(":")[1].Trim()
}

function Get-TargetFrameworks ($projFile)
{
<#
Expand Down Expand Up @@ -198,20 +174,39 @@ function Get-NetCoreTargetFramework ($projFile)
Get-TargetFrameworks $projFile | Where-Object { $_ -like "netstandard*" -or $_ -like "netcoreapp*" }
}

function dotnet-test ($project, $argv)
function Invoke-DotNetCli ($Cmd, $Project, $Argv)
{
# Currently dotnet test does not work for net461 on Linux/Mac
# See: https://github.com/Microsoft/vstest/issues/1318
#
# Previously dotnet-xunit was a working alternative, however
# after issues with the maintenance of dotnet xunit it has been
# discontinued since xunit 2.4: https://xunit.github.io/releases/2.4
if(!(Test-IsWindows))
{
$fw = Get-NetCoreTargetFramework $project;
$argv = "-f $fw " + $argv
$fw = Get-NetCoreTargetFramework($Project)
$Argv = "-f $fw " + $Argv
}
Invoke-Cmd "dotnet test $project $argv"
Invoke-Cmd "dotnet $Cmd $Project $Argv"
}

function dotnet-info { Invoke-Cmd "dotnet --info" }
function dotnet-version { Invoke-Cmd "dotnet --version" }
function dotnet-restore ($project, $argv) { Invoke-Cmd "dotnet restore $project $argv" }
function dotnet-build ($project, $argv) { Invoke-DotNetCli -Cmd "build" -Project $project -Argv $argv }
function dotnet-test ($project, $argv) { Invoke-DotNetCli -Cmd "test" -Project $project -Argv $argv }
function dotnet-run ($project, $argv) { Invoke-Cmd "dotnet run --project $project $argv" }
function dotnet-pack ($project, $argv) { Invoke-Cmd "dotnet pack $project $argv" }
function dotnet-publish ($project, $argv) { Invoke-Cmd "dotnet publish $project $argv" }

function Get-DotNetRuntimeVersion
{
<#
.DESCRIPTION
Runs the dotnet --info command and extracts the .NET Core Runtime version number.
.NOTES
The .NET Core Runtime version can sometimes be useful for other dotnet CLI commands (e.g. dotnet xunit -fxversion ".NET Core Runtime version").
#>

$info = dotnet-info
[System.Array]::Reverse($info)
$version = $info | Where-Object { $_.Contains("Version") } | Select-Object -First 1
$version.Split(":")[1].Trim()
}

function Write-DotnetCoreVersions
Expand Down
2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Remove-OldBuildArtifacts
$configuration = if ($Release.IsPresent) { "Release" } else { "Debug" }

Write-Host "Building Giraffe..." -ForegroundColor Magenta
dotnet-build $giraffe "-c $configuration"
dotnet-build $giraffe "-c $configuration"

if (!$ExcludeTests.IsPresent -and !$Run.IsPresent)
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Giraffe.Tests/Giraffe.Tests.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.1</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp2.1</TargetFrameworks>
<AssemblyName>Giraffe.Tests</AssemblyName>
<DebugType>portable</DebugType>
</PropertyGroup>
Expand Down

0 comments on commit ee1f0a2

Please sign in to comment.