Logo Search packages:      
Sourcecode: nant version File versions  Download package

NAnt::Core::Project Class Reference

List of all members.


Detailed Description

Central representation of a NAnt project.

The Run method will initialize the project with the build file specified in the constructor and execute the default target.

            <![CDATA[
        Project p = new Project("foo.build", Level.Info);
        p.Run();
            ]]>

If no target is given, the default target will be executed if specified in the project.

            <![CDATA[
        Project p = new Project("foo.build", Level.Info);
        p.Execute("build");
            ]]>

Definition at line 67 of file Project.cs.


Public Member Functions

void AttachBuildListeners (BuildListenerCollection listeners)
 Attaches the specified build listeners to the Project.
DataTypeBase CreateDataTypeBase (XmlNode elementNode)
void CreateDefaultLogger ()
 Creates the default IBuildLogger and attaches it to the Project.
Task CreateTask (XmlNode taskNode, Target target)
 Creates a new Task from the given XmlNode within a Target.
Task CreateTask (XmlNode taskNode)
 Creates a new from the given XmlNode.
void DetachBuildListeners ()
 Detaches the currently attached IBuildListener instances from the Project.
void Execute (string targetName, bool forceDependencies)
 Executes a specific target.
void Execute (string targetName)
 Executes a specific target, and its dependencies.
virtual void Execute ()
 Executes the default target.
string ExpandProperties (string input, Location location)
 Expands a string from known properties.
string GetFullPath (string path)
 Combines the specified path with the BaseDirectory of the Project to form a full path to file or directory.
void Indent ()
 Increases the IndentationLevel of the Project.
void Log (Target target, Level messageLevel, string message)
 Writes a Target level message to the build log with the given Level.
void Log (Task task, Level messageLevel, string message)
 Writes a Task task level message to the build log with the given Level.
void Log (Level messageLevel, string message, params object[] args)
 Writes a Project level formatted message to the build log with the given Level.
void Log (Level messageLevel, string message)
 Writes a Project level message to the build log with the given Level.
void OnBuildFinished (object sender, BuildEventArgs e)
 Dispatches a BuildFinished event to the build listeners for this Project.
void OnBuildStarted (object sender, BuildEventArgs e)
 Dispatches a BuildStarted event to the build listeners for this Project.
void OnMessageLogged (BuildEventArgs e)
 Dispatches a MessageLogged event to the build listeners for this Project.
void OnTargetFinished (object sender, BuildEventArgs e)
 Dispatches a TargetFinished event to the build listeners for this Project.
void OnTargetStarted (object sender, BuildEventArgs e)
 Dispatches a TargetStarted event to the build listeners for this Project.
void OnTaskFinished (object sender, BuildEventArgs e)
 Dispatches the TaskFinished event to the build listeners for this Project.
void OnTaskStarted (object sender, BuildEventArgs e)
 Dispatches a TaskStarted event to the build listeners for this Project.
 Project (string uriOrFilePath, Level threshold, int indentLevel, XmlNode configurationNode)
 Initializes a new Project class with the given source, message threshold and indentation level, and using the specified XmlNode to load internal configuration settings.
 Project (string uriOrFilePath, Level threshold, int indentLevel)
 Initializes a new Project class with the given source, message threshold and indentation level.
 Project (XmlDocument doc, Level threshold, int indentLevel, XmlNode configurationNode)
 Initializes a new Project class with the given document, message threshold and indentation level, and using the specified XmlNode to load internal configuration settings.
 Project (XmlDocument doc, Level threshold, int indentLevel)
 Initializes a new Project class with the given document, message threshold and indentation level.
bool Run ()
 Executes the default target and wraps in error handling and time stamping.
TargetCollection TopologicalTargetSort (string root, TargetCollection targets)
 Topologically sorts a set of targets.
void Unindent ()
 Decreases the IndentationLevel of the Project.

Protected Member Functions

void CtorHelper (XmlDocument doc, Level threshold, int indentLevel)
 Inits stuff:

TypeFactory: Calls Initialize and AddProject

Log.IndentSize set to 12

Project properties are initialized ("nant.* stuff set")

NAnt Props: nant.filename nant.version nant.location nant.project.name nant.project.buildfile (if doc has baseuri) nant.project.basedir nant.project.default = defaultTarget nant.tasks.[name] = true nant.tasks.[name].location = AssemblyFileName

.


Properties

string BaseDirectory [get, set]
 Gets or sets the base directory used for relative references.
string BuildFileLocalName [get]
 Gets the path to the build file.
Uri BuildFileUri [get]
 Gets the Uri form of the current project definition.
BuildListenerCollection BuildListeners [get]
 Gets the build listeners for this project.
StringCollection BuildTargets [get]
 The list of targets to build.
XmlNode ConfigurationNode [get]
 Gets the XmlNode NAnt should use to initialize configuration settings.
Target CurrentTarget [get]
 Gets the current target.
DataTypeBaseDictionary DataTypeReferences [get]
 Gets the DataTypeBase instances defined in this project.
