Workaround for getting tests to work.
[SquirrelJME.git] / buildSrc / src / main / java / cc / squirreljme / plugin / multivm / TaskInitialization.java
blob2ff3022824fbc0b3b47ebabb3725c42181f5871f
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 cc.squirreljme.plugin.SquirrelJMEPluginConfiguration;
13 import cc.squirreljme.plugin.general.UpdateFossilJavaDoc;
14 import cc.squirreljme.plugin.multivm.ident.SourceTargetClassifier;
15 import cc.squirreljme.plugin.tasks.AdditionalManifestPropertiesTask;
16 import cc.squirreljme.plugin.tasks.GenerateTestsListTask;
17 import cc.squirreljme.plugin.tasks.JasminAssembleTask;
18 import cc.squirreljme.plugin.tasks.MimeDecodeResourcesTask;
19 import cc.squirreljme.plugin.tasks.TestsJarTask;
20 import java.io.File;
21 import java.nio.file.Path;
22 import java.util.ArrayList;
23 import java.util.Iterator;
24 import java.util.LinkedHashMap;
25 import java.util.List;
26 import java.util.Map;
27 import org.gradle.api.GradleException;
28 import org.gradle.api.Project;
29 import org.gradle.api.Task;
30 import org.gradle.api.UnknownDomainObjectException;
31 import org.gradle.api.file.FileCollection;
32 import org.gradle.api.internal.AbstractTask;
33 import org.gradle.api.plugins.JavaPluginConvention;
34 import org.gradle.api.provider.Provider;
35 import org.gradle.api.tasks.SourceSet;
36 import org.gradle.api.tasks.TaskContainer;
37 import org.gradle.api.tasks.bundling.AbstractArchiveTask;
38 import org.gradle.api.tasks.javadoc.Javadoc;
39 import org.gradle.api.tasks.testing.Test;
40 import org.gradle.external.javadoc.CoreJavadocOptions;
41 import org.gradle.external.javadoc.MinimalJavadocOptions;
42 import org.gradle.jvm.tasks.Jar;
44 /**
45 * This is used to initialize the Gradle tasks for projects accordingly.
47 * @since 2020/08/07
49 public final class TaskInitialization
51 /** Use legacy testing? */
52 public static final boolean LEGACY_TEST_FRAMEWORK =
53 Boolean.getBoolean("squirreljme.test.legacy");
55 /** Source sets that are used. */
56 private static final String[] _SOURCE_SETS =
57 new String[]{SourceSet.MAIN_SOURCE_SET_NAME,
58 VMHelpers.TEST_FIXTURES_SOURCE_SET_NAME,
59 SourceSet.TEST_SOURCE_SET_NAME};
61 /**
62 * Not used.
64 * @since 2020/08/07
66 private TaskInitialization()
70 /**
71 * Initializes the project for the tasks and such
73 * @param __project The project to initialize for.
74 * @throws NullPointerException On null arguments.
75 * @since 2020/08/07
77 public static void initialize(Project __project)
78 throws NullPointerException
80 if (__project == null)
81 throw new NullPointerException("NARG");
83 // Disable the test task, since it is non-functional
84 // However this might fail
85 try
87 __project.getTasks().replace("test", DefunctTestTask.class);
89 catch (IllegalStateException|GradleException e)
91 __project.getLogger().debug("Could not defunct test task.", e);
94 Task check = __project.getTasks().getByName("check");
95 for (Iterator<Object> it = check.getDependsOn().iterator();
96 it.hasNext();)
98 // Get the root item, if a provider of one
99 Object item = it.next();
100 if (item instanceof Provider)
101 item = ((Provider<?>)item).get();
103 // Only consider tasks
104 if (!(item instanceof Task))
105 continue;
107 // Remove the test task, since we do not want it to run here
108 if ("test".equals(((Task)item).getName()))
109 it.remove();
112 // Initialize or both main classes and such
113 for (String sourceSet : TaskInitialization._SOURCE_SETS)
114 TaskInitialization.initialize(__project, sourceSet);
118 * Initializes the source set for the given project.
120 * @param __project The project to initialize for.
121 * @param __sourceSet The source set to be initialized.
122 * @throws NullPointerException On null arguments.
123 * @since 2020/08/07
125 public static void initialize(Project __project, String __sourceSet)
126 throws NullPointerException
128 if (__project == null || __sourceSet == null)
129 throw new NullPointerException("NARG");
131 // Used for Jasmin and Mime Decoding tasks
132 Task processResources = __project.getTasks()
133 .getByName(TaskInitialization.task(
134 "process", __sourceSet, "resources"));
136 // Make sure process resources is run after any cleans so output is
137 // not destroyed after it is processed
138 Task clean = __project.getTasks().getByName("clean");
139 processResources.mustRunAfter(clean);
141 // Generate the list of tests that are available (only tests)
142 if (__sourceSet.equals(SourceSet.TEST_SOURCE_SET_NAME))
143 __project.getTasks().create("generateTestsList",
144 GenerateTestsListTask.class,
145 processResources, clean);
147 // The current Jar Task
148 String jarTaskName = TaskInitialization.task(
149 "", __sourceSet, "jar");
150 Jar jarTask = (Jar)__project.getTasks()
151 .findByName(jarTaskName);
153 // We need to know how to make the classes
154 Task classes = __project.getTasks()
155 .getByName(TaskInitialization.task(
156 "", __sourceSet, "classes"));
158 // If it does not exist, create it
159 if (jarTask == null)
160 jarTask = (Jar)__project.getTasks()
161 .create("testJar", TestsJarTask.class,
162 classes, processResources);
164 // Correct name of the Jar archive
165 String normalJarName;
166 if (__sourceSet.equals(SourceSet.MAIN_SOURCE_SET_NAME))
167 normalJarName = __project.getName() + ".jar";
168 else
169 normalJarName = __project.getName() + "-" + __sourceSet + ".jar";
170 jarTask.getArchiveFileName().set(normalJarName);
172 // Jasmin assembling
173 __project.getTasks().create(TaskInitialization.task(
174 "assemble", __sourceSet, "jasmin"),
175 JasminAssembleTask.class,
176 __sourceSet, processResources, clean);
178 // Mime Decoding
179 __project.getTasks().create(TaskInitialization.task(
180 "mimeDecode", __sourceSet, "resources"),
181 MimeDecodeResourcesTask.class,
182 __sourceSet, processResources, clean);
184 // Add SquirrelJME properties to the manifest
185 __project.getTasks().create(TaskInitialization.task(
186 "additional", __sourceSet, "jarProperties"),
187 AdditionalManifestPropertiesTask.class,
188 jarTask, processResources, __sourceSet, clean);
190 // Initialize for each VM
191 for (VMType vmType : VMType.values())
192 TaskInitialization.initialize(__project, __sourceSet, vmType);
196 * Initializes the virtual machine for the given project's sourceset.
198 * @param __project The project to initialize for.
199 * @param __sourceSet The source set.
200 * @param __vmType The virtual machine type.
201 * @throws NullPointerException On null arguments.
202 * @since 2020/08/07
204 public static void initialize(Project __project, String __sourceSet,
205 VMSpecifier __vmType)
206 throws NullPointerException
208 if (__project == null || __sourceSet == null || __vmType == null)
209 throw new NullPointerException("NARG");
211 for (ClutterLevel clutterLevel : ClutterLevel.values())
212 for (BangletVariant variant : __vmType.banglets())
213 TaskInitialization.initialize(__project,
214 new SourceTargetClassifier(__sourceSet, __vmType, variant,
215 clutterLevel));
219 * Initializes the virtual machine for the given project's sourceset.
221 * @param __project The project to initialize for.
222 * @param __classifier The classifier used.
223 * @throws NullPointerException On null arguments.
224 * @since 2020/08/07
226 public static void initialize(Project __project,
227 SourceTargetClassifier __classifier)
228 throws NullPointerException
230 if (__project == null || __classifier == null)
231 throw new NullPointerException("NARG");
233 // Everything will be working on these tasks
234 TaskContainer tasks = __project.getTasks();
236 // Make sure the source set exists first
239 __project.getConvention().getPlugin(JavaPluginConvention.class)
240 .getSourceSets().getByName(__classifier.getSourceSet());
242 catch (UnknownDomainObjectException e)
244 __project.getLogger().debug(String.format(
245 "Could not find sourceSet %s in project %s (available: %s)",
246 __classifier.getSourceSet(), __project.getPath(),
247 new ArrayList<>(
248 __project.getConvention()
249 .getPlugin(JavaPluginConvention.class).getSourceSets())),
253 // The source library task depends on whether we are debugging or not
254 Jar sourceJar = VMHelpers.jarTask(__project,
255 __classifier.getSourceSet());
256 AbstractTask usedSourceJar;
258 // If we are debugging, then we keep everything... otherwise we just
259 // strip everything out that we can to minimize the size as much as
260 // possible...
261 // Or it is just disabled completely
262 if (__classifier.getTargetClassifier().getClutterLevel().isDebug())
263 usedSourceJar = sourceJar;
265 // Otherwise set up a new task to compact the Jar and remove any
266 // debugging information and unneeded symbols for execution.
267 else
269 // Look for that task first
270 String checkName = TaskInitialization.task("compactLib",
271 __classifier.getSourceSet());
272 AbstractTask maybe = (AbstractTask)tasks.findByName(checkName);
274 // If it exists, use that one
275 if (maybe != null)
276 usedSourceJar = maybe;
278 // Otherwise, create it
279 else
281 usedSourceJar = tasks.create(checkName,
282 VMCompactLibraryTask.class, __classifier.getSourceSet(),
283 sourceJar);
287 // Library that needs to be constructed so execution happens properly
288 VMLibraryTask libTask = tasks.create(
289 TaskInitialization.task("lib", __classifier),
290 VMLibraryTask.class, __classifier, usedSourceJar);
292 // Is dumping available?
293 if (__classifier.getVmType().hasDumping())
294 tasks.create(
295 TaskInitialization.task("dump", __classifier),
296 VMDumpLibraryTask.class, __classifier, libTask);
298 // Running the target
299 if (__classifier.isMainSourceSet())
300 tasks.create(
301 TaskInitialization.task("run", __classifier),
302 VMRunTask.class, __classifier, libTask);
304 // Testing the target
305 else if (__classifier.isTestSourceSet())
307 Task vmTest;
308 String taskName = TaskInitialization.task("test",
309 __classifier);
311 // Creating the legacy or modern test task? Using the modern one
312 // is recommended if using IntelliJ or otherwise...
313 if (TaskInitialization.LEGACY_TEST_FRAMEWORK)
314 vmTest = tasks.create(taskName,
315 VMLegacyTestTask.class, __classifier, libTask);
316 else
317 vmTest = tasks.create(taskName,
318 VMModernTestTask.class, __classifier, libTask);
320 // Make the standard test task depend on these two VM tasks
321 // so that way if it is run, both are run accordingly
322 if (__classifier.getVmType().isGoldTest())
324 Test test = (Test)__project.getTasks().getByName("test");
326 // Test needs this
327 test.dependsOn(vmTest);
329 // Gradle will think these are JUnit tests and then fail
330 // so exclude everything
331 test.setScanForTestClasses(false);
332 test.include();
333 test.exclude("**");
339 * Initializes the task which puts the entire Markdown documentation into
340 * Fossil's versioned space.
342 * @param __project The project to initialize for.
343 * @param __javaDoc The JavaDoc Task.
344 * @throws NullPointerException On null arguments.
345 * @since 2022/08/29
347 public static void initializeFossilMarkdownTask(Project __project,
348 Javadoc __javaDoc)
349 throws NullPointerException
351 if (__project == null || __javaDoc == null)
352 throw new NullPointerException("NARG");
354 // Find existing task, create if it does not yet exist
355 UpdateFossilJavaDoc task = (UpdateFossilJavaDoc)__project.getTasks()
356 .findByName("updateFossilJavaDoc");
357 if (task == null)
358 task = (UpdateFossilJavaDoc)__project.getTasks()
359 .create("updateFossilJavaDoc", UpdateFossilJavaDoc.class);
361 // Add dependency to the task for later usage
362 task.dependsOn(__javaDoc);
366 * Initializes the full-suite run which selects every API and library
367 * module available, along with allowing an external 3rd library classpath
368 * launching.
370 * @param __project The root project.
371 * @throws NullPointerException On null arguments.
372 * @since 2020/10/17
374 public static void initializeFullSuiteTask(Project __project)
375 throws NullPointerException
377 if (__project == null)
378 throw new NullPointerException("NARG");
380 for (ClutterLevel clutterLevel : ClutterLevel.values())
381 for (VMType vmType : VMType.values())
382 for (BangletVariant variant : vmType.banglets())
383 for (String sourceSet : TaskInitialization._SOURCE_SETS)
384 TaskInitialization.initializeFullSuiteTask(__project,
385 new SourceTargetClassifier(sourceSet, vmType,
386 variant, clutterLevel));
390 * Initializes the full-suite run which selects every API and library
391 * module available, along with allowing an external 3rd library classpath
392 * launching.
394 * @param __project The root project.
395 * @param __classifier The classifier used.
396 * @throws NullPointerException On null arguments.
397 * @since 2020/10/17
399 private static void initializeFullSuiteTask(Project __project,
400 SourceTargetClassifier __classifier)
401 throws NullPointerException
403 if (__project == null || __classifier == null)
404 throw new NullPointerException("NARG");
406 // Standard ROM
407 __project.getTasks().create(
408 TaskInitialization.task("full", __classifier),
409 VMFullSuite.class, __classifier);
413 * Late initialization step.
415 * @param __project The project to initialize.
416 * @throws NullPointerException On null arguments.
417 * @since 2022/08/29
419 public static void lateInitialize(Project __project)
420 throws NullPointerException
422 if (__project == null)
423 throw new NullPointerException("NARG");
425 // Configuration, for modifiers
426 SquirrelJMEPluginConfiguration squirreljmeConf =
427 SquirrelJMEPluginConfiguration.configuration(__project);
429 // We need to evaluate the Doclet project first since we need
430 // the Jar task, which if we use normal evaluation does not exist
431 // yet...
432 Project docletProject =
433 __project.evaluationDependsOn(":tools:markdown-javadoc");
435 // Setup task for creating JavaDoc
436 Javadoc mdJavaDoc = __project.getTasks()
437 .create("markdownJavaDoc", Javadoc.class);
439 // What does this do?
440 mdJavaDoc.setGroup("squirreljme");
441 mdJavaDoc.setDescription("Generates Markdown JavaDoc.");
443 // This has a hard dependency and we do not want to get out of order
444 mdJavaDoc.mustRunAfter(
445 docletProject.getTasks().getByName("clean"),
446 docletProject.getTasks().getByName("jar"));
448 // We are using a specific classpath, in this case it is just
449 // SpringCoat's libraries for runtime
450 SourceTargetClassifier classifier = new SourceTargetClassifier(
451 SourceSet.MAIN_SOURCE_SET_NAME, VMType.SPRINGCOAT,
452 BangletVariant.NONE, ClutterLevel.DEBUG);
453 FileCollection useClassPath = __project.files(
454 (Object[])VMHelpers.runClassPath(__project,
455 classifier));
457 // We need to know how to make the classes
458 Task classes = __project.getTasks().getByName(TaskInitialization.task(
459 "", SourceSet.MAIN_SOURCE_SET_NAME, "classes"));
461 // Where do we find the JAR?
462 Provider<Task> jarProvider = __project.provider(() ->
463 __project.getRootProject().findProject(
464 ":tools:markdown-javadoc").getTasks().getByName("shadowJar"));
466 // SpringCoat related tasks
467 Provider<Iterable<Task>> springCoatTasks = __project.provider(() ->
468 VMHelpers.<Task>resolveProjectTasks(
469 Task.class, __project, VMHelpers.runClassTasks(__project,
470 classifier)));
472 // Classes need to compile first, and we need the doclet Jar too
473 // However we do not know it exists yet
474 mdJavaDoc.dependsOn(classes);
475 mdJavaDoc.dependsOn(springCoatTasks);
476 mdJavaDoc.dependsOn(jarProvider);
478 // We also need to depend on other markdownJavaDoc tasks of our
479 // dependencies... this is so we can do cross-project links with
480 // our JavaDoc generation
481 mdJavaDoc.dependsOn(__project.provider(() -> {
482 Map<String, Javadoc> result = new LinkedHashMap<>();
484 for (Task task : springCoatTasks.get()) {
485 // Ignore our own project, otherwise recursive!
486 Project subProject = task.getProject();
487 if (subProject.equals(__project))
488 continue;
490 // Only refer to projects once
491 String subName = subProject.getPath();
492 if (!result.containsKey(subName))
493 result.put(subName,
494 (Javadoc)subProject.getTasks()
495 .getByName("markdownJavaDoc"));
498 return result.values();
499 }));
501 // Where are the sources?
502 SourceSet sourceSet = __project.getConvention().getPlugin(
503 JavaPluginConvention.class).getSourceSets().getByName(
504 SourceSet.MAIN_SOURCE_SET_NAME);
506 // Configure the JavaDoc task
507 mdJavaDoc.setDestinationDir(TaskInitialization.markdownPath(__project)
508 .toFile());
509 mdJavaDoc.source(sourceSet.getAllJava());
510 mdJavaDoc.setClasspath(useClassPath);
511 mdJavaDoc.setTitle(squirreljmeConf.swmName);
513 // Determine the paths where all markdown JavaDocs are being stored
514 List<Path> projectPaths = new ArrayList<>();
515 for (Project subProject : __project.getRootProject().getAllprojects())
517 // Only consider SquirrelJME projects
518 if (null ==
519 SquirrelJMEPluginConfiguration.configurationOrNull(subProject))
520 continue;
522 // We just store this here, since we do not know what exists
523 // and does not exist
524 projectPaths.add(TaskInitialization.markdownPath(subProject));
527 // Setup more advanced options
528 mdJavaDoc.options((MinimalJavadocOptions __options) ->
530 // We need to set the bootstrap class path otherwise
531 // we will get derivations from whatever JDK the system
532 // is using, and we definitely do not want that.
533 __options.bootClasspath(useClassPath.getFiles()
534 .toArray(new File[0]));
536 // We get this by forcing evaluation
537 Task mdJavaDocletJar = jarProvider.get();
539 // Set other options
540 __options.showFromProtected();
541 __options.encoding("utf-8");
542 __options.locale("en_US");
543 __options.docletpath(mdJavaDocletJar.getOutputs()
544 .getFiles().getSingleFile());
545 __options.doclet(
546 "cc.squirreljme.doclet.MarkdownDoclet");
548 // Used for completion counting
549 if (__options instanceof CoreJavadocOptions)
551 CoreJavadocOptions coreOptions =
552 (CoreJavadocOptions)__options;
554 // Where to find our own sources (for TODOs)
555 coreOptions.addStringOption(
556 "squirreljmejavasources",
557 sourceSet.getAllJava().getAsPath());
559 // Directories to all the other markdown JavaDocs
560 coreOptions.addStringOption(
561 "squirreljmeprojectmjd",
562 VMHelpers.classpathAsString(projectPaths));
564 // The name of the project
565 coreOptions.addStringOption(
566 "squirreljmeproject",
567 __project.getName());
571 // Add markdown task
572 TaskInitialization.initializeFossilMarkdownTask(
573 __project.getRootProject(), mdJavaDoc);
577 * Returns the path to the markdown JavaDoc for a project.
579 * @param __project The project to get for.
580 * @return The path to the project's markdown JavaDoc.
581 * @throws NullPointerException On null arguments.
582 * @since 2022/08/29
584 public static Path markdownPath(Project __project)
585 throws NullPointerException
587 if (__project == null)
588 throw new NullPointerException("NARG");
590 return __project.getBuildDir().toPath().resolve("markdownJavaDoc");
594 * Initializes ROM tasks for the given base project.
596 * @param __project The root project.
597 * @throws NullPointerException On null arguments.
598 * @since 2020/08/23
600 public static void romTasks(Project __project)
601 throws NullPointerException
603 if (__project == null)
604 throw new NullPointerException("NARG");
606 // Initialize or both main classes and such
607 for (ClutterLevel clutterLevel : ClutterLevel.values())
608 for (String sourceSet : TaskInitialization._SOURCE_SETS)
609 for (VMType vmType : VMType.values())
610 for (BangletVariant variant : vmType.banglets())
611 TaskInitialization.romTasks(__project,
612 new SourceTargetClassifier(sourceSet, vmType,
613 variant, clutterLevel));
617 * Initializes ROM tasks for the given base project.
619 * @param __project The root project.
620 * @param __classifier The classifier used.
621 * @throws NullPointerException On null arguments.
622 * @since 2020/08/23
624 private static void romTasks(Project __project,
625 SourceTargetClassifier __classifier)
626 throws NullPointerException
628 if (__project == null || __classifier == null)
629 throw new NullPointerException("NARG");
631 // Everything will be working on these tasks
632 TaskContainer tasks = __project.getTasks();
634 // Does the VM utilize ROMs?
635 // Test fixtures are just for testing, so there is no test fixtures
636 // ROM variant...
637 if (__classifier.getVmType()
638 .hasRom(__classifier.getBangletVariant()) &&
639 !__classifier.isTestFixturesSourceSet())
641 String baseName = TaskInitialization.task("rom",
642 __classifier);
643 VMRomTask rom = tasks.create(baseName, VMRomTask.class,
644 __classifier);
646 // Full RatufaCoat Built-In
647 __project.getTasks().create(baseName + "RatufaCoat",
648 RatufaCoatBuiltInTask.class, __classifier, rom);
653 * Builds a name for a task, without the virtual machine type.
655 * @param __name The task name.
656 * @param __sourceSet The source set for the task base.
657 * @return A string representing the task.
658 * @throws NullPointerException On null arguments.
659 * @since 2021/12/19
661 public static String task(String __name, String __sourceSet)
662 throws NullPointerException
664 return TaskInitialization.task(__name, __sourceSet, "");
668 * Builds a name for a task, without the virtual machine type.
670 * @param __name The task name.
671 * @param __sourceSet The source set for the task base.
672 * @param __suffix The task suffix.
673 * @return A string representing the task.
674 * @throws NullPointerException On null arguments.
675 * @since 2022/08/07
677 public static String task(String __name, String __sourceSet,
678 String __suffix)
679 throws NullPointerException
681 if (__name == null || __sourceSet == null || __suffix == null)
682 throw new NullPointerException("NARG");
684 // We need to later determine how the suffix works
685 String baseName;
687 // If this is the main source set, never include the source set as
688 // it becomes implied. Additionally, if the name and the source set
689 // are the same, reduce the confusion so there is no "testTestHosted".
690 if (__sourceSet.equals(SourceSet.MAIN_SOURCE_SET_NAME) ||
691 __sourceSet.equals(__name) || __sourceSet.isEmpty())
692 baseName = __name;
694 // Otherwise, include it
695 else
697 // If just the source set, then just keep that lowercase
698 if (__name.isEmpty())
699 baseName = __sourceSet;
700 else
701 baseName = __name +
702 TaskInitialization.uppercaseFirst(__sourceSet);
705 // If there is no suffix, just return the base
706 if (__suffix.isEmpty())
707 return baseName;
709 // If there is no base, just return the suffix
710 if (baseName.isEmpty())
711 return __suffix;
713 // Otherwise, perform needed capitalization
714 // "additionalJarProperties" or "additionalTestJarProperties"
715 return baseName + TaskInitialization.uppercaseFirst(__suffix);
719 * Builds a name for a task.
721 * @param __name The task name.
722 * @param __sourceSet The source set for the task base.
723 * @param __vmType The type of virtual machine used.
724 * @return A string representing the task.
725 * @throws NullPointerException On null arguments.
726 * @since 2020/08/07
728 public static String task(String __name, String __sourceSet,
729 VMSpecifier __vmType)
730 throws NullPointerException
732 return TaskInitialization.task(__name, __sourceSet, __vmType,
733 BangletVariant.NONE, ClutterLevel.DEBUG);
737 * Initializes the task name.
739 * @param __name The name of the task.
740 * @param __classifier The classifier for the target.
741 * @return The task name.
742 * @throws NullPointerException On null arguments.
743 * @since 2022/10/01
745 public static String task(String __name,
746 SourceTargetClassifier __classifier)
747 throws NullPointerException
749 if (__name == null || __classifier == null)
750 throw new NullPointerException("NARG");
752 return TaskInitialization.task(__name,
753 __classifier.getSourceSet(),
754 __classifier.getTargetClassifier().getVmType(),
755 __classifier.getTargetClassifier().getBangletVariant(),
756 __classifier.getTargetClassifier().getClutterLevel());
760 * Builds a name for a task.
762 * @param __name The task name.
763 * @param __sourceSet The source set for the task base.
764 * @param __vmType The type of virtual machine used.
765 * @param __variant The banglet variant.
766 * @return A string representing the task.
767 * @throws NullPointerException On null arguments.
768 * @since 2022/10/01
770 public static String task(String __name, String __sourceSet,
771 VMSpecifier __vmType, BangletVariant __variant,
772 ClutterLevel __clutterLevel)
773 throws NullPointerException
775 if (__name == null || __sourceSet == null || __vmType == null ||
776 __variant == null || __clutterLevel == null)
777 throw new NullPointerException("NARG");
779 return TaskInitialization.task(__name, __sourceSet) +
780 __vmType.vmName(VMNameFormat.PROPER_NOUN) +
781 TaskInitialization.uppercaseFirst(__variant.properNoun) +
782 TaskInitialization.uppercaseFirst(__clutterLevel.toString());
786 * Uppercases the first character of a string.
788 * @param __input The input string.
789 * @return The string with the first character uppercased.
790 * @throws NullPointerException On null arguments.
791 * @since 2022/08/07
793 public static String uppercaseFirst(String __input)
794 throws NullPointerException
796 if (__input == null)
797 throw new NullPointerException("NARG");
799 if (__input.isEmpty())
800 return __input;
802 return Character.toUpperCase(__input.charAt(0)) +
803 __input.substring(1);