clean_windows.cmd 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. @ECHO OFF
  2. REM
  3. REM Copyright (c) Contributors to the Open 3D Engine Project.
  4. REM For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. REM
  6. REM SPDX-License-Identifier: Apache-2.0 OR MIT
  7. REM
  8. REM
  9. SETLOCAL EnableDelayedExpansion
  10. REM Jenkins defines environment variables for parameters and passes "false" to variables
  11. REM that are not set. Here we clear them if they are false so we can also just define them
  12. REM from command line
  13. IF "%CLEAN_ASSETS%"=="false" (
  14. set CLEAN_ASSETS=
  15. )
  16. IF "%CLEAN_OUTPUT_DIRECTORY%"=="false" (
  17. set CLEAN_OUTPUT_DIRECTORY=
  18. )
  19. IF DEFINED CLEAN_ASSETS (
  20. ECHO [ci_build] CLEAN_ASSETS option set
  21. FOR %%P in (%CMAKE_LY_PROJECTS%) do (
  22. IF EXIST %%P\Cache (
  23. ECHO [ci_build] Deleting "%%P\Cache"
  24. DEL /s /q /f %%P\Cache 1>nul
  25. )
  26. )
  27. )
  28. REM If the node label changes, we issue a clean output since node changes can change SDK/CMake/toolchains/etc
  29. SET LAST_CONFIGURE_NODE_LABEL_FILE=ci_last_node_label.txt
  30. IF DEFINED NODE_LABEL (
  31. IF EXIST %OUTPUT_DIRECTORY% (
  32. PUSHD %OUTPUT_DIRECTORY%
  33. IF EXIST !LAST_CONFIGURE_NODE_LABEL_FILE! (
  34. FOR /F "delims=" %%x in (%LAST_CONFIGURE_NODE_LABEL_FILE%) DO SET LAST_NODE_LABEL=%%x
  35. ) ELSE (
  36. SET LAST_NODE_LABEL=
  37. )
  38. REM Detect if the node label has changed
  39. IF !LAST_NODE_LABEL! NEQ !NODE_LABEL! (
  40. ECHO [ci_build] Last run was done with node label "!LAST_NODE_LABEL!", new node label is "!NODE_LABEL!", forcing CLEAN_OUTPUT_DIRECTORY
  41. SET CLEAN_OUTPUT_DIRECTORY=1
  42. )
  43. POPD
  44. )
  45. )
  46. IF DEFINED CLEAN_OUTPUT_DIRECTORY (
  47. ECHO [ci_build] CLEAN_OUTPUT_DIRECTORY option set
  48. IF EXIST %OUTPUT_DIRECTORY% (
  49. ECHO [ci_build] Deleting "%OUTPUT_DIRECTORY%"
  50. DEL /s /q /f %OUTPUT_DIRECTORY% 1>nul
  51. )
  52. )
  53. IF NOT EXIST "%OUTPUT_DIRECTORY%" (
  54. MKDIR %OUTPUT_DIRECTORY%.
  55. )
  56. REM Save the node label
  57. PUSHD %OUTPUT_DIRECTORY%
  58. ECHO !NODE_LABEL!> !LAST_CONFIGURE_NODE_LABEL_FILE!
  59. POPD