Package Torello.Java.Build
Class Config
- java.lang.Object
-
- Torello.Java.Build.Config
-
public final class Config extends java.lang.Object
This class provides a list of fields, all of which may be modified and configured, for providing any needed settings to classBuilder
.
Use thepublic
constructor offered by this class, and then set and change the values of any of the Configuration-Fields. Once this class Configuration-Fields have been appropriately set to contain your project's data, pass the instance to theBuilder
class only constructor (along with an argvString[]
-Array).
This will inform theBuilder
-Constructor of all of your nedded settings, and once built, will make running your project's build script very easy.
Hi-Lited Source-Code:- View Here: Torello/Java/Build/Config.java
- Open New Browser-Tab: Torello/Java/Build/Config.java
File Size: 21,679 Bytes Line Count: 533 '\n' Characters Found
-
-
Field Summary
Primary Builder Configurations Modifier and Type Field String[]
CLASS_PATH
JarInclude
jarIncludes
BuildPackage[]
packageList
Binary / Executable Locations Modifier and Type Field String
JAVAC_BIN
String
JAVADOC_BIN
Project Name & Version-Numbers Modifier and Type Field String
PROJECT_NAME
byte
VERSION_MAJOR_NUMBER
byte
VERSION_MINOR_NUMBER
Stage 1: 'javac' Configurations Modifier and Type Field String[]
extraSwitchesJAVAC
byte
JAVA_RELEASE_NUM_SWITCH
boolean
USE_XDIAGS_SWITCH
boolean
USE_XLINT_SWITCH
Stage 2: 'javadoc' Configurations Modifier and Type Field String[]
extraSwitchesJAVADOC
byte
JAVADOC_VER
String
LOCAL_JAVADOC_DIR
boolean
NO_JAVADOC_FRAMES_SWITCH
Stage 3: Upgrader Settings Modifier and Type Field String
FAVICON
UpgradeProcessor
postUpgraderScript
UpgradeProcessor
preUpgraderScript
Upgrade
upgrader
Stage 4: '.tar' & '.jar' File Settings Modifier and Type Field String
JAR_FILE_MOVE_DIR
String
TAR_SOURCE_DIR
Google Cloud Platform Storage-Bucket Names & Settings Modifier and Type Field String
BACKUP_TAR_FILE_GCS_DIR
String
GCS_DIR_DEV
String
GCS_DIR_RELEASE
boolean
RUN_MAKE_PUBLIC_DEV
boolean
RUN_MAKE_PUBLIC_RELEASE
More File-System Directory Names Modifier and Type Field String
HOME_DIR
String
LOG_DIR
Internally-Used Static-Field: Project Name-String Validator Modifier and Type Field static Predicate<String>
projectNameValidator
-
Constructor Summary
Class Sole Constructor: Assigns all Default-Values Constructor Config()
Creates an instance of this class, with all default values assigned to the parameter / fields.
-
Method Summary
Data-Validation Method Modifier and Type Method void
validate()
-
-
-
Field Detail
-
projectNameValidator
public static final java.util.function.Predicate<java.lang.String> projectNameValidator
Project-Name validationString
. The value passed to configuration field/parameter must match this regular expression. This is used in this classvalidate()
method.- See Also:
PROJECT_NAME
,Builder.PROJECT_NAME
,validate()
- Code:
- Exact Field Declaration Expression:
public static final Predicate<String> projectNameValidator = Pattern.compile("^\\w[\\w\\d]*$").asPredicate();
-
HOME_DIR
public java.lang.String HOME_DIR
To-Do, Explain This- See Also:
Builder.HOME_DIR
- Code:
- Exact Field Declaration Expression:
public String HOME_DIR = null;
-
LOCAL_JAVADOC_DIR
public java.lang.String LOCAL_JAVADOC_DIR
The File-System Directory-Location where Java-Doc Output is sent for storage. Also the directory that the Upgrader searches to retrieve and parse JavaDoc Files.- See Also:
Builder.LOCAL_JAVADOC_DIR
- Code:
- Exact Field Declaration Expression:
public String LOCAL_JAVADOC_DIR = "javadoc" + java.io.File.separator;
-
PROJECT_NAME
public java.lang.String PROJECT_NAME
A simple name for this Project. Name must pass theprojectNameValidator
Regular-Expression.- See Also:
Builder.PROJECT_NAME
,projectNameValidator
- Code:
- Exact Field Declaration Expression:
public String PROJECT_NAME = null;
-
VERSION_MAJOR_NUMBER
public byte VERSION_MAJOR_NUMBER
The Major Version Number of the Current Build. This classvalidate()
method checks to ensure that this field contains a positive integer / byte value.- See Also:
Builder.VERSION_MAJOR_NUMBER
- Code:
- Exact Field Declaration Expression:
public byte VERSION_MAJOR_NUMBER = 1;
-
VERSION_MINOR_NUMBER
public byte VERSION_MINOR_NUMBER
The Minor Version Number of the Current Build. This classvalidate()
method checks to ensure that this field contains a positive integer / byte value.- See Also:
Builder.VERSION_MINOR_NUMBER
- Code:
- Exact Field Declaration Expression:
public byte VERSION_MINOR_NUMBER = 0;
-
JAVAC_BIN
public java.lang.String JAVAC_BIN
The full or partial Path-Name of the'javac'
binary to use for compiling this project. This parameter / field may not be null, or aNullPointerException
will throw.
Default Setting:
The default setting for this Configuration-Field is just the command name, which is to presume that thePATH
environment-variable has been set to facilitate finding'javac'
- See Also:
Builder.JAVAC_BIN
- Code:
- Exact Field Declaration Expression:
public String JAVAC_BIN = "javac";
-
JAVADOC_BIN
public java.lang.String JAVADOC_BIN
The full or partial Path-Name of the'javac'
binary to use for compiling this project. This parameter / field may not be null, or aNullPointerException
will throw.
Default Setting:
The default setting for this Configuration-Field is just the command name, which is to presume that thePATH
environment-variable has been set to facilitate finding'javadoc'
.- See Also:
Builder.JAVADOC_BIN
- Code:
- Exact Field Declaration Expression:
public String JAVADOC_BIN = "javadoc";
-
JAVA_RELEASE_NUM_SWITCH
public byte JAVA_RELEASE_NUM_SWITCH
The number to provide to the--release
switch tojavac
. This number may be set to any negative value, and it will prevent theBuilder
from using this switch at all- See Also:
Builder.JAVA_RELEASE_NUM_SWITCH
- Code:
- Exact Field Declaration Expression:
public byte JAVA_RELEASE_NUM_SWITCH = -1;
-
JAVADOC_VER
public byte JAVADOC_VER
Currently unused, but originally used to indicate thejavadoc
version being used- See Also:
Builder.JAVADOC_VER
- Code:
- Exact Field Declaration Expression:
public byte JAVADOC_VER = 11;
-
FAVICON
public java.lang.String FAVICON
If the Stage 3Upgrade
-Process utilizes a favicon on its Web-Pages, then this field may be assigned to the location on disk where that favicon is located.
When this field contains a non-null Image-File, that image will be copied (after upgrade has completed) directly to the'javadoc'
output directory. When this field is left null, it will be ignored and no favicon image is copied.- See Also:
Builder.FAVICON
- Code:
- Exact Field Declaration Expression:
public String FAVICON = null;
-
TAR_SOURCE_DIR
public java.lang.String TAR_SOURCE_DIR
Source-Directory to be used as root directory for archiving- See Also:
Builder.TAR_SOURCE_DIR
- Code:
- Exact Field Declaration Expression:
public String TAR_SOURCE_DIR = null;
-
GCS_DIR_DEV
public java.lang.String GCS_DIR_DEV
The Google Cloud Platform Storage-Bucket into which jar, log & documentation files will be copied by this Build-Tool. This Storage-Bucket Directory is intended for use with a boiler-plate & "still under development"URL
.
If this parameter remains null, several of the user menu options will be removed, because several are designed for coying data to the Developer Site. When it is null such options are removed, and this Configuration-Field is ignored.- See Also:
Builder.GCS_DIR_DEV
,GCS_DIR_RELEASE
,Builder.GCS_DIR_RELEASE
- Code:
- Exact Field Declaration Expression:
public String GCS_DIR_DEV = null;
-
GCS_DIR_RELEASE
public java.lang.String GCS_DIR_RELEASE
Another Google Cloud Platform Storage-Bucket for storing and providing jar, log & Code-Documentation Files.
Similary to Configuration-FieldGCS_DIR_DEV
, this parameter may also be null, and when it is it will be ignored, but a few User-Interface Menu-Options will not be present at the Build-Menu.- See Also:
Builder.GCS_DIR_RELEASE
,GCS_DIR_DEV
,Builder.GCS_DIR_DEV
- Code:
- Exact Field Declaration Expression:
public String GCS_DIR_RELEASE = null;
-
RUN_MAKE_PUBLIC_DEV
public boolean RUN_MAKE_PUBLIC_DEV
Informs the Build-Tool whether or not theGSUTIL
method for making the output directory content public needs to be run. Thisboolean
controls whether or notjavadoc
content synchronized / copied to theGCS_DIR_DEV
is assigned the public read-only access level.
WhenGCS_DIR_DEV
is left null, thi flag is ignored.
There is also aboolean
setting for theGCS_DIR_RELEASE
flag.
The default setting for both of these flags isFALSE
.- See Also:
GCS_DIR_DEV
,Builder.GCS_DIR_DEV
,RUN_MAKE_PUBLIC_RELEASE
- Code:
- Exact Field Declaration Expression:
public boolean RUN_MAKE_PUBLIC_DEV = false;
-
RUN_MAKE_PUBLIC_RELEASE
public boolean RUN_MAKE_PUBLIC_RELEASE
Informs the Build-Tool whether or not theGSUTIL
method for making the output directory content public needs to be run. Thisboolean
controls whether or notjavadoc
content synchronized / copied to theGCS_DIR_RELEASE
is assigned the public read-only access level.
WhenGCS_DIR_RELEASE
is left null, thi flag is ignored.
There is also aboolean
setting for theGCS_DIR_DEV
flag.
The default setting for both of these flags isFALSE
.- See Also:
GCS_DIR_RELEASE
,Builder.GCS_DIR_RELEASE
,RUN_MAKE_PUBLIC_DEV
- Code:
- Exact Field Declaration Expression:
public boolean RUN_MAKE_PUBLIC_RELEASE = false;
-
BACKUP_TAR_FILE_GCS_DIR
public java.lang.String BACKUP_TAR_FILE_GCS_DIR
A Storage-Bucket on Google Cloud Platform for saving the generated backup'.tar'
File. This Configuration-Field may remain null, and if it is it will be silently ignored. In this case, the generated backup'.tar'
File will not be copied onto any Google Cloud Platform Storage-Buckets.- See Also:
Builder.BACKUP_TAR_FILE_GCS_DIR
- Code:
- Exact Field Declaration Expression:
public String BACKUP_TAR_FILE_GCS_DIR = null;
-
JAR_FILE_MOVE_DIR
public java.lang.String JAR_FILE_MOVE_DIR
This optional configuration field is optional, and may be used to move / relocate the'.jar'
File after it's built by this Build-Processor. If there is a diretory or location on the File-System into which the'.jar'
should be moved, then provide that directory's name here.
When this field is left null, it will be silently ignored; furthermore, the'.jar'
File which the Build-Processor creates will be left in the Current Working Directory.
-
LOG_DIR
public java.lang.String LOG_DIR
The directory location where log information will be saved. This configuration field may not be null, or aNullPointerException
will throw.
-
upgrader
-
preUpgraderScript
public UpgradeProcessor preUpgraderScript
The script invoked before the Stage 3 call toUpgrade
. This configuration may be assigned null, and in such cases, no script will be invoked before the upgrader runs.- See Also:
Builder.preUpgraderScript
- Code:
- Exact Field Declaration Expression:
public UpgradeProcessor preUpgraderScript = null;
-
postUpgraderScript
public UpgradeProcessor postUpgraderScript
The script invoked after the Stage 3 call toUpgrade
. This configuration may be assigned null, and in such cases, no script will be invoked before the upgrader runs.- See Also:
Builder.postUpgraderScript
- Code:
- Exact Field Declaration Expression:
public UpgradeProcessor postUpgraderScript = null;
-
extraSwitchesJAVAC
public java.lang.String[] extraSwitchesJAVAC
For Stage 1, the Java-Compiler Stage, this Configuration-Field may be assigned any switch-String's
, and they will be passed to thejavac
invocation.
This field's value may be left null, or assigned a zero-lengthString[]
-Array and, in both cases, it shall be ignored.- See Also:
Builder.extraSwitchesJAVAC
- Code:
- Exact Field Declaration Expression:
public String[] extraSwitchesJAVAC = null;
-
extraSwitchesJAVADOC
public java.lang.String[] extraSwitchesJAVADOC
For Stage 2, thejavadoc
Stage, this Configuration-Field may be assigned any switch-String's
, and they will be passed to thejavadoc
invocation.
This field's value may be left or null, or assigned a zero-lengthString[]
-Array, and, in both cases, it shall be ignored.- See Also:
Builder.extraSwitchesJAVADOC
- Code:
- Exact Field Declaration Expression:
public String[] extraSwitchesJAVADOC = null;
-
packageList
public BuildPackage[] packageList
The list of Java Packages to compile. This list may be neither empty nor null, or an exception will throw.- See Also:
Builder.packageList
- Code:
- Exact Field Declaration Expression:
public BuildPackage[] packageList = null;
-
CLASS_PATH
public java.lang.String[] CLASS_PATH
The Root Class-File Directories to use with'javac'
. This is used to generate the value passed to the-cp
switch passed when Stage 1 invokes the Java-Compiler. This parameter / field may be empty or null, and if it is, it will be ignored.
-
jarIncludes
public JarInclude jarIncludes
This allows for specifying a list of files to manually add into the'.jar'
that is built by this package.
Constructor Call:
Because it isn't necessary to include any "Extra Files" into the'.jar'
, there is some likelihood that this Configuration-Field wouldn't ever be needed / used. Make sure to call theJarInclude
constructor, first, to build an instance of this Config-Field before attempting to use it. Notice that it is initially initialized to null!
Common Usess:
Java-HTML has quite a few Data-Files that are inserted into the Jar-File, manually, using this class. There may also be the need to insertMETA-INF/
directory files that name things like Annotation-Processor locations, taglets, or other Java Services.- See Also:
Builder.jarIncludes
- Code:
- Exact Field Declaration Expression:
public JarInclude jarIncludes = null;
-
USE_XLINT_SWITCH
public boolean USE_XLINT_SWITCH
Requests that when'javac'
is invoked, the switch-Xlint:all,-processing
is included in the command-line invocation.- See Also:
Builder.USE_XLINT_SWITCH
- Code:
- Exact Field Declaration Expression:
public boolean USE_XLINT_SWITCH = true;
-
USE_XDIAGS_SWITCH
public boolean USE_XDIAGS_SWITCH
Requests that when'javac'
is invoked, the switch-Xdiags:verbose
is included in the command-line invocation.- See Also:
Builder.USE_XDIAGS_SWITCH
- Code:
- Exact Field Declaration Expression:
public boolean USE_XDIAGS_SWITCH = true;
-
NO_JAVADOC_FRAMES_SWITCH
public boolean NO_JAVADOC_FRAMES_SWITCH
JavaDoc Frames were a true majesty that should never have been eliminated. If you would prefer to remove them, or you are using JDK 21+ which no longer accepts the--frames
switch, then set this Configuration-Field toFALSE
.- See Also:
Builder.NO_JAVADOC_FRAMES_SWITCH
- Code:
- Exact Field Declaration Expression:
public boolean NO_JAVADOC_FRAMES_SWITCH = false;
-
-
Constructor Detail
-
Config
public Config()
Creates an instance of this class, with all default values assigned to the parameter / fields.
The intention is that an instance of this class will have its Configuration-Fields property assigned, according to the needs of the Project being built. Afterwards, the'Config'
instance may be passed to the'Builder'
-Constructor and then that instance may be used to build the project.- See Also:
Builder(Config, String...)
,Builder.build()
-
-
Method Detail
-
validate
public final void validate() throws java.io.FileNotFoundException
Used by classBuilder
to validate all user-provided data on a best efforts basis.- Throws:
java.lang.NullPointerException
- If any of the configuration parameter/fields listed here have been assigned null
This exception will also be thrown if these lists contain any null-valued entries:java.lang.IllegalArgumentException
- If any of these configuration fields were assigned a negative number:
This exception will also be thrown if:-
PROJECT_NAME
does not pass theprojectNameValidator
test.
-
java.io.FileNotFoundException
- This exception will throw if either of these fields are not assigned a valid File-System Directory-Name:UnrecognizedImageExtException
- If theFAVICON
Image-Format cannot be properly "guessed" by classIF
.EmptyListException
- IfpackageList
has been assigned an empty list.WriteableDirectoryException
- If parameterJAR_FILE_MOVE_DIR
is assigned a non-null value, but theString
assigned it does not point to a File-System directory, or that directory is not writeable.
Also throws ifLOG_DIR
is not a valid directory-name, that allows write-access.- Code:
- Exact Method Body:
Objects.requireNonNull(LOCAL_JAVADOC_DIR, M1 + "LOCAL_JAVADOC_DIR" + M2); Objects.requireNonNull(PROJECT_NAME, M1 + "PROJECT_NAME" + M2); Objects.requireNonNull(JAVAC_BIN, M1 + "JAVAC_BIN" + M2); Objects.requireNonNull(JAVADOC_BIN, M1 + "JAVADOC_BIN" + M2); Objects.requireNonNull(TAR_SOURCE_DIR, M1 + "TAR_SOURCE_DIR" + M2); Objects.requireNonNull(LOG_DIR, M1 + "LOG_DIR" + M2); Objects.requireNonNull(upgrader, M1 + "upgrader" + M2); Objects.requireNonNull(packageList, M1 + "packageList" + M2); if (! projectNameValidator.test(PROJECT_NAME)) throw new IllegalArgumentException (M1 + "PROJECT_NAME] was not passed a valid name."); if (VERSION_MAJOR_NUMBER < 0) throw new IllegalArgumentException (M1 + "VERSION_MAJOR_NUMBER" + M3 + VERSION_MAJOR_NUMBER); if (VERSION_MINOR_NUMBER < 0) throw new IllegalArgumentException (M1 + "VERSION_MINOR_NUMBER" + M3 + VERSION_MINOR_NUMBER); if (JAVADOC_VER < 0) throw new IllegalArgumentException (M1 + "JAVADOC_VER" + M3 + JAVADOC_VER); if (FAVICON != null) { File f = new File(FAVICON); if ((! f.exists()) || (! f.isFile())) throw new FileNotFoundException( "Field 'FAVICON' [" + FAVICON + "] points to a file that was not found, or " + "isn't a File" ); IF.guessOrThrow(FAVICON); } if (packageList.length == 0) throw new EmptyListException (M1 + "packageList] was passed a list of size 0."); for (BuildPackage bp : packageList) if (bp == null) throw new NullPointerException (M1 + "packageList] contains a null value."); for (String p : CLASS_PATH) if (p == null) throw new NullPointerException (M1 + "CLASS_PATH] contains a null value."); File f = new File(TAR_SOURCE_DIR); if (! (f.exists() && f.isDirectory())) throw new FileNotFoundException (M1 + "] was not passed a vaild File-System Directory-Name."); if (JAR_FILE_MOVE_DIR != null) { WritableDirectoryException.check(JAR_FILE_MOVE_DIR); if (! JAR_FILE_MOVE_DIR.endsWith(File.separator)) JAR_FILE_MOVE_DIR = JAR_FILE_MOVE_DIR + File.separator; } WritableDirectoryException.check(LOG_DIR); if (! LOG_DIR.endsWith(File.separator)) LOG_DIR = LOG_DIR + File.separator;
-
-