Grading environment with specific Java version in path.
This image extends grading-base. In addition, following convenience scripts are provided in path.
-
java-compile [-M] [-m ok_message] [files/dirs..]Passes
files/dirstomove-to-package-dirsand then executesjavacwith all matched files. Iffiles/dirsis empty (no argument), then all*.javafiles in the working tree are moved and compiled.You can control classpath via
CLASSPATHenvironment variable. You can define options forjavacusingJAVACFLAGSenvironment variable. Default options are-encoding utf-8 -deprecation.If compilation is successfull, then
ok_messageis printed. By default, it isok, but it can be suppressed with-M. -
move-to-package-dirs [-v] [-d delim] [-f filter] [files/dirs..]Reads
packageandpackage object(scala) directives from files and moves files to correct locations. For example, a file 'example.javacontainingpackage foo.bar;is moved tofoo/bar/example.java. All directories are recursively seached and all files that matchfilter` pattern are handled.If no files or directories are specified, then current tree is searched for files matching filters
*.javaand*.scala.The utility prints final paths of all processed files. By default, paths are separated by space, but you can change this with
-d(e.g. newlines with-d '\n'or nulls with-d '\0'). This can be used to pass files forjavacfor example (e.g.javac $(move-to-package-dirs)).In case of readonly files (e.g. /exercise mount), files are copied instead.
The argument
-vands verbose flag formvandcpcommands with output redirected to stderr. -
junit [-r runner] [files..]Executes java using
runneras the class,filesas arguments and filters output withfilter-junit-stack. Defaultrunnerisorg.junit.runner.JUnitCore. To run test stuite or custom main, use something likejunit -r MyTestsorfilter-junit-stack java MyTests. -
filter-junit-stack CMD..Executes CMD and removes all lines starting with
\tatfrom stdout and stderr. For example, junit prints stack traces in this format. -
run-all-junits [-C] [-p points_per_test_class]Command to do it all. Can replace
run.shin trivial cases.First, script compiles all
*.javafiles from the current tree and /exercise, unless-Cis provided. If compilation fails, then no tests are run. Second, script finds all files matching*Test*.javapattern from the current tree. Then, it runs all files that contain stringorg.junit.Testusingtestcaseandjunit. Testcase will givepoints_per_test_classmany points per successful execution of junit.