Indentations break the feed.
[SquirrelJME.git] / buildSrc / src / main / java / cc / squirreljme / plugin / multivm / VMRunDependencies.java
bloba8582be91d1d0deb1709bc874f81b925e962c2cc
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 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.util.concurrent.Callable;
14 import org.gradle.api.Project;
16 /**
17 * This is the set of dependencies for {@link VMRunTask} which takes all
18 * the dependencies directly needed in order to run the program.
20 * If the virtual machine is {@link VMSpecifier#hasEmulatorJit()} then
21 * SpringCoat libraries will be used instead of the ROM libraries for running.
23 * @since 2020/08/15
25 public final class VMRunDependencies
26 implements Callable<Iterable<VMLibraryTask>>
28 /** The project executing under. */
29 protected final Project project;
31 /** The classifier used. */
32 protected final SourceTargetClassifier classifier;
34 /**
35 * Initializes the provider.
37 * @param __project The project working under.
38 * @param __classifier The classifier used.
39 * @throws NullPointerException On null arguments.
40 * @since 2020/08/15
42 public VMRunDependencies(Project __project,
43 SourceTargetClassifier __classifier)
44 throws NullPointerException
46 if (__project == null || __classifier == null)
47 throw new NullPointerException("NARG");
49 this.project = __project;
50 this.classifier = __classifier;
53 /**
54 * {@inheritDoc}
55 * @since 2020/08/15
57 @Override
58 public final Iterable<VMLibraryTask> call()
60 Project project = this.project;
62 // If this is emulator that is JIT capable, instead for running
63 // load it with SpringCoat's library instead
64 boolean emuJit = this.classifier.getTargetClassifier().getVmType()
65 .hasEmulatorJit();
66 if (emuJit)
67 return VMHelpers.<VMLibraryTask>resolveProjectTasks(
68 VMLibraryTask.class, project,
69 VMHelpers.runClassTasks(project,
70 this.classifier.withVmByEmulatedJit(), true));
72 return VMHelpers.<VMLibraryTask>resolveProjectTasks(
73 VMLibraryTask.class, project,
74 VMHelpers.runClassTasks(project,
75 this.classifier, true));