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 cc
.squirreljme
.plugin
.multivm
.ident
.SourceTargetClassifier
;
13 import javax
.inject
.Inject
;
15 import org
.gradle
.api
.DefaultTask
;
16 import org
.gradle
.api
.tasks
.Internal
;
19 * Used to run the virtual machine.
23 public class VMRunTask
25 implements VMBaseTask
, VMExecutableTask
27 /** The classifier used. */
30 protected final SourceTargetClassifier classifier
;
33 * Initializes the task.
35 * @param __classifier The classifier used.
36 * @param __libTask The task used to create libraries, this may be directly
41 public VMRunTask(SourceTargetClassifier __classifier
,
42 VMLibraryTask __libTask
)
43 throws NullPointerException
45 if (__classifier
== null || __libTask
== null)
46 throw new NullPointerException("NARG");
48 // These are used when running
49 this.classifier
= __classifier
;
51 // Set details of this task
52 this.setGroup("squirreljme");
53 this.setDescription("Executes the program to start running it.");
55 // This task depends on the various VM libraries of this class
56 // depending on the dependencies along with the emulator being
58 this.dependsOn(this.getProject().provider(
59 new VMRunDependencies(this, __classifier
)),
60 new VMEmulatorDependencies(this,
61 __classifier
.getTargetClassifier()));
63 // Only run if entry points are valid
64 this.onlyIf(new CheckForEntryPoints());
66 // Performs the action of the task
67 this.doLast(new VMRunTaskAction(__classifier
));