Esempio n. 1
0
 private static bool ShouldTaskExecute(ICakeContext context, CakeTask task, CakeTaskCriteria criteria, bool isTarget)
 {
     if (!criteria.Predicate(context))
     {
         if (isTarget)
         {
             // It's not OK to skip the target task.
             // See issue #106 (https://github.com/cake-build/cake/issues/106)
             const string format  = "Could not reach target '{0}' since it was skipped due to a criteria.";
             var          message = string.Format(CultureInfo.InvariantCulture, format, task.Name);
             throw new CakeException(message);
         }
         return(false);
     }
     return(true);
 }
Esempio n. 2
0
        private static bool ShouldTaskExecute(ICakeContext context, CakeTask task, CakeTaskCriteria criteria, bool isTarget)
        {
            if (!criteria.Predicate(context))
            {
                if (isTarget)
                {
                    // It's not OK to skip the target task.
                    // See issue #106 (https://github.com/cake-build/cake/issues/106)
                    var message = string.IsNullOrWhiteSpace(criteria.Message) ?
                                  $"Could not reach target '{task.Name}' since it was skipped due to a criteria." :
                                  $"Could not reach target '{task.Name}' since it was skipped due to a criteria: {criteria.Message}.";

                    throw new CakeException(message);
                }

                return(false);
            }

            return(true);
        }