1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package Torello.Java.Build;

import Torello.Java.ReadOnly.ReadOnlyList;
import Torello.Java.Additional.Ret2;

import java.io.File;
import java.io.IOException;

/**
 * <EMBED CLASS='external-html' DATA-FILE-ID=TESTING>
 * <EMBED CLASS='external-html' DATA-FILE-ID=JSON_TEST_DIR>
 */
@Torello.JavaDoc.StaticFunctional
public class Testing 
{
    private Testing() {}

    /**
     * This should be invoked by a Java-Class which has collected the <CODE>'argv'</CODE> parameter
     * from a <CODE>public static void main</CODE> method, and passed to this class' method.
     * 
     * <BR /><BR />This method will invoke one of two, internal, classes:
     * 
     * <BR /><BR /><UL CLASS=JDUL>
     * <LI><B><CODE><A HREF='hilite-files/CompileTests.java.html'>CompileTests</A></CODE></B></LI>
     * <LI><B><CODE><A HREF='hilite-files/RunTests.java.html'>RunTests</A></CODE></B></LI>
     * </UL>
     * 
     * @param pkgList This should be the same list of packages provided to class {@link RunBuild}.
     * @param argv This is the list of arguments to the CLI Processor
     * 
     * @param additionalCompilerArgs This list may be null, and if it is, it shall be silently
     * ignored.
     * 
     * @param testingLogDirName This may be any directory name.  Output from the testing code will
     * be written to <B><I>both</I></B> <CODE>'.txt'</CODE> files, <B><I>and</I></B>
     * <CODE>'.html'</CODE> files.
     * 
     * @param JAVAC_BIN This parameter may be null, and it is it shall be silently ignored.  This
     * parameter expects to receive the {@code 'javac'} binary file-name.
     * 
     * <BR /><BR />If this parameter is null, then whatever {@code 'javac'} binary is located in 
     * the current path environment will be used.
     */
    public static void run(
            final BuildPackage[]        pkgList,
            final String[]              argv,
            final ReadOnlyList<String>  additionalCompilerArgs,
            final String                testingLogDirName,
            final String                JAVAC_BIN
        )
        throws IOException
    {
        Ret2<Boolean, ReadOnlyList<BuildPackage>> r2 =
            new TestingCLI(pkgList).process(argv);

        if (r2.a)   CompileTests.compile(r2.b, additionalCompilerArgs, JAVAC_BIN);
        else        RunTests.run(r2.b, testingLogDirName);
    }
}