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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package Torello.Java.Build;

import Torello.Java.UnreachableError;

import java.io.IOException;

/**
 * <EMBED CLASS='external-html' DATA-FILE-ID=RUN_BUILD>
 * @see BuilderRecord
 * @see Config
 */
@Torello.JavaDoc.StaticFunctional
public class RunBuild
{
    // No need, Static-Functional
    private RunBuild() { }

    /**
     * Runs the build.  Accepts ana instance of {@link BuilderRecord} in order to utilize the
     * configurations needed to actually do a build.
     * 
     * @param brec Requires the instance of {@link BuilderRecord} that was generated by class
     * {@link Config} method {@link Config#createBuilder(String[])}.
     * 
     * @throws IOException There are many, many wonderful opportunities for this exception to throw
     */
    public static void run(BuilderRecord brec) throws IOException
    {
        // Timers.start[0] is how the "Total Timer Count" is computed.  So 'touch it', and things
        // can start counting right from here.

        brec.timers.touch();

        if (brec.cli.compositeStep_RunStage2to4_OptionSelected)
        {
            S02_JavaDoc.javaDoc(brec);
            S03_Upgrade.upgrade(brec);
            S04_TarJar.compress(brec);
        }

        else if (brec.cli.sor.MENU_CHOICE.startsWith("cb"))
        {
            S02_JavaDoc.javaDoc(brec);
            S03_Upgrade.upgrade(brec);
            S04_TarJar.compress(brec);
            S05_SyncJavaDoc.sync(brec);
            S06_SyncTarJar.sync(brec);
            S07_SyncLogs.sync(brec);

            if (brec.cli.sma_NoBrowserCache_OptionSelected) S08_SetMaxAge.set(brec);
        }

        else if (brec.cli.sor.MENU_CHOICE.startsWith("pb"))
        {
            S02_JavaDoc.javaDoc(brec);
            S03_Upgrade.upgrade(brec);

            if (brec.cli.partialWithSync_OptionSelected)
            {
                // NOTE: If the list, below, is "non-null", it is (I think, 99.9%) guaranteed to be
                //       "Non-Empty", however, If you erase either of these lines, you are going to
                //      go back and change the whole thing (again), so just leave it alone, PLEASE.

                boolean packagesWereSpecified = 
                        (brec.cli.sor.userProvidedNickNames != null)        // Sufficient
                    &&  (brec.cli.sor.userProvidedNickNames.size() > 0);    // Just to Remember

                if (packagesWereSpecified)  S05_SyncJavaDoc.syncPart(brec);
                else                        S05_SyncJavaDoc.sync(brec);
            }

            if (brec.cli.sma_NoBrowserCache_OptionSelected) S08_SetMaxAge.set(brec);
        }

        else switch (brec.cli.sor.MENU_CHOICE)
        {
            case "1"    :   S01_JavaCompiler.compile(brec); break;
            case "2"    :   S02_JavaDoc.javaDoc(brec);      break;
            case "3"    :   S03_Upgrade.upgrade(brec);      break;
            case "4"    :   S04_TarJar.compress(brec);      break;
            case "5"    :   S05_SyncJavaDoc.sync(brec);     break;
            case "6"    :   S06_SyncTarJar.sync(brec);      break;
            case "7"    :   S07_SyncLogs.sync(brec);        break;
            case "8"    :   S08_SetMaxAge.set(brec);        break;

            // This works great, but has a minor bug which is not going to be fixed until the
            // CSS Project has completed.  In the mean time there is a very wonderfully worded
            // "ToDoException" that shall throw instead.
            // 
            // Though this is an "invaluable tool" for cleaning up the docs, CSS is an even neater
            // idea that has to be completed, first.  I have checked my broken links many times,
            // and all of the links in my core-libraries are working.  Java-Doc Pages that are
            // created from Torello.Java.Buil (and even Torello.CSS) likely have a broken 
            // internal link somewhere in them.

            case "lc"   :   if (1 == 1) throw new Torello.Java.ToDoException();
                            S02_JavaDoc.javaDoc(brec);

                            // I don't even have a 'WLC' method in Stage-03 Upgrade anymore!
                            // S03_Upgrade.upgradeWLC(U, ES, OS);

                            break;

            default     :   throw new UnreachableError();
        }

        brec.timers.PRINT_TIMES();
    }
}