jenkins.build.cmd 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. setlocal
  7. if not "%JENKINS_BUILD%" == "True" (
  8. echo This script should be run under a Jenkins Build environment
  9. exit /b 2
  10. )
  11. if "%_ENTRY_SCRIPT_NAME%"=="" (
  12. set _ENTRY_SCRIPT_NAME=%0
  13. )
  14. set "_msbuildArgs="
  15. :ContinueArgParse
  16. if not [%1]==[] (
  17. :: _BuildArch
  18. if [%1]==[x86] (
  19. set _BuildArch=x86
  20. goto :ContinueArgParseEnd
  21. ) else if [%1]==[x64] (
  22. set _BuildArch=x64
  23. goto :ContinueArgParseEnd
  24. ) else if [%1]==[arm] (
  25. set _BuildArch=arm
  26. goto :ContinueArgParseEnd
  27. )
  28. :: _BuildArch (deprecated name)
  29. if [%1]==[amd64] (
  30. set _BuildArch=x64
  31. goto :ContinueArgParseEnd
  32. )
  33. :: _BuildType (new names)
  34. if [%1]==[debug] (
  35. set _BuildType=chk
  36. goto :ContinueArgParseEnd
  37. ) else if [%1]==[test] (
  38. set _BuildType=test
  39. goto :ContinueArgParseEnd
  40. ) else if [%1]==[release] (
  41. set _BuildType=fre
  42. goto :ContinueArgParseEnd
  43. )
  44. :: _BuildType (old names)
  45. if [%1]==[chk] (
  46. set _BuildType=chk
  47. goto :ContinueArgParseEnd
  48. ) else if [%1]==[fre] (
  49. set _BuildType=fre
  50. goto :ContinueArgParseEnd
  51. )
  52. :: _targets
  53. if /i [%1] EQU [/c] (
  54. set _targets=/t:Clean,Build
  55. goto :ContinueArgParseEnd
  56. )
  57. :: SWB
  58. if /i [%1] EQU [swb] (
  59. set _msbuildArgs=%_msbuildArgs% "/p:ForceSWB=true"
  60. goto :ContinueArgParseEnd
  61. )
  62. :: DEFAULT - add any other params to %_msBuildArgs%
  63. :: _msbuildArgs
  64. if [%1] NEQ [] (
  65. set _msbuildArgs=%_msbuildArgs% %1
  66. goto :ContinueArgParseEnd
  67. )
  68. :ContinueArgParseEnd
  69. shift
  70. goto :ContinueArgParse
  71. )
  72. if "%_BuildArch%"=="" (
  73. goto :invalidBuildArch
  74. )
  75. if "%_BuildType%"=="" (
  76. goto :invalidBuildType
  77. )
  78. if "%_LoggingParams%" EQU "" (
  79. set _LoggingParams=/fl1 /flp1:logfile=build_%_BuildArch%%_BuildType%.log;verbosity=normal /fl2 /flp2:logfile=build_%_BuildArch%%_BuildType%.err;errorsonly /fl3 /flp3:logfile=build_%_BuildArch%%_BuildType%.wrn;warningsonly
  80. )
  81. set _ChakraBuildConfig=
  82. if "%_BuildType%" EQU "chk" (
  83. set _ChakraBuildConfig=Debug
  84. ) else if "%_BuildType%" EQU "fre" (
  85. set _ChakraBuildConfig=Release
  86. ) else if "%_BuildType%" EQU "test" (
  87. set _ChakraBuildConfig=Test
  88. ) else (
  89. echo WARNING: Unknown build type '%_BuildType%'
  90. )
  91. set "_msbuildProj="
  92. set _ChakraSolution=%REPO_ROOT%\Build\Chakra.Core.sln
  93. set _ChakraConfiguration=all
  94. set _CoreBuild=1
  95. if "%_CoreBuild%" EQU "0" (
  96. set _ChakraBuildConfig=%_ChakraConfiguration%-%_ChakraBuildConfig%
  97. )
  98. echo MSBuildArgs are %_msBuildArgs%
  99. echo msbuild %_msBuildArgs% /m /p:Configuration=%_ChakraBuildConfig% /p:Platform=%_BuildArch% %_ChakraSolution% %_msbuildProj% %_LoggingParams% %_targets% /verbosity:minimal /nr:false
  100. msbuild %_msBuildArgs% /m /p:Configuration=%_ChakraBuildConfig% /p:Platform=%_BuildArch% %_ChakraSolution% %_msbuildProj% %_LoggingParams% %_targets% /verbosity:minimal /nr:false
  101. goto :end
  102. :: ============================================================================
  103. :: Invald Build Arch
  104. :: ============================================================================
  105. :invalidBuildArch
  106. echo None of the parameters were a valid build architecture. Please specify both architecture and type.
  107. goto :examples
  108. :: ============================================================================
  109. :: Invald Build Type
  110. :: ============================================================================
  111. :invalidBuildType
  112. echo None of the parameters were a valid build type. Please specify both architecture and type.
  113. goto :examples
  114. :: ============================================================================
  115. :: Examples
  116. :: ============================================================================
  117. :examples
  118. echo Examples:
  119. echo.
  120. echo %_ENTRY_SCRIPT_NAME% x86 debug
  121. echo %_ENTRY_SCRIPT_NAME% x86 test
  122. echo %_ENTRY_SCRIPT_NAME% x86 release
  123. echo.
  124. echo %_ENTRY_SCRIPT_NAME% x64 debug
  125. echo %_ENTRY_SCRIPT_NAME% x64 test
  126. echo %_ENTRY_SCRIPT_NAME% x64 release
  127. goto :end
  128. :: ============================================================================
  129. :: Epilogue of script (cleanup)
  130. :: ============================================================================
  131. :end
  132. endlocal