本文整理汇总了C#中MonoDevelop.Projects.BuildResult类的典型用法代码示例。如果您正苦于以下问题:C# BuildResult类的具体用法?C# BuildResult怎么用?C# BuildResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BuildResult类属于MonoDevelop.Projects命名空间,在下文中一共展示了BuildResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Build
public async Task<BuildResult> Build (ProgressMonitor monitor, ConfigurationSelector configuration, bool buildReferencedTargets = false, OperationContext operationContext = null)
{
var res = new BuildResult { BuildCount = 0 };
foreach (var bt in Items.OfType<IBuildTarget> ())
res.Append (await bt.Build (monitor, configuration, operationContext:operationContext));
return res;
}
示例2: Build
/// <summary>
/// Builds the specified solution item.
/// </summary>
/// <param name = "monitor">The monitor.</param>
/// <param name = "item">The item.</param>
/// <param name = "configuration">The configuration.</param>
/// <returns>The build result.</returns>
protected override BuildResult Build(IProgressMonitor monitor, SolutionEntityItem item, ConfigurationSelector configuration)
{
BuildResult result = new BuildResult ();
// Pre-build
monitor.BeginTask (GettextCatalog.GetString ("Pre-Building..."), 1);
this.PreBuild (result, monitor, item, configuration);
monitor.EndTask();
if (result.ErrorCount > 0) {
return result;
}
// Build
monitor.BeginTask (GettextCatalog.GetString ("Building"), 1);
result.Append (base.Build (monitor, item, configuration));
monitor.EndTask();
if (result.ErrorCount > 0) {
return result;
}
// Post-build
monitor.BeginTask (GettextCatalog.GetString ("Post-Building..."), 1);
this.PostBuild (result, monitor, item, configuration);
monitor.EndTask();
return result;
}
示例3: CompileXibFiles
public static BuildResult CompileXibFiles (IProgressMonitor monitor, IEnumerable<ProjectFile> files,
FilePath outputRoot)
{
var result = new BuildResult ();
var ibfiles = GetIBFilePairs (files, outputRoot).Where (NeedsBuilding).ToList ();
if (ibfiles.Count > 0) {
monitor.BeginTask (GettextCatalog.GetString ("Compiling interface definitions"), 0);
foreach (var file in ibfiles) {
file.EnsureOutputDirectory ();
var args = new ProcessArgumentBuilder ();
args.AddQuoted (file.Input);
args.Add ("--compile");
args.AddQuoted (file.Output);
var psi = new ProcessStartInfo ("ibtool", args.ToString ());
monitor.Log.WriteLine (psi.FileName + " " + psi.Arguments);
psi.WorkingDirectory = outputRoot;
string errorOutput;
int code;
try {
code = ExecuteCommand (monitor, psi, out errorOutput);
} catch (System.ComponentModel.Win32Exception ex) {
LoggingService.LogError ("Error running ibtool", ex);
result.AddError (null, 0, 0, null, "ibtool not found. Please ensure the Apple SDK is installed.");
return result;
}
if (code != 0) {
//FIXME: parse the plist that ibtool returns
result.AddError (null, 0, 0, null, "ibtool returned error code " + code);
}
}
monitor.EndTask ();
}
return result;
}
示例4: OnBuild
protected override BuildResult OnBuild (MonoDevelop.Core.IProgressMonitor monitor, ConfigurationSelector configuration)
{
var restResult = RestClient.CompileScripts ();
var result = new BuildResult ();
foreach (var message in restResult.Messages)
{
var file = BaseDirectory + "/" + message.File;
var msg = message.Message;
var errorNum = "";
var messageStrings = message.Message.Split(':');
if (messageStrings.Length == 3)
{
var errorNumStrings = messageStrings[1].Split(' ');
if (errorNumStrings.Length > 1)
errorNum = errorNumStrings[errorNumStrings.Length - 1];
msg = messageStrings[2];
}
if(message.Type == "warning")
result.AddWarning(file, message.Line, message.Column, errorNum, msg);
else
result.AddError(file, message.Line, message.Column, errorNum, msg);
}
return result;
}
示例5: UpdateDesignerFile
public static BuildResult UpdateDesignerFile (
CodeBehindWriter writer,
DotNetProject project,
ProjectFile file, ProjectFile designerFile
)
{
var result = new BuildResult ();
//parse the ASP.NET file
var parsedDocument = TypeSystemService.ParseFile (project, file.FilePath).Result as WebFormsParsedDocument;
if (parsedDocument == null) {
result.AddError (string.Format ("Failed to parse file '{0}'", file.Name));
return result;
}
//TODO: ensure type system is up to date
CodeCompileUnit ccu;
result.Append (GenerateCodeBehind (project, designerFile.FilePath, parsedDocument, out ccu));
if (ccu != null) {
writer.WriteFile (designerFile.FilePath, ccu);
}
return result;
}
示例6: HandleCompilerOutput
/// <summary>
/// Scans errorString line-wise for filename-line-message patterns (e.g. "myModule(1): Something's wrong here") and add these error locations to the CompilerResults cr.
/// </summary>
public static void HandleCompilerOutput(AbstractDProject Project, BuildResult br, string errorString)
{
var reader = new StringReader(errorString);
string next;
while ((next = reader.ReadLine()) != null)
{
var error = ErrorExtracting.FindError(next, reader);
if (error != null)
{
if (error.ErrorText != null && error.ErrorText.Length > MaxErrorMsgLength)
error.ErrorText = error.ErrorText.Substring (0, MaxErrorMsgLength) + "...";
// dmd's error filenames may contain mixin location info
var m = mixinInlineRegex.Match (error.FileName);
if (m.Success) {
error.FileName = error.FileName.Substring (0, m.Index);
int line;
int.TryParse (m.Groups ["line"].Value, out line);
error.Line = line;
}
if (!Path.IsPathRooted(error.FileName))
error.FileName = Project.GetAbsoluteChildPath(error.FileName);
br.Append(error);
}
}
reader.Close();
}
示例7: CompileXibs
public static void CompileXibs(IProgressMonitor monitor, BuildData buildData, BuildResult result)
{
var cfg = (MonobjcProjectConfiguration)buildData.Configuration;
string appDir = ((MonobjcProjectConfiguration)buildData.Configuration).ResourcesDirectory;
var ibfiles = GetIBFilePairs(buildData.Items.OfType<ProjectFile>(), appDir).Where(f => f.NeedsBuilding()).ToList();
if (ibfiles.Count > 0) {
monitor.BeginTask(GettextCatalog.GetString("Compiling interface definitions"), 0);
foreach (var file in ibfiles) {
file.EnsureOutputDirectory();
var psi = new ProcessStartInfo("ibtool", String.Format("\"{0}\" --compile \"{1}\"", file.Input, file.Output));
monitor.Log.WriteLine(psi.FileName + " " + psi.Arguments);
psi.WorkingDirectory = cfg.OutputDirectory;
string errorOutput;
int code = BuildUtils.ExecuteCommand(monitor, psi, out errorOutput);
if (code != 0) {
//FIXME: parse the plist that ibtool returns
result.AddError(null, 0, 0, null, "ibtool returned error code " + code);
}
}
monitor.EndTask();
}
}
示例8: ToBuildResult
public static BuildResult ToBuildResult(this DiagnosticsMessage message)
{
var result = new BuildResult ();
AddErrors (result.AddWarning, message.Warnings);
AddErrors (result.AddError, message.Errors);
return result;
}
示例9: BuildProject
public static BuildResult BuildProject(DubProject prj, IProgressMonitor mon, ConfigurationSelector sel)
{
var br = new BuildResult();
// Skip building sourceLibraries
string targetType = null;
var cfg = prj.GetConfiguration (sel) as DubProjectConfiguration;
if (cfg != null){
cfg.BuildSettings.TryGetTargetTypeProperty (prj, sel, ref targetType);
if(string.IsNullOrWhiteSpace(targetType))
prj.CommonBuildSettings.TryGetTargetTypeProperty (prj, sel, ref targetType);
if (targetType != null && targetType.ToLower ().Contains("sourcelibrary")) {
br.BuildCount = 1;
return br;
}
}
var args = new StringBuilder("build");
BuildCommonArgAppendix(args, prj, sel);
string output;
string errDump;
int status = ProjectBuilder.ExecuteCommand(DubSettings.Instance.DubCommand, args.ToString(), prj.BaseDirectory,
mon, out errDump, out output);
br.CompilerOutput = output;
ErrorExtracting.HandleReturnCode (mon, br, status);
ErrorExtracting.HandleCompilerOutput(prj, br, output);
ErrorExtracting.HandleCompilerOutput(prj, br, errDump);
return br;
}
示例10: WaitForRestoreThenBuild
async Task<BuildResult> WaitForRestoreThenBuild (Task restoreTask, ProgressMonitor monitor, ConfigurationSelector configuration, OperationContext operationContext)
{
try {
await restoreTask;
} catch (Exception ex) {
var result = new BuildResult ();
result.AddError (GettextCatalog.GetString ("{0}. Please see the Package Console for more details.", ex.Message));
return result;
}
return await base.OnBuild (monitor, configuration, operationContext);
}
示例11: Compile
public void Compile (PythonProject project,
FilePath fileName,
PythonConfiguration config,
BuildResult result)
{
if (String.IsNullOrEmpty (fileName))
throw new ArgumentNullException ("fileName");
else if (config == null)
throw new ArgumentNullException ("config");
else if (result == null)
throw new ArgumentNullException ("result");
else if (Runtime == null)
throw new InvalidOperationException ("No supported runtime!");
// Get our relative path within the project
if (!fileName.IsChildPathOf (project.BaseDirectory)) {
Console.WriteLine ("File is not within our project!");
return;
}
FilePath relName = fileName.ToRelative (project.BaseDirectory);
string outFile = relName.ToAbsolute (config.OutputDirectory);
if (!outFile.EndsWith (".py"))
return;
// Create the destination directory
FileInfo fileInfo = new FileInfo (outFile);
if (!fileInfo.Directory.Exists)
fileInfo.Directory.Create ();
// Create and start our process to generate the byte code
Process process = BuildCompileProcess (fileName, outFile, config.Optimize);
process.Start ();
process.WaitForExit ();
// Parse errors and warnings
string output = process.StandardError.ReadToEnd ();
// Extract potential Warnings
foreach (Match m in m_WarningRegex.Matches (output)) {
string lineNum = m.Groups[m_WarningRegex.GroupNumberFromName ("line")].Value;
string message = m.Groups[m_WarningRegex.GroupNumberFromName ("message")].Value;
result.AddWarning (fileName, Int32.Parse (lineNum), 0, String.Empty, message);
}
// Extract potential SyntaxError
foreach (Match m in m_ErrorRegex.Matches (output)) {
string lineNum = m.Groups[m_ErrorRegex.GroupNumberFromName ("line")].Value;
result.AddError (fileName, Int32.Parse (lineNum), 0, String.Empty, "SyntaxError");
}
}
示例12: Generate
public static void Generate(IProgressMonitor monitor, BuildResult result, MonobjcProject project, ConfigurationSelector configuration, String outputDirectory, bool native)
{
// Infer application name from configuration
String applicationName = project.GetApplicationName(configuration);
LoggingService.LogInfo("Generate => applicationName='" + applicationName + "'");
LoggingService.LogInfo("Generate => outputDirectory='" + outputDirectory + "'");
// Create the bundle maker
BundleMaker maker = new BundleMaker(applicationName, outputDirectory);
// Compile the XIB files
BuildHelper.CompileXIBFiles(monitor, project, maker, result);
if (result.ErrorCount > 0)
{
monitor.ReportError(GettextCatalog.GetString("Failed to compile XIB files"), null);
return;
}
// Copy the output and dependencies
BuildHelper.CopyOutputFiles(monitor, project, configuration, maker);
// Copy the content files
BuildHelper.CopyContentFiles(monitor, project, configuration, maker);
// Create the Info.plist
BuildHelper.CreateInfoPList(monitor, project, configuration, maker);
if (native)
{
GenerateNative(monitor, result, project, configuration, maker);
}
else
{
// Copy the Monobjc assemblies
BuildHelper.CopyMonobjcAssemblies(monitor, project, configuration, maker);
// Write the native runtime
monitor.BeginTask(GettextCatalog.GetString("Copying native launcher..."), 0);
maker.WriteRuntime(project.TargetOSVersion);
monitor.EndTask();
}
BuildHelper.CombineArtwork(monitor, project, maker);
BuildHelper.EncryptContentFiles(monitor, project, configuration, maker);
// Perform the signing
BuildHelper.SignBundle(monitor, project, maker);
BuildHelper.SignNativeBinaries(monitor, project, maker);
}
示例13: Archive
public static void Archive(IProgressMonitor monitor, BuildResult result, MonobjcProject project, ConfigurationSelector configuration, String outputDirectory)
{
monitor.BeginTask(GettextCatalog.GetString("Archiving..."), 0);
// Infer application name from configuration
String applicationName = project.GetApplicationName(configuration);
// Create the bundle maker
BundleMaker maker = new BundleMaker(applicationName, outputDirectory);
// Archive the application
BuildHelper.ArchiveBundle(monitor, project, maker);
monitor.EndTask();
}
示例14: Pack
async Task<BuildResult> Pack (ProgressMonitor monitor, ConfigurationSelector configuration, bool buildReferencedTargets, OperationContext operationContext)
{
var result = new BuildResult ();
// Build the project and any dependencies first.
if (buildReferencedTargets && project.GetReferencedItems (configuration).Any ()) {
result = await project.Build (monitor, configuration, buildReferencedTargets, operationContext);
if (result.Failed)
return result;
}
// Generate the NuGet package by calling the Pack target.
var packResult = (await project.RunTarget (monitor, "Pack", configuration, new TargetEvaluationContext (operationContext))).BuildResult;
return result.Append (packResult);
}
示例15: HandleReturnCode
/// <summary>
/// Checks a compilation return code,
/// and adds an error result if the compiler results
/// show no errors.
/// </summary>
/// <param name="monitor"></param>
/// <param name="br"> A <see cref="BuildResult"/>: The return code from a build run.</param>
/// <param name="returnCode">A <see cref="System.Int32"/>: A process return code.</param>
public static bool HandleReturnCode(IProgressMonitor monitor, BuildResult br, int returnCode)
{
if (returnCode != 0)
{
if (monitor != null)
monitor.Log.WriteLine("Exit code " + returnCode.ToString());
if(br.ErrorCount == 0)
br.AddError(string.Empty, 0, 0, string.Empty,
GettextCatalog.GetString("Build failed - check build output for details"));
return false;
}
return true;
}