示例#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());
 }