001package Torello.Java.Build; 002 003import Torello.Java.ReadOnly.ReadOnlyList; 004import Torello.Java.Additional.Ret2; 005 006import java.io.File; 007import java.io.IOException; 008 009/** 010 * <EMBED CLASS='external-html' DATA-FILE-ID=TESTING> 011 * <EMBED CLASS='external-html' DATA-FILE-ID=JSON_TEST_DIR> 012 */ 013@Torello.JavaDoc.StaticFunctional 014public class Testing 015{ 016 private Testing() {} 017 018 /** 019 * This should be invoked by a Java-Class which has collected the <CODE>'argv'</CODE> parameter 020 * from a <CODE>public static void main</CODE> method, and passed to this class' method. 021 * 022 * <BR /><BR />This method will invoke one of two, internal, classes: 023 * 024 * <BR /><BR /><UL CLASS=JDUL> 025 * <LI><B><CODE><A HREF='hilite-files/CompileTests.java.html'>CompileTests</A></CODE></B></LI> 026 * <LI><B><CODE><A HREF='hilite-files/RunTests.java.html'>RunTests</A></CODE></B></LI> 027 * </UL> 028 * 029 * @param pkgList This should be the same list of packages provided to class {@link RunBuild}. 030 * @param argv This is the list of arguments to the CLI Processor 031 * 032 * @param additionalCompilerArgs This list may be null, and if it is, it shall be silently 033 * ignored. 034 * 035 * @param testingLogDirName This may be any directory name. Output from the testing code will 036 * be written to <B><I>both</I></B> <CODE>'.txt'</CODE> files, <B><I>and</I></B> 037 * <CODE>'.html'</CODE> files. 038 * 039 * @param JAVAC_BIN This parameter may be null, and it is it shall be silently ignored. This 040 * parameter expects to receive the {@code 'javac'} binary file-name. 041 * 042 * <BR /><BR />If this parameter is null, then whatever {@code 'javac'} binary is located in 043 * the current path environment will be used. 044 */ 045 public static void run( 046 final BuildPackage[] pkgList, 047 final String[] argv, 048 final ReadOnlyList<String> additionalCompilerArgs, 049 final String testingLogDirName, 050 final String JAVAC_BIN 051 ) 052 throws IOException 053 { 054 Ret2<Boolean, ReadOnlyList<BuildPackage>> r2 = 055 new TestingCLI(pkgList).process(argv); 056 057 if (r2.a) CompileTests.compile(r2.b, additionalCompilerArgs, JAVAC_BIN); 058 else RunTests.run(r2.b, testingLogDirName); 059 } 060}