2
0

jenkins.build.init.cmd 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. @echo off
  6. if not "%JENKINS_BUILD%" == "True" (
  7. echo This script should be run under a Jenkins Build environment
  8. exit /b 2
  9. )
  10. set REPO_ROOT=%~dp0\..
  11. set JENKINS_BUILD_ARGS=
  12. set JENKINS_USE_MSBUILD_12=
  13. :ContinueArgParse
  14. if not [%1]==[] (
  15. if [%1]==[msbuild12] (
  16. set JENKINS_USE_MSBUILD_12=True
  17. goto :ContinueArgParseEnd
  18. )
  19. :: DEFAULT - add any other params to %JENKINS_BUILD_ARGS%
  20. if [%1] NEQ [] (
  21. set JENKINS_BUILD_ARGS=%JENKINS_BUILD_ARGS% %1
  22. goto :ContinueArgParseEnd
  23. )
  24. :ContinueArgParseEnd
  25. shift
  26. goto :ContinueArgParse
  27. )
  28. :: ========================================
  29. :: Set up msbuild.exe
  30. :: ========================================
  31. if "%JENKINS_USE_MSBUILD_12%" == "True" (
  32. echo Skipping Dev14 and trying Dev12...
  33. goto :LABEL_USE_MSBUILD_12
  34. )
  35. where /q msbuild.exe
  36. IF "%ERRORLEVEL%" == "0" (
  37. goto :SkipMsBuildSetup
  38. )
  39. REM Try Dev14 first
  40. set MSBUILD_VERSION=14.0
  41. set MSBUILD_PATH="%ProgramFiles%\msbuild\%MSBUILD_VERSION%\Bin\x86"
  42. if not exist %MSBUILD_PATH%\msbuild.exe (
  43. set MSBUILD_PATH="%ProgramFiles(x86)%\msbuild\%MSBUILD_VERSION%\Bin"
  44. )
  45. if not exist %MSBUILD_PATH%\msbuild.exe (
  46. set MSBUILD_PATH="%ProgramFiles(x86)%\msbuild\%MSBUILD_VERSION%\Bin\amd64"
  47. )
  48. if exist %MSBUILD_PATH%\msbuild.exe (
  49. goto :MSBuildFound
  50. )
  51. echo Dev14 not found, trying Dev %MSBUILD_VERSION%
  52. :LABEL_USE_MSBUILD_12
  53. set MSBUILD_VERSION=12.0
  54. set MSBUILD_PATH="%ProgramFiles%\msbuild\%MSBUILD_VERSION%\Bin\x86"
  55. if not exist %MSBUILD_PATH%\msbuild.exe (
  56. set MSBUILD_PATH="%ProgramFiles(x86)%\msbuild\%MSBUILD_VERSION%\Bin"
  57. )
  58. if not exist %MSBUILD_PATH%\msbuild.exe (
  59. set MSBUILD_PATH="%ProgramFiles(x86)%\msbuild\%MSBUILD_VERSION%\Bin\amd64"
  60. )
  61. if not exist %MSBUILD_PATH%\msbuild.exe (
  62. echo Can't find msbuild.exe in %MSBUILD_PATH%
  63. goto :SkipMsBuildSetup
  64. )
  65. :MSBuildFound
  66. echo MSBuild located at %MSBUILD_PATH%
  67. set PATH=%MSBUILD_PATH%;%PATH%
  68. set JENKINS_USE_MSBUILD_12=
  69. set MSBUILD_PATH=
  70. :SkipMsBuildSetup