示例#1
0
        bool AddNamed(int aid, Result r, Fingerprint fp,
                      int index_into_values, IWarningLogger logger)
        {
            if (aid < 0 || aid >= args.Length)
            {
                string s = String.Format("Trying to add {0} to nonexistant " +
                                         "argument ID {1}.", r, aid);
                logger.Error(2042, s, r.ToString());
                return(true);
            }

            Result subres = CompositeResult.FindCompatible(r, args[aid].Type);

            if (subres == null)
            {
                string err = String.Format("Argument value should be of type {0}, but " +
                                           "its type is {1}", args[aid].Type, r.GetType());
                logger.Error(2036, err, r.ToString());
                return(true);
            }

            if (subres == r)
            {
                args[aid].AddResult(r, fp, index_into_values);
            }
            else
            {
                // FIXME: the FP is really invalid, right?
                args[aid].AddResult(r, null, index_into_values);
            }

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