|
@@ -1,10 +1,27 @@
|
|
|
$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
|
|
$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
|
|
|
|
|
|
|
|
|
|
+$configuration = "Release"
|
|
|
|
|
+
|
|
|
|
|
+wget "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" -outfile .\nuget.exe
|
|
|
|
|
+
|
|
|
$msbuild = Get-ItemProperty "hklm:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0"
|
|
$msbuild = Get-ItemProperty "hklm:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0"
|
|
|
|
|
|
|
|
# TODO: if not found, bail out
|
|
# TODO: if not found, bail out
|
|
|
$msbuildExe = Join-Path $msbuild.MSBuildToolsPath "msbuild.exe"
|
|
$msbuildExe = Join-Path $msbuild.MSBuildToolsPath "msbuild.exe"
|
|
|
|
|
|
|
|
|
|
+# get version
|
|
|
|
|
+.\nuget.exe install -excludeversion -pre gitversion.commandline -outputdirectory packages
|
|
|
|
|
+.\packages\gitversion.commandline\tools\gitversion.exe /l console /output buildserver
|
|
|
|
|
+
|
|
|
|
|
+$versionObj = .\packages\gitversion.commandline\tools\gitversion.exe | ConvertFrom-Json
|
|
|
|
|
+
|
|
|
|
|
+$ver1 = $versionObj.NuGetVersionV2
|
|
|
|
|
+$ver2 = $versionObj.CommitsSinceVersionSourcePadded
|
|
|
|
|
+
|
|
|
|
|
+$version = "$ver1-$ver2"
|
|
|
|
|
+
|
|
|
|
|
+Write-Host "Version: $version"
|
|
|
|
|
+
|
|
|
Write-Host "Restoring packages" -Foreground Green
|
|
Write-Host "Restoring packages" -Foreground Green
|
|
|
dotnet restore $scriptPath | out-null
|
|
dotnet restore $scriptPath | out-null
|
|
|
|
|
|
|
@@ -14,11 +31,20 @@ $projects = gci $scriptPath -Directory `
|
|
|
| Select -ExpandProperty FullName
|
|
| Select -ExpandProperty FullName
|
|
|
|
|
|
|
|
foreach ($project in $projects) {
|
|
foreach ($project in $projects) {
|
|
|
|
|
+ dotnet build -c "$configuration" $project
|
|
|
dotnet build $project
|
|
dotnet build $project
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+$nuspecDir = Join-Path $scriptPath "NuSpecs"
|
|
|
|
|
+
|
|
|
|
|
+Write-Host "Building Packages" -Foreground Green
|
|
|
|
|
+$nuspecs = ls $nuspecDir\*.nuspec | Select -ExpandProperty FullName
|
|
|
|
|
+
|
|
|
|
|
+foreach ($nuspec in $nuspecs) {
|
|
|
|
|
+ nuget pack $nuspec -Version $version -Properties "Configuration=$configuration"
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
Write-Host "Running tests" -Foreground Green
|
|
Write-Host "Running tests" -Foreground Green
|
|
|
-$testDirectory = Join-Path $scriptPath "Tests"
|
|
|
|
|
-cd $testDirectory
|
|
|
|
|
-dotnet test
|
|
|
|
|
|
|
+$testDirectory = Join-Path $scriptPath "Tests"
|
|
|
|
|
+dotnet test $testDirectory
|
|
|
|
|
|