[xbuild] Add new reserved properties $(MSBuildThisFile*).
authorAnkit Jain <radical@corewars.org>
Tue, 22 Feb 2011 18:36:07 +0000 (00:06 +0530)
committerAnkit Jain <radical@corewars.org>
Tue, 22 Feb 2011 18:39:33 +0000 (00:09 +0530)
commit3bc6741c3037000eebd46b91efad54e5e6915c74
treec3b3c6ae99b657f1853d829df5417a2f8f29b905
parent750ddb7846642ab89a3810b1bbb816a021120007
[xbuild] Add new reserved properties $(MSBuildThisFile*).

Also, fixes bug #668955.

Add new reserved properties $(MSBuildThisFile*).
Unlike the $(MSBuildProjectFile), the *This* properties are evaluated
in the context where they were used. Eg. if such a property was
referenced in a PropertyGroup, then it would refer to the file
containing the that definition, and *not* the main project file.
It applies to items and tasks/targets also.

* Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildChoose.cs:
* Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildItemGroup.cs:
* Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildPropertyGroup.cs:
Add DefinedInFileName property.

* Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs:
Add a stack to keep track the "current" file, which is used to set
the $(MSBuildThisFile*) properties. Update the properties on
Push/Pop.

* Microsoft.Build.Engine/Microsoft.Build.BuildEngine/GroupingCollection.cs:
Push/Pop the "current" file, when evaluating a property/item/etc.

* Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Target.cs:
Push/Pop the "current" file, when building. This ensures that the
references in the target definition get evaluated correctly.

* Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ProjectTest.cs:
Add corresponding test.
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildChoose.cs
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildItemGroup.cs
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildPropertyGroup.cs
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/GroupingCollection.cs
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Target.cs
mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ProjectTest.cs