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
.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
;
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
;
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
;
45 * This is used to initialize the Gradle tasks for projects accordingly.
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
};
66 private TaskInitialization()
71 * Initializes the project for the tasks and such
73 * @param __project The project to initialize for.
74 * @throws NullPointerException On null arguments.
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
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();
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
))
107 // Remove the test task, since we do not want it to run here
108 if ("test".equals(((Task
)item
).getName()))
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.
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
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";
169 normalJarName
= __project
.getName() + "-" + __sourceSet
+ ".jar";
170 jarTask
.getArchiveFileName().set(normalJarName
);
173 __project
.getTasks().create(TaskInitialization
.task(
174 "assemble", __sourceSet
, "jasmin"),
175 JasminAssembleTask
.class,
176 __sourceSet
, processResources
, clean
);
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.
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())
213 // Only allow debug targets for this?
214 if (__vmType
.allowOnlyDebug() && !clutterLevel
.isDebug())
218 for (BangletVariant variant
: __vmType
.banglets())
219 TaskInitialization
.initialize(__project
,
220 new SourceTargetClassifier(__sourceSet
, __vmType
, variant
,
226 * Initializes the virtual machine for the given project's sourceset.
228 * @param __project The project to initialize for.
229 * @param __classifier The classifier used.
230 * @throws NullPointerException On null arguments.
233 public static void initialize(Project __project
,
234 SourceTargetClassifier __classifier
)
235 throws NullPointerException
237 if (__project
== null || __classifier
== null)
238 throw new NullPointerException("NARG");
240 // Everything will be working on these tasks
241 TaskContainer tasks
= __project
.getTasks();
243 // Make sure the source set exists first
246 __project
.getConvention().getPlugin(JavaPluginConvention
.class)
247 .getSourceSets().getByName(__classifier
.getSourceSet());
249 catch (UnknownDomainObjectException e
)
251 __project
.getLogger().debug(String
.format(
252 "Could not find sourceSet %s in project %s (available: %s)",
253 __classifier
.getSourceSet(), __project
.getPath(),
255 __project
.getConvention()
256 .getPlugin(JavaPluginConvention
.class).getSourceSets())),
260 // The source library task depends on whether we are debugging or not
261 Jar sourceJar
= VMHelpers
.jarTask(__project
,
262 __classifier
.getSourceSet());
263 AbstractTask usedSourceJar
;
265 // If we are debugging, then we keep everything... otherwise we just
266 // strip everything out that we can to minimize the size as much as
268 // Or it is just disabled completely
269 if (__classifier
.getTargetClassifier().getClutterLevel().isDebug())
270 usedSourceJar
= sourceJar
;
272 // Otherwise set up a new task to compact the Jar and remove any
273 // debugging information and unneeded symbols for execution.
276 // Look for that task first
277 String checkName
= TaskInitialization
.task("compactLib",
278 __classifier
.getSourceSet());
279 AbstractTask maybe
= (AbstractTask
)tasks
.findByName(checkName
);
281 // If it exists, use that one
283 usedSourceJar
= maybe
;
285 // Otherwise, create it
288 usedSourceJar
= tasks
.create(checkName
,
289 VMCompactLibraryTask
.class, __classifier
.getSourceSet(),
294 // Library that needs to be constructed so execution happens properly
295 VMLibraryTask libTask
= tasks
.create(
296 TaskInitialization
.task("lib", __classifier
),
297 VMLibraryTask
.class, __classifier
, usedSourceJar
);
299 // Is dumping available?
300 if (__classifier
.getVmType().hasDumping())
302 TaskInitialization
.task("dump", __classifier
),
303 VMDumpLibraryTask
.class, __classifier
, libTask
);
305 // Running the target
306 if (__classifier
.isMainSourceSet())
308 TaskInitialization
.task("run", __classifier
),
309 VMRunTask
.class, __classifier
, libTask
);
311 // Testing the target
312 else if (__classifier
.isTestSourceSet())
315 String taskName
= TaskInitialization
.task("test",
318 // Creating the legacy or modern test task? Using the modern one
319 // is recommended if using IntelliJ or otherwise...
320 if (TaskInitialization
.LEGACY_TEST_FRAMEWORK
)
321 vmTest
= tasks
.create(taskName
,
322 VMLegacyTestTask
.class, __classifier
, libTask
);
324 vmTest
= tasks
.create(taskName
,
325 VMModernTestTask
.class, __classifier
, libTask
);
327 // Since there is a release and debug variant, have the base test
328 // refer to both of these
329 String bothName
= TaskInitialization
.task("test",
330 __classifier
.getSourceSet(),
331 __classifier
.getVmType(), __classifier
.getBangletVariant(),
334 // If the task is missing, create it
335 Test bothTest
= (Test
)__project
.getTasks().findByName(bothName
);
336 if (bothTest
== null)
338 // Create a test task, so IDEs like IntelliJ can pick this up
339 // despite there being no actual tests that exist
340 bothTest
= __project
.getTasks().create(bothName
, Test
.class);
342 // Setup description of these
343 bothTest
.setGroup("squirreljme");
345 // Make sure the description makes sense
346 if (__classifier
.getVmType().allowOnlyDebug())
347 bothTest
.setDescription(String
.format("Alias for %s.",
350 bothTest
.setDescription(
351 String
.format("Runs both test tasks %s and %s.",
352 taskName
, TaskInitialization
.task("test",
353 __classifier
.withClutterLevel(__classifier
354 .getTargetClassifier().getClutterLevel()
357 // Gradle will think these are JUnit tests and then fail
358 // so exclude everything
359 bothTest
.setScanForTestClasses(false);
361 bothTest
.exclude("**");
364 // Add to the both task as a dependency
365 bothTest
.dependsOn(vmTest
);
367 // Make the standard test task depend on these two VM tasks
368 // so that way if it is run, both are run accordingly
369 if (__classifier
.getVmType().isGoldTest())
371 Test test
= (Test
)__project
.getTasks().getByName("test");
374 test
.dependsOn(vmTest
);
376 // Gradle will think these are JUnit tests and then fail
377 // so exclude everything
378 test
.setScanForTestClasses(false);
386 * Initializes the task which puts the entire Markdown documentation into
387 * Fossil's versioned space.
389 * @param __project The project to initialize for.
390 * @param __javaDoc The JavaDoc Task.
391 * @throws NullPointerException On null arguments.
394 public static void initializeFossilMarkdownTask(Project __project
,
396 throws NullPointerException
398 if (__project
== null || __javaDoc
== null)
399 throw new NullPointerException("NARG");
401 // Find existing task, create if it does not yet exist
402 UpdateFossilJavaDoc task
= (UpdateFossilJavaDoc
)__project
.getTasks()
403 .findByName("updateFossilJavaDoc");
405 task
= (UpdateFossilJavaDoc
)__project
.getTasks()
406 .create("updateFossilJavaDoc", UpdateFossilJavaDoc
.class);
408 // Add dependency to the task for later usage
409 task
.dependsOn(__javaDoc
);
413 * Initializes the full-suite run which selects every API and library
414 * module available, along with allowing an external 3rd library classpath
417 * @param __project The root project.
418 * @throws NullPointerException On null arguments.
421 public static void initializeFullSuiteTask(Project __project
)
422 throws NullPointerException
424 if (__project
== null)
425 throw new NullPointerException("NARG");
427 for (ClutterLevel clutterLevel
: ClutterLevel
.values())
428 for (VMType vmType
: VMType
.values())
429 for (BangletVariant variant
: vmType
.banglets())
430 for (String sourceSet
: TaskInitialization
._SOURCE_SETS
)
431 TaskInitialization
.initializeFullSuiteTask(__project
,
432 new SourceTargetClassifier(sourceSet
, vmType
,
433 variant
, clutterLevel
));
437 * Initializes the full-suite run which selects every API and library
438 * module available, along with allowing an external 3rd library classpath
441 * @param __project The root project.
442 * @param __classifier The classifier used.
443 * @throws NullPointerException On null arguments.
446 private static void initializeFullSuiteTask(Project __project
,
447 SourceTargetClassifier __classifier
)
448 throws NullPointerException
450 if (__project
== null || __classifier
== null)
451 throw new NullPointerException("NARG");
454 __project
.getTasks().create(
455 TaskInitialization
.task("full", __classifier
),
456 VMFullSuite
.class, __classifier
);
460 * Late initialization step.
462 * @param __project The project to initialize.
463 * @throws NullPointerException On null arguments.
466 public static void lateInitialize(Project __project
)
467 throws NullPointerException
469 if (__project
== null)
470 throw new NullPointerException("NARG");
472 // Configuration, for modifiers
473 SquirrelJMEPluginConfiguration squirreljmeConf
=
474 SquirrelJMEPluginConfiguration
.configuration(__project
);
476 // We need to evaluate the Doclet project first since we need
477 // the Jar task, which if we use normal evaluation does not exist
479 Project docletProject
=
480 __project
.evaluationDependsOn(":tools:markdown-javadoc");
482 // Setup task for creating JavaDoc
483 Javadoc mdJavaDoc
= __project
.getTasks()
484 .create("markdownJavaDoc", Javadoc
.class);
486 // What does this do?
487 mdJavaDoc
.setGroup("squirreljme");
488 mdJavaDoc
.setDescription("Generates Markdown JavaDoc.");
490 // This has a hard dependency and we do not want to get out of order
491 mdJavaDoc
.mustRunAfter(
492 docletProject
.getTasks().getByName("clean"),
493 docletProject
.getTasks().getByName("jar"));
495 // We are using a specific classpath, in this case it is just
496 // SpringCoat's libraries for runtime
497 SourceTargetClassifier classifier
= new SourceTargetClassifier(
498 SourceSet
.MAIN_SOURCE_SET_NAME
, VMType
.SPRINGCOAT
,
499 BangletVariant
.NONE
, ClutterLevel
.DEBUG
);
500 FileCollection useClassPath
= __project
.files(
501 (Object
[])VMHelpers
.runClassPath(__project
,
504 // We need to know how to make the classes
505 Task classes
= __project
.getTasks().getByName(TaskInitialization
.task(
506 "", SourceSet
.MAIN_SOURCE_SET_NAME
, "classes"));
508 // Where do we find the JAR?
509 Provider
<Task
> jarProvider
= __project
.provider(() ->
510 __project
.getRootProject().findProject(
511 ":tools:markdown-javadoc").getTasks().getByName("shadowJar"));
513 // SpringCoat related tasks
514 Provider
<Iterable
<Task
>> springCoatTasks
= __project
.provider(() ->
515 VMHelpers
.<Task
>resolveProjectTasks(
516 Task
.class, __project
, VMHelpers
.runClassTasks(__project
,
519 // Classes need to compile first, and we need the doclet Jar too
520 // However we do not know it exists yet
521 mdJavaDoc
.dependsOn(classes
);
522 mdJavaDoc
.dependsOn(springCoatTasks
);
523 mdJavaDoc
.dependsOn(jarProvider
);
525 // We also need to depend on other markdownJavaDoc tasks of our
526 // dependencies... this is so we can do cross-project links with
527 // our JavaDoc generation
528 mdJavaDoc
.dependsOn(__project
.provider(() -> {
529 Map
<String
, Javadoc
> result
= new LinkedHashMap
<>();
531 for (Task task
: springCoatTasks
.get()) {
532 // Ignore our own project, otherwise recursive!
533 Project subProject
= task
.getProject();
534 if (subProject
.equals(__project
))
537 // Only refer to projects once
538 String subName
= subProject
.getPath();
539 if (!result
.containsKey(subName
))
541 (Javadoc
)subProject
.getTasks()
542 .getByName("markdownJavaDoc"));
545 return result
.values();
548 // Where are the sources?
549 SourceSet sourceSet
= __project
.getConvention().getPlugin(
550 JavaPluginConvention
.class).getSourceSets().getByName(
551 SourceSet
.MAIN_SOURCE_SET_NAME
);
553 // Configure the JavaDoc task
554 mdJavaDoc
.setDestinationDir(TaskInitialization
.markdownPath(__project
)
556 mdJavaDoc
.source(sourceSet
.getAllJava());
557 mdJavaDoc
.setClasspath(useClassPath
);
558 mdJavaDoc
.setTitle(squirreljmeConf
.swmName
);
560 // Determine the paths where all markdown JavaDocs are being stored
561 List
<Path
> projectPaths
= new ArrayList
<>();
562 for (Project subProject
: __project
.getRootProject().getAllprojects())
564 // Only consider SquirrelJME projects
566 SquirrelJMEPluginConfiguration
.configurationOrNull(subProject
))
569 // We just store this here, since we do not know what exists
570 // and does not exist
571 projectPaths
.add(TaskInitialization
.markdownPath(subProject
));
574 // Setup more advanced options
575 mdJavaDoc
.options((MinimalJavadocOptions __options
) ->
577 // We need to set the bootstrap class path otherwise
578 // we will get derivations from whatever JDK the system
579 // is using, and we definitely do not want that.
580 __options
.bootClasspath(useClassPath
.getFiles()
581 .toArray(new File
[0]));
583 // We get this by forcing evaluation
584 Task mdJavaDocletJar
= jarProvider
.get();
587 __options
.showFromProtected();
588 __options
.encoding("utf-8");
589 __options
.locale("en_US");
590 __options
.docletpath(mdJavaDocletJar
.getOutputs()
591 .getFiles().getSingleFile());
593 "cc.squirreljme.doclet.MarkdownDoclet");
595 // Used for completion counting
596 if (__options
instanceof CoreJavadocOptions
)
598 CoreJavadocOptions coreOptions
=
599 (CoreJavadocOptions
)__options
;
601 // Where to find our own sources (for TODOs)
602 coreOptions
.addStringOption(
603 "squirreljmejavasources",
604 sourceSet
.getAllJava().getAsPath());
606 // Directories to all the other markdown JavaDocs
607 coreOptions
.addStringOption(
608 "squirreljmeprojectmjd",
609 VMHelpers
.classpathAsString(projectPaths
));
611 // The name of the project
612 coreOptions
.addStringOption(
613 "squirreljmeproject",
614 __project
.getName());
619 TaskInitialization
.initializeFossilMarkdownTask(
620 __project
.getRootProject(), mdJavaDoc
);
624 * Returns the path to the markdown JavaDoc for a project.
626 * @param __project The project to get for.
627 * @return The path to the project's markdown JavaDoc.
628 * @throws NullPointerException On null arguments.
631 public static Path
markdownPath(Project __project
)
632 throws NullPointerException
634 if (__project
== null)
635 throw new NullPointerException("NARG");
637 return __project
.getBuildDir().toPath().resolve("markdownJavaDoc");
641 * Initializes ROM tasks for the given base project.
643 * @param __project The root project.
644 * @throws NullPointerException On null arguments.
647 public static void romTasks(Project __project
)
648 throws NullPointerException
650 if (__project
== null)
651 throw new NullPointerException("NARG");
653 // Initialize or both main classes and such
654 for (ClutterLevel clutterLevel
: ClutterLevel
.values())
655 for (String sourceSet
: TaskInitialization
._SOURCE_SETS
)
656 for (VMType vmType
: VMType
.values())
657 for (BangletVariant variant
: vmType
.banglets())
658 TaskInitialization
.romTasks(__project
,
659 new SourceTargetClassifier(sourceSet
, vmType
,
660 variant
, clutterLevel
));
664 * Initializes ROM tasks for the given base project.
666 * @param __project The root project.
667 * @param __classifier The classifier used.
668 * @throws NullPointerException On null arguments.
671 private static void romTasks(Project __project
,
672 SourceTargetClassifier __classifier
)
673 throws NullPointerException
675 if (__project
== null || __classifier
== null)
676 throw new NullPointerException("NARG");
678 // Everything will be working on these tasks
679 TaskContainer tasks
= __project
.getTasks();
681 // Does the VM utilize ROMs?
682 // Test fixtures are just for testing, so there is no test fixtures
684 if (__classifier
.getVmType()
685 .hasRom(__classifier
.getBangletVariant()) &&
686 !__classifier
.isTestFixturesSourceSet())
688 String baseName
= TaskInitialization
.task("rom",
690 VMRomTask rom
= tasks
.create(baseName
, VMRomTask
.class,
693 // Full RatufaCoat Built-In
694 __project
.getTasks().create(baseName
+ "RatufaCoat",
695 RatufaCoatBuiltInTask
.class, __classifier
, rom
);
700 * Builds a name for a task, without the virtual machine type.
702 * @param __name The task name.
703 * @param __sourceSet The source set for the task base.
704 * @return A string representing the task.
705 * @throws NullPointerException On null arguments.
708 public static String
task(String __name
, String __sourceSet
)
709 throws NullPointerException
711 return TaskInitialization
.task(__name
, __sourceSet
, "");
715 * Builds a name for a task, without the virtual machine type.
717 * @param __name The task name.
718 * @param __sourceSet The source set for the task base.
719 * @param __suffix The task suffix.
720 * @return A string representing the task.
721 * @throws NullPointerException On null arguments.
724 public static String
task(String __name
, String __sourceSet
,
726 throws NullPointerException
728 if (__name
== null || __sourceSet
== null || __suffix
== null)
729 throw new NullPointerException("NARG");
731 // We need to later determine how the suffix works
734 // If this is the main source set, never include the source set as
735 // it becomes implied. Additionally, if the name and the source set
736 // are the same, reduce the confusion so there is no "testTestHosted".
737 if (__sourceSet
.equals(SourceSet
.MAIN_SOURCE_SET_NAME
) ||
738 __sourceSet
.equals(__name
) || __sourceSet
.isEmpty())
741 // Otherwise, include it
744 // If just the source set, then just keep that lowercase
745 if (__name
.isEmpty())
746 baseName
= __sourceSet
;
749 TaskInitialization
.uppercaseFirst(__sourceSet
);
752 // If there is no suffix, just return the base
753 if (__suffix
.isEmpty())
756 // If there is no base, just return the suffix
757 if (baseName
.isEmpty())
760 // Otherwise, perform needed capitalization
761 // "additionalJarProperties" or "additionalTestJarProperties"
762 return baseName
+ TaskInitialization
.uppercaseFirst(__suffix
);
766 * Builds a name for a task.
768 * @param __name The task name.
769 * @param __sourceSet The source set for the task base.
770 * @param __vmType The type of virtual machine used.
771 * @return A string representing the task.
772 * @throws NullPointerException On null arguments.
775 public static String
task(String __name
, String __sourceSet
,
776 VMSpecifier __vmType
)
777 throws NullPointerException
779 return TaskInitialization
.task(__name
, __sourceSet
, __vmType
,
780 BangletVariant
.NONE
, ClutterLevel
.DEBUG
);
784 * Initializes the task name.
786 * @param __name The name of the task.
787 * @param __classifier The classifier for the target.
788 * @return The task name.
789 * @throws NullPointerException On null arguments.
792 public static String
task(String __name
,
793 SourceTargetClassifier __classifier
)
794 throws NullPointerException
796 if (__name
== null || __classifier
== null)
797 throw new NullPointerException("NARG");
799 return TaskInitialization
.task(__name
,
800 __classifier
.getSourceSet(),
801 __classifier
.getTargetClassifier().getVmType(),
802 __classifier
.getTargetClassifier().getBangletVariant(),
803 __classifier
.getTargetClassifier().getClutterLevel());
807 * Builds a name for a task.
809 * @param __name The task name.
810 * @param __sourceSet The source set for the task base.
811 * @param __vmType The type of virtual machine used.
812 * @param __variant The banglet variant.
813 * @param __clutterLevel Release or debug, may be {@code null}.
814 * @return A string representing the task.
815 * @throws NullPointerException On null arguments.
818 public static String
task(String __name
, String __sourceSet
,
819 VMSpecifier __vmType
, BangletVariant __variant
,
820 ClutterLevel __clutterLevel
)
821 throws NullPointerException
823 if (__name
== null || __sourceSet
== null || __vmType
== null ||
825 throw new NullPointerException("NARG");
827 return TaskInitialization
.task(__name
, __sourceSet
) +
828 __vmType
.vmName(VMNameFormat
.PROPER_NOUN
) +
829 TaskInitialization
.uppercaseFirst(__variant
.properNoun
) +
830 (__clutterLevel
== null ?
"" :
831 TaskInitialization
.uppercaseFirst(__clutterLevel
.toString()));
835 * Uppercases the first character of a string.
837 * @param __input The input string.
838 * @return The string with the first character uppercased.
839 * @throws NullPointerException On null arguments.
842 public static String
uppercaseFirst(String __input
)
843 throws NullPointerException
846 throw new NullPointerException("NARG");
848 if (__input
.isEmpty())
851 return Character
.toUpperCase(__input
.charAt(0)) +
852 __input
.substring(1);