示例#1
0
        protected bool ResolveTemplate(TypeResolver res, IWarningLogger log)
        {
            TargetTemplate tmpl;

            if (TemplateName != null)
            {
                tmpl = res.ResolveName(TemplateName, log);
            }
            else if (Rule == null)
            {
                // This is sketchy: assume that if we have a rule by now,
                // we need no templating; if we don't, assume that we
                // want to do inference
                tmpl = InferTemplate(res, log);
            }
            else
            {
                return(false);
            }

            if (tmpl == null)
            {
                // Error will already be reported
                return(true);
            }

            tmpl.ApplyTemplate(this);

            if (Rule == null)
            {
                log.Error(9999, "Target did not have its rule set by " +
                          "its primary template {0}", tmpl.ToString());
                return(true);
            }

            if (!Rule.IsSubclassOf(typeof(Mono.Build.Rule)))
            {
                string s = String.Format("Invalid rule `{0}\' for target {1}: not a subclass of Rule",
                                         Rule, FullName);
                log.Error(2029, s, Rule.FullName);
                return(true);
            }

            return(false);
        }