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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
package Torello.Java.Build;

import Torello.Java.ReadOnly.ROArrayListBuilder;

import Apache.CLI.OptionGroup;
import Apache.CLI.Option;

import static Torello.Java.C.BGREEN;
import static Torello.Java.C.BYELLOW;
import static Torello.Java.C.RESET;

import java.io.File;

class GeneratePrimaryOpts
{
    static String generate(

            // Apache.CLI "OptionGroup" instance.  This is the Main-Menu Dispatch-Decision
            // thing-y.  All Main-Menu (non-Auxiliary) Options are added into this group, and
            // the end user is expected to select precisely / exactly one of these options.
            // 
            // NOTE: THESE COMMENTS WERE BLOCK COPIED FROM THE SAME METHOD-PARAMETERS INSIDE OF
            //       CLASS "GenerateCompositeOpts"

            final OptionGroup group,


            // This list-builder builds a list that maintains the names of all Menu-Options which
            // accept a list of Package Nick-Names at the Command-Line.

            final ROArrayListBuilder<String> optionsWhichAcceptPkgNickNames_B,


            // This maintains a list of Menu-Options where the "No Browser Cache" / Stage-8
            // is part of the Composite-List of steps to be executed.  It is easier to keep this
            // as a ReadOnlyList when the build starts because, well, that's how if-then-else
            // statements work!
            // 
            // Inside the actual Stage_8 code, the ReadOnlyList<String> is queried whether or not
            // the user's selected Menu-Option implies that Stage-8 needs to run.

            final ROArrayListBuilder<String> sma_IsRequested_List_B
        )
    {
        StringBuilder helpMenu_BuildStageSteps_SB = new StringBuilder();


        // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
        // Primary Build-Step Options.  Options that equate to Build Stages #1 throughb #8.
        // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

        final Option javac = Option
            .builder        ("1")
            .required       (false)
            .desc           ("Build Stage 1: Java-Compiler")
            .longOpt        ("javac")
            .hasArgs        ()
            .optionalArg    (true)
            .valueSeparator (' ')
            .argName        ("PackageNickNames")
            .build();

        helpMenu_BuildStageSteps_SB.append(
            BYELLOW + "\n\tPrimary Build Steps / Stages:" + RESET +
            "\n\t\t-1   -> Compile [" + BGREEN + "Optional: " + RESET + "Package-Nicknames]"
        );

        // REMEMBER: Option #1 (javac) allows for providing a list of package nicknames
        optionsWhichAcceptPkgNickNames_B.add("1");


        final Option javaDoc = Option
            .builder    ("2")
            .required   (false)
            .desc       ("Build Stage 2: Standard 'javadoc' Tool")
            .longOpt    ("javadoc")
            .hasArg     (false)
            .build();

        helpMenu_BuildStageSteps_SB.append(
            "\n\t\t-2   -> JavaDoc"
        );


        final Option jdu = Option
            .builder        ("3")
            .required       (false)
            .desc           ("Build Stage 3: Torello Java-Doc Upgrader")
            .longOpt        ("jdu")
            .hasArgs        ()
            .optionalArg    (true)
            .valueSeparator (' ')
            .argName        ("PackageNickNames")
            .build();

        helpMenu_BuildStageSteps_SB.append
            ("\n\t\t-3   -> Upgrader [" + BGREEN + "Optional: " + RESET + " Package-Nicknames]");

        // Option #3 (jdu) also allows for providing a list of package nicknames
        optionsWhichAcceptPkgNickNames_B.add("3");


        final Option tarJar = Option
            .builder        ("4")
            .required       (false)
            .desc           ("Build Stage 4, Archive-Files")
            .longOpt        ("tarjar")
            .optionalArg    (true)  // "JARONLY"
            .valueSeparator (' ')
            .argName        ("JARONLY")
            .build();

        helpMenu_BuildStageSteps_SB.append
            ("\n\t\t-4   -> Archive & Compress: Build 2 TAR's & 1 JAR");


        // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
        // Sync-Step Options
        // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

        helpMenu_BuildStageSteps_SB.append
            (BYELLOW + "\n\n\tCloud-Synchronization Primary Build Steps / Stages:" + RESET);

        final Option syncJavaDoc = Option
            .builder    ("5")
            .required   (false)
            .desc       ("Build Stage 5: Sync 'javadoc/'")
            .longOpt    ("syncJavaDoc")
            .hasArg     (false)
            .build();

        helpMenu_BuildStageSteps_SB.append
            ("\n\t\t-5   -> Transfer: 'javadoc" + File.separator + "' directory to Cloud");


        final Option syncTarJar = Option
            .builder    ("6")
            .required   (false)
            .desc       ("Build Stage 6: Sync Tar & Jar")
            .longOpt    ("syncTarJar")
            .hasArg     (false)
            .build();

        helpMenu_BuildStageSteps_SB.append
            ("\n\t\t-6   -> Transfer: '.tar' and '.jar' files to Cloud");


        final Option syncLogs = Option
            .builder    ("7")
            .required   (false)
            .desc       ("Build Stage 7: Sync Log-Files")
            .longOpt    ("syncLogs")
            .hasArg     (false)
            .build();

        helpMenu_BuildStageSteps_SB.append
            ("\n\t\t-7   -> Transfer: logs to Cloud");


        final Option setMaxAge = Option
            .builder    ("8")
            .required   (false)
            .desc       ("Build Stage 8: Set Max-Age Browser-Cache")
            .longOpt    ("setMaxAge")
            .hasArg     (false)
            .build();

        helpMenu_BuildStageSteps_SB.append
            ("\n\t\t-8   -> Set Cloud-Files' Browser-Cache Meta-Data to 150 seconds");

        // NOTE: This really is an SMA stage, so don't forget it!
        sma_IsRequested_List_B.add("8");


        // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
        // INSERT ALL INTO THE "OptionGroup" ... And return that instance
        // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

        group
            // Primary Build-Step Options
            .addOption(javac)
            .addOption(javaDoc)
            .addOption(jdu)
            .addOption(tarJar)

            // Sync-Step Options
            .addOption(syncJavaDoc)
            .addOption(syncTarJar)
            .addOption(syncLogs)
            .addOption(setMaxAge);

        return helpMenu_BuildStageSteps_SB.toString();
    }    
}