Remove clashing error prefix; Use better name for RatufaCoat ROMs.
[SquirrelJME.git] / buildSrc / src / main / java / cc / squirreljme / plugin / multivm / RatufaCoatBuiltInTask.java
blobfa3f39e6ffc20109701fdf0c97f06df978945d74
1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // Multi-Phasic Applications: 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.nio.file.Path;
14 import javax.inject.Inject;
15 import lombok.Getter;
16 import org.gradle.api.DefaultTask;
17 import org.gradle.api.provider.Provider;
19 /**
20 * This task is used to generate a built-in RatufaCoat ROm.
22 * @since 2021/02/25
24 public class RatufaCoatBuiltInTask
25 extends DefaultTask
26 implements VMBaseTask
28 /** The classifier used. */
29 @Getter
30 private final SourceTargetClassifier classifier;
32 /**
33 * Initializes the full suite task.
35 * @param __classifier The classifier used.
36 * @param __romTask The task used to create the ROM.
37 * @throws NullPointerException On null arguments.
38 * @since 2021/02/25
40 @Inject
41 public RatufaCoatBuiltInTask(SourceTargetClassifier __classifier,
42 VMRomTask __romTask)
43 throws NullPointerException
45 if (__classifier == null || __romTask == null)
46 throw new NullPointerException("NARG");
48 this.classifier = __classifier;
50 // Set details of this task
51 this.setGroup("squirreljmeGeneral");
52 this.setDescription("Builds the combined ROM.");
54 // Depends on the ROM being built
55 this.dependsOn(__romTask);
57 // The inputs are the ROM task's output
58 this.getInputs().file(this.inputPath(__romTask));
60 // And the output is a primary single file for the ROM
61 this.getOutputs().file(this.outputPath());
63 // Actual running of everything
64 this.doLast(new RatufaCoatBuiltInTaskAction(__classifier));
67 /**
68 * Returns the input path to use for this task.
70 * @param __romTask The ROM task.
71 * @return The output of the task, used for input.
72 * @since 2021/02/25
74 private Provider<Path> inputPath(VMRomTask __romTask)
76 return this.getProject().provider(() -> __romTask.getOutputs()
77 .getFiles().getSingleFile().toPath());
80 /**
81 * Returns the output path of the C file.
83 * @return The output path.
84 * @since 2021/02/25
86 public final Provider<Path> outputPath()
88 return this.getProject().provider(() -> this.getProject().getRootDir()
89 .toPath().resolve("ratufacoat").resolve("build")
90 .resolve(TaskInitialization.task(
91 "builtin", this.classifier) + ".c"));