|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.sandev.sandbuild.SandBuildDriver
The SAND build structure for runtime execution. This holds all the component projects in dependency order and all the generator declarations. The SandBuildDriver is accessed as a singleton.
| Field Summary | |
protected java.util.Collection |
allGens
a collection of all the SandGenDecls for the build |
protected SandDecl[] |
allNodes
all the node declarations for the build |
protected SandDecl[] |
allStructs
all the struct declarations for the build |
protected SandDecl[] |
allStructsAndNodes
all the struct and node declarations for the build |
protected SandProject |
buildRoot
The project to start the build with. |
protected SandProject |
buildTrigger
The project that started the build. |
protected java.util.Collection |
dirtyFiles
a collection of dirty file names |
protected int |
fileCount
|
protected int |
lineCount
|
protected int |
mode
One of the MODE_* values. |
static int |
MODE_BUILD
we are building |
static int |
MODE_CLEAN
we are cleaning |
protected SandDeploymentPackager |
packager
The SandDeploymentPackager that will be used to build the finished SAND application. |
protected int |
scope
One of the SCOPE_* values. |
static int |
SCOPE_GLOBAL
build the entire dependency graph |
static int |
SCOPE_LOCAL
just build the current project |
protected static SandBuildDriver |
singleton
The singleton reference to the SandBuildDriver |
protected int |
type
One of the TYPE_* values. |
static int |
TYPE_ALL
build both static and dynamic targets |
static int |
TYPE_DYNAMIC
build generated targets (generators, envfiles, javadoc) |
static int |
TYPE_STATIC
build only static code targets (compile, .jar etc) |
| Constructor Summary | |
protected |
SandBuildDriver()
Use getSandBuildDriver accessor to retrieve the SandBuildDriver instance. |
| Method Summary | |
void |
appendProject(java.lang.String sandDir)
Like requiredProject, except the specified project is appended to the end of the dependency graph. |
void |
buildGenerators(SandProject proj)
Build the generators for this project and any downstream projects. |
void |
cleanGenerators(SandProject proj)
Clean up the generators for this project and any downstream projects. |
void |
countFile(java.lang.String filename)
|
void |
countLine(java.lang.String line)
Given a line for output, increment the count. |
void |
doDownstreamFiles(SandProject currProj)
Deal with moving jar, war, and sandenvfile declarations for downstream projects. |
void |
doDownstreamFiles(SandProject proj,
java.lang.String filename,
boolean isDeclaredEnvFile)
recursive workhorse. |
protected void |
doGen(SandProject proj,
java.lang.String declFiles,
java.lang.String genPath)
Given all the initialized data structures, run the generators for this project and all subprojects. |
protected java.util.Collection |
doGenerators()
Build and run all the declared generators |
protected void |
doProjectTree(SandProject proj,
java.util.Collection dirtyFiles)
Walk through the projects in dependency order and build each one. |
void |
dumpDependencyGraph(SandProject proj,
java.lang.String indent)
Recursively dump out the given root and it's downstream projects. |
SandProject |
findProject(java.lang.String projname)
Return the SandProject instance matching this name, or null if no instance was found off the buildRoot. |
SandProject |
findProjectParent(SandProject currProj,
java.lang.String childname)
Recursive workhorse. |
SandProject |
findProjectParent(java.lang.String projname)
Return the SandProject instance containing the specified project in its requiredBy. |
java.util.Collection |
getAllGens()
accessor for allGens |
SandDecl[] |
getAllNodes()
accessor for allNodes |
SandDecl[] |
getAllStructs()
accessor for allStructs |
SandDecl[] |
getAllStructsAndNodes()
accessor for allStructsAndNodes |
SandProject |
getBuildRoot()
accessor for buildRoot |
SandProject |
getBuildTrigger()
accessor for buildTrigger |
protected java.lang.String |
getDeclFiles(java.util.Collection allStructs,
java.util.Collection allNodes,
java.lang.String sandhome)
The GenDriverDoclet needs a CSV list of all the struct and node declaration files as input. |
java.util.Collection |
getDirtyFiles()
accessor for dirtyFiles |
int |
getFileCount()
|
protected java.lang.String |
getGenPath(SandProject root)
Build a path specification out of the generator .jar files we have built. |
SandProject |
getLeafmostProject(SandProject proj)
Given a SandProject reference, return the leafmost project in the dependency graph. |
int |
getLineCount()
Return the line count |
int |
getMode()
accessor for mode |
SandDeploymentPackager |
getPackager()
accessor for packager |
static SandBuildDriver |
getSandBuildDriver()
|
static java.lang.String |
getSandHome(SandProject proj)
Use the given project to look up the SAND_HOME property from Ant. |
int |
getScope()
accessor for scope |
int |
getType()
accessor for type |
static SandBuildDriver |
initializeSandBuildDriverSingleton()
|
protected void |
initSandDecls(SandProject proj,
java.util.Collection allGens,
java.util.Collection allStructs,
java.util.Collection allNodes)
Walk the project tree from the given root downwards, setting up the generator, struct and node collections. |
void |
loadProject(SandProject proj)
Given a project, process the SAND build declarations to setup dependencies, generators, and env files. |
void |
log(java.lang.String text)
This is how we dump processing messages and such. |
protected boolean |
nodoc()
If the nodoc flag is set, then return true. |
void |
requiredProject(java.lang.String reqProject,
java.lang.String currProject)
Record the given project dependency. |
void |
runBuild()
Do the build processing and return null if everything went fine. |
java.util.Collection |
runGenerators(SandProject root)
Run the generators for this project and any downstream projects, returning the collection of any files that were changed. |
void |
setAllNodes(java.util.ArrayList decls)
convenience wrapper for setAllNodes |
void |
setAllNodes(SandDecl[] decls)
mutator for allNodes |
void |
setAllStructs(java.util.ArrayList decls)
convenience wrapper for setAllStructs |
void |
setAllStructs(SandDecl[] decls)
mutator for allStructs |
void |
setAllStructsAndNodes(java.util.ArrayList decls)
convenience wrapper for setAllStructsAndNodes |
void |
setAllStructsAndNodes(SandDecl[] decls)
mutator for allStructsAndNodes |
void |
setBuildRoot(SandProject newRoot)
mutator for buildRoot. |
void |
setBuildTrigger(SandProject trigger)
mutator for buildTrigger |
void |
setBuildTriggerDir(java.lang.String buildTriggerDir,
SandProject proj)
Recursively walk the given project tree, setting the buildTriggerDir property of all projects to the given value. |
void |
setFileCount(int count)
|
void |
setGenJarDir(java.io.File genJarDir,
SandProject proj)
Recursively walk the given project tree, setting the genJarDir property of all projects to point to the given root. |
void |
setLineCount(int count)
Set the line count |
void |
setMode(int mode)
mutator for mode |
void |
setPackager(SandDeploymentPackager val)
mutator for packager |
void |
setScope(int scope)
mutator for scope |
void |
setType(int type)
mutator for type |
protected void |
setupGlobal()
Setup for a global scope build. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static SandBuildDriver singleton
protected int scope
public static final int SCOPE_GLOBAL
public static final int SCOPE_LOCAL
protected int type
public static final int TYPE_STATIC
public static final int TYPE_DYNAMIC
public static final int TYPE_ALL
protected int mode
public static final int MODE_BUILD
public static final int MODE_CLEAN
protected SandProject buildRoot
Notes:
protected SandProject buildTrigger
protected java.util.Collection allGens
protected SandDecl[] allStructs
protected SandDecl[] allNodes
protected SandDecl[] allStructsAndNodes
protected java.util.Collection dirtyFiles
protected int lineCount
protected int fileCount
protected SandDeploymentPackager packager
| Constructor Detail |
protected SandBuildDriver()
| Method Detail |
public static SandBuildDriver getSandBuildDriver()
public static SandBuildDriver initializeSandBuildDriverSingleton()
public int getScope()
public void setScope(int scope)
public int getType()
public void setType(int type)
public int getMode()
public void setMode(int mode)
public SandProject getBuildRoot()
public void setBuildRoot(SandProject newRoot)
public SandProject getBuildTrigger()
public void setBuildTrigger(SandProject trigger)
public java.util.Collection getAllGens()
public SandDecl[] getAllStructs()
public void setAllStructs(SandDecl[] decls)
public void setAllStructs(java.util.ArrayList decls)
public SandDecl[] getAllNodes()
public void setAllNodes(SandDecl[] decls)
public void setAllNodes(java.util.ArrayList decls)
public SandDecl[] getAllStructsAndNodes()
public void setAllStructsAndNodes(SandDecl[] decls)
public void setAllStructsAndNodes(java.util.ArrayList decls)
public java.util.Collection getDirtyFiles()
public int getLineCount()
LineCounter
getLineCount in interface LineCounterpublic void setLineCount(int count)
LineCounter
setLineCount in interface LineCounterpublic void countLine(java.lang.String line)
LineCounter
countLine in interface LineCounterpublic int getFileCount()
public void setFileCount(int count)
public void countFile(java.lang.String filename)
public SandDeploymentPackager getPackager()
public void setPackager(SandDeploymentPackager val)
public void log(java.lang.String text)
public void runBuild()
throws SandBuildException
SandBuildException
protected void doProjectTree(SandProject proj,
java.util.Collection dirtyFiles)
throws SandBuildException
The dirtyFiles list is used for incremental javadoc and other
tasks where we want to focus on changed files. It contains
filenames known to have been changed by generators or other setup
processing.
SandBuildExceptionprotected boolean nodoc()
public void doDownstreamFiles(SandProject currProj)
throws SandBuildException
For compilation purposes, jarfiles need to be copied downstream into the requiredBy projects. This movement is downstream only, an upstream project may not link to anything defined downstream. Here's what gets copied downstream:
SandBuildException
public void doDownstreamFiles(SandProject proj,
java.lang.String filename,
boolean isDeclaredEnvFile)
throws SandBuildException
SandBuildException
protected void setupGlobal()
throws SandBuildException
SandBuildException
protected java.util.Collection doGenerators()
throws SandBuildException
SandBuildException
public void buildGenerators(SandProject proj)
throws SandBuildException
SandBuildException
public void cleanGenerators(SandProject proj)
throws SandBuildException
SandBuildException
public java.util.Collection runGenerators(SandProject root)
throws SandBuildException
When this method is called, each SandProject has only its
genDecls initialized, so the first thing we do is walk the projects
setting up the structDecls and nodeDecls for each one. As we walk
through, we also create the master declaration lists.
After setting things up, we walk the projects again. For each
project, we walk the master list of generators, calling based on
whether the runscope matches, and passing in the appropriate input
as declared.
SandBuildException
protected void initSandDecls(SandProject proj,
java.util.Collection allGens,
java.util.Collection allStructs,
java.util.Collection allNodes)
throws SandBuildException
SandBuildException
protected java.lang.String getDeclFiles(java.util.Collection allStructs,
java.util.Collection allNodes,
java.lang.String sandhome)
throws SandBuildException
SandBuildException
protected java.lang.String getGenPath(SandProject root)
throws SandBuildException
SandBuildException
protected void doGen(SandProject proj,
java.lang.String declFiles,
java.lang.String genPath)
throws SandBuildException
SandBuildException
public void loadProject(SandProject proj)
throws SandBuildException
SandBuildException
public void dumpDependencyGraph(SandProject proj,
java.lang.String indent)
public void setGenJarDir(java.io.File genJarDir,
SandProject proj)
root/build/env
public void setBuildTriggerDir(java.lang.String buildTriggerDir,
SandProject proj)
public void appendProject(java.lang.String sandDir)
throws SandBuildException
Assumptions:
SandBuildException
public void requiredProject(java.lang.String reqProject,
java.lang.String currProject)
throws SandBuildException
The algorithm is "insert before with existence check". It is implemented as:
The algorithm works because the required project declarations
are processed from the leafmost declaration (the deployment build)
and then working back towards the root of the tree. So if your
required project declarations make sense (right order, not circular
etc) then it works out.
SandBuildExceptionpublic SandProject findProject(java.lang.String projname)
public SandProject findProjectParent(java.lang.String projname)
public SandProject findProjectParent(SandProject currProj,
java.lang.String childname)
public SandProject getLeafmostProject(SandProject proj)
public static java.lang.String getSandHome(SandProject proj)
throws SandBuildException
SandBuildException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||