Пример #1
0
	internal BuildServices (WrenchProject proj, TargetTagInfo tti)
	    : this (proj, tti.Target)
	{
	    cached_tag = tti.Tag;
	    cached_tag_rval = tti.ValResult;
	    cached_tag_tval = tti.ValTarget;
	}
Пример #2
0
        public static bool Install(WrenchProject proj, BuildServices bs, bool backwards)
        {
            IResultInstaller iri;
            Result           res;

            if (GetInstallerAndResult(proj, bs, out iri, out res))
            {
                return(true);
            }

            if (iri == null)
            {
                return(false);
            }

            try {
                bs.Logger.Log("operation.install", bs.FullName);
                if (backwards)
                {
                    DoBeforeUninstall(proj, bs);
                }
                else
                {
                    DoBeforeInstall(proj, bs);
                }
                return(iri.InstallResult(res, backwards, bs.Context));
            } catch (Exception e) {
                bs.Logger.Error(3012, "Unhandled exception in install routine for " + res.ToString(), e.ToString());
                return(true);
            }
        }
Пример #3
0
 public static bool Uncache(WrenchProject proj, BuildServices bs)
 {
     bs.Logger.Log("operation.uncache", bs.FullName);
     DoBeforeUncache(proj, bs);
     bs.UncacheValue();
     return(false);
 }
Пример #4
0
            string GetStatePath(WrenchProject proj)
            {
                string basis = proj.Graph.GetProviderBasis(id);

                return(proj.ss.PathToStateItem(SourceSettings.BasisToFileToken(basis) +
                                               StateSuffix));
            }
Пример #5
0
 internal BuildServices(WrenchProject proj, TargetTagInfo tti)
     : this(proj, tti.Target)
 {
     cached_tag      = tti.Tag;
     cached_tag_rval = tti.ValResult;
     cached_tag_tval = tti.ValTarget;
 }
Пример #6
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);
	    }
Пример #7
0
		public static bool GetInstaller (WrenchProject proj, BuildServices bs, 
						 out IResultInstaller ret) {
			ret = null;

			// potential recursion!
			Result installer;
			if (bs.GetTag (proj.Graph.GetTagId ("install"), out installer))
				return true;

			if (installer == null)
				return false;

			// use install = false to mean "don't install"

			if (installer is MBBool) {
				if (((MBBool) installer).Value) {
					bs.Logger.Error (2019, "To install this target, set its installer tag to an Installer.", null);
					return true;
				}

				return false;
			}

			ret = installer as IResultInstaller;

			if (ret == null) {
				bs.Logger.Error (2016, "This target's \"install\" tag does not support installation", installer.ToString ());
				return true;
			}

			return false;
		}
Пример #8
0
        public void Dispose()
        {
            if (disposed)
            {
                return;
            }

            if (proj != null)
            {
                proj.Dispose();
                proj = null;
            }

            if (log != null)
            {
                log.Save(ss);
                log = null;
            }

            if (ProfileStateUsage)
            {
                Console.Error.WriteLine("GRAPH STATE USAGE PROFILE:");
                Console.Error.WriteLine("{0}", graph);
            }

            graph = null;
            ss    = null;
            bm    = null;

            disposed = true;
        }
Пример #9
0
 public WrenchManager(WrenchProject proj)
 {
     if (proj == null)
     {
         throw new ArgumentNullException();
     }
     this.proj = proj;
 }
Пример #10
0
            // TODO: Use varying persistence storages; right now
            // we only ever use FileStateTable.

            public ProviderInfo(short id, WrenchProject proj)
            {
                this.id = id;

                pp = FileStateTable.Load(GetStatePath(proj), proj.Log);

                context = new InfoContext(proj.Graph.GetProviderDeclarationLoc(id), proj);
            }
Пример #11
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);
            }
Пример #12
0
        static void DoBeforeClean(WrenchProject proj, BuildServices bs)
        {
            if (BeforeClean == null)
            {
                return;
            }

            BeforeClean(proj, bs);
        }
