Example #1
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);
        }
Example #2
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);
        }
Example #3
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;
	}
Example #4
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;
		}
Example #5
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;
		}
Example #6
0
	// Config

	bool ConfigOperation (WrenchProject proj, BuildServices bs) {
		Result res = bs.GetValue ().Result;

		if (res == null)
			return true;

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

		string prompt;

		if (rprompt == null) {
			log.PushLocation (bs.FullName);
			log.Warning (2017, "This configurable option does not have a \'prompt\' tag.", null);
			log.PopLocation ();
			prompt = String.Format ("Set value of {0}:", bs.FullName);
		} else {
			// TODO: i18n
			prompt = ((MBString) rprompt).Value;
		}

		if (res is MBBool)
			DoConfigBool (prompt, (MBBool) res);
		else if (res is MBString)
			DoConfigString (prompt, (MBString) res);
		else if (res is MBDirectory)
			DoConfigDirectory (prompt, (MBDirectory) res);
		else {
			string s = String.Format ("Current value is {0}", res);
			log.PushLocation (bs.FullName);
			log.Error (2018, "Don't know how to configure this option.", s);
			log.PopLocation ();
			return true;
		}

		bs.FixValue (res);
		return false;
	}
Example #7
0
	// basic operations

	bool ShowOperation (WrenchProject proj, BuildServices bs) {
		Result res = bs.GetValue ().Result;

		if (res != null)
			Console.WriteLine ("{0} = {1}", bs.FullName, res);
		else
			Console.WriteLine ("{0} couldn't be evaluated.", bs.FullName);

		return false;
	}