Ministry

Compile.bat

Apr 24th, 2011
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. @ECHO OFF
  2.  
  3. SET cc=javac
  4. SET cflags=-g -Xlint:deprecation
  5. SET src=src
  6. SET lib=lib
  7. SET res=resources
  8. SET out=bin
  9. SET dist=RSBot.jar
  10.  
  11. CALL :clean 2>NUL
  12. CALL "%res%\FindJDK.bat"
  13.  
  14. SET lstf=temp.txt
  15. SET imgdir=%res%\images
  16. SET manifest=%res%\Manifest.txt
  17. SET versionfile=%res%\version.txt
  18. FOR /F %%G IN (%versionfile%) DO SET version=%%G
  19. SET scripts=scripts
  20.  
  21. ECHO Compiling bot
  22. IF EXIST "%lstf%" DEL /F /Q "%lstf%"
  23. FOR /F "usebackq tokens=*" %%G IN (`DIR /B /S "%src%\*.java"`) DO CALL :append "%%G"
  24. IF EXIST "%out%" RMDIR /S /Q "%out%" > NUL
  25. MKDIR "%out%"
  26. "%cc%" %cflags% -d "%out%" "@%lstf%" 2>NUL
  27. DEL /F /Q "%lstf%"
  28.  
  29. :scripts
  30. ECHO Compiling scripts
  31. ECHO. > "%scripts%\.class"
  32. DEL /F /Q "%scripts%\*.class" > NUL
  33. "%cc%" %cflags% -cp "%out%" %scripts%\*.java
  34.  
  35. ECHO Packing JAR
  36.  
  37. IF EXIST "%dist%" DEL /F /Q "%dist%"
  38. IF EXIST "%lstf%" DEL /F /Q "%lstf%"
  39. COPY "%manifest%" "%lstf%"
  40. ECHO Specification-Version: "%version%" >> "%lstf%"
  41. ECHO Implementation-Version: "%version%" >> "%lstf%"
  42. jar cfm "%dist%" "%lstf%" -C "%out%" . %versionfile% %scripts%\*.class %imgdir%\* %res%\*.bat %res%\*.sh
  43. DEL /F /Q "%lstf%"
  44.  
  45. :end
  46. CALL :clean 2>NUL
  47. ECHO Compilation successful.
  48. GOTO :eof
  49.  
  50. :append
  51. SET gx=%1
  52. SET gx=%gx:\=\\%
  53. ECHO %gx% >> %lstf%
  54. GOTO :eof
  55.  
  56. :clean
  57. RMDIR /S /Q "%out%"
  58. DEL /F /Q %scripts%\*.class
  59. GOTO :eof
Advertisement
Add Comment
Please, Sign In to add comment