Пример #13
0
        static void DoBeforeSkip(WrenchProject proj, BuildServices bs)
        {
            if (BeforeSkip == null)
            {
                return;
            }

            BeforeSkip(proj, bs);
        }
Пример #14
0
        static void DoBeforeUninstall(WrenchProject proj, BuildServices bs)
        {
            if (BeforeUninstall == null)
            {
                return;
            }

            BeforeUninstall(proj, bs);
        }
Пример #15
0
        static void DoBeforeUncache(WrenchProject proj, BuildServices bs)
        {
            if (BeforeUncache == null)
            {
                return;
            }

            BeforeUncache(proj, bs);
        }
Пример #16
0
        static void DoBeforeDistribute(WrenchProject proj, BuildServices bs)
        {
            if (BeforeDistribute == null)
            {
                return;
            }

            BeforeDistribute(proj, bs);
        }
Пример #17
0
	internal BuildServices (WrenchProject proj, int tid) 
	{
	    this.proj = proj;
	    this.tid = tid;

	    pi = proj.GetTargetInfo (tid);

	    basename = proj.Graph.GetTargetName (tid);

	    string basis = proj.Graph.GetProviderBasis ((short) (tid >> 16));
	    target = basis + basename;
	}
Пример #18
0
		public static BuiltItem BuildValue (WrenchProject proj, BuildServices bs) {
			BuiltItem bi;

			if (bs.TryValueRecovery (out bi))
				return BuiltItem.Null;

			if (bi.IsValid) {
				DoBeforeSkip (proj, bs);
				return bi;
			}

			return BuildValueUnconditional (proj, bs);
		}
Пример #19
0
        internal BuildServices(WrenchProject proj, int tid)
        {
            this.proj = proj;
            this.tid  = tid;

            pi = proj.GetTargetInfo(tid);

            basename = proj.Graph.GetTargetName(tid);

            string basis = proj.Graph.GetProviderBasis((short)(tid >> 16));

            target = basis + basename;
        }
Пример #20
0
		public static bool Clean (WrenchProject proj, BuildServices bs) {
			BuiltItem bi = bs.GetRawCachedValue ();

			if (!bi.IsValid)
				return false;

			bs.Logger.Log ("operation.clean", bs.FullName);
			if (bi.Result.Clean (bs.Context))
				// FIXME: rename to After
				DoBeforeClean (proj, bs);

			bs.UncacheValue ();
			return false;
		}
Пример #21
0
	public bool LoadRest (IWarningLogger uilog) 
	{
	    if ((log = ActionLog.Load (ss, uilog)) == null)
		return true;

	    if ((graph = GetGraph ()) == null)
		return true;

	    if (ProfileStateUsage)
		graph = new GraphStateProfiler (graph);

	    proj = new WrenchProject (ss, graph, log);
	    return false;
	}
Пример #22
0
        public static BuiltItem BuildValue(WrenchProject proj, BuildServices bs)
        {
            BuiltItem bi;

            if (bs.TryValueRecovery(out bi))
            {
                return(BuiltItem.Null);
            }

            if (bi.IsValid)
            {
                DoBeforeSkip(proj, bs);
                return(bi);
            }

            return(BuildValueUnconditional(proj, bs));
        }
Пример #23
0
            public bool InitializeBuilddir(WrenchProject proj)
            {
                string declloc = proj.Graph.GetProviderDeclarationLoc(id);
                string decldir = proj.ss.PathToBuildRelative(declloc);

                try {
                    Directory.CreateDirectory(decldir);
                } catch (IOException) {
                    // Dir already exists, presumed OK.
                    return(false);
                }

                // Do this here (not in the try) just in case
                // something here could raise an IOException
                // that might be masked.

                return(proj.ss.SaveForSubpath(declloc, proj.log));
            }
