I would like to ask for some help automating a process which I don’t know how to do without the IntelliJ menu items. I would like to write a shell script (could also be a scala script but I think shell script is probably easier) will take some specified scala source files from several source locations, will then (1) “combine” the files, (2) run the code, and (3) examine the results.
(1) By combine, I’m not sure what I actually mean. One possibility is to create a tmp directory, and just copy the files there. Another possibility would be to concatenate the files into a single file but each file might lead with a
package statement. Another possibility might be to create some sort of ?sbt? script which will simply reference the specific files from their given location. My intuition is that copying the relevant files into a single tmp directory and instructing the scala compiler to ONLY use files in that directory (plus the standard library) is the easiest and least error prone.
(2) By run the code I mean make sure the code compiles, and run the designated test suite, which is defined in one of the specified source files.
(3) By examine the results I mean to figure out if the tests passed and perhaps distinguish this from a case of compilation failed.
I am perfectly willing to provide additional information to the shell script such as name of test suite class. It is not necessary that the code auto-magically figure this out. And I’m perfectly willing to hand edit the script if the file names, locations, or class names change.
Why do I need this? I have given my students several template files of scala code with
??? in certain locations, and I’ve provided them with test suites. I also have written a solution and verified that the solution passes my internal test cases. foreach template for each student, I’d like to substitutive that student’s completed template for my solution, and then run the tests, thus determining whether the student did his homework. In each case the student template uses
import to include some code provided in the lecture. For all the test suites and lecture code I want to be sure that MY version of the reference code is used. I’m happy to write a different unix script for each of the different templates, but I want the same script to then run for each student.
I’d be grateful if someone could help me develop this script.