ci.build.cmd 4.7 KB

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