本文整理汇总了C#中MonoDevelop.Projects.BuildResult.Append方法的典型用法代码示例。如果您正苦于以下问题:C# BuildResult.Append方法的具体用法?C# BuildResult.Append怎么用?C# BuildResult.Append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MonoDevelop.Projects.BuildResult
的用法示例。
在下文中一共展示了BuildResult.Append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: UpdateDesignerFile
public static BuildResult UpdateDesignerFile (
CodeBehindWriter writer,
AspNetAppProject project,
ProjectFile file, ProjectFile designerFile
)
{
var result = new BuildResult ();
//parse the ASP.NET file
var parsedDocument = TypeSystemService.ParseFile (project, file.FilePath) 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;
}
示例4: 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);
}
示例5: Build
protected override BuildResult Build (IProgressMonitor monitor, SolutionEntityItem project, ConfigurationSelector configuration)
{
var aspProject = project as AspNetAppProject;
//get the config object and validate
AspNetAppProjectConfiguration config = (AspNetAppProjectConfiguration)aspProject.GetConfiguration (configuration);
if (config == null || config.DisableCodeBehindGeneration) {
return base.Build (monitor, project, configuration);
}
var writer = CodeBehindWriter.CreateForProject (monitor, aspProject);
if (!writer.SupportsPartialTypes) {
return base.Build (monitor, project, configuration);
}
var result = new BuildResult ();
monitor.BeginTask ("Updating CodeBehind designer files", 0);
foreach (var file in aspProject.Files) {
ProjectFile designerFile = CodeBehind.GetDesignerFile (file);
if (designerFile == null)
continue;
if (File.GetLastWriteTimeUtc (designerFile.FilePath) > File.GetLastWriteTimeUtc (file.FilePath))
continue;
monitor.Log.WriteLine ("Updating CodeBehind for file '{0}'", file);
result.Append (CodeBehind.UpdateDesignerFile (writer, aspProject, file, designerFile));
}
writer.WriteOpenFiles ();
monitor.EndTask ();
if (writer.WrittenCount > 0)
monitor.Log.WriteLine ("{0} CodeBehind designer classes updated.", writer.WrittenCount);
else
monitor.Log.WriteLine ("No changes made to CodeBehind classes.");
if (result.Failed)
return result;
return result.Append (base.Build (monitor, project, configuration));
}
示例6: HandleOptLinkOutput
private void HandleOptLinkOutput(BuildResult br, string linkerOutput)
{
var matches = optlinkRegex.Matches (linkerOutput);
var ctxt = ResolutionContext.Create(Project == null ?
ParseCacheList.Create(DCompilerService.Instance.GetDefaultCompiler().ParseCache) :
Project.ParseCache, null, null);
ctxt.ContextIndependentOptions =
ResolutionOptions.IgnoreAllProtectionAttributes |
ResolutionOptions.DontResolveBaseTypes |
ResolutionOptions.DontResolveBaseClasses |
ResolutionOptions.DontResolveAliases;
foreach (Match match in matches) {
var error = new BuildError ();
// Get associated D source file
if (match.Groups ["obj"].Success) {
var obj = Project.GetAbsoluteChildPath (new FilePath (match.Groups ["obj"].Value)).ChangeExtension (".d");
foreach (var pf in Project.Files)
if (pf.FilePath == obj) {
error.FileName = pf.FilePath;
break;
}
}
var msg = match.Groups ["message"].Value;
var symUndefMatch = symbolUndefRegex.Match(msg);
if(symUndefMatch.Success && symUndefMatch.Groups["mangle"].Success)
{
var mangledSymbol = symUndefMatch.Groups["mangle"].Value;
ITypeDeclaration qualifier;
try{
var resSym = D_Parser.Misc.Mangling.Demangler.DemangleAndResolve(mangledSymbol, ctxt, out qualifier);
if(resSym is DSymbol)
{
var ds = resSym as DSymbol;
var ast = ds.Definition.NodeRoot as DModule;
if(ast!=null)
error.FileName = ast.FileName;
error.Line = ds.Definition.Location.Line;
error.Column = ds.Definition.Location.Column;
msg = ds.Definition.ToString(false, true);
}
else
msg = qualifier.ToString();
}catch(Exception ex)
{
msg = "<log analysis error> "+ex.Message;
}
error.ErrorText = msg + " could not be resolved - library reference missing?";
}
else
error.ErrorText = "Linker error " + match.Groups ["code"].Value + " - " + msg;
br.Append (error);
}
}
示例7: 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>
protected void HandleCompilerOutput(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 (!Path.IsPathRooted (error.FileName))
error.FileName = Project.GetAbsoluteChildPath (error.FileName);
br.Append (error);
}
}
reader.Close ();
}
示例8: 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();
}
示例9: HandleLdOutput
public static void HandleLdOutput(AbstractDProject prj, BuildResult br, string linkerOutput)
{
var ctxt = ResolutionContext.Create(DResolverWrapper.CreateParseCacheView(prj), null, null);
ctxt.ContextIndependentOptions =
ResolutionOptions.IgnoreAllProtectionAttributes |
ResolutionOptions.DontResolveBaseTypes |
ResolutionOptions.DontResolveBaseClasses |
ResolutionOptions.DontResolveAliases;
foreach (Match m in ldErrorRegex.Matches(linkerOutput))
{
var error = new BuildError();
var firstSymbolOccurring = ldMangleRegex.Match(m.Groups["err"].Value);
if(firstSymbolOccurring.Success)
{
var mangledString = "_D" + firstSymbolOccurring.Groups["mangle"].Value;
var associatedSymbol = DResolver.GetResultMember(Demangler.DemangleAndResolve(mangledString, ctxt));
if(associatedSymbol != null)
{
error.FileName = (associatedSymbol.NodeRoot as DModule).FileName;
error.Line = associatedSymbol.Location.Line;
error.Column = associatedSymbol.Location.Column;
}
}
error.ErrorText = m.Groups["msg"].Value;
if (string.IsNullOrWhiteSpace(error.ErrorText))
error.ErrorText = m.Groups["err"].Value;
error.ErrorText = DemangleLdOutput(error.ErrorText);
br.Append(error);
}
}
示例10: ParseOutput
static BuildResult ParseOutput(string stdout, string stderr)
{
BuildResult result = new BuildResult ();
StringBuilder compilerOutput = new StringBuilder ();
bool typeLoadException = false;
foreach (string s in new string[] { stdout, stderr }) {
StreamReader sr = File.OpenText (s);
while (true) {
if (typeLoadException) {
compilerOutput.Append (sr.ReadToEnd ());
break;
}
string curLine = sr.ReadLine();
compilerOutput.AppendLine (curLine);
if (curLine == null)
break;
curLine = curLine.Trim();
if (curLine.Length == 0)
continue;
if (curLine.StartsWith ("Unhandled Exception: System.TypeLoadException") ||
curLine.StartsWith ("Unhandled Exception: System.IO.FileNotFoundException")) {
result.ClearErrors ();
typeLoadException = true;
}
BuildError error = CreateErrorFromString (curLine);
if (error != null)
result.Append (error);
}
sr.Close();
}
if (typeLoadException) {
Regex reg = new Regex (@".*WARNING.*used in (mscorlib|System),.*", RegexOptions.Multiline);
if (reg.Match (compilerOutput.ToString ()).Success)
result.AddError ("", 0, 0, "", "Error: A referenced assembly may be built with an incompatible CLR version. See the compilation output for more details.");
else
result.AddError ("", 0, 0, "", "Error: A dependency of a referenced assembly may be missing, or you may be referencing an assembly created with a newer CLR version. See the compilation output for more details.");
}
result.CompilerOutput = compilerOutput.ToString ();
return result;
}
示例11: CreateMergedPlist
public static BuildResult CreateMergedPlist (IProgressMonitor monitor,
ProjectFile template, string outPath,
Func<PlistDocument,BuildResult> merge)
{
var result = new BuildResult ();
var doc = new PlistDocument ();
if (template != null) {
try {
doc.LoadFromXmlFile (template.FilePath);
} catch (Exception ex) {
if (ex is XmlException)
result.AddError (template.FilePath, ((XmlException)ex).LineNumber,
((XmlException)ex).LinePosition, null, ex.Message);
else
result.AddError (template.FilePath, 0, 0, null, ex.Message);
monitor.ReportError (GettextCatalog.GetString ("Could not load file '{0}': {1}",
template.FilePath, ex.Message), null);
return result;
}
}
try {
if (result.Append (merge (doc)).ErrorCount > 0)
return result;
} catch (Exception ex) {
result.AddError ("Error merging Info.plist: " + ex.Message);
LoggingService.LogError ("Error merging Info.plist", ex);
return result;
}
try {
EnsureDirectoryForFile (outPath);
doc.WriteToFile (outPath);
} catch (Exception ex) {
result.AddError (outPath, 0, 0, null, ex.Message);
monitor.ReportError (GettextCatalog.GetString ("Could not write file '{0}'", outPath), ex);
}
return result;
}
示例12: Build
protected override BuildResult Build (IProgressMonitor monitor, SolutionEntityItem item, ConfigurationSelector configuration)
{
IPhoneProject proj = item as IPhoneProject;
if (proj == null || proj.CompileTarget != CompileTarget.Exe)
return base.Build (monitor, item, configuration);
IPhoneFramework.CheckInfoCaches ();
//prebuild
var conf = (IPhoneProjectConfiguration) proj.GetConfiguration (configuration);
bool isDevice = conf.Platform == IPhoneProject.PLAT_IPHONE;
if (IPhoneFramework.SimOnly && isDevice) {
//if in the GUI, show a dialog too
if (MonoDevelop.Ide.IdeApp.IsInitialized)
Gtk.Application.Invoke (delegate { IPhoneFramework.ShowSimOnlyDialog (); } );
return IPhoneFramework.GetSimOnlyError ();
}
var result = new BuildResult ();
var sdkVersion = conf.MtouchSdkVersion.ResolveIfDefault ();
if (!IPhoneFramework.SdkIsInstalled (sdkVersion)) {
sdkVersion = IPhoneFramework.GetClosestInstalledSdk (sdkVersion);
if (sdkVersion.IsUseDefault || !IPhoneFramework.SdkIsInstalled (sdkVersion)) {
if (conf.MtouchSdkVersion.IsUseDefault)
result.AddError (
string.Format ("The Apple iPhone SDK is not installed."));
else
result.AddError (
string.Format ("Apple iPhone SDK version '{0}' is not installed, and no newer version was found.",
conf.MtouchSdkVersion));
return result;
}
result.AddWarning (
string.Format ("Apple iPhone SDK version '{0}' is not installed. Using newer version '{1}' instead'.",
conf.MtouchSdkVersion, sdkVersion));
}
IPhoneAppIdentity identity = null;
if (isDevice) {
monitor.BeginTask (GettextCatalog.GetString ("Detecting signing identity..."), 0);
if ((result = GetIdentity (monitor, proj, conf, out identity).Append (result)).ErrorCount > 0)
return result;
monitor.Log.WriteLine ("Provisioning profile: \"{0}\" ({1})", identity.Profile.Name, identity.Profile.Uuid);
monitor.Log.WriteLine ("Signing Identity: \"{0}\"", Keychain.GetCertificateCommonName (identity.SigningKey));
monitor.Log.WriteLine ("App ID: \"{0}\"", identity.AppID);
monitor.EndTask ();
} else {
identity = new IPhoneAppIdentity () {
BundleID = !string.IsNullOrEmpty (proj.BundleIdentifier)?
proj.BundleIdentifier : GetDefaultBundleID (proj, null)
};
}
result = base.Build (monitor, item, configuration).Append (result);
if (result.ErrorCount > 0)
return result;
if (!Directory.Exists (conf.AppDirectory))
Directory.CreateDirectory (conf.AppDirectory);
var assemblyRefs = proj.GetReferencedAssemblies (configuration).Distinct ().ToList ();
FilePath mtouchOutput = conf.NativeExe;
if (new FilePair (conf.CompiledOutputName, mtouchOutput).NeedsBuilding ()) {
BuildResult error;
var mtouch = GetMTouch (proj, monitor, out error);
if (error != null)
return error.Append (result);
var args = new ProcessArgumentBuilder ();
//FIXME: make verbosity configurable?
args.Add ("-v");
args.Add ("--nomanifest", "--nosign");
//FIXME: should we error out if the platform is invalid?
if (conf.Platform == IPhoneProject.PLAT_IPHONE) {
args.Add ("-dev");
args.AddQuoted (conf.AppDirectory);
} else {
args.Add ("-sim");
args.AddQuoted (conf.AppDirectory);
}
foreach (string asm in assemblyRefs)
args.AddQuotedFormat ("-r={0}", asm);
IPhoneSdkVersion osVersion = IPhoneSdkVersion.V3_0;
try {
osVersion = IPhoneSdkVersion.Parse (conf.MtouchMinimumOSVersion);
} catch {
result.AddWarning ("Could not parse minimum OS version '" + conf.MtouchMinimumOSVersion + "'");
}
if (osVersion < IPhoneSdkVersion.V3_0 && conf.MtouchArch == MtouchArch.ARMv7) {
//.........这里部分代码省略.........
示例13: HandleOptLinkOutput
private void HandleOptLinkOutput(BuildResult br, string linkerOutput)
{
var matches = optlinkRegex.Matches (linkerOutput);
foreach (Match match in matches) {
var error = new BuildError ();
// Get associated D source file
if (match.Groups ["obj"].Success) {
var obj = Project.GetAbsoluteChildPath (new FilePath (match.Groups ["obj"].Value)).ChangeExtension (".d");
foreach (var pf in Project.Files)
if (pf.FilePath == obj) {
error.FileName = pf.FilePath;
break;
}
}
error.ErrorText = "Linker error " + match.Groups ["code"].Value + " - " + match.Groups ["message"].Value;
br.Append (error);
}
}
示例14: Clean
public async Task<BuildResult> Clean (ProgressMonitor monitor, ConfigurationSelector configuration, OperationContext operationContext = null)
{
AssertMainThread ();
var res = new BuildResult { BuildCount = 0 };
foreach (var bt in Items.OfType<IBuildTarget> ())
res.Append (await bt.Clean (monitor, configuration, operationContext));
return res;
}
示例15: OnBuild
protected async override Task<BuildResult> OnBuild (ProgressMonitor monitor, ConfigurationSelector configuration, OperationContext operationContext)
{
var toBuild = Translations.Where (t => t.NeedsBuilding(configuration)).ToArray ();
BuildResult results = new BuildResult ("", 1, 0);
string outputDirectory = GetOutputDirectory (configuration);
if (!string.IsNullOrEmpty (outputDirectory)) {
await Task.Run (delegate {
foreach (Translation translation in toBuild) {
if (translation.NeedsBuilding (configuration)) {
BuildResult res = translation.Build (monitor, configuration);
results.Append (res);
}
}
isDirty = false;
});
}
return results;
}