this.name = itemName;
this.finalItemSpec = itemInclude;
+ this.itemInclude = itemInclude;
this.unevaluatedMetadata = CollectionsUtil.CreateCaseInsensitiveHashtable ();
this.evaluatedMetadata = CollectionsUtil.CreateCaseInsensitiveHashtable ();
}
BindToXml (itemElement);
}
- private BuildItem (BuildItem parent)
+ BuildItem (BuildItem parent)
{
this.isImported = parent.isImported;
this.name = parent.name;
unevaluatedMetadata.Add (metadataName, metadataValue);
}
- private void BindToXml (XmlElement xmlElement)
+ void BindToXml (XmlElement xmlElement)
{
if (xmlElement == null)
throw new ArgumentNullException ("xmlElement");
this.SetMetadata (xe.Name, xe.InnerText);
}
- internal void Evaluate (bool evaluatedTo)
+ internal void Evaluate (Project project, bool evaluatedTo)
{
+ // FIXME: maybe make Expression.ConvertTo (null, ...) work as Utilities.Unescape ()?
+ if (project == null) {
+ this.finalItemSpec = Utilities.Unescape (itemInclude);
+ return;
+ }
+
DirectoryScanner directoryScanner;
Expression includeExpr, excludeExpr;
string includes, excludes;
excludeExpr = new Expression ();
excludeExpr.Parse (Exclude);
- includes = (string) includeExpr.ConvertTo (parentItemGroup.Project, typeof (string));
- excludes = (string) excludeExpr.ConvertTo (parentItemGroup.Project, typeof (string));
+ includes = (string) includeExpr.ConvertTo (project, typeof (string));
+ excludes = (string) excludeExpr.ConvertTo (project, typeof (string));
this.finalItemSpec = includes;
directoryScanner.Includes = includes;
directoryScanner.Excludes = excludes;
- if (parentItemGroup.Project.FullFileName != String.Empty) {
- directoryScanner.BaseDirectory = new DirectoryInfo (Path.GetDirectoryName (parentItemGroup.Project.FullFileName));
- } else {
+
+ if (project.FullFileName != String.Empty)
+ directoryScanner.BaseDirectory = new DirectoryInfo (Path.GetDirectoryName (project.FullFileName));
+ else
directoryScanner.BaseDirectory = new DirectoryInfo (Directory.GetCurrentDirectory ());
- }
directoryScanner.Scan ();
- foreach (string matchedFile in directoryScanner.MatchedFilenames) {
- AddEvaluatedItem (evaluatedTo, matchedFile);
- }
+ foreach (string matchedFile in directoryScanner.MatchedFilenames)
+ AddEvaluatedItem (project, evaluatedTo, matchedFile);
}
- private void AddEvaluatedItem (bool evaluatedTo, string itemSpec)
+ void AddEvaluatedItem (Project project, bool evaluatedTo, string itemSpec)
{
- Project project = this.parentItemGroup.Project;
BuildItemGroup big;
BuildItem bi = new BuildItem (this);
bi.finalItemSpec = itemSpec;
return taskItem;
}
- private string GetItemSpecFromTransform (Expression transform)
+ string GetItemSpecFromTransform (Expression transform)
{
StringBuilder sb;
string itemInclude,
bool treatItemIncludeAsLiteral)
{
+ if (treatItemIncludeAsLiteral)
+ itemInclude = Utilities.Escape (itemInclude);
+
BuildItem bi = new BuildItem (itemName, itemInclude);
+
+ bi.Evaluate (null, true);
+
buildItems.Add (bi);
+
return bi;
}
{
foreach (BuildItem bi in buildItems) {
if (bi.Condition == String.Empty)
- bi.Evaluate (true);
+ bi.Evaluate (parentProject, true);
else {
ConditionExpression ce = ConditionParser.ParseCondition (bi.Condition);
- bi.Evaluate (ce.BoolEvaluate (parentProject));
+ bi.Evaluate (parentProject, ce.BoolEvaluate (parentProject));
}
}
}