Skip to content

Commit 9b38f33

Browse files
author
puny
committed
Moved IOProvider outside of the Callable
1 parent dae3f74 commit 9b38f33

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

tmc-plugin/src/fi/helsinki/cs/tmc/runners/MakefileExerciseRunner.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,28 @@
2525
public class MakefileExerciseRunner extends AbstractExerciseRunner {
2626

2727
private static final Logger log = Logger.getLogger(MakefileExerciseRunner.class.getName());
28-
28+
2929
@Override
3030
public Callable<Optional<TestRunResult>> getTestRunningTask(final TmcProjectInfo projectInfo) {
31-
return new Callable<Optional<TestRunResult>>() {
31+
final InputOutput io = IOProvider.getDefault().getIO(projectInfo.getProjectName(), false);
3232

33+
return new Callable<Optional<TestRunResult>>() {
3334
@Override
3435
public Optional<TestRunResult> call() throws Exception {
3536
log.log(Level.INFO, "Compiling project {0}", projectInfo.getProjectName());
3637
Project project = projectInfo.getProject();
3738
FileObject makeFile = project.getProjectDirectory().getFileObject("Makefile");
38-
39+
3940
if (makeFile == null) {
4041
log.log(INFO, "Project has no Makefile");
4142
return Optional.absent();
4243
}
43-
44+
4445
File workDir = projectInfo.getProjectDirAsFile();
4546
String[] command = {"make", "test"};
46-
47-
final InputOutput io = IOProvider.getDefault().getIO(projectInfo.getProjectName(), false);
47+
4848
final ProcessRunner runner = new ProcessRunner(command, workDir, io);
49-
49+
5050
try {
5151
ProcessResult result = runner.call();
5252
int ret = result.statusCode;
@@ -65,7 +65,7 @@ public Optional<TestRunResult> call() throws Exception {
6565
}
6666
};
6767
}
68-
68+
6969
// TODO: use make
7070
private TestRunResult runTests(final TmcProjectInfo projectInfo, final boolean withValgrind) throws Exception {
7171
log.log(INFO, "Running tests {0}", projectInfo.getProjectName());
@@ -115,4 +115,4 @@ private TestRunResult runTests(final TmcProjectInfo projectInfo, final boolean w
115115
return resultParser.parseCTestResults(resultsFile, valgrindLog, null);
116116
}
117117
}
118-
}
118+
}

tmc-plugin/src/fi/helsinki/cs/tmc/runners/MavenExerciseRunner.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@ public class MavenExerciseRunner extends AbstractJavaExerciseRunner {
2727

2828
@Override
2929
public Callable<Optional<TestRunResult>> getTestRunningTask(final TmcProjectInfo projectInfo) {
30+
final InputOutput inOut = IOProvider.getDefault().getIO(projectInfo.getProjectName(), false);
31+
3032
return new Callable<Optional<TestRunResult>>() {
3133
@Override
3234
public Optional<TestRunResult> call() throws Exception {
3335
File projectDir = projectInfo.getProjectDirAsFile();
3436
log.log(INFO, "Starting compile");
3537
String goal = "test-compile";
36-
final InputOutput inOut = IOProvider.getDefault().getIO(projectInfo.getProjectName(), false);
3738

3839
final ProcessRunner runner = new MavenRunBuilder()
3940
.setProjectDir(projectDir)

0 commit comments

Comments
 (0)