Пример #24
0
        public static bool Distribute(WrenchProject proj, BuildServices bs)
        {
            Result res = bs.GetValue().Result;

            if (res == null)
            {
                return(true);
            }

            bs.Logger.Log("operation.distribute", bs.FullName);
            if (res.DistClone(bs.Context))
            {
                // rename this event
                DoBeforeDistribute(proj, bs);
            }

            return(false);
        }
Пример #25
0
        public static bool Clean(WrenchProject proj, BuildServices bs)
        {
            BuiltItem bi = bs.GetRawCachedValue();

            if (!bi.IsValid)
            {
                return(false);
            }

            bs.Logger.Log("operation.clean", bs.FullName);
            if (bi.Result.Clean(bs.Context))
            {
                // FIXME: rename to After
                DoBeforeClean(proj, bs);
            }

            bs.UncacheValue();
            return(false);
        }
Пример #26
0
        public bool LoadRest(IWarningLogger uilog)
        {
            if ((log = ActionLog.Load(ss, uilog)) == null)
            {
                return(true);
            }

            if ((graph = GetGraph()) == null)
            {
                return(true);
            }

            if (ProfileStateUsage)
            {
                graph = new GraphStateProfiler(graph);
            }

            proj = new WrenchProject(ss, graph, log);
            return(false);
        }
Пример #27
0
	public MainWindow (WrenchProject project) {
		this.project = project;

		ui = new Glade.XML (null, "mb-gtkconfig.glade", "main_window", null);
                ui.Autoconnect (this);

		main_window.Title = project.Info.Name + " " + 
			project.Info.Version + " - Build Configuration";

		group_menu = new Menu ();
		group_menu.Show ();
		group_option.Menu = group_menu;

		// kill the default page that glade forces us to have
		notebook.RemovePage (0);
		AddNewGroup (DefaultGroupName);
		group_option.SetHistory (0);

		LoadConfigItems ();
 	}
Пример #28
0
        public static bool GetInstaller(WrenchProject proj, BuildServices bs,
                                        out IResultInstaller ret)
        {
            ret = null;

            // potential recursion!
            Result installer;

            if (bs.GetTag(proj.Graph.GetTagId("install"), out installer))
            {
                return(true);
            }

            if (installer == null)
            {
                return(false);
            }

            // use install = false to mean "don't install"

            if (installer is MBBool)
            {
                if (((MBBool)installer).Value)
                {
                    bs.Logger.Error(2019, "To install this target, set its installer tag to an Installer.", null);
                    return(true);
                }

                return(false);
            }

            ret = installer as IResultInstaller;

            if (ret == null)
            {
                bs.Logger.Error(2016, "This target's \"install\" tag does not support installation", installer.ToString());
                return(true);
            }

            return(false);
        }
Пример #29
0
        public static bool GetInstallerAndResult(WrenchProject proj,
                                                 BuildServices bs, out IResultInstaller iri,
                                                 out Result obj)
        {
            obj = null;

            if (GetInstaller(proj, bs, out iri))
            {
                return(true);
            }

            if (iri == null)
            {
                return(false);
            }

            obj = bs.GetValue().Result;

            if (obj == null)
            {
                // error already reported
                return(true);
            }

            bs.Logger.PushLocation(bs.FullName);
            obj = CompositeResult.FindCompatible(obj, iri.OtherType);
            bs.Logger.PopLocation();

            if (obj == null)
            {
                bs.Logger.Error(2031, "Trying to install result with incompatible installer",
                                iri.OtherType.ToString());
                return(true);
            }

            return(false);
        }
Пример #30
0
		public static bool GetInstallerAndResult (WrenchProject proj,
							  BuildServices bs, out IResultInstaller iri,
							  out Result obj) {
			obj = null;

			if (GetInstaller (proj, bs, out iri))
				return true;

			if (iri == null)
				return false;

			obj = bs.GetValue ().Result;

			if (obj == null)
				// error already reported
				return true;

			bs.Logger.PushLocation (bs.FullName);
			obj = CompositeResult.FindCompatible (obj, iri.OtherType);
			bs.Logger.PopLocation ();

			if (obj == null) {
				bs.Logger.Error (2031, "Trying to install result with incompatible installer", 
					      iri.OtherType.ToString ());
				return true;
			}

			return false;
		}
