|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.h2.build.BuildBase
public class BuildBase
This class is a complete pure Java build tool. It allows to build this project without any external dependencies except a JDK. Advantages: ability to debug the build, extensible, flexible, no XML, a bit faster.
Nested Class Summary | |
---|---|
static class |
BuildBase.FileList
A list of files. |
static class |
BuildBase.StringList
A list of strings. |
Field Summary | |
---|---|
protected boolean |
quiet
If output should be disabled. |
protected java.io.PrintStream |
sysOut
The output stream (System.out). |
Constructor Summary | |
---|---|
BuildBase()
|
Method Summary | |
---|---|
protected void |
all()
This method is called if no other target is specified in the command line. |
protected static BuildBase.StringList |
args(java.lang.String... args)
Create a string list. |
protected void |
beep()
Emit a beep. |
protected void |
copy(java.lang.String targetDir,
BuildBase.FileList files,
java.lang.String baseDir)
Copy files to the specified target directory. |
protected void |
delete(BuildBase.FileList files)
Delete all files in the list. |
protected void |
delete(java.lang.String dir)
Delete all files in the given directory and all subdirectories. |
protected void |
download(java.lang.String target,
java.lang.String fileURL,
java.lang.String sha1Checksum)
Download a file if it does not yet exist. |
protected void |
downloadUsingMaven(java.lang.String target,
java.lang.String group,
java.lang.String artifact,
java.lang.String version,
java.lang.String sha1Checksum)
Download a file if it does not yet exist. |
protected int |
exec(java.lang.String command,
BuildBase.StringList args)
Execute a program in a separate process. |
protected int |
execScript(java.lang.String script,
BuildBase.StringList args)
Execute a script in a separate process. |
protected BuildBase.FileList |
files(java.lang.String dir)
Get the list of files in the given directory and all subdirectories. |
protected static java.lang.String |
getJavaSpecVersion()
Get the current java specification version (for example, 1.4). |
protected java.lang.String |
getLocalMavenDir()
|
protected static java.lang.String |
getSHA1(byte[] data)
Generate the SHA1 checksum of a byte array. |
protected static java.lang.String |
getStaticField(java.lang.String className,
java.lang.String fieldName)
Read a final static field in a class using reflection. |
protected static java.lang.String |
getStaticValue(java.lang.String className,
java.lang.String methodName)
Reads the value from a static method of a class using reflection. |
protected long |
jar(java.lang.String destFile,
BuildBase.FileList files,
java.lang.String basePath)
Create a jar file. |
protected void |
java(java.lang.String className,
BuildBase.StringList args)
Call the main method of the given Java class using reflection. |
protected void |
javac(BuildBase.StringList args,
BuildBase.FileList files)
Compile the files. |
protected void |
javadoc(java.lang.String... args)
Run a Javadoc task. |
protected static void |
mkdir(java.lang.String dir)
Create the directory including the parent directories if they don't exist. |
protected void |
print(java.lang.String s)
Print a message to the output unless the quiet mode is enabled. |
protected void |
println(java.lang.String s)
Print a line to the output unless the quiet mode is enabled. |
protected void |
projectHelp()
Lists all targets (all public methods non-static methods without parameters). |
static byte[] |
readFile(java.io.File file)
Read a file. |
protected static java.lang.String |
replaceAll(java.lang.String s,
java.lang.String before,
java.lang.String after)
Replace each substring in a given string. |
protected void |
run(java.lang.String... args)
This method should be called by the main method. |
static void |
writeFile(java.io.File file,
byte[] data)
Create or overwrite a file. |
protected void |
zip(java.lang.String destFile,
BuildBase.FileList files,
java.lang.String basePath,
boolean storeOnly,
boolean sortBySuffix)
Create a zip file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final java.io.PrintStream sysOut
protected boolean quiet
Constructor Detail |
---|
public BuildBase()
Method Detail |
---|
protected void run(java.lang.String... args)
args
- the command line parametersprotected void all()
protected void beep()
protected void projectHelp()
protected int execScript(java.lang.String script, BuildBase.StringList args)
script
- the program to runargs
- the command line parameters
protected int exec(java.lang.String command, BuildBase.StringList args)
command
- the program to runargs
- the command line parameters
protected static java.lang.String getStaticField(java.lang.String className, java.lang.String fieldName)
className
- the name of the classfieldName
- the field name
protected static java.lang.String getStaticValue(java.lang.String className, java.lang.String methodName)
className
- the name of the classmethodName
- the field name
protected void copy(java.lang.String targetDir, BuildBase.FileList files, java.lang.String baseDir)
targetDir
- the target directoryfiles
- the list of files to copybaseDir
- the base directoryprotected void javadoc(java.lang.String... args)
args
- the command line arguments to passprotected static java.lang.String getSHA1(byte[] data)
data
- the byte array
protected void downloadUsingMaven(java.lang.String target, java.lang.String group, java.lang.String artifact, java.lang.String version, java.lang.String sha1Checksum)
target
- the target file namegroup
- the Maven group idartifact
- the Maven artifact idversion
- the Maven version idsha1Checksum
- the SHA-1 checksum or nullprotected java.lang.String getLocalMavenDir()
protected void download(java.lang.String target, java.lang.String fileURL, java.lang.String sha1Checksum)
target
- the target file namefileURL
- the source url of the filesha1Checksum
- the SHA-1 checksum or nullprotected BuildBase.FileList files(java.lang.String dir)
dir
- the source directory
protected static BuildBase.StringList args(java.lang.String... args)
args
- the arguments
public static void writeFile(java.io.File file, byte[] data)
file
- the filedata
- the data to writepublic static byte[] readFile(java.io.File file)
file
- the file
protected long jar(java.lang.String destFile, BuildBase.FileList files, java.lang.String basePath)
destFile
- the target file namefiles
- the file listbasePath
- the base path
protected void zip(java.lang.String destFile, BuildBase.FileList files, java.lang.String basePath, boolean storeOnly, boolean sortBySuffix)
destFile
- the target file namefiles
- the file listbasePath
- the base pathstoreOnly
- if the files should not be compressedsortBySuffix
- if the file should be sorted by the file suffixprotected static java.lang.String getJavaSpecVersion()
protected void javac(BuildBase.StringList args, BuildBase.FileList files)
args
- the command line parametersfiles
- the file listprotected void java(java.lang.String className, BuildBase.StringList args)
className
- the class nameargs
- the command line parameters to passprotected static void mkdir(java.lang.String dir)
dir
- the directory to createprotected void delete(java.lang.String dir)
dir
- the name of the directoryprotected void delete(BuildBase.FileList files)
files
- the name of the files to deleteprotected static java.lang.String replaceAll(java.lang.String s, java.lang.String before, java.lang.String after)
s
- the original textbefore
- the old substringafter
- the new substring
protected void println(java.lang.String s)
s
- the text to writeprotected void print(java.lang.String s)
s
- the message to write
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |