-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
47a8639
commit f3d0139
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
[CmdletBinding()] | ||
param ( | ||
[Parameter(HelpMessage="The action to execute.")] | ||
[ValidateSet("Build", "Test", "Pack")] | ||
[string] $Action = "Build", | ||
|
||
[Parameter(HelpMessage="The msbuild configuration to use.")] | ||
[ValidateSet("Debug", "Release")] | ||
[string] $Configuration = "Debug", | ||
|
||
[switch] $NoRestore, | ||
|
||
[switch] $Clean | ||
) | ||
|
||
function RunCommand { | ||
param ([string] $CommandExpr) | ||
Write-Verbose " $CommandExpr" | ||
Invoke-Expression $CommandExpr | ||
} | ||
|
||
$projectName = "Danom" | ||
$rootDir = $PSScriptRoot | ||
$srcDir = Join-Path -Path $rootDir -ChildPath 'src' | ||
$testDir = Join-Path -Path $rootDir -ChildPath 'test' | ||
|
||
switch ($Action) { | ||
"Test" { $projectdir = Join-Path -Path $testDir -ChildPath "$projectName.Tests" } | ||
"Pack" { $projectDir = Join-Path -Path $srcDir -ChildPath "$projectName" } | ||
Default { $projectDir = Join-Path -Path $srcDir -ChildPath "$projectName" } | ||
} | ||
|
||
if(!$NoRestore.IsPresent) { | ||
RunCommand "dotnet restore $projectDir --force --force-evaluate --nologo --verbosity quiet" | ||
} | ||
|
||
if ($Clean) | ||
{ | ||
RunCommand "dotnet clean $projectDir -c $Configuration --nologo --verbosity quiet" | ||
} | ||
|
||
switch ($Action) { | ||
"Test" { RunCommand "dotnet test `"$projectDir`"" } | ||
"Pack" { RunCommand "dotnet pack `"$projectDir`" -c $Configuration --include-symbols --include-source" } | ||
Default { RunCommand "dotnet build `"$projectDir`" -c $Configuration" } | ||
} |