Beispiel #1
0
        // Utility, for bundlegen

        public bool DefineConstantTarget(string name, Result r, IWarningLogger log)
        {
            TargetBuilder tb = DefineTarget(name, log);

            if (tb == null)
            {
                return(true);
            }

            tb.RuleType = typeof(Mono.Build.RuleLib.CloneRule);
            tb.AddDep(r);
            return(false);
        }
Beispiel #2
0
        // Returns null and logs an error if the target with the given
        // name has already been defined.

        public TargetBuilder DefineTarget(string name, IWarningLogger log)
        {
            if (done_modifying)
            {
                throw ExHelp.InvalidOp("Cannot define target {0} because its " +
                                       "provider is now unmodifiable", name);
            }

            TargetBuilder tb = EnsureTarget(name);

            if (tb.Define(log))
            {
                return(null);
            }

            return(tb);
        }
Beispiel #3
0
        public TargetBuilder ReferenceTarget(string name)
        {
            if (targets.ContainsKey(name))
            {
                return(targets[name]);
            }

            if (done_modifying)
            {
                throw ExHelp.InvalidOp("Cannot reference new target {0} because its " +
                                       "provider is been marked as finished", name);
            }

            TargetBuilder tb = CreateTarget(name);

            targets[name] = tb;
            return(tb);
        }
Beispiel #4
0
        public TargetBuilder RequestTarget(string name)
        {
            // We can request targets via a SetDefault call via ApplyTemplate
            // via ResolveTemplate during target fixup, at which point providers
            // will have their done_modifying flag set. So only signal the error
            // if the request would have actually created a new target, not if
            // it is effectively a noop.

            if (done_modifying && !targets.ContainsKey(name))
            {
                throw ExHelp.InvalidOp("Cannot request target {0} because its " +
                                       "provider is now unmodifiable", name);
            }

            TargetBuilder tb = EnsureTarget(name);

            tb.Request();

            return(tb);
        }