Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.5 KiB

  1. @echo off
  2. if not exist version.txt goto usage
  3. set bldBldNumber=
  4. set bldBldNumber1=
  5. set bldBldNumber2=
  6. set bldBldNumber3=
  7. set bldBldNumber4=
  8. echo VERSION.BAT: Current version.txt:
  9. type version.txt
  10. awk -f ver1.awk version.txt > x.bat
  11. call x.bat
  12. del x.bat
  13. if "%bldBldNumber%" == "" goto usage
  14. if "%bldBldNumber1%" == "" goto usage
  15. if "%bldBldNumber2%" == "" goto usage
  16. if "%bldBldNumber3%" == "" goto usage
  17. if "%bldBldNumber4%" == "" goto usage
  18. if "%1" == "bumpver" goto bumpver
  19. if "%1" == "bump" goto bumpver
  20. goto bumpverX
  21. :bumpver
  22. awk -f ver2.awk version.txt > version.new
  23. copy version.new version.txt
  24. del version.new
  25. awk -f ver1.awk version.txt > x.bat
  26. call x.bat
  27. del x.bat
  28. if "%bldBldNumber%" == "" goto usage
  29. if "%bldBldNumber1%" == "" goto usage
  30. if "%bldBldNumber2%" == "" goto usage
  31. if "%bldBldNumber3%" == "" goto usage
  32. if "%bldBldNumber4%" == "" goto usage
  33. echo VERSION.BAT: New build number is %bldBldNumber%
  34. echo VERSION.BAT: New version.txt:
  35. type version.txt
  36. :bumpverX
  37. call bt.bat
  38. attrib -r %bldDir%\..\..\common\h\version.tmp
  39. out -f %bldDir%\..\..\common\h\version.h
  40. if exist version.sed del version.sed
  41. echo /^#define VERSION/ s/".*\..*\..*"/"%bldBldNumber1%.%bldBldNumber2%.%bldBldNumber4%"/g>> version.sed
  42. echo /^#define VER_FILEVERSION_STR/ s/".*\..*\..*\\0"/"%bldBldNumber1%.%bldBldNumber2%.%bldBldNumber4%\\0"/g>> version.sed
  43. echo /^#define VER_FILEVERSION/ s/[0-9]*,.*,.*,.*/%bldBldNumber1%,%bldBldNumber2%,%bldBldNumber3%,%bldBldNumber4%/g>> version.sed
  44. echo /^#define VER_PRODUCTVERSION_STR/ s/".*\..*\..*\\0"/"%bldBldNumber1%.%bldBldNumber2%.%bldBldNumber4%\\0"/g>> version.sed
  45. echo /^#define VER_PRODUCTVERSION/ s/[0-9]*,.*,.*,.*/%bldBldNumber1%,%bldBldNumber2%,%bldBldNumber3%,%bldBldNumber4%/g>> version.sed
  46. sed -f version.sed %bldDir%\..\..\common\h\version.tmp > %bldDir%\..\..\common\h\version.h
  47. del version.sed
  48. attrib +r %bldDir%\..\..\common\h\version.tmp
  49. in -f -c "" %bldDir%\..\..\common\h\version.h
  50. goto exit
  51. :usage
  52. echo.
  53. echo Something bad has happened!
  54. echo.
  55. echo A. You do not have a version.txt in your build directory
  56. echo B. You have a corrupted version.txt in your build directory
  57. echo.
  58. echo You need to fix this before you can continue!
  59. echo.
  60. set verfile=
  61. goto exit
  62. :exit