string DefaultTargetName [get]
XmlDocument Document [get]
 Gets the active Project definition.
PropertyDictionary FrameworkNeutralProperties [get]
 Gets the framework-neutral properties defined in the NAnt configuration file.
FrameworkInfoDictionary Frameworks [get]
 Gets a collection of available .NET frameworks.
int IndentationLevel [get]
 Gets or sets the indendation level of the build output.
int IndentationSize [get]
 Gets or sets the indentation size of the build output.
internal LocationMap LocationMap [get]
XmlNamespaceManager NamespaceManager [get]
 Gets the XmlNamespaceManager.
string PlatformName [get]
 Gets the name of the platform on which NAnt is currently running.
string ProjectName [get]
 Gets the name of the Project.
PropertyDictionary Properties [get]
 Gets the properties defined in this project.
FrameworkInfo RuntimeFramework [get, set]
 Gets the framework in which NAnt is currently running.
FrameworkInfo TargetFramework [get, set]
 Gets or sets the framework to use for compilation.
TargetCollection Targets [get]
 Gets the targets defined in this project.
Level Threshold [get, set]
 Gets or sets the default threshold level for build loggers.
bool Verbose [get]
 Gets a value indicating whether tasks should output more build log messages.

Events

BuildEventHandler BuildFinished
BuildEventHandler BuildStarted
BuildEventHandler MessageLogged
BuildEventHandler TargetFinished
BuildEventHandler TargetStarted
BuildEventHandler TaskFinished
BuildEventHandler TaskStarted

Private Member Functions

void ConfigurePlatformProperties ()
 Configures the platform properties for the current platform.
XmlNode GetConfigurationNode ()
internal void InitializeProjectDocument (XmlDocument doc)
 This method is only meant to be used by the Project class and NAnt.Core.Tasks.IncludeTask.
XmlDocument LoadBuildFile (string source)
 Creates a new XmlDocument based on the project definition.
void TopologicalTargetSort (string root, TargetCollection targets, Hashtable state, Stack visiting, TargetCollection executeTargets)
 Performs a single step in a recursive depth-first-search traversal of the target dependency tree.

The current target is first set to the "visiting" state, and pushed onto the "visiting" stack.

An exception is then thrown if any child of the current node is in the visiting state, as that implies a circular dependency. The exception contains details of the cycle, using elements of the "visiting" stack.

If any child has not already been "visited", this method is called recursively on it.

The current target is then added to the ordered list of targets. Note that this is performed after the children have been visited in order to get the correct order. The current target is set to the "visited" state.

By the time this method returns, the ordered list contains the sequence of targets up to and including the current target.

void UpdateTargetFrameworkProperties ()
 Updates dependent properties when the TargetFramework is set.

Static Private Member Functions

static BuildException CreateCircularException (string end, Stack stack)
 Builds an appropriate exception detailing a specified circular dependency.

Private Attributes

string _baseDirectory
BuildListenerCollection _buildListeners = new BuildListenerCollection()
StringCollection _buildTargets = new StringCollection()
XmlNode _configurationNode
Target _currentTarget
DataTypeBaseDictionary _dataTypeReferences = new DataTypeBaseDictionary()
string _defaultTargetName
XmlDocument _doc
PropertyDictionary _frameworkNeutralProperties
FrameworkInfoDictionary _frameworks = new FrameworkInfoDictionary()
int _indentationLevel = 0
int _indentationSize = 4
LocationMap _locationMap = new LocationMap()
XmlNamespaceManager _nsMgr = new XmlNamespaceManager(new NameTable())
string _projectName = ""
PropertyDictionary _properties
FrameworkInfo _runtimeFramework
FrameworkInfo _targetFramework
TargetCollection _targets = new TargetCollection()
Level _threshold = Level.Info
 Holds the default threshold for build loggers.
internal const string NAntPlatform = "nant.platform"
internal const string NAntPlatformName = NAntPlatform + ".name"
internal const string NAntPropertyFileName = "nant.filename"
internal const string NAntPropertyLocation = "nant.location"
internal const string NAntPropertyOnFailure = "nant.onfailure"
internal const string NAntPropertyOnSuccess = "nant.onsuccess"
internal const string NAntPropertyProjectBaseDir = "nant.project.basedir"
internal const string NAntPropertyProjectBuildFile = "nant.project.buildfile"
internal const string NAntPropertyProjectDefault = "nant.project.default"
internal const string NAntPropertyProjectName = "nant.project.name"
internal const string NAntPropertyVersion = "nant.version"
const string ProjectBaseDirAttribute = "basedir"
const string ProjectDefaultAttribte = "default"
const string ProjectNameAttribute = "name"
const string RootXml = "project"
const string TargetXml = "target"
const string Visited = "VISITED"
 Constant for the "visited" state, used when traversing a DFS of target dependencies.
const string Visiting = "VISITING"
 Constant for the "visiting" state, used when traversing a DFS of target dependencies.
const string WildTarget = "*"

Static Private Attributes

static readonly log4net.ILog logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)
 Holds the logger for this class.

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index