- List <Target> list = new List <Target> ();
- Target t;
- string [] targetNames;
- Expression deps;
-
- if (DependsOnTargets != String.Empty) {
- deps = new Expression ();
- deps.Parse (DependsOnTargets, ParseOptions.AllowItemsNoMetadataAndSplit);
- targetNames = (string []) deps.ConvertTo (Project, typeof (string []));
- foreach (string dep_name in targetNames) {
- t = project.Targets [dep_name.Trim ()];
- if (t == null)
- throw new InvalidProjectFileException (String.Format (
- "Target '{0}', a dependency of target '{1}', not found.",
- dep_name.Trim (), Name));
- list.Add (t);
- }
- }
- return list;
+ executeOnErrors = false;
+
+ if (String.IsNullOrEmpty (DependsOnTargets))
+ return true;
+
+ var expr = new Expression ();
+ expr.Parse (DependsOnTargets, ParseOptions.AllowItemsNoMetadataAndSplit);
+ string [] targetNames = (string []) expr.ConvertTo (Project, typeof (string []));
+
+ bool result = BuildOtherTargets (targetNames,
+ tname => engine.LogError ("Target '{0}', a dependency of target '{1}', not found.",
+ tname, Name),
+ out executeOnErrors);
+ if (!result && executeOnErrors)
+ ExecuteOnErrors ();
+
+ return result;
+ }
+
+#if NET_4_0
+ bool BuildBeforeThisTargets (out bool executeOnErrors)
+ {
+ executeOnErrors = false;
+ bool result = BuildOtherTargets (BeforeThisTargets, null, out executeOnErrors);
+ if (!result && executeOnErrors)
+ ExecuteOnErrors ();
+
+ return result;