Пример #31
0
	    string GetStatePath (WrenchProject proj)
	    {
		string basis = proj.Graph.GetProviderBasis (id);
		return proj.ss.PathToStateItem (SourceSettings.BasisToFileToken (basis) + 
						StateSuffix);
	    }
Пример #32
0
		public static bool Install (WrenchProject proj, BuildServices bs, bool backwards) {
			IResultInstaller iri;
			Result res;

			if (GetInstallerAndResult (proj, bs, out iri, out res))
				return true;

			if (iri == null)
				return false;

			try {
				bs.Logger.Log ("operation.install", bs.FullName);
				if (backwards)
					DoBeforeUninstall (proj, bs);
				else
					DoBeforeInstall (proj, bs);
				return iri.InstallResult (res, backwards, bs.Context);
			} catch (Exception e) {
				bs.Logger.Error (3012, "Unhandled exception in install routine for " + res.ToString (), e.ToString ());
				return true;
			}
		}
Пример #33
0
		public static bool Distribute (WrenchProject proj, BuildServices bs) {
			Result res = bs.GetValue ().Result;

			if (res == null)
				return true;

			bs.Logger.Log ("operation.distribute", bs.FullName);
			if (res.DistClone (bs.Context))
				// rename this event
				DoBeforeDistribute (proj, bs);
				
			return false;
		}
Пример #34
0
			public WrenchManager (WrenchProject proj) {
				if (proj == null)
					throw new ArgumentNullException ();
				this.proj = proj;
			}
Пример #35
0
		public static bool ForceBuild (WrenchProject proj, BuildServices bs) {
			return (!BuildValueUnconditional (proj, bs).IsValid);
		}
Пример #36
0
		public static bool Install (WrenchProject proj, BuildServices bs) {
			return Install (proj, bs, false);
		}
Пример #37
0
		public static bool Uninstall (WrenchProject proj, BuildServices bs) {
			return Install (proj, bs, true);
		}
Пример #38
0
		static void DoBeforeUncache (WrenchProject proj, BuildServices bs) {
			if (BeforeUncache == null)
				return;

			BeforeUncache (proj, bs);
		}
Пример #39
0
 public static IBuildManager MakeManager(WrenchProject proj)
 {
     return(new WrenchManager(proj));
 }
Пример #40
0
	public void Dispose () {
	    if (disposed)
		return;
	    
	    if (proj != null) {
		proj.Dispose ();
		proj = null;
	    }

	    if (log != null) {
		log.Save (ss);
		log = null;
	    }

	    if (ProfileStateUsage) {
		Console.Error.WriteLine ("GRAPH STATE USAGE PROFILE:");
		Console.Error.WriteLine ("{0}", graph);
	    }

	    graph = null;
	    ss = null;
	    bm = null;

	    disposed = true;
	}
Пример #41
0
		static void DoBeforeClean (WrenchProject proj, BuildServices bs) {
			if (BeforeClean == null)
				return;

			BeforeClean (proj, bs);
		}
Пример #42
0
 public static bool Build(WrenchProject proj, BuildServices bs)
 {
     return(!BuildValue(proj, bs).IsValid);
 }
Пример #43
0
	bool LoadConfigItem (WrenchProject proj, BuildServices bs) {
		string prompt, group;
		string target = bs.FullName;
		Result res = bs.GetValue ().Result;

		if (res == null)
			return true;

		Result tag;
		if (bs.GetTag ("prompt", out tag))
			return true;

		MBString rstr = tag as MBString;

		if (rstr == null) {
			// FIXME
			Console.Error.WriteLine ("Configurable option " + target + " does not have a string \'prompt\' tag.");
			prompt = target;
		} else {
			// TODO: i18n
			prompt = rstr.Value;
		}

		if (bs.GetTag ("config_group", out tag))
			return true;

		rstr = tag as MBString;

		if (rstr == null)
			group = DefaultGroupName;
		else {
			// TODO: i18n
			group = rstr.Value;
		}

		Widget widget = null;

		if (res is MBBool)
			widget = MakeBoolItem (bs, prompt, (MBBool) res);
		else if (res is MBString)
			widget = MakeStringItem (bs, prompt, (MBString) res);
		else {
			// FIXME
			Console.Error.WriteLine ("Don't know how to configure the option {0}.", target);
			return true;
		}

		AddGuiItem (group, widget);
		return false;
	}
