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.

makeTestBat.sh 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #!/bin/sh
  2. # kludge to generate a bat script using ajc.bat, ajdoc.bat, and ajdb.bat
  3. # set the Java command for the target platform,
  4. # and run the resulting script in the aspectj directory
  5. # @process-test tools makeTestBat.sh # generate .bat script to test examples
  6. JAVA='C:\home\apps\jdk13\bin\java'
  7. errMssg() {
  8. [ -n "$1" ] && echo "## $0 - $1"
  9. [ -n "$2" ] && exit "$2"
  10. }
  11. javaCommand() {
  12. # grep 'main(' */*.java | sed 's|\.java.*||;s|\/|.|;s|\(.*\)| \1 ) m=\1;;| ' | sort -u
  13. m=""
  14. case "$1" in
  15. # todo: need to distinguish multiple entrypoints per compile?
  16. bean\\files ) m=bean.DeclareError;;
  17. bean\\files ) m=bean.Demo;;
  18. introduction\\files ) m=introduction.CloneablePoint;;
  19. introduction\\files ) m=introduction.ComparablePoint;;
  20. introduction\\files ) m=introduction.HashablePoint;;
  21. introduction\\files ) m=introduction.Point;;
  22. observer\\files ) m=observer.Demo;;
  23. spacewar\\debug ) m=spacewar.Game;;
  24. spacewar\\demo ) m=spacewar.Game;;
  25. telecom\\basic ) m=telecom.BasicSimulation;;
  26. telecom\\billing ) m=telecom.BillingSimulation;;
  27. telecom\\timing ) m=telecom.TimingSimulation;;
  28. tjp\\files ) m=tjp.Demo;;
  29. tracing\\notrace ) m=tracing.ExampleMain;;
  30. tracing\\tracelib ) m=tracing.ExampleMain;;
  31. tracing\\tracev1 ) m=tracing.ExampleMain;;
  32. tracing\\tracev2 ) m=tracing.ExampleMain;;
  33. tracing\\tracev3 ) m=tracing.ExampleMain;;
  34. * ) echo "rem no java command yet for $1" ;;
  35. esac
  36. if [ -n "$m" ] ; then
  37. case "$2" in
  38. ajdb ) echo "call ..\\bin\\ajdb.bat -classpath \"$1;..\\lib\\aspectjrt.jar\" $m < ajdbInput" ;;
  39. java ) echo "$JAVA -classpath \"$1;..\\lib\\aspectjrt.jar\" $m ";;
  40. * ) echo "rem unrecognized request $2 for $1"
  41. esac
  42. fi
  43. }
  44. getAjdocPackages() {
  45. m=""
  46. case "$1" in
  47. bean\\files ) m="bean ";;
  48. introduction\\files ) m="introduction ";;
  49. coordination\\lib ) m="coordination ";;
  50. observer\\files ) m="observer ";;
  51. spacewar\\debug ) m="spacewar coordination";;
  52. spacewar\\demo ) m="spacewar ";;
  53. telecom\\basic ) m="telecom ";;
  54. telecom\\billing ) m="telecom ";;
  55. telecom\\timing ) m="telecom ";;
  56. tjp\\files ) m="tjp ";;
  57. tracing\\notrace ) m="tracing ";;
  58. tracing\\tracelib ) m="tracing tracing.lib";;
  59. tracing\\tracev1 ) m="tracing tracing.version1";;
  60. tracing\\tracev2 ) m="tracing tracing.version2";;
  61. tracing\\tracev3 ) m="tracing tracing.version3";;
  62. * ) echo "rem no ajdoc command yet for $1" ;;
  63. esac
  64. echo "$m"
  65. }
  66. example() {
  67. docPacks=$(getAjdocPackages "$1")
  68. cat<<EOF
  69. echo "###################### running $1"
  70. if exist $1 rmdir /S /Q $1
  71. if not exist $1 mkdir $1
  72. call ..\\bin\\ajc.bat -d $1 -classpath ..\\lib\\aspectjrt.jar -argfile $1.lst > $1\\ajc.txt 2>&1
  73. @echo on
  74. $(javaCommand $1 java) > $1\\java.txt 2>&1
  75. @echo on
  76. $(javaCommand $1 ajdb) > $1\\ajdb.txt 2>&1
  77. @echo on
  78. call ..\\bin\\ajdoc.bat -d $1 -classpath ..\\lib\\aspectjrt.jar -sourcepath . $docPacks > $1\\ajdoc.txt 2>&1
  79. EOF
  80. }
  81. unixToDOS() {
  82. sed 's| ||' # add ^M here (C-v C-m)
  83. }
  84. allListFiles() {
  85. cat<<EOF
  86. @bean\files.lst
  87. @spacewar\debug.lst
  88. @coordination\lib.lst
  89. @introduction\files.lst
  90. @observer\files.lst
  91. @telecom\timing.lst
  92. @spacewar\debug.lst
  93. @tjp\files.lst
  94. @tracing\tracev3.lst
  95. EOF
  96. }
  97. [ -f "lib/aspectjrt.jar" ] || errMssg "rt" 3
  98. [ -f "examples/bean/files.lst" ] || errMssg "eg" 3
  99. cd examples
  100. allListFiles | unixToDOS > examples.lst
  101. echo "exit" > ajdbInput
  102. echo "cd examples"
  103. echo "if not exist ajworkingdir mkdir ajworkingdir"
  104. for i in $(ls */*.lst | sed 's|\.lst||;s|\/|\\|') ; do
  105. example $i | sed 's|$||' # add ^M here (C-v C-m)
  106. done
  107. ## now do all together
  108. dir=all
  109. packages="bean coordination introduction spacewar telecom telecom.timing tracing tracing.lib tracing.version3"
  110. cat<<EOF
  111. echo "###################### compile all "
  112. if exist $dir rmdir /S /Q $dir
  113. if not exist $dir mkdir $dir
  114. call ..\\bin\\ajc.bat -d $dir -classpath ..\\lib\\aspectjrt.jar @examples.lst > $dir\\ajc.txt 2>&1
  115. call ..\\bin\\ajdoc.bat -d $dir -classpath ..\\lib\\aspectjrt.jar -sourcepath . $packages > $dir\\ajdoc.txt 2>&1
  116. EOF