protected override BuildResult Compile (MonoDevelop.Core.IProgressMonitor monitor, SolutionEntityItem item, BuildData buildData) { var proj = item as Project; if (proj == null) return base.Compile (monitor, item, buildData); if (!proj.GetProjectTypes().Any(x => supportedProjectTypes.ContainsKey(x))) return base.Compile (monitor, item, buildData); var files = buildData.Items.Where(x => x is ProjectFile).Cast<ProjectFile>().ToArray(); foreach (var file in files.Where(f => f.BuildAction == "MonoGameContentReference")) { var path = System.IO.Path.Combine (Path.GetDirectoryName (file.FilePath.ToString ()), "bin", supportedProjectTypes[platform]); monitor.Log.WriteLine("Processing {0}", path); if (!Directory.Exists (path)) continue; foreach (var output in Directory.GetFiles (path, "*.*", SearchOption.AllDirectories)) { var link = string.Format ("Content{0}", output.Replace (path, "")); if (proj.Files.FirstOrDefault (x => Path.GetFileName (x.FilePath.ToString ()) == Path.GetFileName (output)) == null) { monitor.Log.WriteLine ("Auto Including Content {0}", output); proj.Files.Add (new ProjectFile (output, BuildAction.BundleResource) { Link = new MonoDevelop.Core.FilePath (link), Flags = ProjectItemFlags.DontPersist | ProjectItemFlags.Hidden, Visible = false, }); } } } return base.Compile (monitor, item, buildData); }
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(); } }
protected override BuildResult Compile(MonoDevelop.Core.IProgressMonitor monitor, SolutionEntityItem item, BuildData buildData) { #if DEBUG monitor.Log.WriteLine("MonoGame Extension Compile Called"); #endif try { var proj = item as MonoGameProject; if (proj == null) { return base.Compile (monitor, item, buildData); } monitor.Log.WriteLine("Compiling for {0}", proj.MonoGamePlatform); var results = new System.Collections.Generic.List<BuildResult>(); foreach(var file in proj.Files) { if (MonoGameBuildAction.IsMonoGameBuildAction(file.BuildAction)) { buildData.Items.Add(file); var buildResult = MonoGameContentProcessor.Compile(file, monitor, buildData); results.Add(buildResult); } } return base.Compile (monitor, item, buildData).Append(results); } finally { #if DEBUG monitor.Log.WriteLine("MonoGame Extension Compile Ended"); #endif } }
protected override BuildResult Compile (IProgressMonitor monitor, SolutionEntityItem item, BuildData buildData) { MoonlightProject proj = item as MoonlightProject; if (proj == null) return base.Compile (monitor, item, buildData); var objDir = GetObjDir (proj, buildData.Configuration); if (!Directory.Exists (objDir)) Directory.CreateDirectory (objDir); var codeDomProvider = proj.LanguageBinding.GetCodeDomProvider (); string appName = proj.Name; var toResGen = new List<FilePath> (); List<BuildResult> results = new List<BuildResult> (); foreach (ProjectFile pf in proj.Files) { if (pf.BuildAction == BuildAction.Resource || pf.BuildAction == BuildAction.Page || pf.BuildAction == BuildAction.ApplicationDefinition) toResGen.Add (pf.FilePath); if (pf.FilePath.Extension == ".xaml" && pf.Generator == "MSBuild:MarkupCompilePass1") { var outFile = objDir.Combine (proj.LanguageBinding.GetFileName (pf.FilePath.FileName + ".g")); buildData.Items.Add (new ProjectFile (outFile, BuildAction.Compile)); if (!File.Exists (outFile) || File.GetLastWriteTime (outFile) < File.GetLastWriteTime (pf.FilePath)) { string rel = pf.ProjectVirtualPath; monitor.Log.WriteLine ("Generating codebehind accessors for {0}...", rel); BuildResult result = XamlG.GenerateFile (codeDomProvider, appName, pf.FilePath, rel, outFile); if (result.Failed) return result; results.Add (result); } } } string resFile = objDir.Combine (appName + ".g.resources"); if (toResGen.Count > 0) { DateTime lastMod = DateTime.MinValue; if (File.Exists (resFile)) lastMod = File.GetLastWriteTime (resFile); foreach (string f in toResGen) { if (File.GetLastWriteTime (f) > lastMod) { BuildResult result = Respack (monitor, proj, toResGen, resFile); if (result.Failed) return result; results.Add (result); break; } } buildData.Items.Add (new ProjectFile (resFile, BuildAction.EmbeddedResource) { ResourceId = appName + ".g.resources" }); } else { if (File.Exists (resFile)) File.Delete (resFile); } return base.Compile (monitor, item, buildData).Append (results); }
public static BuildResult Compile( ProjectFile file, MonoDevelop.Core.IProgressMonitor monitor, BuildData buildData) { switch (file.BuildAction) { case "MonoGameShader": { var results = new BuildResult (); monitor.Log.WriteLine ("Compiling Shader"); monitor.Log.WriteLine ("Shader : " + buildData.Configuration.OutputDirectory); monitor.Log.WriteLine ("Shader : " + file.FilePath); monitor.Log.WriteLine ("Shader : " + file.ToString ()); return results; } default: return new BuildResult (); } }
protected override BuildResult Compile(MonoDevelop.Core.IProgressMonitor monitor, SolutionEntityItem item, BuildData buildData) { try { var proj = item as MonoGameProject; if (proj == null){ return base.Compile (monitor, item, buildData); } var results = new System.Collections.Generic.List<BuildResult>(); foreach (var file in proj.Files) { if (MonoGameBuildAction.IsMonoGameBuildAction(file.BuildAction)){ buildData.Items.Add(file); var buildresults = MonoGameContentProcessor.Compile(file, monitor,buildData); results.Add(buildresults); } } return base.Compile(monitor, item, buildData).Append(results); } finally { } }
internal virtual BuildResult Compile(IProgressMonitor monitor, SolutionEntityItem item, BuildData buildData, ItemCompileCallback callback) { compileCallbackStack.Push(callback); try { BuildResult res = Compile(monitor, item, buildData); return(res); } finally { compileCallbackStack.Pop(); } }
internal protected override Task<BuildResult> OnCompile (ProgressMonitor monitor, BuildData buildData) { return Project.OnCompile (monitor, buildData); }
protected virtual Task<BuildResult> OnCompile (ProgressMonitor monitor, BuildData buildData) { return MD1DotNetProjectHandler.Compile (monitor, this, buildData); }
internal Task<BuildResult> Compile (ProgressMonitor monitor, BuildData buildData) { return ProjectExtension.OnCompile (monitor, buildData); }
internal protected virtual Task<BuildResult> OnCompile (ProgressMonitor monitor, BuildData buildData) { return next.OnCompile (monitor, buildData); }
protected virtual BuildResult Compile (IProgressMonitor monitor, SolutionEntityItem item, BuildData buildData) { return GetNext (item).Compile (monitor, item, buildData, compileCallbackStack.Peek ()); }
internal override BuildResult Compile(IProgressMonitor monitor, SolutionEntityItem item, BuildData buildData, ItemCompileCallback callback) { return callback (monitor, item, buildData); }
protected override BuildResult Compile (MonoDevelop.Core.IProgressMonitor monitor, SolutionEntityItem item, BuildData buildData) { #if DEBUG monitor.Log.WriteLine("MonoGame Extension Compile Called"); #endif try { var cfg = buildData.Configuration as MonoGameContentProjectConfiguration; var proj = item as MonoGameContentProject; if (proj == null || cfg == null) { monitor.Log.WriteLine("Compiling for Unknown MonoGame Project"); return base.Compile(monitor, item, buildData); } monitor.Log.WriteLine("Detected {0} MonoGame Platform", cfg.MonoGamePlatform); var result = new BuildResult(); var manager = new PipelineManager(proj.BaseDirectory.FullPath, Path.Combine(buildData.Configuration.OutputDirectory, cfg.MonoGamePlatform), buildData.Configuration.IntermediateOutputDirectory); manager.Logger = new MonitorBuilder(monitor, result); manager.Platform = (TargetPlatform)Enum.Parse(typeof(TargetPlatform), cfg.MonoGamePlatform); try { foreach(var pr in proj.ParentSolution.GetAllProjects()) { if (pr is DotNetAssemblyProject) { var dot = pr as DotNetAssemblyProject; foreach(var r in dot.References) { if (r.Package.Name == "monogame-contentpipeline" ) { var output = dot.GetOutputFileName(buildData.ConfigurationSelector).FullPath; monitor.Log.WriteLine("Adding {0} to Content Pipeline Assembly List", output); manager.AddAssembly(output); proj.Manager.AddAssembly(output); break; } } } } } catch(Exception ex) { result.AddWarning(string.Format("Problem processing Content Extensions {0}", ex.Message)); } var dict = new Microsoft.Xna.Framework.Content.Pipeline.OpaqueDataDictionary(); if (cfg != null) { if (cfg.XnaCompressContent.ToLower() == "true") { // tell the manager to compress the output } } foreach(var file in proj.Files) { if (file.BuildAction == "Compile") { try { dict.Clear(); foreach(object key in file.ExtendedProperties.Keys) { string k = key as string; if (k != null && k.StartsWith("ProcessorParameters_")) { if (!dict.ContainsKey(k.Replace("ProcessorParameters_", String.Empty))) { dict.Add(k.Replace("ProcessorParameters_", String.Empty), file.ExtendedProperties[k]); } else { dict[k.Replace("ProcessorParameters_", String.Empty)] = file.ExtendedProperties[k]; } } } // check if the file has changed and rebuild if required. manager.BuildContent(file.FilePath.FullPath, null, file.ExtendedProperties.Contains("Importer") ? (string)file.ExtendedProperties["Importer"] : null, file.ExtendedProperties.Contains("Processor") ? (string)file.ExtendedProperties["Processor"] : null, dict); } catch(Exception ex) { monitor.Log.WriteLine(ex.ToString()); result.AddError(ex.Message); } } } return result; } finally { #if DEBUG monitor.Log.WriteLine("MonoGame Extension Compile Ended"); #endif } }
protected override BuildResult Compile (IProgressMonitor monitor, SolutionEntityItem item, BuildData buildData) { CheckNHibernateProject (item); return base.Compile (monitor, item, buildData); }
protected override BuildResult Compile(IProgressMonitor monitor, SolutionEntityItem item, BuildData buildData) { MonobjcProject proj = item as MonobjcProject; if (proj == null || proj.CompileTarget != CompileTarget.Exe) return base.Compile(monitor, item, buildData); BuildResult result = base.Compile(monitor, item, buildData); if (result.ErrorCount > 0) return result; BuildUtils.CompileXibs(monitor, buildData, result); if (result.ErrorCount > 0) return result; BuildUtils.CopyContentFiles(proj, monitor, buildData, result); if (result.ErrorCount > 0) return result; return result; }
protected override BuildResult Compile (IProgressMonitor monitor, SolutionEntityItem item, BuildData buildData) { IPhoneProject proj = item as IPhoneProject; if (proj == null || (proj.CompileTarget != CompileTarget.Exe && proj.CompileTarget != CompileTarget.Library)) return base.Compile (monitor, item, buildData); var cfg = (IPhoneProjectConfiguration) buildData.Configuration; var projFiles = buildData.Items.OfType<ProjectFile> (); if (proj.CompileTarget == CompileTarget.Library) { if (IPhoneFramework.MonoTouchVersion < new IPhoneSdkVersion (3, 99)) return base.Compile (monitor, item, buildData); //pack nibs and content into the dll resources (MT 4+ only) var nibDir = cfg.ObjDir.Combine ("nibs"); var xibRes = MacBuildUtilities.CompileXibFiles (monitor, projFiles, nibDir); if (xibRes.ErrorCount > 0) return xibRes; MangleLibraryResourceNames (buildData, nibDir, xibRes); return xibRes.Append (base.Compile (monitor, item, buildData)); } string appDir = cfg.AppDirectory; var sdkVersion = cfg.MtouchSdkVersion.ResolveIfDefault (); if (!IPhoneFramework.SdkIsInstalled (sdkVersion)) sdkVersion = IPhoneFramework.GetClosestInstalledSdk (sdkVersion); var result = MacBuildUtilities.UpdateCodeBehind (monitor, proj.CodeBehindGenerator, projFiles); if (result.ErrorCount > 0) return result; if (!cfg.IsValidAppName) result.AddWarning ("iOS executable name should be alphanumeric, or it may not run (Project Options->Build->Output)."); if (result.Append (base.Compile (monitor, item, buildData)).ErrorCount > 0) return result; if (result.Append (MacBuildUtilities.CompileXibFiles (monitor, projFiles, appDir)).ErrorCount > 0) return result; var contentFiles = GetContentFilePairs (projFiles, appDir, result) .Where (NeedsBuilding).ToList (); contentFiles.AddRange (GetIconContentFiles (sdkVersion, proj, cfg)); if (contentFiles.Count > 0) { monitor.BeginTask (GettextCatalog.GetString ("Copying content files"), contentFiles.Count); foreach (var file in contentFiles) { file.EnsureOutputDirectory (); monitor.Log.WriteLine (GettextCatalog.GetString ("Copying '{0}' to '{1}'", file.Input, file.Output)); if (!File.Exists (file.Input)) { var msg = String.Format ("File '{0}' is missing.", file.Input); monitor.Log.WriteLine (msg); result.AddError (null, 0, 0, null, msg); } else { File.Copy (file.Input, file.Output, true); } monitor.Step (1); } monitor.EndTask (); } return result; }
void MangleLibraryResourceNames (BuildData buildData, FilePath tempNibDir, BuildResult result) { for (int i = 0; i < buildData.Items.Count; i++) { var pf = buildData.Items[i] as ProjectFile; if (pf == null) continue; if (pf.BuildAction == BuildAction.Content) { var vpath = pf.ProjectVirtualPath; if (!CheckContentNamePermitted (vpath, result)) continue; buildData.Items[i] = new ProjectFile (pf.FilePath, BuildAction.EmbeddedResource) { ResourceId = "__monotouch_content_" + EscapeMangledResource (vpath) }; } else if (pf.BuildAction == BuildAction.Page) { var vpath = pf.ProjectVirtualPath; if (vpath.Extension != ".xib") continue; if (!CheckPageNamePermitted (vpath, result)) continue; vpath = vpath.ChangeExtension (".nib"); var nibPath = vpath.ToAbsolute (tempNibDir); buildData.Items[i] = new ProjectFile (nibPath, BuildAction.EmbeddedResource) { ResourceId = "__monotouch_page_" + EscapeMangledResource (vpath) }; } } }
protected virtual BuildResult Compile(IProgressMonitor monitor, SolutionEntityItem item, BuildData buildData) { return(GetNext(item).Compile(monitor, item, buildData, compileCallbackStack.Peek())); }
public static void CopyContentFiles(MonobjcProject proj, IProgressMonitor monitor, BuildData buildData, BuildResult result) { var cfg = (MonobjcProjectConfiguration)buildData.Configuration; string resDir = ((MonobjcProjectConfiguration)buildData.Configuration).ResourcesDirectory; // Copy 'content' files into 'Resources' directory var contentFiles = BuildUtils.GetContentFilePairs(buildData.Items.OfType<ProjectFile>(), resDir) .Where(f => f.NeedsBuilding()) .ToList(); if (!proj.BundleIcon.IsNullOrEmpty) { FilePair icon = new FilePair(proj.BundleIcon, cfg.ResourcesDirectory.Combine(proj.BundleIcon.FileName)); if (!File.Exists(proj.BundleIcon)) { result.AddError(null, 0, 0, null, String.Format("Application icon '{0}' is missing.", proj.BundleIcon)); return; } else { contentFiles.Add(icon); } } if (contentFiles.Count > 0) { monitor.BeginTask(GettextCatalog.GetString("Copying content files"), contentFiles.Count); foreach (var file in contentFiles) { file.EnsureOutputDirectory(); monitor.Log.WriteLine(GettextCatalog.GetString("Copying '{0}' to '{1}'", file.Input, file.Output)); File.Copy(file.Input, file.Output, true); monitor.Step(1); } monitor.EndTask(); } }
internal virtual BuildResult Compile (IProgressMonitor monitor, SolutionEntityItem item, BuildData buildData, ItemCompileCallback callback) { compileCallbackStack.Push (callback); try { BuildResult res = Compile (monitor, item, buildData); return res; } finally { compileCallbackStack.Pop (); } }
internal protected virtual Task <BuildResult> OnCompile(ProgressMonitor monitor, BuildData buildData) { return(next.OnCompile(monitor, buildData)); }
protected override BuildResult Compile (IProgressMonitor monitor, SolutionEntityItem item, BuildData buildData) { return base.Compile (monitor, item, buildData); }
protected override BuildResult Compile (IProgressMonitor monitor, SolutionEntityItem item, BuildData buildData) { IPhoneProject proj = item as IPhoneProject; if (proj == null || proj.CompileTarget != CompileTarget.Exe) return base.Compile (monitor, item, buildData); var cfg = (IPhoneProjectConfiguration) buildData.Configuration; //make sure the codebehind files are updated before building monitor.BeginTask (GettextCatalog.GetString ("Updating CodeBehind files"), 0); var cbWriter = MonoDevelop.DesignerSupport.CodeBehindWriter.CreateForProject (monitor, proj); BuildResult result = null; if (cbWriter.SupportsPartialTypes) { bool forceRegen = !Directory.Exists (cfg.AppDirectory); result = CodeBehind.UpdateXibCodebehind (cbWriter, proj, buildData.Items.OfType<ProjectFile> (), forceRegen); cbWriter.WriteOpenFiles (); if (cbWriter.WrittenCount > 0) monitor.Log.WriteLine (GettextCatalog.GetString ("Updated {0} CodeBehind files", cbWriter.WrittenCount)); } else { monitor.ReportWarning ("Cannot generate designer code, because CodeDom " + "provider does not support partial classes."); } monitor.EndTask (); if (base.GetNeedsBuilding (item, buildData.ConfigurationSelector)) { result = base.Compile (monitor, item, buildData).Append (result); if (result.ErrorCount > 0) return result; } string appDir = ((IPhoneProjectConfiguration)buildData.Configuration).AppDirectory; var ibfiles = GetIBFilePairs (buildData.Items.OfType<ProjectFile> (), appDir).Where (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; 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 (); } var contentFiles = GetContentFilePairs (buildData.Items.OfType<ProjectFile> (), appDir) .Where (NeedsBuilding).ToList (); if (!proj.BundleIcon.IsNullOrEmpty) { FilePair icon = new FilePair (proj.BundleIcon, cfg.AppDirectory.Combine (proj.BundleIcon.FileName)); if (!File.Exists (proj.BundleIcon)) { result.AddError (null, 0, 0, null, String.Format ("Application icon '{0}' is missing.", proj.BundleIcon)); return result; } else if (icon.NeedsBuilding ()) { contentFiles.Add (icon); } } if (contentFiles.Count > 0) { monitor.BeginTask (GettextCatalog.GetString ("Copying content files"), contentFiles.Count); foreach (var file in contentFiles) { file.EnsureOutputDirectory (); monitor.Log.WriteLine (GettextCatalog.GetString ("Copying '{0}' to '{1}'", file.Input, file.Output)); File.Copy (file.Input, file.Output, true); monitor.Step (1); } monitor.EndTask (); } return result; }
internal override BuildResult Compile(IProgressMonitor monitor, SolutionEntityItem item, BuildData buildData, ItemCompileCallback callback) { return(callback(monitor, item, buildData)); }
protected override BuildResult Compile (IProgressMonitor monitor, SolutionEntityItem item, BuildData buildData) { IPhoneProject proj = item as IPhoneProject; if (proj == null || proj.CompileTarget != CompileTarget.Exe) return base.Compile (monitor, item, buildData); var cfg = (IPhoneProjectConfiguration) buildData.Configuration; var projFiles = buildData.Items.OfType<ProjectFile> (); string appDir = cfg.AppDirectory; var result = MacBuildUtilities.UpdateCodeBehind (monitor, proj.CodeBehindGenerator, projFiles); if (result.ErrorCount > 0) return result; if (!cfg.IsValidAppName) result.AddWarning ("iOS executable name should be alphanumeric, or it may not run (Project Options->Build->Output)."); if (result.Append (base.Compile (monitor, item, buildData)).ErrorCount > 0) return result; if (result.Append (MacBuildUtilities.CompileXibFiles (monitor, projFiles, appDir)).ErrorCount > 0) return result; var contentFiles = GetContentFilePairs (projFiles, appDir) .Where (NeedsBuilding).ToList (); contentFiles.AddRange (GetIconContentFiles (proj, cfg)); if (contentFiles.Count > 0) { monitor.BeginTask (GettextCatalog.GetString ("Copying content files"), contentFiles.Count); foreach (var file in contentFiles) { file.EnsureOutputDirectory (); monitor.Log.WriteLine (GettextCatalog.GetString ("Copying '{0}' to '{1}'", file.Input, file.Output)); if (!File.Exists (file.Input)) { var msg = String.Format ("File '{0}' is missing.", file.Input); monitor.Log.WriteLine (msg); result.AddError (null, 0, 0, null, msg); } else { File.Copy (file.Input, file.Output, true); } monitor.Step (1); } monitor.EndTask (); } return result; }