public void Save() { var bFile = PrepBuildFile(); BuildFileHandler.Save(FileName, bFile); IsNew = false; IsDirty = false; }
private bool MultiTargetMode(string filename) { var pFile = BuildFileHandler.Load(filename); var m = new JobManager(); var targetName = _argParser["t"]; if (targetName.Contains(",")) { // more than one target specified var targets = targetName.Split( new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (targets.Length == 0) { DisplayUsage("Invalid target list specified"); return(false); } foreach (var tname in targets) { if (!RecursiveDependencyEval(m, pFile, tname)) { return(false); } } } else { if (!RecursiveDependencyEval(m, pFile, targetName)) { return(false); } } if (_argParser.IsSwitchSet("nodeps")) { m.ResolveDependencies = false; } try { m.Execute(); return(true); } catch (Exception e) { Log.Error("Building failed", e); return(false); } }
private bool AllTargetsMode(string filename) { var pFile = BuildFileHandler.Load(filename); var m = new JobManager(); foreach (var p in pFile.Projects) { m.AddWorker(p.Name, p); } try { m.Execute(); return(true); } catch (Exception e) { Log.Error("Building failed", e); return(false); } }
public void SaveAs(string filename) { var tmp = FileName; // save new filename FileName = filename; // we need to go through all the projects and updated their // paths so that they are rooted to the place where the builds file is // located var tmpBuildFileDir = Path.GetDirectoryName(tmp); var pathBackup = new Dictionary <ProjectAdapter, string>(); foreach (var proj in Projects) { var actualPath = proj.Path; if (string.IsNullOrEmpty(actualPath)) { continue; } if (!Path.IsPathRooted(actualPath)) { actualPath = Path.Combine(tmpBuildFileDir, actualPath); } pathBackup[proj] = proj.Path; proj.Path = GetPathRootedAtBuildsFile(actualPath); foreach (var pOut in proj.OutputInformation) { actualPath = pOut.ActualOutput.DestPath; if (!string.IsNullOrEmpty(actualPath)) { if (!Path.IsPathRooted(actualPath)) { actualPath = Path.Combine(tmpBuildFileDir, actualPath); } pOut.DestPath = GetPathRootedAtBuildsFile(actualPath); } for (int i = 0; i < pOut.PathList.Count; i++) { actualPath = pOut.PathList[i]; if (string.IsNullOrEmpty(actualPath)) { continue; } if (!Path.IsPathRooted(actualPath)) { actualPath = Path.Combine(tmpBuildFileDir, actualPath); } pOut.PathList[i] = GetPathRootedAtBuildsFile(actualPath); } } } try { var bFile = PrepBuildFile(); BuildFileHandler.Save(filename, bFile); } catch (Exception e) { // restore paths foreach (var val in pathBackup) { val.Key.Path = val.Value; } FileName = filename; // rethrow exception throw; } IsDirty = false; IsNew = false; }
public BuildFileAdapter(string filename) : this(BuildFileHandler.Load(filename), filename, false) { }