1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the Mozilla Public License Version 2.0.
7 // See license.mkd for licensing and copyright information.
8 // ---------------------------------------------------------------------------
10 package cc
.squirreljme
.plugin
.multivm
;
12 import cc
.squirreljme
.plugin
.multivm
.ident
.SourceTargetClassifier
;
13 import java
.nio
.file
.Path
;
14 import java
.util
.Collection
;
15 import java
.util
.LinkedHashSet
;
16 import java
.util
.concurrent
.Callable
;
17 import org
.gradle
.api
.Project
;
20 * This calculates all of the test outputs for a given test, so that it can
21 * be used to determine if it should run or run again.
25 public class VMTestOutputs
26 implements Callable
<Iterable
<Path
>>
28 /** The task executing under. */
29 protected final VMExecutableTask task
;
31 /** The classifier used. */
32 protected final SourceTargetClassifier classifier
;
35 * Initializes the handler.
37 * @param __task The task testing under.
38 * @param __classifier The classifier used.
39 * @throws NullPointerException On null arguments.
42 public VMTestOutputs(VMExecutableTask __task
,
43 SourceTargetClassifier __classifier
)
44 throws NullPointerException
46 if (__task
== null || __classifier
== null)
47 throw new NullPointerException("NARG");
50 this.classifier
= __classifier
;
58 public Iterable
<Path
> call()
60 Collection
<Path
> result
= new LinkedHashSet
<>();
62 Project project
= this.task
.getProject();
63 String sourceSet
= this.classifier
.getSourceSet();
65 // Determine the root test result directory
66 Path resultRoot
= VMHelpers
.testResultXmlDir(
67 project
, this.classifier
).get();
69 // The output of the task will be the test results
70 for (String testName
: VMHelpers
.runningTests(project
, sourceSet
)
72 result
.add(resultRoot
.resolve(
73 VMHelpers
.testResultXmlName(testName
)));
75 // Result CSV file that contains a summary on all the tests
76 result
.add(VMHelpers
.testResultsCsvDir(project
, this.classifier
)
77 .get().resolve(VMHelpers
.testResultsCsvName(project
)));