Add task for running tests that runs both clutter levels accordingly.
[SquirrelJME.git] / buildSrc / src / main / java / cc / squirreljme / plugin / multivm / VMRunDependencies.java
blob00cdd48ff2fff4292f1ae76978de9ce7b1ddbb44
1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // SquirrelJME
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the GNU General Public License v3+, or later.
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.util.concurrent.Callable;
15 /**
16 * This is the set of dependencies for {@link VMRunTask} which takes all
17 * the dependencies directly needed in order to run the program.
19 * If the virtual machine is {@link VMSpecifier#hasEmulatorJit()} then
20 * SpringCoat libraries will be used instead of the ROM libraries for running.
22 * @since 2020/08/15
24 public final class VMRunDependencies
25 implements Callable<Iterable<VMLibraryTask>>
27 /** The task executing under. */
28 protected final VMExecutableTask task;
30 /** The classifier used. */
31 protected final SourceTargetClassifier classifier;
33 /**
34 * Initializes the provider.
36 * @param __task The task working under.
37 * @param __classifier The classifier used.
38 * @throws NullPointerException On null arguments.
39 * @since 2020/08/15
41 public VMRunDependencies(VMExecutableTask __task,
42 SourceTargetClassifier __classifier)
43 throws NullPointerException
45 if (__task == null || __classifier == null)
46 throw new NullPointerException("NARG");
48 this.task = __task;
49 this.classifier = __classifier;
52 /**
53 * {@inheritDoc}
54 * @since 2020/08/15
56 @Override
57 public final Iterable<VMLibraryTask> call()
59 VMExecutableTask task = this.task;
61 // If this is emulator that is JIT capable, instead for running
62 // load it with SpringCoat's library instead
63 boolean emuJit = this.classifier.getTargetClassifier().getVmType()
64 .hasEmulatorJit();
65 if (emuJit)
66 return VMHelpers.<VMLibraryTask>resolveProjectTasks(
67 VMLibraryTask.class, task.getProject(),
68 VMHelpers.runClassTasks(this.task.getProject(),
69 this.classifier.withVmByEmulatedJit(), true));
71 return VMHelpers.<VMLibraryTask>resolveProjectTasks(
72 VMLibraryTask.class, task.getProject(),
73 VMHelpers.runClassTasks(this.task.getProject(),
74 this.classifier, true));