本文整理汇总了C#中NAnt.Core.BuildEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# BuildEventArgs类的具体用法?C# BuildEventArgs怎么用?C# BuildEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BuildEventArgs类属于NAnt.Core命名空间,在下文中一共展示了BuildEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildFinished
public void BuildFinished(object sender, BuildEventArgs e)
{
if (e.Exception == null && e.Project == Project)
{
GenerateSolutionFile(Project);
}
}
示例2: TaskFinished
public void TaskFinished(object sender, BuildEventArgs e)
{
var task = (CscTask)e.Task;
var generator = (GenerateMsBuildTask)sender;
var projectFileName = String.Format(
"{0}{1}{2}.csproj",
task.Sources.BaseDirectory.FullName,
Path.DirectorySeparatorChar,
Path.GetFileNameWithoutExtension(task.OutputFile.Name));
ProjectRootElement project = null;
if (!File.Exists(projectFileName))
project = ProjectRootElement.Create(projectFileName);
else
project = ProjectRootElement.Open(projectFileName);
var projectManipulator = new MB.Project(project);
project.DefaultTargets = "Build";
SetKnownProperties(project, task);
GenerateReferences(project, projectManipulator, task, generator);
GenerateCompileIncludes(project, projectManipulator, task);
project.EnsureImportExists("$(MSBuildToolsPath)\\Microsoft.CSharp.targets");
generator.RegisterProjectInSolution(project);
project.Save();
}
示例3: OnMessageLogged
private static void OnMessageLogged(object sender, BuildEventArgs e)
{
if (Loggers.IsEmpty)
{
// tiny race.
((Project)sender).MessageLogged -= OnMessageLogged;
return;
}
var msg = FormatMessage(e);
if (msg == null)
return;
foreach (var log in Loggers)
{
try
{
log.Value.WriteLine(msg);
log.Value.Flush();
}
catch (Exception)
{
}
}
}
示例4: TaskFinished
public void TaskFinished(object sender, BuildEventArgs e)
{
// resources embedded in csc tasks are already handled
if (typeof(CscTask) != e.Task.Parent.GetType())
{
throw new NotImplementedException();
}
}
示例5: LogEvent
public LogEvent(String sourceName, Object sender, BuildEventArgs args, LogEventType eventType)
{
_sourceName = sourceName;
_sender = sender;
_args = args;
_eventType = eventType;
_exception = null;
}
示例6: BuildStarted
public void BuildStarted(Object sender, BuildEventArgs be)
{
autoTrace = be.Project.Properties.Contains("trace.ant.disableAutoTrace") && be.Project.Properties["trace.ant.disableAutoTrace"].Equals("true", StringComparison.InvariantCultureIgnoreCase);
TraceManager.BeginTrace();
if (autoTrace)
TraceManager.Trace.BeginEntry(String.Format("Start build '{0}'.", be.Project.ProjectName), severityType.INFO);
}
示例7: TaskFinished
public void TaskFinished(object sender, BuildEventArgs e)
{
if (e.Exception == null && !string.IsNullOrEmpty(e.Task.Name))
{
if (taskTranslators.ContainsKey(e.Task.Name))
{
taskTranslators[e.Task.Name].TaskFinished(this, e);
}
}
}
示例8: TaskStarted
public void TaskStarted(object sender, BuildEventArgs e) {
_taskStartedFired = true;
if (e.Task != null) {
if (_executedTasks.ContainsKey(e.Task.Name)) {
_executedTasks[e.Task.Name] = ((int) _executedTasks[e.Task.Name]) + 1;
} else {
_executedTasks.Add(e.Task.Name, 1);
}
}
}
示例9: TargetStarted
public void TargetStarted(object sender, BuildEventArgs e) {
_targetStartedFired = true;
if (e.Target != null) {
if (_executedTargets.ContainsKey(e.Target.Name)) {
_executedTargets[e.Target.Name] = ((int) _executedTargets[e.Target.Name]) + 1;
} else {
_executedTargets.Add(e.Target.Name, 1);
}
_targetStartTimes[e.Target.Name] = DateTime.UtcNow;
}
}
示例10: BuildStarted
public void BuildStarted(object sender, BuildEventArgs e)
{
string host = e.Project.Properties[PROP_HOST];
if (host == null) {
host = DEFAULT_HOST;
}
string port = e.Project.Properties[PROP_PORT];
if (port == null) {
port = DEFAULT_PORT;
}
int portInt = int.Parse(port);
reporter = new UdpBuildReporter(host, portInt);
report("BUILD_STARTED", e);
}
示例11: ParseMessage
public void ParseMessage(BuildEventArgs e, out MessagePriority priority, out string file, out int lineNumber, out string code, out string message)
{
switch(e.MessageLevel) {
case Level.Warning: priority = MessagePriority.WARNING; break;
case Level.Error: priority = MessagePriority.ERROR; break;
default: priority = MessagePriority.INFO; break;
}
file = null;
code = null;
lineNumber = 0;
message = e.Message;
Match match = messageRegex.Match(message);
if (match.Success)
{
if (match.Groups["category"].Value == "warning")
{
priority = MessagePriority.WARNING;
}
else
{
priority = MessagePriority.ERROR;
}
file = match.Groups["file"].Value;
string lineString = match.Groups["line"].Value;
if (lineString != "")
{
lineNumber = int.Parse(lineString);
}
code = match.Groups["code"].Value;
message = match.Groups["message"].Value;
}
}
示例12: OutputMessage
/// <summary>
/// Outputs an indented message to the build log if its priority is
/// greather than or equal to the <see cref="Threshold" /> of the
/// logger.
/// </summary>
/// <param name="e">The event to output.</param>
private void OutputMessage(BuildEventArgs e)
{
int indentationLength = 0;
if (e.Project != null) {
indentationLength = e.Project.IndentationLevel * e.Project.IndentationSize;
}
OutputMessage(e, indentationLength);
}
示例13: CreateBuildEvent
private static BuildEventArgs CreateBuildEvent(Level messageLevel, string message)
{
BuildEventArgs buildEvent = new BuildEventArgs();
buildEvent.MessageLevel = messageLevel;
buildEvent.Message = message;
return buildEvent;
}
示例14: TaskStarted
/// <summary>
/// Signals that a task has started.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">A <see cref="BuildEventArgs" /> object that contains the event data.</param>
public virtual void TaskStarted(object sender, BuildEventArgs e)
{
}
示例15: TaskFinished
/// <summary>
/// Signals that a task has finished.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">A <see cref="BuildEventArgs" /> object that contains the event data.</param>
/// <remarks>
/// This event will still be fired if an error occurred during the build.
/// </remarks>
public virtual void TaskFinished(object sender, BuildEventArgs e)
{
}