Exemplo n.º 1
0
	    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);
	    }
Exemplo n.º 2
0
    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);
    }
Exemplo n.º 3
0
            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);
            }
Exemplo n.º 4
0
		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;
		}
Exemplo n.º 5
0
        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.");
            }
        }
Exemplo n.º 6
0
        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)));
        }
Exemplo n.º 7
0
        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");
            }
        }
Exemplo n.º 8
0
    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);
    }
Exemplo n.º 9
0
    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;
        }
    }
Exemplo n.º 10
0
        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));
        }
Exemplo n.º 11
0
 public string PathTo(MBDirectory dir)
 {
     return(real.PathTo(dir));
 }
Exemplo n.º 12
0
	    public string DistPath (MBDirectory dir) {
		return proj.ss.DistPath (dir);
	    }
Exemplo n.º 13
0
	    public string PathTo (MBDirectory dir) {
		return proj.ss.PathTo (dir);
	    }
Exemplo n.º 14
0
	public string DistPath (MBDirectory dir) {
		return real.DistPath (dir);
	}
Exemplo n.º 15
0
 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);
 }
Exemplo n.º 16
0
	public string PathTo (MBDirectory dir) {
		return real.PathTo (dir);
	}
Exemplo n.º 17
0
	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);
	}
Exemplo n.º 18
0
		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));
		}
Exemplo n.º 19
0
 public string DistPath(MBDirectory dir)
 {
     return(real.DistPath(dir));
 }
Exemplo n.º 20
0
		public string DistPath (MBDirectory d) {
			throw new InvalidOperationException ("Shouldn't need distpath to configure gacutil.");
		}
Exemplo n.º 21
0
		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.");
			}
		}
Exemplo n.º 22
0
	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;
	}
Exemplo n.º 23
0
	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;
	}
Exemplo n.º 24
0
	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");
	    }
	}
Exemplo n.º 25
0
		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;
		}
Exemplo n.º 26
0
		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;
		}
Exemplo n.º 27
0
		public void SetFromSystemPath (string path)
		{
		    dir = new MBDirectory (ResultStorageKind.System, 
					   Path.GetDirectoryName (path));
		    name = Path.GetFileName (path);
		}
Exemplo n.º 28
0
		public void CopyTo (MBDirectory dir, IBuildContext ctxt) {
			string dest = Path.Combine (ctxt.PathTo (dir), Name);

			CopyToUnsafe (dest, ctxt);
		}
Exemplo n.º 29
0
 public string DistPath(MBDirectory d)
 {
     throw new InvalidOperationException("Shouldn't need distpath to configure gacutil.");
 }
Exemplo n.º 30
0
 public string PathTo(MBDirectory dir)
 {
     return(proj.ss.PathTo(dir));
 }
Exemplo n.º 31
0
 public string DistPath(MBDirectory dir)
 {
     return(proj.ss.DistPath(dir));
 }
Exemplo n.º 32
0
		public void SetToInsecureTemporary (string ext, IBuildContext ctxt)
		{
		    dir = ctxt.WorkingDirectory;
		    name = String.Format ("tmp{0}.{1}", new Random ().Next (), ext);
		}
Exemplo n.º 33
0
	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;
	}