public static void Run(string filePath, DProject project, DProjectConfiguration conf) { if (manager == null) { manager = new ProgressMonitorManager(); monitor = manager.GetOutputProgressMonitor("Run Unittest", Stock.RunProgramIcon, true, true); } Pad pad = manager.GetPadForMonitor(monitor); if (pad != null) { pad.BringToFront(); } monitor.BeginTask("start unittest...", 1); new System.Threading.Thread(delegate(){ string[] cmdParts = GetCmdParts(project); string args = GetCommandArgs(cmdParts.Length >= 2 ?cmdParts[1] : "", filePath, project, conf); string errorOutput; string stdOutput; string execDir = GetExecDir(project, conf); ProjectBuilder.ExecuteCommand(cmdParts[0], args, execDir, monitor, out stdOutput, out errorOutput); monitor.Log.WriteLine("unittest done."); monitor.EndTask(); }).Start(); }
public void Load(DProject proj, DProjectConfiguration config) { project = proj; configuration = config; cbUseDefaultCompiler.Active = proj.UseDefaultCompilerVendor; OnUseDefaultCompilerChanged(); Gtk.TreeIter iter; if (cmbCompiler.Model.GetIterFirst (out iter)) { do { if (proj.UsedCompilerVendor == (DCompilerVendor)cmbCompiler.Model.GetValue(iter, 1)) { cmbCompiler.SetActiveIter(iter); break; } } while (cmbCompiler.Model.IterNext (ref iter)); } extraCompilerTextView.Buffer.Text = config.ExtraCompilerArguments; extraLinkerTextView.Buffer.Text = config.ExtraLinkerArguments; libStore.Clear(); foreach (string lib in proj.ExtraLibraries) libStore.AppendValues (lib); includePathStore.Clear(); foreach(var p in project.LocalIncludeCache.DirectoryPaths) includePathStore.AppendValues(p); }
public static IEnumerable <string> GetLibraries(DProjectConfiguration projCfg, DCompilerConfiguration compiler) { var libraries = new List <string>(FillInMacros(projCfg.GetReferencedLibraries(projCfg.Selector), new PrjPathMacroProvider { slnPath = projCfg.Project.ParentSolution != null ? projCfg.Project.ParentSolution.BaseDirectory.ToString() : "" })); // Link in lib files that are ought to be 'Compile'd foreach (var pf in projCfg.Project.Files) { if (pf.BuildAction != BuildAction.Compile) { continue; } var filePath = pf.IsLink ? pf.Link : pf.FilePath; if (OS.IsWindows ? filePath.Extension == ".a" : filePath.Extension == ".lib") { libraries.Add(filePath); } } if (compiler.EnableGDCLibPrefixing) { libraries = new List <string>(HandleGdcSpecificLibraryReferencing(libraries, projCfg.Project.BaseDirectory)); } return(libraries); }
public void Load(DProject proj, DProjectConfiguration config) { project = proj; configuration = config; cbUseDefaultCompiler.Active = proj.UseDefaultCompilerVendor; OnUseDefaultCompilerChanged(); Gtk.TreeIter iter; if (cmbCompiler.Model.GetIterFirst(out iter)) { do { if (proj.UsedCompilerVendor == (DCompilerVendor)cmbCompiler.Model.GetValue(iter, 1)) { cmbCompiler.SetActiveIter(iter); break; } } while (cmbCompiler.Model.IterNext(ref iter)); } extraCompilerTextView.Buffer.Text = config.ExtraCompilerArguments; extraLinkerTextView.Buffer.Text = config.ExtraLinkerArguments; libStore.Clear(); foreach (string lib in proj.ExtraLibraries) { libStore.AppendValues(lib); } includePathStore.Clear(); foreach (var p in project.LocalIncludeCache.DirectoryPaths) { includePathStore.AppendValues(p); } }
public ProjectIncludesWidget (DProject prj, DProjectConfiguration cfg) { this.Build (); Project = prj; CurrentConfig = cfg; }
/// <summary> /// Compiles a D project. /// </summary> public BuildResult Build(DProject Project, ConfigurationSelector BuildConfigurationSelector) { this.Project = Project; BuildConfig = Project.GetConfiguration(BuildConfigurationSelector) as DProjectConfiguration; commonMacros = new PrjPathMacroProvider { slnPath = Project.ParentSolution != null?EnsureCorrectPathSeparators(Project.ParentSolution.BaseDirectory) : "" }; BuiltObjects.Clear(); if (Compiler == null) { var targetBuildResult = new BuildResult(); targetBuildResult.AddError("Project compiler \"" + Project.UsedCompilerVendor + "\" not found"); targetBuildResult.FailedBuildCount++; return(targetBuildResult); } if (!Directory.Exists(AbsoluteObjectDirectory)) { Directory.CreateDirectory(AbsoluteObjectDirectory); } if (CanDoOneStepBuild) { return(DoOneStepBuild()); } else { return(DoStepByStepBuild()); } }
public ProjectDependenciesWidget(DProject prj, DProjectConfiguration cfg) { this.Build (); Show(); Project = prj; CurrentConfig = cfg; }
static string GetExecDir(DProject project, DProjectConfiguration conf) { string execDir = conf.OutputDirectory.FullPath; if (!Directory.Exists(execDir)) { execDir = project.BaseDirectory.FullPath; } return(execDir); }
static string AbsoluteObjectDirectory(DProjectConfiguration cfg) { if (Path.IsPathRooted(cfg.ObjectDirectory)) { return(ObjectDirectory(cfg)); } else { return(Path.Combine(cfg.Project.BaseDirectory, ObjectDirectory(cfg))); } }
public static void GenerateMakefile(DProject prj, DProjectConfiguration cfg, ref string file) { if (string.IsNullOrEmpty(file)) { file = prj.BaseDirectory.Combine("makefile"); } var code = GenerateMakeCode(prj, cfg); File.WriteAllText(file, code); }
public static void RunExternal(string filePath, DProject project, DProjectConfiguration conf) { if (console == null) { console = ExternalConsoleFactory.Instance.CreateConsole(false); } string args = GetCommandArgs(UnittestSettings.UnittestCommand, filePath, project, conf); //string execDir = GetExecDir(project, conf); //Runtime.ProcessService.StartConsoleProcess(cmdParts[0],args,execDir,console,null); }
public static IEnumerable <string> GetLibraries(DProjectConfiguration projCfg, DCompilerConfiguration compiler) { IEnumerable <string> libraries = FillInMacros(projCfg.GetReferencedLibraries(projCfg.Selector), new PrjPathMacroProvider { slnPath = projCfg.Project.ParentSolution != null ? projCfg.Project.ParentSolution.BaseDirectory.ToString() : "" }); if (compiler.EnableGDCLibPrefixing) { libraries = HandleGdcSpecificLibraryReferencing(libraries, projCfg.Project.BaseDirectory); } return(libraries); }
public static void RunExternal(string filePath, DProject project, DProjectConfiguration conf) { if (console == null) { console = ExternalConsoleFactory.Instance.CreateConsole(false); } string[] cmdParts = GetCmdParts(project); string args = GetCommandArgs(cmdParts.Length >= 2 ?cmdParts[1] : "", filePath, project, conf); string execDir = GetExecDir(project, conf); Runtime.ProcessService.StartConsoleProcess(cmdParts[0], args, execDir, console, null); }
/// <summary> /// Compiles a D project. /// </summary> public BuildResult Build(DProject Project, ConfigurationSelector BuildConfigurationSelector) { this.Project = Project; BuildConfig = Project.GetConfiguration(BuildConfigurationSelector) as DProjectConfiguration; if (Ide.IdeApp.Workbench == null) { _currentConfig = BuildConfig.Selector; } if (BuildConfig.Project != Project) { throw new InvalidOperationException("Wrong project configuration"); } commonMacros = new PrjPathMacroProvider { slnPath = Project.ParentSolution != null?EnsureCorrectPathSeparators(Project.ParentSolution.BaseDirectory) : "" }; BuiltObjects.Clear(); if (Compiler == null) { var targetBuildResult = new BuildResult(); targetBuildResult.AddError("Project compiler \"" + Project.UsedCompilerVendor + "\" not found"); targetBuildResult.FailedBuildCount++; _currentConfig = null; return(targetBuildResult); } var absDir = AbsoluteObjectDirectory(BuildConfig); if (!Directory.Exists(absDir)) { Directory.CreateDirectory(absDir); } BuildResult result; if (CanDoOneStepBuild) { result = DoOneStepBuild(); } else { result = DoStepByStepBuild(); } _currentConfig = null; return(result); }
static string PrefixedExtraLinkerFlags(DProjectConfiguration BuildConfig) { var linkerRedirectPrefix = BuildConfig.Project.Compiler.ArgumentPatterns.LinkerRedirectPrefix; if (string.IsNullOrWhiteSpace(BuildConfig.ExtraLinkerArguments)) { return(string.Empty); } var sb = new StringBuilder(BuildConfig.ExtraLinkerArguments); int lastArgStart = -1; bool isInString = false; for (int i = 0; i < sb.Length; i++) { switch (sb[i]) { case '\t': case ' ': if (isInString) { continue; } lastArgStart = -1; break; case '"': isInString = !isInString; goto default; default: if (lastArgStart == -1) { lastArgStart = i; sb.Insert(i, linkerRedirectPrefix); i += linkerRedirectPrefix.Length; } break; } } return(sb.ToString()); }
/// <summary> /// Compiles a D project. /// </summary> public BuildResult Build(DProject Project, ConfigurationSelector BuildConfigurationSelector) { this.Project = Project; BuildConfig = Project.GetConfiguration(BuildConfigurationSelector) as DProjectConfiguration; BuiltObjects.Clear(); if (Compiler == null) { var targetBuildResult = new BuildResult(); targetBuildResult.AddError("Project compiler \"" + Project.UsedCompilerVendor + "\" not found"); targetBuildResult.FailedBuildCount++; return(targetBuildResult); } if (Path.IsPathRooted(BuildConfig.ObjectDirectory)) { AbsoluteObjectDirectory = BuildConfig.ObjectDirectory; } else { AbsoluteObjectDirectory = Path.Combine(Project.BaseDirectory, EnsureCorrectPathSeparators(BuildConfig.ObjectDirectory)); } if (!Directory.Exists(AbsoluteObjectDirectory)) { Directory.CreateDirectory(AbsoluteObjectDirectory); } if (CanDoOneStepBuild) { return(DoOneStepBuild()); } else { return(DoStepByStepBuild()); } }
protected override void Run(object dataItem) { MessageHandler guiRun = delegate { var project = IdeApp.ProjectOperations.CurrentSelectedProject as DProject; if (project == null) { return; } DProjectConfiguration conf = project.Configurations["Unittest"] as DProjectConfiguration; if (conf == null) { return; } ProjectFile file = IdeApp.ProjectOperations.CurrentSelectedItem as ProjectFile; if (file == null) { return; } string filePath = file.FilePath.FullPath; IdeApp.Workbench.SaveAll(); if ((string)commandInfo.Command.Id == "MonoDevelop.D.Unittest.Commands.UnittestCommands.RunExternal") { UnittestCore.RunExternal(filePath, project, conf); } else { UnittestCore.Run(filePath, project, conf); } }; DispatchService.GuiDispatch(guiRun); }
public static string GenAdditionalAttributes(DCompilerConfiguration compiler, DProjectConfiguration cfg) { if (compiler == null || cfg == null) { return(string.Empty); } var sb = new StringBuilder(); var p = compiler.ArgumentPatterns; string s = cfg.Platform; if (s != null && s.Contains('|')) { s = s.Substring(0, s.IndexOf('|')); } if (cfg.Platform != null && compiler.ArgumentPatterns.PlatformDependentOptions.TryGetValue(s, out s)) { sb.Append(s).Append(' '); } if (cfg.UnittestMode) { sb.Append(p.UnittestFlag).Append(' '); } if (ProfilerModeHandler.IsProfilerMode && compiler.HasProfilerSupport) { sb.Append(p.ProfileFlag).Append(' '); } if (cfg.CustomDebugIdentifiers != null && cfg.CustomDebugIdentifiers.Length != 0) { foreach (var id in cfg.CustomDebugIdentifiers) { sb.Append(p.DebugDefinition + "=" + id + " "); } } if (cfg.DebugLevel > 0) { sb.Append(p.DebugDefinition).Append('=').Append(cfg.DebugLevel).Append(' '); } if (cfg.DebugMode) { sb.Append(p.DebugDefinition).Append(' '); } if (cfg.CustomVersionIdentifiers != null && cfg.CustomVersionIdentifiers.Length != 0) { foreach (var id in cfg.CustomVersionIdentifiers) { sb.Append(p.VersionDefinition).Append('=').Append(id).Append(' '); } } // DDoc handling if (cfg.Project == null) { return(sb.ToString().Trim()); } var ddocFiles = new List <string> (); var files = cfg.Project.GetItemFiles(true); foreach (var f in files) { if (f.Extension.EndsWith(".ddoc", StringComparison.OrdinalIgnoreCase)) { ddocFiles.Add(f); } } if (ddocFiles.Count != 0) { sb.Append(p.EnableDDocFlag + " "); foreach (var ddoc in ddocFiles) { sb.AppendFormat(p.DDocDefinitionFile, ddoc); sb.Append(" "); } sb.AppendFormat(p.DDocExportDirectory, Path.IsPathRooted(cfg.DDocDirectory)? cfg.DDocDirectory : (new FilePath(cfg.DDocDirectory).ToAbsolute(cfg.Project.BaseDirectory)).ToString()); } return(sb.ToString().Trim()); }
public void Load(DProjectConfiguration config) { configuration = config; }
public void Load(DProject proj, DProjectConfiguration config) { project = proj; configuration = config; cbUseDefaultCompiler.Active = proj.UseDefaultCompilerVendor; cbPreferOneStepCompilation.Active = proj.PreferOneStepBuild; OnUseDefaultCompilerChanged(); Gtk.TreeIter iter; if (cmbCompiler.Model.GetIterFirst(out iter)) { do { if (proj.UsedCompilerVendor == cmbCompiler.Model.GetValue(iter, 0) as string) { cmbCompiler.SetActiveIter(iter); break; } } while (cmbCompiler.Model.IterNext(ref iter)); } extraCompilerTextView.Buffer.Text = config.ExtraCompilerArguments; extraLinkerTextView.Buffer.Text = config.ExtraLinkerArguments; text_BinDirectory.Text = config.OutputDirectory; text_TargetFile.Text = config.Output; text_ObjectsDirectory.Text = config.ObjectDirectory; text_DDocDir.Text = config.DDocDirectory; if (config.CustomDebugIdentifiers == null) { text_debugConstants.Text = ""; } else { text_debugConstants.Text = string.Join(";", config.CustomDebugIdentifiers); } if (config.CustomVersionIdentifiers == null) { text_versionConstants.Text = ""; } else { text_versionConstants.Text = string.Join(";", config.CustomVersionIdentifiers); } spin_debugLevel.Value = (double)config.DebugLevel; // Disable debug-specific fields on non-debug configurations text_debugConstants.Sensitive = spin_debugLevel.Sensitive = config.DebugMode; if (model_compileTarget.GetIterFirst(out iter)) { do { if (config.CompileTarget == (DCompileTarget)model_compileTarget.GetValue(iter, 1)) { combo_ProjectType.SetActiveIter(iter); break; } } while (model_compileTarget.IterNext(ref iter)); } text_Libraries.Buffer.Text = string.Join("\n", config.ExtraLibraries); text_Includes.Buffer.Text = string.Join("\n", proj.LocalIncludeCache.ParsedDirectories); // Remove old children list var depsChildren = ((ArrayList)vbox_ProjectDeps.AllChildren); for (int k = depsChildren.Count - 1; k >= 0; k--) { vbox_ProjectDeps.Remove((Widget)depsChildren[k]); } // Init new project dep list int i = 0; foreach (var prj in proj.ParentSolution.GetAllProjects()) { if (prj == proj) { continue; } var cb = new Gtk.CheckButton(prj.Name) { CanFocus = true, DrawIndicator = true, UseUnderline = false, Active = proj.ProjectDependencies.Contains(prj.ItemId) }; cb.Data.Add("prj", prj); vbox_ProjectDeps.Add(cb); var bc = (Box.BoxChild)vbox_ProjectDeps[cb]; bc.Expand = false; bc.Fill = false; bc.Position = i++; } vbox_ProjectDeps.ShowAll(); }
public static string GenerateMakeCode(DProject Project, DProjectConfiguration cfg) { var compiler = Project.Compiler; var s = new StringBuilder(); // Constants var buildCommands = compiler.GetOrCreateTargetConfiguration(cfg.CompileTarget); var Arguments = buildCommands.GetArguments(cfg.DebugMode); s.AppendLine("compiler=" + compiler.SourceCompilerCommand); s.AppendLine("linker=" + buildCommands.Linker); s.AppendLine(); s.AppendLine("target="+ cfg.OutputDirectory.Combine(cfg.CompiledOutputName).ToRelative(Project.BaseDirectory)); var srcObjPairs = new Dictionary<string, string>(); var objs= new List<string>(); foreach (var pf in Project.Files) { if (pf.BuildAction != BuildAction.Compile) continue; var obj = ProjectBuilder.GetRelativeObjectFileName(cfg.ObjectDirectory, pf, DCompilerService.ObjectExtension); objs.Add(obj); srcObjPairs[pf.FilePath.ToRelative(Project.BaseDirectory)] = obj; } s.AppendLine("objects = "+ string.Join(" ",objs)); s.AppendLine(); s.AppendLine(); s.AppendLine("all: $(target)"); // Linker s.AppendLine(); s.AppendLine("$(target): $(objects)"); var linkArgs = ProjectBuilder.FillInMacros ( ProjectBuilder.GenAdditionalAttributes(compiler, cfg) + Arguments.LinkerArguments + " " + cfg.ExtraLinkerArguments, new DLinkerMacroProvider { ObjectsStringPattern = "{0}", Objects = new[]{"$(objects)"}, TargetFile = "$@", RelativeTargetDirectory = cfg.OutputDirectory.ToRelative (Project.BaseDirectory), Libraries = ProjectBuilder.GetLibraries(cfg, compiler) }); s.AppendLine("\t@echo Linking..."); s.AppendLine("\t$(linker) "+ linkArgs.Trim()); // Compiler s.AppendLine(); var compilerCommand = "\t$(compiler) "+ ProjectBuilder.FillInMacros( Arguments.CompilerArguments + " " + cfg.ExtraCompilerArguments, new DCompilerMacroProvider{ IncludePathConcatPattern = compiler.ArgumentPatterns.IncludePathPattern, Includes = Project.IncludePaths, ObjectFile = "$@", SourceFile = "$?" }) // Replace "$?" by $? because the $? macro appends one ' ' (space) // to the name which obstructs the source file names .Replace("\"$?\"","$?"); foreach(var kv in srcObjPairs) { s.AppendLine(kv.Value + " : "+ kv.Key); s.AppendLine(compilerCommand); s.AppendLine(); } // Clean up s.AppendLine("clean:"); s.AppendLine("\t"+(OS.IsWindows?"del /Q":"$(RM)")+" \"$(target)\" $(objects)"); return s.ToString(); }
static string ObjectDirectory(DProjectConfiguration cfg) { return(EnsureCorrectPathSeparators(cfg.ObjectDirectory)); }
public static void GenerateMakefile(DProject prj, DProjectConfiguration cfg, ref string file) { if (string.IsNullOrEmpty(file)) file = prj.BaseDirectory.Combine("makefile"); var code = GenerateMakeCode(prj, cfg); File.WriteAllText(file, code); }
public void Load(DProject proj, DProjectConfiguration config) { project = proj; configuration = config; cbUseDefaultCompiler.Active = proj.UseDefaultCompilerVendor; cbPreferOneStepCompilation.Active = proj.PreferOneStepBuild; OnUseDefaultCompilerChanged (); Gtk.TreeIter iter; if (cmbCompiler.Model.GetIterFirst (out iter)) do { if (proj.UsedCompilerVendor == cmbCompiler.Model.GetValue (iter, 0) as string) { cmbCompiler.SetActiveIter (iter); break; } } while (cmbCompiler.Model.IterNext (ref iter)); extraCompilerTextView.Buffer.Text = config.ExtraCompilerArguments; extraLinkerTextView.Buffer.Text = config.ExtraLinkerArguments; text_BinDirectory.Text = config.OutputDirectory; text_TargetFile.Text = config.Output; text_ObjectsDirectory.Text = config.ObjectDirectory; if (model_compileTarget.GetIterFirst (out iter)) do { if (config.CompileTarget == (DCompileTarget)model_compileTarget.GetValue (iter, 1)) { combo_ProjectType.SetActiveIter (iter); break; } } while (model_compileTarget.IterNext (ref iter)); text_Libraries.Buffer.Text = string.Join ("\n", config.ExtraLibraries); text_Includes.Buffer.Text = string.Join ("\n", proj.LocalIncludeCache.ParsedDirectories); // Init project dep list int i=0; foreach(var prj in proj.ParentSolution.GetAllProjects()) { if (prj == proj) continue; var cb = new Gtk.CheckButton(prj.Name){ CanFocus=true, DrawIndicator=true, UseUnderline=false, Active = proj.ProjectDependencies.Contains(prj.ItemId) }; cb.Data.Add("prj", prj); vbox_ProjectDeps.Add(cb); var bc=(Box.BoxChild)vbox_ProjectDeps[cb]; bc.Expand=false; bc.Fill=false; bc.Position=i++; } vbox_ProjectDeps.ShowAll(); }
public static string GenAdditionalAttributes(DCompilerConfiguration compiler, DProjectConfiguration cfg) { var sb = new StringBuilder(); var p = compiler.ArgumentPatterns; if (cfg.UnittestMode) { sb.Append(p.UnittestFlag + " "); } if (ProfilerModeHandler.IsProfilerMode && compiler.HasProfilerSupport) { sb.Append(p.ProfileFlag + " -v "); } if (cfg.CustomDebugIdentifiers != null && cfg.CustomVersionIdentifiers.Length != 0) { foreach (var id in cfg.CustomDebugIdentifiers) { sb.Append(p.DebugDefinition + "=" + id + " "); } } if (cfg.DebugLevel > 0) { sb.Append(p.DebugDefinition + "=" + cfg.DebugLevel + " "); } if (cfg.DebugMode) { sb.Append(p.DebugDefinition + " "); } if (cfg.CustomVersionIdentifiers != null && cfg.CustomVersionIdentifiers.Length != 0) { foreach (var id in cfg.CustomVersionIdentifiers) { sb.Append(p.VersionDefinition + "=" + id + " "); } } // DDoc handling var ddocFiles = new List <string> (); var files = cfg.Project.GetItemFiles(true); foreach (var f in files) { if (f.Extension.EndsWith(".ddoc", StringComparison.OrdinalIgnoreCase)) { ddocFiles.Add(f); } } if (ddocFiles.Count != 0) { sb.Append(p.EnableDDocFlag + " "); foreach (var ddoc in ddocFiles) { sb.AppendFormat(p.DDocDefinitionFile, ddoc); sb.Append(" "); } sb.AppendFormat(p.DDocExportDirectory, Path.IsPathRooted(cfg.DDocDirectory)? cfg.DDocDirectory : (new FilePath(cfg.DDocDirectory).ToAbsolute(cfg.Project.BaseDirectory)).ToString()); } return(sb.ToString().Trim()); }
public void Load(DProject proj, DProjectConfiguration config) { project = proj; configuration = config; cbUseDefaultCompiler.Active = proj.UseDefaultCompilerVendor; cbIsUnittestConfig.Active = config.UnittestMode; cbPreferOneStepCompilation.Active = proj.PreferOneStepBuild; OnUseDefaultCompilerChanged(); Gtk.TreeIter iter; if (cmbCompiler.Model.GetIterFirst(out iter)) { do { if (proj.UsedCompilerVendor == cmbCompiler.Model.GetValue(iter, 0) as string) { cmbCompiler.SetActiveIter(iter); break; } } while (cmbCompiler.Model.IterNext(ref iter)); } extraCompilerTextView.Buffer.Text = config.ExtraCompilerArguments; extraLinkerTextView.Buffer.Text = config.ExtraLinkerArguments; check_LinkThirdPartyLibs.Active = configuration.LinkinThirdPartyLibraries; text_BinDirectory.Text = proj.GetRelativeChildPath(config.OutputDirectory); text_TargetFile.Text = config.Output; text_ObjectsDirectory.Text = config.ObjectDirectory; text_DDocDir.Text = config.DDocDirectory; if (config.CustomDebugIdentifiers == null) { text_debugConstants.Text = ""; } else { text_debugConstants.Text = string.Join(";", config.CustomDebugIdentifiers); } if (config.CustomVersionIdentifiers == null) { text_versionConstants.Text = ""; } else { text_versionConstants.Text = string.Join(";", config.CustomVersionIdentifiers); } spin_debugLevel.Value = (double)config.DebugLevel; // Disable debug-specific fields on non-debug configurations text_debugConstants.Sensitive = spin_debugLevel.Sensitive = config.DebugMode; if (model_compileTarget.GetIterFirst(out iter)) { do { if (config.CompileTarget == (DCompileTarget)model_compileTarget.GetValue(iter, 1)) { combo_ProjectType.SetActiveIter(iter); break; } } while (model_compileTarget.IterNext(ref iter)); } text_Libraries.Buffer.Text = string.Join("\n", config.ExtraLibraries); model_Platforms.Clear(); var blackListed = new List <string>(); foreach (var cfg in proj.Configurations) { if (cfg.Name == config.Name && cfg.Platform != config.Platform) { blackListed.Add(cfg.Platform.ToLower()); } } var platform_lower = config.Platform.ToLower(); foreach (var platform in proj.SupportedPlatforms) { // Skip already taken platforms if (blackListed.Contains(platform.ToLower())) { continue; } var it = model_Platforms.Append(); if (platform_lower == platform.ToLower()) { combo_Platform.SetActiveIter(it); } model_Platforms.SetValue(it, 0, platform); } }
/// <summary> /// Compiles a D project. /// </summary> public static BuildResult Compile( DProject Project, ProjectFileCollection FilesToCompile, DProjectConfiguration BuildConfig, IProgressMonitor monitor) { var relObjDir = "objs"; var objDir = Path.Combine(Project.BaseDirectory, relObjDir); if(!Directory.Exists(objDir)) Directory.CreateDirectory(objDir); // List of created object files var BuiltObjects = new List<string>(); var compilerResults = new CompilerResults(new TempFileCollection()); var buildResult = new BuildResult(compilerResults, ""); bool succesfullyBuilt = true; bool modificationsDone = false; var Compiler = Project.Compiler; var Commands = Compiler.GetTargetConfiguration(Project.CompileTarget); var Arguments= Commands.GetArguments(BuildConfig.DebugMode); /// The target file to which all objects will be linked to var LinkTarget = BuildConfig.OutputDirectory.Combine(BuildConfig.CompiledOutputName); monitor.BeginTask("Build Project", FilesToCompile.Count + 1); var SourceIncludePaths=new List<string>(Compiler.GlobalParseCache.DirectoryPaths); SourceIncludePaths.AddRange(Project.LocalIncludeCache.DirectoryPaths); #region Compile sources to objects foreach (var f in FilesToCompile) { if (monitor.IsCancelRequested) return buildResult; // If not compilable, skip it if (f.BuildAction != BuildAction.Compile || !File.Exists(f.FilePath)) continue; // a.Check if source file was modified and if object file still exists if (Project.LastModificationTimes.ContainsKey(f) && Project.LastModificationTimes[f] == File.GetLastWriteTime(f.FilePath) && File.Exists(f.LastGenOutput)) { // File wasn't edited since last build // but add the built object to the objs array BuiltObjects.Add(f.LastGenOutput); monitor.Step(1); continue; } else modificationsDone=true; #region Resource file if(f.Name.EndsWith(".rc",StringComparison.OrdinalIgnoreCase)) { var res = Path.Combine(objDir, Path.GetFileNameWithoutExtension(f.FilePath))+ ".res"; if(File.Exists(res)) File.Delete(res); // Build argument string var resCmpArgs = FillInMacros(Win32ResourceCompiler.Instance.Arguments, new Win32ResourceCompiler.ArgProvider{ RcFile=f.FilePath.ToString(), ResFile=res }); // Execute compiler string output; int _exitCode = ExecuteCommand(Win32ResourceCompiler.Instance.Executable, resCmpArgs, Project.BaseDirectory, monitor, out output); // Error analysis if(!string.IsNullOrEmpty(output)) compilerResults.Errors.Add(new CompilerError{ FileName=f.FilePath, ErrorText=output}); CheckReturnCode(_exitCode, compilerResults); monitor.Step(1); if (_exitCode != 0) { buildResult.FailedBuildCount++; succesfullyBuilt = false; break; } else { f.LastGenOutput = res; buildResult.BuildCount++; Project.LastModificationTimes[f] = File.GetLastWriteTime(f.FilePath); // Especially when compiling large projects, do only add the relative part of the r file due to command shortness if (res.StartsWith(Project.BaseDirectory)) BuiltObjects.Add(res.Substring(Project.BaseDirectory.ToString().Length).TrimStart(Path.DirectorySeparatorChar)); else BuiltObjects.Add(res); } continue; } #endregion // Create object file path var obj = Path.Combine(objDir, Path.GetFileNameWithoutExtension(f.FilePath)) + ObjectExtension; if (File.Exists(obj)) File.Delete(obj); // Prevent duplicates e.g. when having the samely-named source files in different sub-packages int i=2; while(File.Exists(obj)) { // Simply add a number between the obj name and its extension obj= Path.Combine(objDir, Path.GetFileNameWithoutExtension(f.FilePath))+i + ObjectExtension; i++; } // Create argument string for source file compilation. var dmdArgs = FillInMacros(Arguments.CompilerArguments + " " + BuildConfig.ExtraCompilerArguments, new DCompilerMacroProvider { IncludePathConcatPattern=Commands.IncludePathPattern, SourceFile = f.FilePath, ObjectFile = obj, Includes=SourceIncludePaths, }); // b.Execute compiler string dmdOutput; int exitCode = ExecuteCommand(Commands.Compiler, dmdArgs, Project.BaseDirectory, monitor, out dmdOutput); ParseCompilerOutput(dmdOutput, compilerResults); CheckReturnCode(exitCode, compilerResults); monitor.Step(1); if (exitCode != 0) { buildResult.FailedBuildCount++; succesfullyBuilt = false; break; } else { f.LastGenOutput = obj; buildResult.BuildCount++; Project.LastModificationTimes[f] = File.GetLastWriteTime(f.FilePath); // Especially when compiling large projects, do only add the relative part of the obj file due to command shortness if (obj.StartsWith(Project.BaseDirectory)) BuiltObjects.Add(obj.Substring(Project.BaseDirectory.ToString().Length).TrimStart(Path.DirectorySeparatorChar)); else BuiltObjects.Add(obj); } } #endregion #region Link files if (succesfullyBuilt) { // a. if ((!modificationsDone) && lastLinkerActionSuccessfull) { // Only return if build target is still existing if (File.Exists(LinkTarget)) { monitor.Step(1); return new BuildResult(compilerResults, ""); } } // b.Build linker argument string // Build argument preparation /* var libPaths=new List<string>(Compiler.DefaultLibPaths); libPaths.AddRange(Project.LibraryPaths); */ var libs=new List<string>(Compiler.DefaultLibraries); libs.AddRange(Project.ExtraLibraries); var linkArgs = FillInMacros(Arguments.LinkerArguments + " "+BuildConfig.ExtraLinkerArguments, new DLinkerMacroProvider { ObjectsStringPattern=Commands.ObjectFileLinkPattern, Objects=BuiltObjects.ToArray(), TargetFile=LinkTarget, RelativeTargetDirectory=BuildConfig.OutputDirectory.ToRelative(Project.BaseDirectory), //LibraryPaths=libPaths, Libraries=libs }); var linkerOutput = ""; int exitCode = ExecuteCommand(Commands.Linker,linkArgs,Project.BaseDirectory,monitor,out linkerOutput); compilerResults.NativeCompilerReturnValue = exitCode; CheckReturnCode(exitCode, compilerResults); lastLinkerActionSuccessfull = (exitCode == 0); if (lastLinkerActionSuccessfull) { monitor.ReportSuccess("Build successful!"); monitor.Step(1); } } #endregion return new BuildResult(compilerResults,""); }
/// <summary> /// Compiles a D project. /// </summary> public static BuildResult Compile( DProject Project, ProjectFileCollection FilesToCompile, DProjectConfiguration BuildConfig, IProgressMonitor monitor) { var relObjDir = "objs"; var objDir = Path.Combine(Project.BaseDirectory, relObjDir); if (!Directory.Exists(objDir)) { Directory.CreateDirectory(objDir); } // List of created object files var BuiltObjects = new List <string>(); var compilerResults = new CompilerResults(new TempFileCollection()); var buildResult = new BuildResult(compilerResults, ""); bool succesfullyBuilt = true; bool modificationsDone = false; var Compiler = Project.Compiler; var Commands = Compiler.GetTargetConfiguration(Project.CompileTarget); var Arguments = Commands.GetArguments(BuildConfig.DebugMode); /// The target file to which all objects will be linked to var LinkTarget = BuildConfig.OutputDirectory.Combine(BuildConfig.CompiledOutputName); monitor.BeginTask("Build Project", FilesToCompile.Count + 1); var SourceIncludePaths = new List <string>(Compiler.GlobalParseCache.DirectoryPaths); SourceIncludePaths.AddRange(Project.LocalIncludeCache.DirectoryPaths); #region Compile sources to objects foreach (var f in FilesToCompile) { if (monitor.IsCancelRequested) { return(buildResult); } // If not compilable, skip it if (f.BuildAction != BuildAction.Compile || !File.Exists(f.FilePath)) { continue; } // a.Check if source file was modified and if object file still exists if (Project.LastModificationTimes.ContainsKey(f) && Project.LastModificationTimes[f] == File.GetLastWriteTime(f.FilePath) && File.Exists(f.LastGenOutput)) { // File wasn't edited since last build // but add the built object to the objs array BuiltObjects.Add(f.LastGenOutput); monitor.Step(1); continue; } else { modificationsDone = true; } #region Resource file if (f.Name.EndsWith(".rc", StringComparison.OrdinalIgnoreCase)) { var res = Path.Combine(objDir, Path.GetFileNameWithoutExtension(f.FilePath)) + ".res"; if (File.Exists(res)) { File.Delete(res); } // Build argument string var resCmpArgs = FillInMacros(Win32ResourceCompiler.Instance.Arguments, new Win32ResourceCompiler.ArgProvider { RcFile = f.FilePath.ToString(), ResFile = res }); // Execute compiler string output; int _exitCode = ExecuteCommand(Win32ResourceCompiler.Instance.Executable, resCmpArgs, Project.BaseDirectory, monitor, out output); // Error analysis if (!string.IsNullOrEmpty(output)) { compilerResults.Errors.Add(new CompilerError { FileName = f.FilePath, ErrorText = output }); } CheckReturnCode(_exitCode, compilerResults); monitor.Step(1); if (_exitCode != 0) { buildResult.FailedBuildCount++; succesfullyBuilt = false; break; } else { f.LastGenOutput = res; buildResult.BuildCount++; Project.LastModificationTimes[f] = File.GetLastWriteTime(f.FilePath); // Especially when compiling large projects, do only add the relative part of the r file due to command shortness if (res.StartsWith(Project.BaseDirectory)) { BuiltObjects.Add(res.Substring(Project.BaseDirectory.ToString().Length).TrimStart(Path.DirectorySeparatorChar)); } else { BuiltObjects.Add(res); } } continue; } #endregion // Create object file path var obj = Path.Combine(objDir, Path.GetFileNameWithoutExtension(f.FilePath)) + ObjectExtension; if (File.Exists(obj)) { File.Delete(obj); } // Prevent duplicates e.g. when having the samely-named source files in different sub-packages int i = 2; while (File.Exists(obj)) { // Simply add a number between the obj name and its extension obj = Path.Combine(objDir, Path.GetFileNameWithoutExtension(f.FilePath)) + i + ObjectExtension; i++; } // Create argument string for source file compilation. var dmdArgs = FillInMacros(Arguments.CompilerArguments + " " + BuildConfig.ExtraCompilerArguments, new DCompilerMacroProvider { IncludePathConcatPattern = Commands.IncludePathPattern, SourceFile = f.FilePath, ObjectFile = obj, Includes = SourceIncludePaths, }); // b.Execute compiler string dmdOutput; int exitCode = ExecuteCommand(Commands.Compiler, dmdArgs, Project.BaseDirectory, monitor, out dmdOutput); ParseCompilerOutput(dmdOutput, compilerResults); CheckReturnCode(exitCode, compilerResults); monitor.Step(1); if (exitCode != 0) { buildResult.FailedBuildCount++; succesfullyBuilt = false; break; } else { f.LastGenOutput = obj; buildResult.BuildCount++; Project.LastModificationTimes[f] = File.GetLastWriteTime(f.FilePath); // Especially when compiling large projects, do only add the relative part of the obj file due to command shortness if (obj.StartsWith(Project.BaseDirectory)) { BuiltObjects.Add(obj.Substring(Project.BaseDirectory.ToString().Length).TrimStart(Path.DirectorySeparatorChar)); } else { BuiltObjects.Add(obj); } } } #endregion #region Link files if (succesfullyBuilt) { // a. if ((!modificationsDone) && lastLinkerActionSuccessfull) { // Only return if build target is still existing if (File.Exists(LinkTarget)) { monitor.Step(1); return(new BuildResult(compilerResults, "")); } } // b.Build linker argument string // Build argument preparation /* * var libPaths=new List<string>(Compiler.DefaultLibPaths); * libPaths.AddRange(Project.LibraryPaths); */ var libs = new List <string>(Compiler.DefaultLibraries); libs.AddRange(Project.ExtraLibraries); var linkArgs = FillInMacros(Arguments.LinkerArguments + " " + BuildConfig.ExtraLinkerArguments, new DLinkerMacroProvider { ObjectsStringPattern = Commands.ObjectFileLinkPattern, Objects = BuiltObjects.ToArray(), TargetFile = LinkTarget, RelativeTargetDirectory = BuildConfig.OutputDirectory.ToRelative(Project.BaseDirectory), //LibraryPaths=libPaths, Libraries = libs }); var linkerOutput = ""; int exitCode = ExecuteCommand(Commands.Linker, linkArgs, Project.BaseDirectory, monitor, out linkerOutput); compilerResults.NativeCompilerReturnValue = exitCode; CheckReturnCode(exitCode, compilerResults); lastLinkerActionSuccessfull = (exitCode == 0); if (lastLinkerActionSuccessfull) { monitor.ReportSuccess("Build successful!"); monitor.Step(1); } } #endregion return(new BuildResult(compilerResults, "")); }
public static string GenerateMakeCode(DProject Project, DProjectConfiguration cfg) { var compiler = Project.Compiler; var s = new StringBuilder(); // Constants var buildCommands = compiler.GetOrCreateTargetConfiguration(cfg.CompileTarget); var Arguments = buildCommands.GetArguments(cfg.DebugMode); s.AppendLine("compiler=" + compiler.SourceCompilerCommand); s.AppendLine("linker=" + buildCommands.Linker); s.AppendLine(); s.AppendLine("target=" + cfg.OutputDirectory.Combine(cfg.CompiledOutputName).ToRelative(Project.BaseDirectory)); var srcObjPairs = new Dictionary <string, string>(); var objs = new List <string>(); foreach (var pf in Project.Files) { if (pf.BuildAction != BuildAction.Compile) { continue; } var obj = ProjectBuilder.GetRelativeObjectFileName(ProjectBuilder.EnsureCorrectPathSeparators(cfg.ObjectDirectory), pf, DCompilerService.ObjectExtension); objs.Add(obj); srcObjPairs[pf.FilePath.ToRelative(Project.BaseDirectory)] = obj; } s.AppendLine("objects = " + string.Join(" ", objs)); s.AppendLine(); s.AppendLine(); s.AppendLine("all: $(target)"); // Linker s.AppendLine(); s.AppendLine("$(target): $(objects)"); var linkArgs = ProjectBuilder.FillInMacros( ProjectBuilder.GenAdditionalAttributes(compiler, cfg) + Arguments.LinkerArguments + " " + cfg.ExtraLinkerArguments, new DLinkerMacroProvider { ObjectsStringPattern = "{0}", Objects = new[] { "$(objects)" }, TargetFile = "$@", RelativeTargetDirectory = cfg.OutputDirectory.ToRelative(Project.BaseDirectory), Libraries = ProjectBuilder.GetLibraries(cfg, compiler) }); s.AppendLine("\t@echo Linking..."); s.AppendLine("\t$(linker) " + linkArgs.Trim()); // Compiler s.AppendLine(); var compilerCommand = "\t$(compiler) " + ProjectBuilder.FillInMacros( Arguments.CompilerArguments + " " + cfg.ExtraCompilerArguments, new DCompilerMacroProvider { IncludePathConcatPattern = compiler.ArgumentPatterns.IncludePathPattern, Includes = Project.IncludePaths, ObjectFile = "$@", SourceFile = "$?" }) // Replace "$?" by $? because the $? macro appends one ' ' (space) // to the name which obstructs the source file names .Replace("\"$?\"", "$?"); foreach (var kv in srcObjPairs) { s.AppendLine(kv.Value + " : " + kv.Key); s.AppendLine(compilerCommand); s.AppendLine(); } // Clean up s.AppendLine("clean:"); s.AppendLine("\t" + (OS.IsWindows?"del /Q":"$(RM)") + " \"$(target)\" $(objects)"); return(s.ToString()); }
static string GetCommandArgs(string baseCommandArgs, string filePath, DProject project, DProjectConfiguration conf) { var compiler = project.Compiler; ProjectBuilder.PrjPathMacroProvider prjPath = new ProjectBuilder.PrjPathMacroProvider { slnPath = project.ParentSolution != null?ProjectBuilder.EnsureCorrectPathSeparators(project.ParentSolution.BaseDirectory) : "" }; List <string> includes = new List <string>(project.IncludePaths); includes.Add(project.BaseDirectory.FullPath); string[] src = { filePath }; OneStepBuildArgumentMacroProvider compilerMacro = new OneStepBuildArgumentMacroProvider { ObjectsStringPattern = compiler.ArgumentPatterns.ObjectFileLinkPattern, IncludesStringPattern = compiler.ArgumentPatterns.IncludePathPattern, SourceFiles = src, Includes = ProjectBuilder.FillInMacros(includes, prjPath), Libraries = ProjectBuilder.GetLibraries(conf, compiler), }; return(ProjectBuilder.FillInMacros(baseCommandArgs, compilerMacro, prjPath)); }
public static IEnumerable<string> GetLibraries(DProjectConfiguration projCfg, DCompilerConfiguration compiler) { var libraries = (IEnumerable<string>)FillInMacros(projCfg.GetReferencedLibraries(projCfg.Selector), new PrjPathMacroProvider { slnPath = projCfg.Project.ParentSolution.BaseDirectory }); if (compiler.EnableGDCLibPrefixing) libraries = HandleGdcSpecificLibraryReferencing(libraries, projCfg.Project.BaseDirectory); return libraries; }
public void Load(DProject proj, DProjectConfiguration config) { project = proj; configuration = config; cbUseDefaultCompiler.Active = proj.UseDefaultCompilerVendor; cbPreferOneStepCompilation.Active = proj.PreferOneStepBuild; OnUseDefaultCompilerChanged(); Gtk.TreeIter iter; if (cmbCompiler.Model.GetIterFirst(out iter)) { do { if (proj.UsedCompilerVendor == cmbCompiler.Model.GetValue(iter, 0) as string) { cmbCompiler.SetActiveIter(iter); break; } } while (cmbCompiler.Model.IterNext(ref iter)); } extraCompilerTextView.Buffer.Text = config.ExtraCompilerArguments; extraLinkerTextView.Buffer.Text = config.ExtraLinkerArguments; text_BinDirectory.Text = config.OutputDirectory; text_TargetFile.Text = config.Output; text_ObjectsDirectory.Text = config.ObjectDirectory; text_DDocDir.Text = config.DDocDirectory; if (config.CustomDebugIdentifiers == null) { text_debugConstants.Text = ""; } else { text_debugConstants.Text = string.Join(";", config.CustomDebugIdentifiers); } if (config.CustomVersionIdentifiers == null) { text_versionConstants.Text = ""; } else { text_versionConstants.Text = string.Join(";", config.CustomVersionIdentifiers); } spin_debugLevel.Value = (double)config.DebugLevel; // Disable debug-specific fields on non-debug configurations text_debugConstants.Sensitive = spin_debugLevel.Sensitive = config.DebugMode; if (model_compileTarget.GetIterFirst(out iter)) { do { if (config.CompileTarget == (DCompileTarget)model_compileTarget.GetValue(iter, 1)) { combo_ProjectType.SetActiveIter(iter); break; } } while (model_compileTarget.IterNext(ref iter)); } text_Libraries.Buffer.Text = string.Join("\n", config.ExtraLibraries); }
public static string GetCommandArgs(string baseCommandArgs, string filePath, DProject project, DProjectConfiguration conf) { var compiler = project.Compiler; ProjectBuilder.PrjPathMacroProvider prjPath = new ProjectBuilder.PrjPathMacroProvider { slnPath = project.ParentSolution != null?ProjectBuilder.EnsureCorrectPathSeparators(project.ParentSolution.BaseDirectory) : "" }; List <string> includes = new List <string>(project.IncludePaths); includes.Add(project.BaseDirectory.FullPath); string[] src = { filePath }; var compilerMacro = new UnittestMacros { ObjectsStringPattern = compiler.ArgumentPatterns.ObjectFileLinkPattern, IncludesStringPattern = compiler.ArgumentPatterns.IncludePathPattern, SourceFiles = src, Includes = ProjectBuilder.FillInMacros(includes, prjPath), Libraries = ProjectBuilder.GetLibraries(conf, compiler), HasMain = HasMainMethod(D_Parser.Misc.GlobalParseCache.GetModule(filePath)), compilerFlags = conf.ExtraCompilerArguments, linkerFlags = conf.ExtraLinkerArguments }; return(ProjectBuilder.FillInMacros(baseCommandArgs, compilerMacro, prjPath)); }
public static string GenAdditionalAttributes(DCompilerConfiguration compiler, DProjectConfiguration cfg) { var sb = new StringBuilder (); var p = compiler.ArgumentPatterns; if (cfg.UnittestMode) sb.Append (p.UnittestFlag + " "); if(ProfilerModeHandler.IsProfilerMode && compiler.HasProfilerSupport) sb.Append (p.ProfileFlag + " -v "); if (cfg.CustomDebugIdentifiers != null && cfg.CustomVersionIdentifiers.Length != 0) foreach (var id in cfg.CustomDebugIdentifiers) sb.Append (p.DebugDefinition + "=" + id + " "); if (cfg.DebugLevel > 0) sb.Append (p.DebugDefinition + "=" + cfg.DebugLevel + " "); if (cfg.DebugMode) sb.Append (p.DebugDefinition + " "); if (cfg.CustomVersionIdentifiers != null && cfg.CustomVersionIdentifiers.Length != 0) foreach (var id in cfg.CustomVersionIdentifiers) sb.Append (p.VersionDefinition + "=" + id + " "); // DDoc handling var ddocFiles = new List<string> (); var files = cfg.Project.GetItemFiles (true); foreach (var f in files) if (f.Extension.EndsWith (".ddoc", StringComparison.OrdinalIgnoreCase)) ddocFiles.Add (f); if (ddocFiles.Count != 0) { sb.Append(p.EnableDDocFlag+" "); foreach(var ddoc in ddocFiles){ sb.AppendFormat(p.DDocDefinitionFile,ddoc); sb.Append(" "); } sb.AppendFormat(p.DDocExportDirectory,Path.IsPathRooted(cfg.DDocDirectory)? cfg.DDocDirectory : (new FilePath(cfg.DDocDirectory).ToAbsolute(cfg.Project.BaseDirectory)).ToString()); } return sb.ToString().Trim(); }
public static DCompileTarget BuildTargetType(DProjectConfiguration BuildConfig) { return(BuildConfig.UnittestMode ? DCompileTarget.Executable : BuildConfig.CompileTarget); }
/// <summary> /// Compiles a D project. /// </summary> public BuildResult Build(DProject Project, ConfigurationSelector BuildConfigurationSelector) { this.Project = Project; BuildConfig = Project.GetConfiguration (BuildConfigurationSelector) as DProjectConfiguration; commonMacros = new PrjPathMacroProvider { slnPath = Project.ParentSolution.BaseDirectory }; BuiltObjects.Clear (); if (Compiler == null) { var targetBuildResult = new BuildResult (); targetBuildResult.AddError ("Project compiler \"" + Project.UsedCompilerVendor + "\" not found"); targetBuildResult.FailedBuildCount++; return targetBuildResult; } if (Path.IsPathRooted (BuildConfig.ObjectDirectory)) AbsoluteObjectDirectory = BuildConfig.ObjectDirectory; else AbsoluteObjectDirectory = Path.Combine (Project.BaseDirectory, EnsureCorrectPathSeparators (BuildConfig.ObjectDirectory)); if (!Directory.Exists (AbsoluteObjectDirectory)) Directory.CreateDirectory (AbsoluteObjectDirectory); if (CanDoOneStepBuild) return DoOneStepBuild (); else return DoStepByStepBuild (); }
public static LinkTargetConfiguration LinkTargetCfg(DProjectConfiguration cfg) { return(cfg.Project.Compiler.GetOrCreateTargetConfiguration(BuildTargetType(cfg))); }
public void Load(DProject proj, DProjectConfiguration config) { project = proj; configuration = config; cbUseDefaultCompiler.Active = proj.UseDefaultCompilerVendor; cbPreferOneStepCompilation.Active = proj.PreferOneStepBuild; OnUseDefaultCompilerChanged (); Gtk.TreeIter iter; if (cmbCompiler.Model.GetIterFirst (out iter)) do { if (proj.UsedCompilerVendor == cmbCompiler.Model.GetValue (iter, 0) as string) { cmbCompiler.SetActiveIter (iter); break; } } while (cmbCompiler.Model.IterNext (ref iter)); extraCompilerTextView.Buffer.Text = config.ExtraCompilerArguments; extraLinkerTextView.Buffer.Text = config.ExtraLinkerArguments; text_BinDirectory.Text = config.OutputDirectory; text_TargetFile.Text = config.Output; text_ObjectsDirectory.Text = config.ObjectDirectory; text_DDocDir.Text = config.DDocDirectory; if(config.CustomDebugIdentifiers==null) text_debugConstants.Text = ""; else text_debugConstants.Text = string.Join(";",config.CustomDebugIdentifiers); if(config.CustomVersionIdentifiers == null) text_versionConstants.Text = ""; else text_versionConstants.Text = string.Join(";", config.CustomVersionIdentifiers); spin_debugLevel.Value = (double)config.DebugLevel; // Disable debug-specific fields on non-debug configurations text_debugConstants.Sensitive = spin_debugLevel.Sensitive = config.DebugMode; if (model_compileTarget.GetIterFirst (out iter)) do { if (config.CompileTarget == (DCompileTarget)model_compileTarget.GetValue (iter, 1)) { combo_ProjectType.SetActiveIter (iter); break; } } while (model_compileTarget.IterNext (ref iter)); text_Libraries.Buffer.Text = string.Join ("\n", config.ExtraLibraries); text_Includes.Buffer.Text = string.Join ("\n", proj.LocalIncludeCache.ParsedDirectories); // Remove old children list var depsChildren = ((ArrayList)vbox_ProjectDeps.AllChildren); for (int k = depsChildren.Count - 1; k >= 0; k--) vbox_ProjectDeps.Remove((Widget)depsChildren[k]); // Init new project dep list int i = 0; foreach(var prj in proj.ParentSolution.GetAllProjects()) { if (prj == proj) continue; var cb = new Gtk.CheckButton(prj.Name){ CanFocus=true, DrawIndicator=true, UseUnderline=false, Active = proj.ProjectDependencies.Contains(prj.ItemId) }; cb.Data.Add("prj", prj); vbox_ProjectDeps.Add(cb); var bc=(Box.BoxChild)vbox_ProjectDeps[cb]; bc.Expand=false; bc.Fill=false; bc.Position=i++; } vbox_ProjectDeps.ShowAll(); }
static BuildConfiguration BuildArguments(DProjectConfiguration cfg) { return(LinkTargetCfg(cfg).GetArguments(cfg.DebugMode)); }