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 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
;
14 import org
.gradle
.api
.DefaultTask
;
15 import org
.gradle
.api
.tasks
.Internal
;
18 * Used to run the virtual machine.
22 public class VMRunTask
24 implements VMExecutableTask
26 /** The source set used. */
29 protected final String sourceSet
;
31 /** The virtual machine type. */
34 protected final VMSpecifier vmType
;
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
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
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
));