public InfoContext (string decl_loc, WrenchProject proj) { this.proj = proj; // even works for "/" wd = new MBDirectory (ResultStorageKind.Built, decl_loc); sd = new MBDirectory (ResultStorageKind.Source, decl_loc); }
bool RealImport(string dir) { DirectoryInfo di = new DirectoryInfo(dir); if (!di.Exists) { log.Error(9999, "The directory \"" + dir + "\" does not exist.", null); return(true); } FileInfo[] dlls = di.GetFiles(BundleManager.MBuildPrefix + "*_*.dll"); if (dlls.Length == 0) { log.Error(9999, "There are no bundle files in \"" + dir + "\".", null); return(true); } MBDirectory as_mbd = new MBDirectory(ResultStorageKind.System, di.FullName); bool fail = false; for (int i = 0; i < dlls.Length; i++) { fail |= ImportDll(as_mbd, dlls[i]); } return(fail); }
public InfoContext(string decl_loc, WrenchProject proj) { this.proj = proj; // even works for "/" wd = new MBDirectory(ResultStorageKind.Built, decl_loc); sd = new MBDirectory(ResultStorageKind.Source, decl_loc); }
public MBFile (MBDirectory dir, string name) : base () { if (dir == null) throw new ArgumentNullException ("dir"); if (name == null) throw new ArgumentNullException ("name"); this.dir = dir; this.name = name; this.modtime = invalid_modtime; }
public string PathTo(MBDirectory d) { switch (d.Storage) { case ResultStorageKind.System: return(d.SubPath); default: throw new InvalidOperationException("Shouldn't need internal path to configure gacutil."); } }
protected MBFile MakeDestination(MBFile src, IBuildContext ctxt) { string ddir = MutateDestDir(DestDir, src, ctxt); if (ddir == null) { string t = String.Format("No destination directory for the installation of {0}", src); ctxt.Logger.Error(2013, t, String.Format("Base dest directory \"{0}\"", DestDir)); return(null); } MBDirectory dir = new MBDirectory(ResultStorageKind.System, ddir); return(new MBFile(dir, GetDestName(src, dir, ctxt))); }
public string PathTo(MBDirectory dir) { switch (dir.Storage) { case ResultStorageKind.System: return(dir.SubPath); case ResultStorageKind.Built: return(PathToBuildRelative(dir.SubPath)); case ResultStorageKind.Source: return(PathToSourceRelative(dir.SubPath)); default: throw new Exception("Invalid ResultStorageKind"); } }
bool ImportDll(MBDirectory dir, FileInfo dll) { string[] pieces = dll.Name.Split('_'); if (pieces.Length != 2) { log.Error(9999, "Invalid bundle filename (expected exactly one underscore): " + dll.Name, null); return(true); } // pieces[1] is <version>.dll, so strip off the .dll part string shortname = pieces[0].Substring(BundleManager.MBuildPrefix.Length); string version = pieces[1].Substring(0, pieces[1].Length - 4); AssemblyName aname = BundleManager.MakeName(shortname, version); if (bm.LoadBundle(aname, log) == false) { Console.WriteLine(" + Bundle {0}/{1} already imported", shortname, version); return(false); } if (dry_run) { Console.WriteLine(" + Would import {0}/{1}", shortname, version); return(false); } Console.WriteLine(" + Importing {0}/{1}", shortname, version); AssemblyFile assy = new AssemblyFile(); assy.Dir = dir; assy.Name = dll.Name; // FIXME //if (gacprog.InstallAssembly (assy, root, MBImport.Config.CompatCode, false, ctxt)) if (gacprog.InstallAssembly(assy, root, "mbuild-0.0", false, ctxt)) { return(true); } num_imported++; return(false); }
void DoConfigDirectory(string prompt, MBDirectory res) { // FIXME: how to handle system/build/config? Right now just ignore it; // probably will work ok for most sane situations. Console.WriteLine("{0} (default: {1})", prompt, res.SubPath); string response = Console.ReadLine(); if (response == "") { Console.WriteLine("(Didn't understand; going with the default.)"); } else { res.SubPath = response; } }
public string DistPath(MBDirectory dir) { if (dir.Storage != ResultStorageKind.Source) { throw new Exception("Don't know how to distpath " + dir.ToString()); } string path; if (Path.IsPathRooted(topdist_from_topbuild)) { path = topdist_from_topbuild; } else { path = PathToBuildRelative(topdist_from_topbuild); } return(Path.Combine(path, dir.SubPath)); }
public string PathTo(MBDirectory dir) { return(real.PathTo(dir)); }
public string DistPath (MBDirectory dir) { return proj.ss.DistPath (dir); }
public string PathTo (MBDirectory dir) { return proj.ss.PathTo (dir); }
public string DistPath (MBDirectory dir) { return real.DistPath (dir); }
protected virtual string GetDestName(MBFile file, MBDirectory dest, IBuildContext ctxt) { // return the basename of the destination file, derived from the arguments // in whatever manner is fit. return(file.Name); }
public string PathTo (MBDirectory dir) { return real.PathTo (dir); }
public string DistPath (MBDirectory dir) { if (dir.Storage != ResultStorageKind.Source) throw new Exception ("Don't know how to distpath " + dir.ToString ()); string path; if (Path.IsPathRooted (topdist_from_topbuild)) path = topdist_from_topbuild; else path = PathToBuildRelative (topdist_from_topbuild); return Path.Combine (path, dir.SubPath); }
protected MBFile MakeDestination (MBFile src, IBuildContext ctxt) { string ddir = MutateDestDir (DestDir, src, ctxt); if (ddir == null) { string t = String.Format ("No destination directory for the installation of {0}", src); ctxt.Logger.Error (2013, t, String.Format ("Base dest directory \"{0}\"", DestDir)); return null; } MBDirectory dir = new MBDirectory (ResultStorageKind.System, ddir); return new MBFile (dir, GetDestName (src, dir, ctxt)); }
public string DistPath(MBDirectory dir) { return(real.DistPath(dir)); }
public string DistPath (MBDirectory d) { throw new InvalidOperationException ("Shouldn't need distpath to configure gacutil."); }
public string PathTo (MBDirectory d) { switch (d.Storage) { case ResultStorageKind.System: return d.SubPath; default: throw new InvalidOperationException ("Shouldn't need internal path to configure gacutil."); } }
bool RealImport (string dir) { DirectoryInfo di = new DirectoryInfo (dir); if (!di.Exists) { log.Error (9999, "The directory \"" + dir + "\" does not exist.", null); return true; } FileInfo[] dlls = di.GetFiles (BundleManager.MBuildPrefix + "*_*.dll"); if (dlls.Length == 0) { log.Error (9999, "There are no bundle files in \"" + dir + "\".", null); return true; } MBDirectory as_mbd = new MBDirectory (ResultStorageKind.System, di.FullName); bool fail = false; for (int i = 0; i < dlls.Length; i++) fail |= ImportDll (as_mbd, dlls[i]); return fail; }
bool ImportDll (MBDirectory dir, FileInfo dll) { string[] pieces = dll.Name.Split ('_'); if (pieces.Length != 2) { log.Error (9999, "Invalid bundle filename (expected exactly one underscore): " + dll.Name, null); return true; } // pieces[1] is <version>.dll, so strip off the .dll part string shortname = pieces[0].Substring (BundleManager.MBuildPrefix.Length); string version = pieces[1].Substring (0, pieces[1].Length - 4); AssemblyName aname = BundleManager.MakeName (shortname, version); if (bm.LoadBundle (aname, log) == false) { Console.WriteLine (" + Bundle {0}/{1} already imported", shortname, version); return false; } if (dry_run) { Console.WriteLine (" + Would import {0}/{1}", shortname, version); return false; } Console.WriteLine (" + Importing {0}/{1}", shortname, version); AssemblyFile assy = new AssemblyFile (); assy.Dir = dir; assy.Name = dll.Name; // FIXME //if (gacprog.InstallAssembly (assy, root, MBImport.Config.CompatCode, false, ctxt)) if (gacprog.InstallAssembly (assy, root, "mbuild-0.0", false, ctxt)) return true; num_imported++; return false; }
public string PathTo (MBDirectory dir) { switch (dir.Storage) { case ResultStorageKind.System: return dir.SubPath; case ResultStorageKind.Built: return PathToBuildRelative (dir.SubPath); case ResultStorageKind.Source: return PathToSourceRelative (dir.SubPath); default: throw new Exception ("Invalid ResultStorageKind"); } }
protected override bool ImportXml (XmlReader xr, IWarningLogger log) { bool gotdir = false; bool gotname = false; int depth = xr.Depth; while (xr.Depth >= depth) { if (xr.NodeType != XmlNodeType.Element) { //Console.WriteLine ("skipping {0}: {1} = \"{2}\"", xr.NodeType, xr.Name, xr.Value); xr.Read (); continue; } switch (xr.Name) { case "result": string ignore; Result r = Result.ImportXml (xr, out ignore, log); if (r == null) return true; if (!(r is MBDirectory)) { log.Warning (3019, "Result embedded in file result is not directory during XML import", null); return true; } dir = (MBDirectory) r; gotdir = true; break; case "name": name = xr.ReadElementString (); gotname = true; break; default: log.Warning (3019, "Unknown element in file result during XML import", xr.Name); xr.Skip (); break; } } if (!gotdir) { log.Warning (3019, "Did not find directory in file element during XML import", null); return true; } if (!gotname) { log.Warning (3019, "Did not find name in file element during XML import", null); return true; } return false; }
protected virtual string GetDestName (MBFile file, MBDirectory dest, IBuildContext ctxt) { // return the basename of the destination file, derived from the arguments // in whatever manner is fit. return file.Name; }
public void SetFromSystemPath (string path) { dir = new MBDirectory (ResultStorageKind.System, Path.GetDirectoryName (path)); name = Path.GetFileName (path); }
public void CopyTo (MBDirectory dir, IBuildContext ctxt) { string dest = Path.Combine (ctxt.PathTo (dir), Name); CopyToUnsafe (dest, ctxt); }
public string DistPath(MBDirectory d) { throw new InvalidOperationException("Shouldn't need distpath to configure gacutil."); }
public string PathTo(MBDirectory dir) { return(proj.ss.PathTo(dir)); }
public string DistPath(MBDirectory dir) { return(proj.ss.DistPath(dir)); }
public void SetToInsecureTemporary (string ext, IBuildContext ctxt) { dir = ctxt.WorkingDirectory; name = String.Format ("tmp{0}.{1}", new Random ().Next (), ext); }
void DoConfigDirectory (string prompt, MBDirectory res) { // FIXME: how to handle system/build/config? Right now just ignore it; // probably will work ok for most sane situations. Console.WriteLine ("{0} (default: {1})", prompt, res.SubPath); string response = Console.ReadLine (); if (response == "") Console.WriteLine ("(Didn't understand; going with the default.)"); else res.SubPath = response; }