2
0

jenkins.build.cmd 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. :: DEFAULT - add any other params to %_msBuildArgs%
  58. :: _msbuildArgs
  59. if [%1] NEQ [] (
  60. set _msbuildArgs=%_msbuildArgs% %1
  61. goto :ContinueArgParseEnd
  62. )
  63. :ContinueArgParseEnd
  64. shift
  65. goto :ContinueArgParse
  66. )
  67. if "%_BuildArch%"=="" (
  68. goto :invalidBuildArch
  69. )
  70. if "%_BuildType%"=="" (
  71. goto :invalidBuildType
  72. )
  73. if "%_LoggingParams%" EQU "" (
  74. 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
  75. )
  76. set _ChakraBuildConfig=
  77. if "%_BuildType%" EQU "chk" (
  78. set _ChakraBuildConfig=Debug
  79. ) else if "%_BuildType%" EQU "fre" (
  80. set _ChakraBuildConfig=Release
  81. ) else if "%_BuildType%" EQU "test" (
  82. set _ChakraBuildConfig=Test
  83. ) else (
  84. echo WARNING: Unknown build type '%_BuildType%'
  85. )
  86. set "_msbuildProj="
  87. set _ChakraSolution=%REPO_ROOT%\Build\Chakra.Core.sln
  88. set _ChakraConfiguration=all
  89. set _CoreBuild=1
  90. if "%_CoreBuild%" EQU "0" (
  91. set _ChakraBuildConfig=%_ChakraConfiguration%-%_ChakraBuildConfig%
  92. )
  93. echo MSBuildArgs are %_msBuildArgs%
  94. echo msbuild %_msBuildArgs% /m /p:Configuration=%_ChakraBuildConfig% /p:Platform=%_BuildArch% %_ChakraSolution% %_msbuildProj% %_LoggingParams% %_targets% /verbosity:minimal /nr:false
  95. msbuild %_msBuildArgs% /m /p:Configuration=%_ChakraBuildConfig% /p:Platform=%_BuildArch% %_ChakraSolution% %_msbuildProj% %_LoggingParams% %_targets% /verbosity:minimal /nr:false
  96. goto :end
  97. :: ============================================================================
  98. :: Invald Build Arch
  99. :: ============================================================================
  100. :invalidBuildArch
  101. echo None of the parameters were a valid build architecture. Please specify both architecture and type.
  102. goto :examples
  103. :: ============================================================================
  104. :: Invald Build Type
  105. :: ============================================================================
  106. :invalidBuildType
  107. echo None of the parameters were a valid build type. Please specify both architecture and type.
  108. goto :examples
  109. :: ============================================================================
  110. :: Examples
  111. :: ============================================================================
  112. :examples
  113. echo Examples:
  114. echo.
  115. echo %_ENTRY_SCRIPT_NAME% x86 debug
  116. echo %_ENTRY_SCRIPT_NAME% x86 test
  117. echo %_ENTRY_SCRIPT_NAME% x86 release
  118. echo.
  119. echo %_ENTRY_SCRIPT_NAME% x64 debug
  120. echo %_ENTRY_SCRIPT_NAME% x64 test
  121. echo %_ENTRY_SCRIPT_NAME% x64 release
  122. goto :end
  123. :: ============================================================================
  124. :: Epilogue of script (cleanup)
  125. :: ============================================================================
  126. :end
  127. endlocal