#if NET_2_0
using System;
+using System.Collections;
+using System.Collections.Generic;
using System.IO;
using Microsoft.Build.Framework;
public class CallTarget : TaskExtension {
bool runEachTargetSeparately;
- ITaskItem[] targetOutputs;
+ List<ITaskItem> targetOutputs_list;
+ ITaskItem[] targetOutputs_array;
string[] targets;
public CallTarget ()
{
+ targetOutputs_list = new List<ITaskItem> ();
}
- [MonoTODO]
public override bool Execute ()
{
- return false;
+ if (targets == null || targets.Length == 0)
+ return true;
+
+ Hashtable targets_table = new Hashtable ();
+
+ if (!RunEachTargetSeparately) {
+ bool ret = BuildEngine.BuildProjectFile (BuildEngine.ProjectFileOfTaskNode,
+ targets, null, targets_table);
+ foreach (ITaskItem[] items in targets_table.Values) {
+ if (items != null)
+ targetOutputs_list.AddRange (items);
+ }
+
+ return ret;
+ }
+
+ // RunEachTargetSeparately
+ bool allPassed = true;
+ for (int i = 0; i < targets.Length; i ++) {
+ string target = targets [i];
+ bool result = BuildEngine.BuildProjectFile (BuildEngine.ProjectFileOfTaskNode,
+ new string[] { target }, null, targets_table);
+
+ if (allPassed && !result)
+ allPassed = false;
+
+ if (!targets_table.Contains (target))
+ continue;
+
+ ITaskItem [] items = (ITaskItem[]) targets_table [target];
+ if (items != null)
+ targetOutputs_list.AddRange (items);
+ }
+
+ return allPassed;
}
public bool RunEachTargetSeparately {
set { runEachTargetSeparately = value; }
}
+ [Output]
public ITaskItem[] TargetOutputs {
- get { return targetOutputs; }
+ get {
+ if (targetOutputs_array == null)
+ targetOutputs_array = targetOutputs_list.ToArray ();
+ return targetOutputs_array;
+ }
}
public string[] Targets {
}
}
-#endif
\ No newline at end of file
+#endif