Esempio n. 1
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;
		}
Esempio n. 2
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);
        }
Esempio n. 3
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);
        }
Esempio n. 4
0
    public bool Install(Result installer, Result target, bool backwards, IBuildContext ctxt)
    {
        IResultInstaller iri = installer as IResultInstaller;

        return(iri.InstallResult(target, backwards, ctxt));
    }
Esempio n. 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;
		}