Пример #44
0
 public static bool ForceBuild(WrenchProject proj, BuildServices bs)
 {
     return(!BuildValueUnconditional(proj, bs).IsValid);
 }
Пример #45
0
		public static BuiltItem BuildValueUnconditional (WrenchProject proj, BuildServices bs) {
			bs.Logger.Log ("operation.build", bs.FullName);
			DoBeforeBuild (proj, bs);
			return bs.BuildValue ();
		}
Пример #46
0
		static void DoBeforeDistribute (WrenchProject proj, BuildServices bs) {
			if (BeforeDistribute == null)
				return;

			BeforeDistribute (proj, bs);
		}
Пример #47
0
 public bool Close(WrenchProject proj)
 {
     return(pp.Save(GetStatePath(proj), proj.Log));
 }
Пример #48
0
		static void DoBeforeSkip (WrenchProject proj, BuildServices bs) {
			if (BeforeSkip == null)
				return;

			BeforeSkip (proj, bs);
		}
Пример #49
0
		public static bool Build (WrenchProject proj, BuildServices bs) {
			return (!BuildValue (proj, bs).IsValid);
		}
Пример #50
0
 public static bool Install(WrenchProject proj, BuildServices bs)
 {
     return(Install(proj, bs, false));
 }
Пример #51
0
	    public bool Close (WrenchProject proj)
	    {
		return pp.Save (GetStatePath (proj), proj.Log);
	    }
Пример #52
0
 public static bool Uninstall(WrenchProject proj, BuildServices bs)
 {
     return(Install(proj, bs, true));
 }
Пример #53
0
	    public bool InitializeBuilddir (WrenchProject proj)
	    {
		string declloc = proj.Graph.GetProviderDeclarationLoc (id);
		string decldir = proj.ss.PathToBuildRelative (declloc);

		try {
		    Directory.CreateDirectory (decldir);
		} catch (IOException) {
		    // Dir already exists, presumed OK.
		    return false; 
		}

		// Do this here (not in the try) just in case
		// something here could raise an IOException
		// that might be masked.

		return proj.ss.SaveForSubpath (declloc, proj.log);
	    }
Пример #54
0
		public static bool Uncache (WrenchProject proj, BuildServices bs) {
			bs.Logger.Log ("operation.uncache", bs.FullName);
			DoBeforeUncache (proj, bs);
			bs.UncacheValue ();
			return false;
		}
Пример #55
0
	    // TODO: Use varying persistence storages; right now
	    // we only ever use FileStateTable.

	    public ProviderInfo (short id, WrenchProject proj) 
	    {
		this.id = id;

		pp = FileStateTable.Load (GetStatePath (proj), proj.Log);

		context = new InfoContext (proj.Graph.GetProviderDeclarationLoc (id), proj);
	    }
Пример #56
0
		public static IBuildManager MakeManager (WrenchProject proj) {
			return new WrenchManager (proj);
		}
Пример #57
0
		static void DoBeforeUninstall (WrenchProject proj, BuildServices bs) {
			if (BeforeUninstall == null)
				return;

			BeforeUninstall (proj, bs);
		}
Пример #58
0
 public static BuiltItem BuildValueUnconditional(WrenchProject proj, BuildServices bs)
 {
     bs.Logger.Log("operation.build", bs.FullName);
     DoBeforeBuild(proj, bs);
     return(bs.BuildValue());
 }