* Target.cs: Changed "" to String.Empty.
* TaskEngine.cs: Don't try to convert a parameter to specific type if
string was evaluated to String.Empty.
* InternalLoggerException.cs:
* InvalidProjectFileException.cs: Added LinkDemand before
GetObjectData ().
* ConsoleLogger.cs: Changed "" to String.Empty.
* TargetCollection.cs: Fixed GetEnumerator () (stupid bug introduced
with change to generics).
* Project.cs: Made Build () throw more meaningful exception.
svn path=/trunk/mcs/; revision=66403
+2006-10-08 Marek Sieradzki <marek.sieradzki@gmail.com>
+
+ * Target.cs: Changed "" to String.Empty.
+ * TaskEngine.cs: Don't try to convert a parameter to specific type if
+ string was evaluated to String.Empty.
+ * InternalLoggerException.cs:
+ * InvalidProjectFileException.cs: Added LinkDemand before
+ GetObjectData ().
+ * ConsoleLogger.cs: Changed "" to String.Empty.
+ * TargetCollection.cs: Fixed GetEnumerator () (stupid bug introduced
+ with change to generics).
+ * Project.cs: Made Build () throw more meaningful exception.
+
2006-10-06 Marek Sieradzki <marek.sieradzki@gmail.com>
* Target.cs: Reformatted.
public void BuildStartedHandler (object sender, BuildStartedEventArgs args)
{
- WriteLine ("");
+ WriteLine (String.Empty);
WriteLine (String.Format ("Build started {0}.", args.Timestamp));
WriteLine ("__________________________________________________");
buildStart = args.Timestamp;
TimeSpan timeElapsed = args.Timestamp - buildStart;
WriteLine (String.Format ("\t {0} Warning(s)", warningCount));
WriteLine (String.Format ("\t {0} Error(s)", errorCount));
- WriteLine ("");
+ WriteLine (String.Empty);
WriteLine (String.Format ("Time Elapsed {0}", timeElapsed));
}
}
public void ProjectStartedHandler (object sender, ProjectStartedEventArgs args)
{
WriteLine (String.Format ("Project \"{0}\" ({1} target(s)):", args.ProjectFile, args.TargetNames));
- WriteLine ("");
+ WriteLine (String.Empty);
}
public void ProjectFinishedHandler (object sender, ProjectFinishedEventArgs args)
{
if (IsVerbosityGreaterOrEqual (LoggerVerbosity.Diagnostic)) {
WriteLine (String.Format ("Done building project \"{0}\".", args.ProjectFile));
- WriteLine ("");
+ WriteLine (String.Empty);
}
}
if (IsVerbosityGreaterOrEqual (LoggerVerbosity.Diagnostic))
WriteLine (String.Format ("Done building target \"{0}\" in project \"{1}\".",
args.TargetName, args.ProjectFile));
- WriteLine ("");
+ WriteLine (String.Empty);
}
public void TaskStartedHandler (object sender, TaskStartedEventArgs args)
}
}
-#endif
\ No newline at end of file
+#endif
using System;
using System.Runtime.Serialization;
+using System.Security.Permissions;
using Microsoft.Build.Framework;
namespace Microsoft.Build.BuildEngine {
helpKeyword = info.GetString ("HelpKeywordPrefix");
}
+ [SecurityPermission (SecurityAction.LinkDemand, SerializationFormatter = true)]
public override void GetObjectData (SerializationInfo info,
StreamingContext context)
{
using System;
using System.Runtime.Serialization;
+using System.Security.Permissions;
using System.Xml;
namespace Microsoft.Build.BuildEngine {
this.projectFile = info.GetString ("ProjectFile");
}
+ [SecurityPermission (SecurityAction.LinkDemand, SerializationFormatter = true)]
public override void GetObjectData (SerializationInfo info,
StreamingContext context)
{
public bool Build (string targetName)
{
if (targets.Exists (targetName) == false)
- throw new Exception ("Target specified to build does not exist.");
+ throw new Exception (String.Format ("Target {0} does not exist.", targetName));
return this.targets [targetName].Build ();
}
buildState = BuildState.Started;
if (dependsOnTargets == null) {
;
- } else if (dependsOnTargets.Value == "") {
+ } else if (dependsOnTargets.Value == String.Empty) {
;
} else {
OldExpression dependencies = new OldExpression (Project);
public IEnumerator GetEnumerator ()
{
foreach (KeyValuePair <string, Target> kvp in targetsByName) {
- yield return kvp.Key;
+ yield return kvp.Value;
}
}
Dictionary <string, object> values;
PropertyInfo currentProperty;
PropertyInfo[] properties;
+ object value;
this.task = task;
this.taskElement = taskElement;
if (currentProperty == null)
throw new InvalidProjectFileException (String.Format ("Task does not have property \"{0}\" defined",
de.Key));
- values.Add (de.Key, GetObjectFromString (de.Value, currentProperty.PropertyType));
+
+ value = GetObjectFromString (de.Value, currentProperty.PropertyType);
+
+ if (value != null)
+ values.Add (de.Key, value);
}
properties = taskType.GetProperties ();
if (xmlElement.Name != "Output")
throw new InvalidProjectFileException ("Only Output elements can be Task's child nodes.");
- if (xmlElement.GetAttribute ("ItemName") != "" && xmlElement.GetAttribute ("PropertyName") != "")
+ if (xmlElement.GetAttribute ("ItemName") != String.Empty && xmlElement.GetAttribute ("PropertyName") != String.Empty)
throw new InvalidProjectFileException ("Only one of ItemName and ProperytyName attributes can be specified.");
- if (xmlElement.GetAttribute ("TaskParameter") == "")
+ if (xmlElement.GetAttribute ("TaskParameter") == String.Empty)
throw new InvalidProjectFileException ("TaskParameter attribute must be specified.");
taskParameter = xmlElement.GetAttribute ("TaskParameter");
e = new OldExpression (parentProject);
e.ParseSource (raw);
+ if ((string) e.ConvertTo (typeof (string)) == String.Empty)
+ return null;
+
result = e.ConvertTo (type);
return result;