public static DubProject ReadPackageInformation(FilePath packageJsonPath, JsonReader r, IProgressMonitor monitor) { var defaultPackage = new DubProject(); defaultPackage.FileName = packageJsonPath; defaultPackage.BaseDirectory = packageJsonPath.ParentDirectory; defaultPackage.BeginLoad(); defaultPackage.AddProjectAndSolutionConfiguration(new DubProjectConfiguration { Name = GettextCatalog.GetString("Default"), Id = DubProjectConfiguration.DefaultConfigId }); while (r.Read()) { if (r.TokenType == JsonToken.PropertyName) { var propName = r.Value as string; defaultPackage.TryPopulateProperty(propName, r, monitor); } else if (r.TokenType == JsonToken.EndObject) { break; } } defaultPackage.Items.Add(new ProjectFile(packageJsonPath, BuildAction.None)); defaultPackage.EndLoad(); return(defaultPackage); }
public void BuildCommonArgAppendix(StringBuilder sr, DubProject prj, ConfigurationSelector sel) { if (prj.Configurations.Count > 1) { sr.Append(" --config=").Append(sel.GetConfiguration(prj).Id); } }
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; }
public void TryGetTargetFileProperties(DubProject prj, ConfigurationSelector configuration, ref string targetType, ref string targetName, ref string targetPath) { List <DubBuildSetting> l; if (TryGetValue(DubBuildSettings.TargetNameProperty, out l)) { foreach (var sett in l) { if (prj.BuildSettingMatchesConfiguration(sett, configuration)) { targetName = sett.Values [0]; } } } if (TryGetValue(DubBuildSettings.TargetPathProperty, out l)) { foreach (var sett in l) { if (prj.BuildSettingMatchesConfiguration(sett, configuration)) { targetPath = sett.Values [0]; } } } TryGetTargetTypeProperty(prj, configuration, ref targetType); }
internal static void ExecuteProject(DubProject prj, IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration) { bool isDebug = context.ExecutionHandler.GetType().Name.StartsWith("Debug"); var conf = prj.GetConfiguration(configuration) as DubProjectConfiguration; IConsole console; if (conf.ExternalConsole) { console = context.ExternalConsoleFactory.CreateConsole(!conf.PauseConsoleOutput); } else { console = context.ConsoleFactory.CreateConsole(true); } var operationMonitor = new AggregatedOperationMonitor(monitor); var sr = new StringBuilder(); if (!isDebug) { sr.Append("run"); BuildCommonArgAppendix(sr, prj, configuration); } try { var cmd = isDebug ? prj.CreateExecutionCommand(configuration) : new NativeExecutionCommand(DubSettings.Instance.DubCommand, sr.ToString(), prj.BaseDirectory.ToString()); if (!context.ExecutionHandler.CanExecute(cmd)) { monitor.ReportError("Cannot execute \"" + cmd.Command + " " + cmd.Arguments + "\". The selected execution mode is not supported for Dub projects.", null); return; } var op = context.ExecutionHandler.Execute(cmd, console); operationMonitor.AddOperation(op); op.WaitForCompleted(); if (op.ExitCode != 0) { monitor.ReportError(cmd.Command + " exited with code: " + op.ExitCode.ToString(), null); } else { monitor.Log.WriteLine(cmd.Command + " exited with code: {0}", op.ExitCode); } } catch (Exception ex) { monitor.ReportError("Cannot execute \"" + sr.ToString() + "\"", ex); } finally { operationMonitor.Dispose(); console.Dispose(); } }
public static void BuildCommonArgAppendix(StringBuilder sr,DubProject prj, ConfigurationSelector sel) { sr.Append (" \"").Append(prj.packageName).Append("\""); if(!string.IsNullOrWhiteSpace(DubSettings.Instance.CommonArgs)) sr.Append(' ').Append (DubSettings.Instance.CommonArgs); if (prj.Configurations.Count > 1 && sel.GetConfiguration(prj).Name.ToLower() != "default") sr.Append(" \"--config=").Append(sel.GetConfiguration(prj).Name).Append("\""); }
public static DubSubPackage ReadAndAdd(DubProject superProject, JsonReader r, IProgressMonitor monitor) { if (r.TokenType != JsonToken.StartObject) { throw new JsonReaderException("Illegal token on subpackage definition beginning"); } var sub = new DubSubPackage(); sub.FileName = superProject.FileName; sub.OriginalBasePath = superProject is DubSubPackage ? (superProject as DubSubPackage).OriginalBasePath : superProject.BaseDirectory; sub.VirtualBasePath = sub.OriginalBasePath; sub.BeginLoad(); sub.AddProjectAndSolutionConfiguration(new DubProjectConfiguration { Name = GettextCatalog.GetString("Default"), Id = DubProjectConfiguration.DefaultConfigId }); superProject.packagesToAdd.Add(sub); while (r.Read()) { if (r.TokenType == JsonToken.PropertyName) { sub.TryPopulateProperty(r.Value as string, r, monitor); } else if (r.TokenType == JsonToken.EndObject) { break; } } sub.packageName = superProject.packageName + ":" + (sub.packageName ?? string.Empty); var sourcePaths = sub.GetSourcePaths().ToArray(); if (sourcePaths.Length > 0 && !string.IsNullOrWhiteSpace(sourcePaths[0])) { sub.VirtualBasePath = new FilePath(sourcePaths [0]); } PackageJsonParser.LoadDubProjectReferences(sub, monitor); // TODO: What to do with new configurations that were declared in this sub package? Add them to all other packages as well? sub.EndLoad(); if (r.TokenType != JsonToken.EndObject) { throw new JsonReaderException("Illegal token on subpackage definition end"); } return(sub); }
public object ReadFile(FilePath file, Type expectedType, IProgressMonitor monitor) { object ret; var serializer = new JsonSerializer(); DubSolution sln; var dp = new DubProject { FileName = file, BaseDirectory = file.ParentDirectory }; if (expectedType.Equals(typeof(SolutionEntityItem))) { ret = dp; sln = null; } else if (expectedType.Equals(typeof(WorkspaceItem))) { ret = sln = new DubSolution(file); sln.RootFolder.AddItem(dp, false); sln.StartupItem = dp; dp.AddProjectAndSolutionConfiguration(new DubProjectConfiguration { Name = "Default", Id = "Default" }); } else { return(null); } using (var s = File.OpenText(file)) using (var rdr = new JsonTextReader(s)) { while (rdr.Read()) { if (rdr.TokenType == JsonToken.PropertyName) { dp.TryPopulateProperty(rdr.Value as string, rdr); } else if (rdr.TokenType == JsonToken.EndObject) { break; } } } dp.UpdateFilelist(); if (sln != null) { sln.LoadUserProperties(); } return(ret); }
public static void BuildCommonArgAppendix(StringBuilder sr, DubProject prj, ConfigurationSelector sel) { sr.Append(" \"").Append(prj.packageName).Append("\""); if (!string.IsNullOrWhiteSpace(DubSettings.Instance.CommonArgs)) { sr.Append(' ').Append(DubSettings.Instance.CommonArgs); } if (prj.Configurations.Count > 1 && sel.GetConfiguration(prj).Name.ToLower() != "default") { sr.Append(" \"--config=").Append(sel.GetConfiguration(prj).Name).Append("\""); } }
public static void BuildCommonArgAppendix(StringBuilder sr,DubProject prj, ConfigurationSelector sel) { sr.Append (" \"").Append(prj.packageName).Append("\""); if(!string.IsNullOrWhiteSpace(DubSettings.Instance.CommonArgs)) sr.Append(' ').Append (DubSettings.Instance.CommonArgs); var buildType = Ide.IdeApp.Workspace.ActiveExecutionTarget.Id; if (!string.IsNullOrWhiteSpace(buildType)) sr.Append(" \"--build=").Append(buildType).Append("\""); if (prj.Configurations.Count > 1 && sel.GetConfiguration(prj).Name.ToLower() != "default") sr.Append(" \"--config=").Append(sel.GetConfiguration(prj).Name).Append("\""); }
public static DubSubPackage ReadAndAdd(DubProject superProject,JsonReader r, IProgressMonitor monitor) { DubSubPackage sub; switch (r.TokenType) { case JsonToken.StartObject: break; case JsonToken.String: sub = PackageJsonParser.ReadPackageInformation (PackageJsonParser.GetDubJsonFilePath (superProject, r.Value as string), monitor, null, superProject) as DubSubPackage; return sub; default: throw new JsonReaderException ("Illegal token on subpackage definition beginning"); } sub = new DubSubPackage (); sub.FileName = superProject.FileName; sub.OriginalBasePath = superProject is DubSubPackage ? (superProject as DubSubPackage).OriginalBasePath : superProject.BaseDirectory; sub.VirtualBasePath = sub.OriginalBasePath; sub.BeginLoad (); sub.AddProjectAndSolutionConfiguration(new DubProjectConfiguration { Name = GettextCatalog.GetString("Default"), Id = DubProjectConfiguration.DefaultConfigId }); superProject.packagesToAdd.Add(sub); while (r.Read ()) { if (r.TokenType == JsonToken.PropertyName) sub.TryPopulateProperty (r.Value as string, r, monitor); else if (r.TokenType == JsonToken.EndObject) break; } sub.packageName = superProject.packageName + ":" + (sub.packageName ?? string.Empty); var sourcePaths = sub.GetSourcePaths ().ToArray(); if (sourcePaths.Length > 0 && !string.IsNullOrWhiteSpace(sourcePaths[0])) sub.VirtualBasePath = new FilePath(sourcePaths [0]); PackageJsonParser.LoadDubProjectReferences (sub, monitor); // TODO: What to do with new configurations that were declared in this sub package? Add them to all other packages as well? sub.EndLoad (); if (r.TokenType != JsonToken.EndObject) throw new JsonReaderException ("Illegal token on subpackage definition end"); return sub; }
public void TryGetTargetTypeProperty(DubProject prj, ConfigurationSelector cfg, ref string targetType) { List <DubBuildSetting> l; if (TryGetValue(DubBuildSettings.TargetTypeProperty, out l)) { foreach (var sett in l) { if (prj.BuildSettingMatchesConfiguration(sett, cfg)) { targetType = sett.Values [0]; } } } }
public static void ExecuteProject(DubProject prj,IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration, string dubVerb = "run") { bool isDebug = context.ExecutionHandler.GetType ().Name.StartsWith ("Debug"); var conf = prj.GetConfiguration(configuration) as DubProjectConfiguration; IConsole console; if (conf.ExternalConsole) console = context.ExternalConsoleFactory.CreateConsole(!conf.PauseConsoleOutput); else console = context.ConsoleFactory.CreateConsole(true); var operationMonitor = new AggregatedOperationMonitor(monitor); var sr = new StringBuilder(); if (!isDebug) { sr.Append (dubVerb); BuildCommonArgAppendix (sr, prj, configuration); } try { var cmd = isDebug ? prj.CreateExecutionCommand(configuration) : new NativeExecutionCommand(DubSettings.Instance.DubCommand, sr.ToString(), prj.BaseDirectory.ToString()); if (!context.ExecutionHandler.CanExecute(cmd)) { monitor.ReportError("Cannot execute \"" + cmd.Command + " " + cmd.Arguments + "\". The selected execution mode is not supported for Dub projects.", null); return; } var op = context.ExecutionHandler.Execute(cmd, console); operationMonitor.AddOperation(op); op.WaitForCompleted(); if(op.ExitCode != 0) monitor.ReportError(cmd.Command+" exited with code: "+op.ExitCode.ToString(), null); else monitor.Log.WriteLine(cmd.Command+" exited with code: {0}", op.ExitCode); } catch (Exception ex) { monitor.ReportError("Cannot execute \"" + sr.ToString() + "\"", ex); } finally { operationMonitor.Dispose(); console.Dispose(); } }
internal static void ExecuteProject(DubProject prj, IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration) { var conf = prj.GetConfiguration(configuration) as DubProjectConfiguration; IConsole console; if (conf.ExternalConsole) { console = context.ExternalConsoleFactory.CreateConsole(!conf.PauseConsoleOutput); } else { console = context.ConsoleFactory.CreateConsole(true); } var operationMonitor = new AggregatedOperationMonitor(monitor); var sr = new StringBuilder("run"); Instance.BuildCommonArgAppendix(sr, prj, configuration); try { var cmd = new NativeExecutionCommand(Instance.DubExecutable, sr.ToString(), prj.BaseDirectory.ToString()); if (!context.ExecutionHandler.CanExecute(cmd)) { monitor.ReportError("Cannot execute \"" + "\". The selected execution mode is not supported for Dub projects.", null); return; } var op = context.ExecutionHandler.Execute(cmd, console); operationMonitor.AddOperation(op); op.WaitForCompleted(); monitor.Log.WriteLine(Instance.DubExecutable + " exited with code: {0}", op.ExitCode); } catch (Exception ex) { monitor.ReportError("Cannot execute \"" + sr.ToString() + "\"", ex); } finally { operationMonitor.Dispose(); console.Dispose(); } }
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); }
internal static void ExecuteProject(DubProject prj,IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration) { var conf = prj.GetConfiguration(configuration) as DubProjectConfiguration; IConsole console; if (conf.ExternalConsole) console = context.ExternalConsoleFactory.CreateConsole(!conf.PauseConsoleOutput); else console = context.ConsoleFactory.CreateConsole(true); var operationMonitor = new AggregatedOperationMonitor(monitor); var sr = new StringBuilder("run"); Instance.BuildCommonArgAppendix(sr, prj, configuration); try { var cmd = new NativeExecutionCommand(Instance.DubExecutable, sr.ToString(), prj.BaseDirectory.ToString()); if (!context.ExecutionHandler.CanExecute(cmd)) { monitor.ReportError("Cannot execute \"" + "\". The selected execution mode is not supported for Dub projects.", null); return; } var op = context.ExecutionHandler.Execute(cmd, console); operationMonitor.AddOperation(op); op.WaitForCompleted(); monitor.Log.WriteLine(Instance.DubExecutable+" exited with code: {0}", op.ExitCode); } catch (Exception ex) { monitor.ReportError("Cannot execute \"" + sr.ToString() + "\"", ex); } finally { operationMonitor.Dispose(); console.Dispose(); } }
internal static void LoadDubProjectReferences(DubProject defaultPackage, IProgressMonitor monitor, Solution sln = null) { var sub = defaultPackage as DubSubPackage; foreach (var dep in defaultPackage.DubReferences) { if (string.IsNullOrWhiteSpace(dep.Path)) { continue; } if (sub != null) { sub.useOriginalBasePath = true; } var packageDir = defaultPackage.GetAbsPath(Building.ProjectBuilder.EnsureCorrectPathSeparators(dep.Path)); if (sub != null) { sub.useOriginalBasePath = false; } string packageJsonToLoad; if (File.Exists(packageJsonToLoad = Path.Combine(packageDir, PackageJsonFile)) || File.Exists(packageJsonToLoad = Path.Combine(packageDir, DubJsonFile))) { var prj = ReadFile_(packageJsonToLoad, typeof(Project), monitor) as DubProject; if (prj != null) { if (sln != null) { sln.RootFolder.AddItem(prj, false); } else { defaultPackage.packagesToAdd.Add(prj); } } } } }
public static BuildResult BuildProject(DubProject prj, IProgressMonitor mon, ConfigurationSelector sel) { var br = new BuildResult(); var args = new StringBuilder("build"); Instance.BuildCommonArgAppendix(args, prj, sel); string output; string errDump; int status = ProjectBuilder.ExecuteCommand(Instance.DubExecutable, 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; }
public object ReadFile(FilePath file, Type expectedType, IProgressMonitor monitor) { object ret; var serializer = new JsonSerializer(); DubSolution sln; var dp = new DubProject { FileName = file, BaseDirectory = file.ParentDirectory }; if (expectedType.Equals(typeof(SolutionEntityItem))){ ret = dp; sln = null; } else if(expectedType.Equals(typeof(WorkspaceItem))) { ret = sln = new DubSolution(file); sln.RootFolder.AddItem(dp, false); sln.StartupItem = dp; dp.AddProjectAndSolutionConfiguration(new DubProjectConfiguration { Name = "Default", Id = "Default" }); } else return null; using (var s = File.OpenText(file)) using(var rdr = new JsonTextReader(s)) { while (rdr.Read()) { if (rdr.TokenType == JsonToken.PropertyName) dp.TryPopulateProperty(rdr.Value as string, rdr); else if (rdr.TokenType == JsonToken.EndObject) break; } } dp.UpdateFilelist(); if (sln != null) sln.LoadUserProperties(); return ret; }
public static BuildResult BuildProject(DubProject prj, IProgressMonitor mon, ConfigurationSelector sel) { var br = new BuildResult(); var args = new StringBuilder("build"); Instance.BuildCommonArgAppendix(args, prj, sel); string output; string errDump; int status = ProjectBuilder.ExecuteCommand(Instance.DubExecutable, 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); }
public static void BuildCommonArgAppendix(StringBuilder sr, DubProject prj, ConfigurationSelector sel) { sr.Append(" \"").Append(prj.packageName).Append("\""); if (!string.IsNullOrWhiteSpace(DubSettings.Instance.CommonArgs)) { sr.Append(' ').Append(DubSettings.Instance.CommonArgs); } var buildType = Ide.IdeApp.Workspace.ActiveExecutionTarget.Id; if (!string.IsNullOrWhiteSpace(buildType)) { sr.Append(" \"--build=").Append(buildType).Append("\""); MonoDevelop.D.Profiler.Commands.ProfilerModeHandler.IsProfilerMode = buildType.ToLowerInvariant() == "profile"; } if (prj.Configurations.Count > 1 && sel.GetConfiguration(prj).Name.ToLower() != "default") { sr.Append(" \"--config=").Append(sel.GetConfiguration(prj).Name).Append("\""); } }
public void BuildCommonArgAppendix(StringBuilder sr,DubProject prj, ConfigurationSelector sel) { if (prj.Configurations.Count > 1) sr.Append(" --config=").Append(sel.GetConfiguration(prj).Id); }
public void BuildProgramArgAppendix(StringBuilder sr, DubProject prj, DubProjectConfiguration cfg) { }
internal static void LoadDubProjectReferences(DubProject defaultPackage, IProgressMonitor monitor, Solution sln = null) { var sub = defaultPackage as DubSubPackage; foreach (var dep in defaultPackage.DubReferences) { if (string.IsNullOrWhiteSpace(dep.Path)) continue; if (sub != null) sub.useOriginalBasePath = true; var packageDir = defaultPackage.GetAbsPath(Building.ProjectBuilder.EnsureCorrectPathSeparators(dep.Path)); if(sub != null) sub.useOriginalBasePath = false; string packageJsonToLoad; if (File.Exists(packageJsonToLoad = Path.Combine(packageDir, PackageJsonFile)) || File.Exists(packageJsonToLoad = Path.Combine(packageDir, DubJsonFile))) { var prj = ReadFile_(packageJsonToLoad, typeof(Project), monitor) as DubProject; if (prj != null) { if (sln != null) sln.RootFolder.AddItem (prj, false); else defaultPackage.packagesToAdd.Add (prj); } } } }
internal static void LoadDubProjectReferences(DubProject defaultPackage, IProgressMonitor monitor, Solution sln = null) { foreach (var dep in defaultPackage.DubReferences) { if (string.IsNullOrWhiteSpace(dep.Path)) continue; string packageJsonToLoad = GetDubJsonFilePath(defaultPackage, dep.Path); if (packageJsonToLoad != null && packageJsonToLoad != defaultPackage.FileName) { var prj = ReadFile_(packageJsonToLoad, typeof(Project), monitor) as DubProject; if (prj != null) { if (sln != null) sln.RootFolder.AddItem (prj, false); else defaultPackage.packagesToAdd.Add (prj); } } } }
public static DubProject ReadPackageInformation(FilePath packageJsonPath,IProgressMonitor monitor,JsonReader r = null, DubProject superPackage = null) { DubProject defaultPackage; bool free; StreamReader s = null; bool cleanupAlreadyLoadedPacks = AlreadyLoadedPackages == null; if (cleanupAlreadyLoadedPacks) AlreadyLoadedPackages = new Dictionary<string, DubProject> (); if (free = (r == null)) { if (AlreadyLoadedPackages.TryGetValue (packageJsonPath, out defaultPackage)) { if (cleanupAlreadyLoadedPacks) AlreadyLoadedPackages = null; return defaultPackage; } s = File.OpenText (packageJsonPath); r = new JsonTextReader (s); } defaultPackage = superPackage != null ? new DubSubPackage() : new DubProject(); try { defaultPackage.FileName = packageJsonPath; AlreadyLoadedPackages[packageJsonPath] = defaultPackage; defaultPackage.BaseDirectory = packageJsonPath.ParentDirectory; defaultPackage.BeginLoad (); defaultPackage.AddProjectAndSolutionConfiguration(new DubProjectConfiguration { Name = GettextCatalog.GetString("Default"), Id = DubProjectConfiguration.DefaultConfigId }); if(superPackage != null) superPackage.packagesToAdd.Add(defaultPackage); while (r.Read ()) { if (r.TokenType == JsonToken.PropertyName) { var propName = r.Value as string; defaultPackage.TryPopulateProperty (propName, r, monitor); } else if (r.TokenType == JsonToken.EndObject) break; } if(superPackage != null) defaultPackage.packageName = superPackage.packageName + ":" + (defaultPackage.packageName ?? string.Empty); defaultPackage.Items.Add(new ProjectFile(packageJsonPath, BuildAction.None)); // https://github.com/aBothe/Mono-D/issues/555 var dubSelectionJsonPath = packageJsonPath.ParentDirectory.Combine(DubSelectionsJsonFile); if(File.Exists(dubSelectionJsonPath)) defaultPackage.Items.Add(new ProjectFile(dubSelectionJsonPath, BuildAction.None)); defaultPackage.EndLoad (); } catch(Exception ex) { monitor.ReportError ("Exception while reading dub package "+packageJsonPath,ex); } finally{ if (free) { r.Close (); s.Dispose (); } if (cleanupAlreadyLoadedPacks) AlreadyLoadedPackages = null; } return defaultPackage; }
public static DubProject ReadPackageInformation(FilePath packageJsonPath,JsonReader r, IProgressMonitor monitor) { var defaultPackage = new DubProject(); defaultPackage.FileName = packageJsonPath; defaultPackage.BaseDirectory = packageJsonPath.ParentDirectory; defaultPackage.BeginLoad (); defaultPackage.AddProjectAndSolutionConfiguration(new DubProjectConfiguration { Name = GettextCatalog.GetString("Default"), Id = DubProjectConfiguration.DefaultConfigId }); while (r.Read ()) { if (r.TokenType == JsonToken.PropertyName) { var propName = r.Value as string; defaultPackage.TryPopulateProperty (propName, r, monitor); } else if (r.TokenType == JsonToken.EndObject) break; } defaultPackage.Items.Add(new ProjectFile(packageJsonPath, BuildAction.None)); defaultPackage.EndLoad (); return defaultPackage; }
public DubReferencesCollection(DubProject prj) : base(prj) { }