internal BuildServices (WrenchProject proj, TargetTagInfo tti) : this (proj, tti.Target) { cached_tag = tti.Tag; cached_tag_rval = tti.ValResult; cached_tag_tval = tti.ValTarget; }
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); } }
public static bool Uncache(WrenchProject proj, BuildServices bs) { bs.Logger.Log("operation.uncache", bs.FullName); DoBeforeUncache(proj, bs); bs.UncacheValue(); return(false); }
string GetStatePath(WrenchProject proj) { string basis = proj.Graph.GetProviderBasis(id); return(proj.ss.PathToStateItem(SourceSettings.BasisToFileToken(basis) + StateSuffix)); }
internal BuildServices(WrenchProject proj, TargetTagInfo tti) : this(proj, tti.Target) { cached_tag = tti.Tag; cached_tag_rval = tti.ValResult; cached_tag_tval = tti.ValTarget; }
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 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; }
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; }
public WrenchManager(WrenchProject proj) { if (proj == null) { throw new ArgumentNullException(); } this.proj = proj; }
// 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); }
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); }
static void DoBeforeClean(WrenchProject proj, BuildServices bs) { if (BeforeClean == null) { return; } BeforeClean(proj, bs); }
static void DoBeforeSkip(WrenchProject proj, BuildServices bs) { if (BeforeSkip == null) { return; } BeforeSkip(proj, bs); }
static void DoBeforeUninstall(WrenchProject proj, BuildServices bs) { if (BeforeUninstall == null) { return; } BeforeUninstall(proj, bs); }
static void DoBeforeUncache(WrenchProject proj, BuildServices bs) { if (BeforeUncache == null) { return; } BeforeUncache(proj, bs); }
static void DoBeforeDistribute(WrenchProject proj, BuildServices bs) { if (BeforeDistribute == null) { return; } BeforeDistribute(proj, bs); }
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; }
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); }
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; }
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; }
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; }
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)); }
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)); }
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); }
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); }
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); }
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 (); }
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); }
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); }
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; }
string GetStatePath (WrenchProject proj) { string basis = proj.Graph.GetProviderBasis (id); return proj.ss.PathToStateItem (SourceSettings.BasisToFileToken (basis) + StateSuffix); }
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; } }
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; }
public WrenchManager (WrenchProject proj) { if (proj == null) throw new ArgumentNullException (); this.proj = proj; }
public static bool ForceBuild (WrenchProject proj, BuildServices bs) { return (!BuildValueUnconditional (proj, bs).IsValid); }
public static bool Install (WrenchProject proj, BuildServices bs) { return Install (proj, bs, false); }
public static bool Uninstall (WrenchProject proj, BuildServices bs) { return Install (proj, bs, true); }
static void DoBeforeUncache (WrenchProject proj, BuildServices bs) { if (BeforeUncache == null) return; BeforeUncache (proj, bs); }
public static IBuildManager MakeManager(WrenchProject proj) { return(new WrenchManager(proj)); }
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; }
static void DoBeforeClean (WrenchProject proj, BuildServices bs) { if (BeforeClean == null) return; BeforeClean (proj, bs); }
public static bool Build(WrenchProject proj, BuildServices bs) { return(!BuildValue(proj, bs).IsValid); }
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; }
public static bool ForceBuild(WrenchProject proj, BuildServices bs) { return(!BuildValueUnconditional(proj, bs).IsValid); }
public static BuiltItem BuildValueUnconditional (WrenchProject proj, BuildServices bs) { bs.Logger.Log ("operation.build", bs.FullName); DoBeforeBuild (proj, bs); return bs.BuildValue (); }
static void DoBeforeDistribute (WrenchProject proj, BuildServices bs) { if (BeforeDistribute == null) return; BeforeDistribute (proj, bs); }
public bool Close(WrenchProject proj) { return(pp.Save(GetStatePath(proj), proj.Log)); }
static void DoBeforeSkip (WrenchProject proj, BuildServices bs) { if (BeforeSkip == null) return; BeforeSkip (proj, bs); }
public static bool Build (WrenchProject proj, BuildServices bs) { return (!BuildValue (proj, bs).IsValid); }
public static bool Install(WrenchProject proj, BuildServices bs) { return(Install(proj, bs, false)); }
public bool Close (WrenchProject proj) { return pp.Save (GetStatePath (proj), proj.Log); }
public static bool Uninstall(WrenchProject proj, BuildServices bs) { return(Install(proj, bs, true)); }
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); }
public static bool Uncache (WrenchProject proj, BuildServices bs) { bs.Logger.Log ("operation.uncache", bs.FullName); DoBeforeUncache (proj, bs); bs.UncacheValue (); return false; }
// 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); }
public static IBuildManager MakeManager (WrenchProject proj) { return new WrenchManager (proj); }
static void DoBeforeUninstall (WrenchProject proj, BuildServices bs) { if (BeforeUninstall == null) return; BeforeUninstall (proj, bs); }
public static BuiltItem BuildValueUnconditional(WrenchProject proj, BuildServices bs) { bs.Logger.Log("operation.build", bs.FullName); DoBeforeBuild(proj, bs); return(bs.BuildValue()); }