If a test has variants, do not add the base test class because that will just cause...
[SquirrelJME.git] / buildSrc / src / main / java / cc / squirreljme / plugin / multivm / VMRunTask.java
blob5e15bb8db3640a381a89639f920138647dbd6eb3
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 javax.inject.Inject;
13 import lombok.Getter;
14 import org.gradle.api.DefaultTask;
15 import org.gradle.api.tasks.Internal;
17 /**
18 * Used to run the virtual machine.
20 * @since 2020/08/07
22 public class VMRunTask
23 extends DefaultTask
24 implements VMExecutableTask
26 /** The source set used. */
27 @Internal
28 @Getter
29 protected final String sourceSet;
31 /** The virtual machine type. */
32 @Internal
33 @Getter
34 protected final VMSpecifier vmType;
36 /**
37 * Initializes the task.
39 * @param __sourceSet The source set to use.
40 * @param __vmType The virtual machine type.
41 * @param __libTask The task used to create libraries, this may be directly
42 * depended upon.
43 * @since 2020/08/07
45 @Inject
46 public VMRunTask(String __sourceSet,
47 VMSpecifier __vmType, VMLibraryTask __libTask)
48 throws NullPointerException
50 if (__sourceSet == null || __vmType == null || __libTask == null)
51 throw new NullPointerException("NARG");
53 // These are used when running
54 this.sourceSet = __sourceSet;
55 this.vmType = __vmType;
57 // Set details of this task
58 this.setGroup("squirreljme");
59 this.setDescription("Executes the program to start running it.");
61 // This task depends on the various VM libraries of this class
62 // depending on the dependencies along with the emulator being
63 // available as well
64 this.dependsOn(this.getProject().provider(
65 new VMRunDependencies(this, __sourceSet, __vmType)),
66 new VMEmulatorDependencies(this, __vmType));
68 // Only run if entry points are valid
69 this.onlyIf(new CheckForEntryPoints());
71 // Performs the action of the task
72 this.doLast(new VMRunTaskAction(__sourceSet, __vmType));