pre_post_util.ps1 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #-------------------------------------------------------------------------------------------------------
  2. # Copyright (C) Microsoft. All rights reserved.
  3. # Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. #-------------------------------------------------------------------------------------------------------
  5. . "$PSScriptRoot\util.ps1"
  6. function UseValueOrDefault($value, $defaultvalue, $defaultvalue2) {
  7. if ($value -ne "") {
  8. return $value;
  9. } elseif ($defaultvalue -ne "") {
  10. return $defaultvalue;
  11. }
  12. return $defaultvalue2;
  13. }
  14. function WriteCommonArguments() {
  15. WriteMessage "Source Path : $srcpath"
  16. WriteMessage "Object Path : $objpath"
  17. WriteMessage "Binaries Path: $binpath"
  18. }
  19. function GetGitPath() {
  20. $gitExe = "git.exe"
  21. if (!(Get-Command $gitExe -ErrorAction SilentlyContinue)) {
  22. $gitExe = "C:\1image\Git\bin\git.exe"
  23. if (!(Test-Path $gitExe)) {
  24. throw "git.exe not found in path- aborting."
  25. }
  26. }
  27. return $gitExe;
  28. }
  29. $srcpath = UseValueOrDefault $srcpath "$env:TF_BUILD_SOURCESDIRECTORY" (Resolve-Path "$OuterScriptRoot\..\..");
  30. $objpath = UseValueOrDefault $objpath "$env:TF_BUILD_BUILDDIRECTORY" "${srcpath}\Build\VcBuild\obj\${arch}_${flavor}";
  31. $binpath = UseValueOrDefault $binpath "$env:TF_BUILD_BINARIESDIRECTORY" "${srcpath}\Build\VcBuild";