diff --git a/src/Build.UnitTests/BackEnd/TaskRegistry_Tests.cs b/src/Build.UnitTests/BackEnd/TaskRegistry_Tests.cs index ecdfc421d3c..16bcba2d9d4 100644 --- a/src/Build.UnitTests/BackEnd/TaskRegistry_Tests.cs +++ b/src/Build.UnitTests/BackEnd/TaskRegistry_Tests.cs @@ -2255,7 +2255,7 @@ internal static Expander GetExpand secondaryItemsByName.ImportItems(thirdItemGroup); secondaryItemsByName.ImportItems(trueItemGroup); - Expander expander = new Expander(pg, secondaryItemsByName, FileSystems.Default); + Expander expander = new Expander(pg, secondaryItemsByName); return expander; } diff --git a/src/Build.UnitTests/Evaluation/Evaluator_Tests.cs b/src/Build.UnitTests/Evaluation/Evaluator_Tests.cs index 14b91ed0795..1c34ccd4977 100644 --- a/src/Build.UnitTests/Evaluation/Evaluator_Tests.cs +++ b/src/Build.UnitTests/Evaluation/Evaluator_Tests.cs @@ -4298,7 +4298,7 @@ public void VerifyDTDProcessingIsDisabled2() public void VerifyConditionEvaluatorResetStateOnFailure() { PropertyDictionary propertyBag = new PropertyDictionary(); - Expander expander = new Expander(propertyBag, FileSystems.Default); + Expander expander = new Expander(propertyBag); string condition = " '$(TargetOSFamily)' >= '3' "; // Give an incorrect value for the property "TargetOSFamily", and then the evaluation should throw an exception. diff --git a/src/Build.UnitTests/Evaluation/Expander_Tests.cs b/src/Build.UnitTests/Evaluation/Expander_Tests.cs index 5c949dfc17b..4a286fd8520 100644 --- a/src/Build.UnitTests/Evaluation/Expander_Tests.cs +++ b/src/Build.UnitTests/Evaluation/Expander_Tests.cs @@ -43,7 +43,7 @@ public class Expander_Tests public void ExpandAllIntoTaskItems0() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); IList itemsOut = expander.ExpandIntoTaskItemsLeaveEscaped("", ExpanderOptions.ExpandProperties, null); @@ -54,7 +54,7 @@ public void ExpandAllIntoTaskItems0() public void ExpandAllIntoTaskItems1() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); IList itemsOut = expander.ExpandIntoTaskItemsLeaveEscaped("foo", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -65,7 +65,7 @@ public void ExpandAllIntoTaskItems1() public void ExpandAllIntoTaskItems2() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); IList itemsOut = expander.ExpandIntoTaskItemsLeaveEscaped("foo;bar", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -92,7 +92,7 @@ public void ExpandAllIntoTaskItems3() itemsByType.ImportItems(ig); itemsByType.ImportItems(ig2); - Expander expander = new Expander(pg, itemsByType, FileSystems.Default); + Expander expander = new Expander(pg, itemsByType); IList itemsOut = expander.ExpandIntoTaskItemsLeaveEscaped("foo;bar;@(compile);@(resource)", ExpanderOptions.ExpandPropertiesAndItems, MockElementLocation.Instance); @@ -113,7 +113,7 @@ public void ExpandAllIntoTaskItems4() pg.Set(ProjectPropertyInstance.Create("b", "bbb")); pg.Set(ProjectPropertyInstance.Create("c", "cc;dd")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); IList itemsOut = expander.ExpandIntoTaskItemsLeaveEscaped("foo$(a);$(b);$(c)", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -137,7 +137,7 @@ public void ExpandPropertiesIntoProjectPropertyInstances() pg.Set(ProjectPropertyInstance.Create("b", "bbb")); pg.Set(ProjectPropertyInstance.Create("c", "cc;dd")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); ProjectItemInstanceFactory itemFactory = new ProjectItemInstanceFactory(project, "i"); IList itemsOut = expander.ExpandIntoItemsLeaveEscaped("foo$(a);$(b);$(c);$(d", itemFactory, ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -154,7 +154,7 @@ public void ExpandEmptyPropertyExpressionToEmpty() ProjectHelpers.CreateEmptyProjectInstance(); PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped("$()", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); Assert.Equal(String.Empty, result); @@ -778,7 +778,7 @@ private Expander CreateItemFunctio itemMetadataTable["Language"] = "english"; IMetadataTable itemMetadata = new StringMetadataTable(itemMetadataTable); - Expander expander = new Expander(pg, ig, itemMetadata, FileSystems.Default); + Expander expander = new Expander(pg, ig, itemMetadata); return expander; } @@ -800,7 +800,7 @@ private Expander CreateExpander() ig.Add(i0); ig.Add(i1); - Expander expander = new Expander(pg, ig, FileSystems.Default); + Expander expander = new Expander(pg, ig); return expander; } @@ -1344,7 +1344,7 @@ public void ExpandAllIntoTaskItemsComplex() StringMetadataTable itemMetadata; CreateComplexPropertiesItemsMetadata(out lookup, out itemMetadata); - Expander expander = new Expander(lookup, lookup, itemMetadata, FileSystems.Default); + Expander expander = new Expander(lookup, lookup, itemMetadata); IList taskItems = expander.ExpandIntoTaskItemsLeaveEscaped( "@(Resource->'%(Filename)') ; @(Content) ; @(NonExistent) ; $(NonExistent) ; %(NonExistent) ; " + @@ -1376,7 +1376,7 @@ public void ExpandAllIntoStringComplexPiecemeal() StringMetadataTable itemMetadata; CreateComplexPropertiesItemsMetadata(out lookup, out itemMetadata); - Expander expander = new Expander(lookup, lookup, itemMetadata, FileSystems.Default); + Expander expander = new Expander(lookup, lookup, itemMetadata); string stringToExpand = "@(Resource->'%(Filename)') ;"; Assert.Equal( @@ -1429,7 +1429,7 @@ public void ExpandAllIntoStringEmpty() StringMetadataTable itemMetadata; CreateComplexPropertiesItemsMetadata(out lookup, out itemMetadata); - Expander expander = new Expander(lookup, lookup, itemMetadata, FileSystems.Default); + Expander expander = new Expander(lookup, lookup, itemMetadata); XmlAttribute xmlattribute = (new XmlDocument()).CreateAttribute("dummy"); xmlattribute.Value = "@(IntermediateAssembly->'')"; @@ -1455,7 +1455,7 @@ public void ExpandAllIntoStringComplex() StringMetadataTable itemMetadata; CreateComplexPropertiesItemsMetadata(out lookup, out itemMetadata); - Expander expander = new Expander(lookup, lookup, itemMetadata, FileSystems.Default); + Expander expander = new Expander(lookup, lookup, itemMetadata); XmlAttribute xmlattribute = (new XmlDocument()).CreateAttribute("dummy"); xmlattribute.Value = "@(Resource->'%(Filename)') ; @(Content) ; @(NonExistent) ; $(NonExistent) ; %(NonExistent) ; " + @@ -1477,7 +1477,7 @@ public void ExpandAllIntoStringLeaveEscapedComplex() StringMetadataTable itemMetadata; CreateComplexPropertiesItemsMetadata(out lookup, out itemMetadata); - Expander expander = new Expander(lookup, lookup, itemMetadata, FileSystems.Default); + Expander expander = new Expander(lookup, lookup, itemMetadata); XmlAttribute xmlattribute = (new XmlDocument()).CreateAttribute("dummy"); xmlattribute.Value = "@(Resource->'%(Filename)') ; @(Content) ; @(NonExistent) ; $(NonExistent) ; %(NonExistent) ; " + @@ -1526,7 +1526,7 @@ public void ExpandAllIntoStringTruncated() }); lookup.PopulateWithItems("ManyItems", itemGroup); - Expander expander = new Expander(lookup, lookup, itemMetadata, FileSystems.Default); + Expander expander = new Expander(lookup, lookup, itemMetadata); XmlAttribute xmlattribute = (new XmlDocument()).CreateAttribute("dummy"); xmlattribute.Value = "'%(ManySpacesMetadata)' != '' and '$(ManySpacesProperty)' != '' and '@(ManySpacesItem)' != '' and '@(Exactly1024)' != '' and '@(ManyItems)' != '' and '@(ManyItems->'%(Foo)')' != '' and '@(ManyItems->'%(Nonexistent)')' != ''"; @@ -1558,7 +1558,7 @@ public void ExpandAllIntoStringExpectIdenticalReference() StringMetadataTable itemMetadata; CreateComplexPropertiesItemsMetadata(out lookup, out itemMetadata); - Expander expander = new Expander(lookup, lookup, itemMetadata, FileSystems.Default); + Expander expander = new Expander(lookup, lookup, itemMetadata); XmlAttribute xmlattribute = (new XmlDocument()).CreateAttribute("dummy"); @@ -1591,7 +1591,7 @@ public void ExpandAllIntoStringExpanderOptions() string value = @"@(Resource->'%(Filename)') ; @(Content) ; @(NonExistent) ; $(NonExistent) ; %(NonExistent) ; $(OutputPath) ; $(TargetPath) ; %(Language)_%(Culture)"; - Expander expander = new Expander(lookup, lookup, itemMetadata, FileSystems.Default); + Expander expander = new Expander(lookup, lookup, itemMetadata); Assert.Equal(@"@(Resource->'%(Filename)') ; @(Content) ; @(NonExistent) ; ; %(NonExistent) ; \jk ; l\mno%3bpqr\stu ; @(IntermediateAssembly->'%(RelativeDir)') ; %(Language)_%(Culture)", expander.ExpandIntoStringAndUnescape(value, ExpanderOptions.ExpandProperties, MockElementLocation.Instance)); @@ -1612,7 +1612,7 @@ public void ExpandAllIntoStringListLeaveEscapedComplex() StringMetadataTable itemMetadata; CreateComplexPropertiesItemsMetadata(out lookup, out itemMetadata); - Expander expander = new Expander(lookup, lookup, itemMetadata, FileSystems.Default); + Expander expander = new Expander(lookup, lookup, itemMetadata); string value = "@(Resource->'%(Filename)') ; @(Content) ; @(NonExistent) ; $(NonExistent) ; %(NonExistent) ; " + "$(OutputPath) ; $(TargetPath) ; %(Language)_%(Culture)"; @@ -1654,7 +1654,7 @@ public void RegistryPropertyInvalidPrefixSpecialCase() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped(@"$(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\VSTSDB@VSTSDBDirectory)", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -1670,7 +1670,7 @@ public void Regress692569() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped(@"$(Solutions.VSVersion)", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -1688,7 +1688,7 @@ public void RegistryPropertyInvalidPrefixError() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); expander.ExpandIntoStringLeaveEscaped(@"$(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\VSTSDB@XXXXDBDirectory)", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); } @@ -1706,7 +1706,7 @@ public void RegistryPropertyInvalidPrefixError2() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); expander.ExpandIntoStringLeaveEscaped(@"$(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\VSTSDB@VSTSDBDirectoryX)", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); } @@ -1720,7 +1720,7 @@ public void RegistryPropertyString() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\MSBuild_test"); key.SetValue("Value", "String", RegistryValueKind.String); @@ -1741,7 +1741,7 @@ public void RegistryPropertyBinary() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\MSBuild_test"); UTF8Encoding enc = new UTF8Encoding(); @@ -1765,7 +1765,7 @@ public void RegistryPropertyDWord() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\MSBuild_test"); key.SetValue("Value", 123456, RegistryValueKind.DWord); @@ -1787,7 +1787,7 @@ public void RegistryPropertyExpandString() string envVar = NativeMethodsShared.IsWindows ? "TEMP" : "USER"; PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\MSBuild_test"); key.SetValue("Value", "%" + envVar + "%", RegistryValueKind.ExpandString); @@ -1808,7 +1808,7 @@ public void RegistryPropertyQWord() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\MSBuild_test"); key.SetValue("Value", (long)123456789123456789, RegistryValueKind.QWord); @@ -1829,7 +1829,7 @@ public void RegistryPropertyMultiString() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\MSBuild_test"); key.SetValue("Value", new string[] { "A", "B", "C", "D" }, RegistryValueKind.MultiString); @@ -1926,7 +1926,7 @@ public void PropertyFunctionNullArgument() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped("$([System.Convert]::ChangeType('null',$(SomeStuff.GetType())))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -1941,7 +1941,7 @@ public void PropertyFunctionNullReturn() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); // The null-returning function is the only thing in the expression. string result = expander.ExpandIntoStringLeaveEscaped("$([System.Environment]::GetEnvironmentVariable(`_NonExistentVar`))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -1961,7 +1961,7 @@ public void PropertyFunctionNoArguments() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("SomeStuff", "This IS SOME STUff")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped("$(SomeStuff.ToUpperInvariant())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -1977,7 +1977,7 @@ public void PropertyFunctionNoArgumentsTrim() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("FileName", " foo.ext ")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped("$(FileName.Trim())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -1993,7 +1993,7 @@ public void PropertyFunctionPropertyGet() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("SomeStuff", "This IS SOME STUff")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped("$(SomeStuff.Length)", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2009,7 +2009,7 @@ public void PropertyFunctionPropertyManualGet() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("SomeStuff", "This IS SOME STUff")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped("$(SomeStuff.get_Length())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2025,7 +2025,7 @@ public void PropertyFunctionPropertyNoArgumentsConcat() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("SomeStuff", "This IS SOME STUff")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped("$(SomeStuff.ToLowerInvariant())_goop", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2041,7 +2041,7 @@ public void PropertyFunctionPropertyWithArgument() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("SomeStuff", "This IS SOME STUff")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped("$(SomeStuff.SubString(13))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2057,7 +2057,7 @@ public void PropertyFunctionPropertyWithArgumentWithSpaces() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("SomeStuff", "This IS SOME STUff")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped("$(SomeStuff.SubString(8))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2074,7 +2074,7 @@ public void PropertyFunctionPropertyPathRootSubtraction() pg.Set(ProjectPropertyInstance.Create("RootPath", Path.Combine(s_rootPathPrefix, "this", "is", "the", "root"))); pg.Set(ProjectPropertyInstance.Create("MyPath", Path.Combine(s_rootPathPrefix, "this", "is", "the", "root", "my", "project", "is", "here.proj"))); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped("$(MyPath.SubString($(RootPath.Length)))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2091,7 +2091,7 @@ public void PropertyFunctionPropertyWithArgumentExpandedProperty() pg.Set(ProjectPropertyInstance.Create("Value", "3")); pg.Set(ProjectPropertyInstance.Create("SomeStuff", "This IS SOME STUff")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped("$(SomeStuff.SubString(1$(Value)))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2108,7 +2108,7 @@ public void PropertyFunctionPropertyWithArgumentBooleanReturn() pg.Set(ProjectPropertyInstance.Create("PathRoot", Path.Combine(s_rootPathPrefix, "goo"))); pg.Set(ProjectPropertyInstance.Create("PathRoot2", Path.Combine(s_rootPathPrefix, "goop") + Path.DirectorySeparatorChar)); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped(@"$(PathRoot2.Endswith(" + Path.DirectorySeparatorChar + "))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); Assert.Equal("True", result); @@ -2126,7 +2126,7 @@ public void PropertyFunctionPropertyWithArgumentNestedAndChainedFunction() pg.Set(ProjectPropertyInstance.Create("Value", "3")); pg.Set(ProjectPropertyInstance.Create("SomeStuff", "This IS SOME STUff")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped("$(SomeStuff.SubString(1$(Value)).ToLowerInvariant().SubString($(Value)))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2144,7 +2144,7 @@ public void PropertyFunctionPropertyWithArgumentChained() pg.Set(ProjectPropertyInstance.Create("Value", "3")); pg.Set(ProjectPropertyInstance.Create("SomeStuff", "This IS SOME STUff")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped("$(SomeStuff.ToUpperInvariant().ToLowerInvariant())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); Assert.Equal("this is some stuff", result); @@ -2160,7 +2160,7 @@ public void PropertyFunctionPropertyWithArgumentNested() pg.Set(ProjectPropertyInstance.Create("Value", "12345")); pg.Set(ProjectPropertyInstance.Create("SomeStuff", "1234567890")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped("$(SomeStuff.SubString($(Value.get_Length())))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2175,7 +2175,7 @@ public void PropertyFunctionGenericListReturn() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped("$([MSBuild]::__GetListTest())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2191,7 +2191,7 @@ public void PropertyFunctionArrayReturn() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("List", "A-B-C-D")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped("$(List.Split(-))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2209,7 +2209,7 @@ public void PropertyFunctionDictionaryReturn() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped("$([System.Environment]::GetEnvironmentVariables())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance).ToUpperInvariant(); string expected = ("OS=" + Environment.GetEnvironmentVariable("OS")).ToUpperInvariant(); @@ -2227,7 +2227,7 @@ public void PropertyFunctionArrayReturnManualSplitter() pg.Set(ProjectPropertyInstance.Create("List", "A-B-C-D")); pg.Set(ProjectPropertyInstance.Create("Splitter", "-")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped("$(List.Split($(Splitter.ToCharArray())))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2244,7 +2244,7 @@ public void PropertyFunctionInCondition() pg.Set(ProjectPropertyInstance.Create("PathRoot", Path.Combine(s_rootPathPrefix, "goo"))); pg.Set(ProjectPropertyInstance.Create("PathRoot2", Path.Combine(s_rootPathPrefix, "goop") + Path.DirectorySeparatorChar)); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); Assert.True( ConditionEvaluator.EvaluateCondition( @@ -2282,7 +2282,7 @@ public void PropertyFunctionInvalid1() pg.Set(ProjectPropertyInstance.Create("Value", "3")); pg.Set(ProjectPropertyInstance.Create("SomeStuff", "This IS SOME STUff")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); expander.ExpandIntoStringLeaveEscaped("[$(SomeStuff($(Value)))]", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); } @@ -2301,7 +2301,7 @@ public void PropertyFunctionInvalid2() pg.Set(ProjectPropertyInstance.Create("Value", "3")); pg.Set(ProjectPropertyInstance.Create("SomeStuff", "This IS SOME STUff")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); expander.ExpandIntoStringLeaveEscaped("[$(SomeStuff.Lgg)]", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); } @@ -2319,7 +2319,7 @@ public void PropertyFunctionInvalid3() pg.Set(ProjectPropertyInstance.Create("Value", "3")); pg.Set(ProjectPropertyInstance.Create("SomeStuff", "This IS SOME STUff")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); expander.ExpandIntoStringLeaveEscaped("$(SomeStuff.ToUpperInvariant().Foo)", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); } @@ -2337,7 +2337,7 @@ public void PropertyFunctionInvalid4() pg.Set(ProjectPropertyInstance.Create("Value", "3")); pg.Set(ProjectPropertyInstance.Create("SomeStuff", "This IS SOME STUff")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); expander.ExpandIntoStringLeaveEscaped("[$(SomeStuff($(System.DateTime.Now)))]", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); } @@ -2355,7 +2355,7 @@ public void PropertyFunctionInvalid5() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("SomeStuff", "This IS SOME STUff")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); expander.ExpandIntoStringLeaveEscaped("$(SomeStuff.ToLowerInvariant()_goop)", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); } @@ -2372,7 +2372,7 @@ public void PropertyFunctionInvalid6() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("SomeStuff", "This IS SOME STUff")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); expander.ExpandIntoStringLeaveEscaped("[$(SomeStuff.Substring(HELLO!))]", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); } @@ -2389,7 +2389,7 @@ public void PropertyFunctionInvalid7() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("SomeStuff", "This IS SOME STUff")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); expander.ExpandIntoStringLeaveEscaped("[$(SomeStuff.Substring(-10))]", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); } @@ -2405,7 +2405,7 @@ public void PropertyFunctionInvalid8() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); expander.ExpandIntoStringLeaveEscaped("$(([System.DateTime]::Now).ToString(\"MM.dd.yyyy\"))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); } @@ -2419,7 +2419,7 @@ public void PropertyFunctionInvalidNoMetadataFunctions() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped("[%(LowerLetterList.Identity.ToUpper())]", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2435,7 +2435,7 @@ public void PropertyFunctionNoCollisionsOnType() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("System", "The System Namespace")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped("$(System)", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2454,7 +2454,7 @@ public void PropertyFunctionStaticMethodMakeRelative() pg.Set(ProjectPropertyInstance.Create("ParentPath", Path.Combine(s_rootPathPrefix, "abc", "def"))); pg.Set(ProjectPropertyInstance.Create("FilePath", Path.Combine(s_rootPathPrefix, "abc", "def", "foo.cpp"))); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped(@"$([MSBuild]::MakeRelative($(ParentPath), `$(FilePath)`))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2471,7 +2471,7 @@ public void PropertyFunctionStaticMethod1() pg.Set(ProjectPropertyInstance.Create("Drive", s_rootPathPrefix)); pg.Set(ProjectPropertyInstance.Create("File", Path.Combine("foo", "file.txt"))); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped(@"$([System.IO.Path]::Combine($(Drive), `$(File)`))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2487,7 +2487,7 @@ public void PropertyFunctionConstructor1() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("ver1", @"1.2.3.4")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); object result = expander.ExpandPropertiesLeaveTypedAndEscaped(@"$([System.Version]::new($(ver1)))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2511,7 +2511,7 @@ public void PropertyFunctionConstructor2() pg.Set(ProjectPropertyInstance.Create("ver1", @"1.2.3.4")); pg.Set(ProjectPropertyInstance.Create("ver2", @"2.2.3.4")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped(@"$([System.Version]::new($(ver1)).CompareTo($([System.Version]::new($(ver2)))))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2531,7 +2531,7 @@ public void PropertyStaticFunctionAllEnabled() PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); try { @@ -2554,7 +2554,7 @@ public void PropertyStaticFunctionLocatedFromAssemblyWithNamespaceName() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string env = Environment.GetEnvironmentVariable("MSBUILDENABLEALLPROPERTYFUNCTIONS"); @@ -2583,7 +2583,7 @@ public void PropertyStaticFunctionUsingNamespaceNotFound() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string env = Environment.GetEnvironmentVariable("MSBUILDENABLEALLPROPERTYFUNCTIONS"); @@ -2617,7 +2617,7 @@ public void PropertyFunctionStaticMethodQuoted1() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("File", Path.Combine("foo", "file.txt"))); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped(@"$([System.IO.Path]::Combine(`" + s_rootPathPrefix + "`, `$(File)`))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2633,7 +2633,7 @@ public void PropertyFunctionStaticMethodQuoted1Spaces() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("File", "foo goo" + Path.DirectorySeparatorChar + "file.txt")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped(@"$([System.IO.Path]::Combine(`" + Path.Combine(s_rootPathPrefix, "foo goo") + "`, `$(File)`))", @@ -2651,7 +2651,7 @@ public void PropertyFunctionStaticMethodQuoted1Spaces2() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("File", Path.Combine("foo bar", "baz.txt"))); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped(@"$([System.IO.Path]::Combine(`" + Path.Combine(s_rootPathPrefix, "foo baz") + @"`, `$(File)`))", @@ -2669,7 +2669,7 @@ public void PropertyFunctionStaticMethodQuoted1Spaces3() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("File", Path.Combine("foo bar", "baz.txt"))); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped(@"$([System.IO.Path]::Combine(`" + Path.Combine(s_rootPathPrefix, "foo baz") + @" `, `$(File)`))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2685,7 +2685,7 @@ public void PropertyFunctionStaticMethodQuoted2() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string dateTime = "'" + _dateToParse + "'"; string result = expander.ExpandIntoStringLeaveEscaped("$([System.DateTime]::Parse(" + dateTime + ").ToString(\"yyyy/MM/dd HH:mm:ss\"))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2701,7 +2701,7 @@ public void PropertyFunctionStaticMethodQuoted3() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string dateTime = "'" + _dateToParse + "'"; string result = expander.ExpandIntoStringLeaveEscaped("$([System.DateTime]::Parse(" + dateTime + ").ToString(\"MM.dd.yyyy\"))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2716,7 +2716,7 @@ public void PropertyFunctionStaticMethodQuoted4() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped("$([System.DateTime]::Now.ToString(\"MM.dd.yyyy\"))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2732,7 +2732,7 @@ public void PropertyFunctionStaticMethodNested() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("File", "foo" + Path.DirectorySeparatorChar + "file.txt")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped(@"$([System.IO.Path]::Combine(`" + s_rootPathPrefix + @@ -2750,7 +2750,7 @@ public void PropertyFunctionStaticMethodRegex1() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("File", "foo" + Path.DirectorySeparatorChar + "file.txt")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); // Support enum combines as Enum.Parse expects them string result = expander.ExpandIntoStringLeaveEscaped(@"$([System.Text.RegularExpressions.Regex]::IsMatch(`-42`, `^-?\d+(\.\d{2})?$`, `RegexOptions.IgnoreCase,RegexOptions.Singleline`))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2775,7 +2775,7 @@ public void PropertyFunctionStaticMethodChained() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string dateTime = "'" + _dateToParse + "'"; string result = expander.ExpandIntoStringLeaveEscaped(@"$([System.DateTime]::Parse(" + dateTime + ").ToString(`yyyy/MM/dd HH:mm:ss`))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2790,7 +2790,7 @@ public void PropertyFunctionGetFolderPath() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped(@"$([System.Environment]::GetFolderPath(SpecialFolder.System))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -2824,7 +2824,7 @@ public void PropertyFunctionRuntimeInformation(string propertyFunction, string e .Replace("$$architecture$$", architecture); var pg = new PropertyDictionary(); - var expander = new Expander(pg, FileSystems.Default); + var expander = new Expander(pg); string currentPlatformString = Helpers.GetOSPlatformAsString(); @@ -2854,7 +2854,7 @@ public void StringIndexOfTests(string propertyName, string properyValue, string var pg = new PropertyDictionary {[propertyName] = ProjectPropertyInstance.Create(propertyName, properyValue)}; - var expander = new Expander(pg, FileSystems.Default); + var expander = new Expander(pg); expander.ExpandIntoStringLeaveEscaped(propertyFunction, ExpanderOptions.ExpandProperties, MockElementLocation.Instance).ShouldBe(expectedExpansion); } @@ -2863,7 +2863,7 @@ public void StringIndexOfTests(string propertyName, string properyValue, string public void IsOsPlatformShouldBeCaseInsensitiveToParameter() { var pg = new PropertyDictionary(); - var expander = new Expander(pg, FileSystems.Default); + var expander = new Expander(pg); var osPlatformLowerCase = Helpers.GetOSPlatformAsString().ToLower(); @@ -2879,7 +2879,7 @@ public void IsOsPlatformShouldBeCaseInsensitiveToParameter() public void PropertyFunctionVersionComparisonsFailsWithInvalidArguments(string badVersion) { var pg = new PropertyDictionary(); - var expander = new Expander(pg, FileSystems.Default); + var expander = new Expander(pg); string expectedMessage = ResourceUtilities.GetResourceString("InvalidVersionFormat"); AssertThrows(expander, $"$([MSBuild]::VersionGreaterThan('{badVersion}', '1.0.0'))", expectedMessage); @@ -2912,7 +2912,7 @@ public void PropertyFunctionVersionComparisonsFailsWithInvalidArguments(string b public void PropertyFunctionVersionComparisons(string a, string b, int expectedSign) { var pg = new PropertyDictionary(); - var expander = new Expander(pg, FileSystems.Default); + var expander = new Expander(pg); AssertSuccess(expander, expectedSign > 0, $"$([MSBuild]::VersionGreaterThan('{a}', '{b}'))"); AssertSuccess(expander, expectedSign >= 0, $"$([MSBuild]::VersionGreaterThanOrEquals('{a}', '{b}'))"); @@ -2931,7 +2931,7 @@ public void PropertyFunctionVersionComparisons(string a, string b, int expectedS public void PropertyFunctionTargetFrameworkParsing(string tfm, string expectedIdentifier, string expectedVersion) { var pg = new PropertyDictionary(); - var expander = new Expander(pg, FileSystems.Default); + var expander = new Expander(pg); AssertSuccess(expander, expectedIdentifier, $"$([MSBuild]::GetTargetFrameworkIdentifier('{tfm}'))"); AssertSuccess(expander, expectedVersion, $"$([MSBuild]::GetTargetFrameworkVersion('{tfm}'))"); @@ -2945,7 +2945,7 @@ public void PropertyFunctionTargetFrameworkParsing(string tfm, string expectedId public void PropertyFunctionTargetFrameworkVersionMultipartParsing(string tfm, int versionPartCount, string expectedVersion) { var pg = new PropertyDictionary(); - var expander = new Expander(pg, FileSystems.Default); + var expander = new Expander(pg); AssertSuccess(expander, expectedVersion, $"$([MSBuild]::GetTargetFrameworkVersion('{tfm}', {versionPartCount}))"); } @@ -2958,7 +2958,7 @@ public void PropertyFunctionTargetFrameworkVersionMultipartParsing(string tfm, i public void PropertyFunctionTargetPlatformVersionMultipartParsing(string tfm, int versionPartCount, string expectedVersion) { var pg = new PropertyDictionary(); - var expander = new Expander(pg, FileSystems.Default); + var expander = new Expander(pg); AssertSuccess(expander, expectedVersion, $"$([MSBuild]::GetTargetPlatformVersion('{tfm}', {versionPartCount}))"); } @@ -2972,7 +2972,7 @@ public void PropertyFunctionTargetPlatformVersionMultipartParsing(string tfm, in public void PropertyFunctionTargetPlatformParsing(string tfm, string expectedIdentifier, string expectedVersion) { var pg = new PropertyDictionary(); - var expander = new Expander(pg, FileSystems.Default); + var expander = new Expander(pg); AssertSuccess(expander, expectedIdentifier, $"$([MSBuild]::GetTargetPlatformIdentifier('{tfm}'))"); AssertSuccess(expander, expectedVersion, $"$([MSBuild]::GetTargetPlatformVersion('{tfm}'))"); @@ -2994,7 +2994,7 @@ public void PropertyFunctionTargetPlatformParsing(string tfm, string expectedIde public void PropertyFunctionTargetFrameworkComparisons(string tfm1, string tfm2, bool expectedFrameworkCompatible) { var pg = new PropertyDictionary(); - var expander = new Expander(pg, FileSystems.Default); + var expander = new Expander(pg); AssertSuccess(expander, expectedFrameworkCompatible, $"$([MSBuild]::IsTargetFrameworkCompatible('{tfm1}', '{tfm2}'))"); } @@ -3028,7 +3028,7 @@ public void PropertyFunctionStaticMethodEnumArgument() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped("$([System.String]::Equals(`a`, `A`, StringComparison.OrdinalIgnoreCase))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); Assert.Equal(true.ToString(), result); @@ -3051,7 +3051,7 @@ public void PropertyFunctionStaticMethodDirectoryNameOfFileAbove() pg.Set(ProjectPropertyInstance.Create("StartingDirectory", directoryStart)); pg.Set(ProjectPropertyInstance.Create("FileToFind", tempFile)); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringAndUnescape(@"$([MSBuild]::GetDirectoryNameOfFileAbove($(StartingDirectory), $(FileToFind)))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -3085,7 +3085,7 @@ public void PropertyFunctionStaticMethodGetPathOfFileAbove() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("FileToFind", Path.GetFileName(fileToFind))); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringAndUnescape(@"$([MSBuild]::GetPathOfFileAbove($(FileToFind)))", ExpanderOptions.ExpandProperties, mockElementLocation); @@ -3128,7 +3128,7 @@ public void PropertyFunctionStaticMethodGetPathOfFileAboveFileNameOnly() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("FileWithPath", fileWithPath)); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); expander.ExpandIntoStringLeaveEscaped(@"$([MSBuild]::GetPathOfFileAbove($(FileWithPath)))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); }); @@ -3144,7 +3144,7 @@ public void PropertyFunctionStaticMethodGetCultureInfo() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); #if FEATURE_CULTUREINFO_GETCULTURES string result = expander.ExpandIntoStringLeaveEscaped(@"$([System.Globalization.CultureInfo]::GetCultureInfo(`en-US`).ToString())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -3163,7 +3163,7 @@ public void PropertyFunctionStaticMethodArithmeticAddInt32() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped(@"$([MSBuild]::Add(40, 2))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -3178,7 +3178,7 @@ public void PropertyFunctionStaticMethodArithmeticAddDouble() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped(@"$([MSBuild]::Add(39.9, 2.1))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -3193,7 +3193,7 @@ public void PropertyFunctionValueOrDefault() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped(@"$([MSBuild]::ValueOrDefault('', '42'))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -3214,7 +3214,7 @@ public void PropertyFunctionValueOrDefaultFromEnvironment() pg["BonkersTargetsPath"] = ProjectPropertyInstance.Create("BonkersTargetsPath", "Bonkers"); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped(@"$([MSBuild]::ValueOrDefault('$(BonkersTargetsPath)', '42'))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -3237,7 +3237,7 @@ public void PropertyFunctionDoesTaskHostExist() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped(@"$([MSBuild]::DoesTaskHostExist('CurrentRuntime', 'CurrentArchitecture'))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -3254,7 +3254,7 @@ public void PropertyFunctionDoesTaskHostExist_Whitespace() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped(@"$([MSBuild]::DoesTaskHostExist(' CurrentRuntime ', 'CurrentArchitecture'))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -3270,7 +3270,7 @@ public void PropertyFunctionNormalizeDirectory() { ProjectPropertyInstance.Create("MyPath", "one"), ProjectPropertyInstance.Create("MySecondPath", "two"), - }), FileSystems.Default); + })); Assert.Equal( $"{Path.GetFullPath("one")}{Path.DirectorySeparatorChar}", @@ -3291,7 +3291,7 @@ public void PropertyFunctionDoesTaskHostExist_Error() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); expander.ExpandIntoStringLeaveEscaped(@"$([MSBuild]::DoesTaskHostExist('ASDF', 'CurrentArchitecture'))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -3314,7 +3314,7 @@ public void PropertyFunctionDoesTaskHostExist_Evaluated() pg["Runtime"] = ProjectPropertyInstance.Create("Runtime", "CurrentRuntime"); pg["Architecture"] = ProjectPropertyInstance.Create("Architecture", "CurrentArchitecture"); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped(@"$([MSBuild]::DoesTaskHostExist('$(Runtime)', '$(Architecture)'))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -3338,7 +3338,7 @@ public void PropertyFunctionDoesTaskHostExist_NonexistentTaskHost() PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped(@"$([MSBuild]::DoesTaskHostExist('CLR2', 'CurrentArchitecture'))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -3364,7 +3364,7 @@ public void PropertyFunctionStaticMethodFileAttributes() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string tempFile = FileUtilities.GetTemporaryFile(); try @@ -3390,7 +3390,7 @@ public void PropertyFunctionStaticMethodIntrinsicMaths() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped(@"$([MSBuild]::Add(39.9, 2.1))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -3464,7 +3464,7 @@ public void PropertySimpleSpaced() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("SomeStuff", "This IS SOME STUff")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped(@"$( SomeStuff )", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -3481,7 +3481,7 @@ public void PropertyFunctionGetRegitryValue() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("SomeProperty", "Value")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\MSBuild_test"); key.SetValue("Value", "%" + envVar + "%", RegistryValueKind.ExpandString); @@ -3504,7 +3504,7 @@ public void PropertyFunctionGetRegitryValueDefault() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("SomeProperty", "Value")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\MSBuild_test"); key.SetValue(String.Empty, "%" + envVar + "%", RegistryValueKind.ExpandString); @@ -3527,7 +3527,7 @@ public void PropertyFunctionGetRegistryValueFromView1() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("SomeProperty", "Value")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\MSBuild_test"); key.SetValue(String.Empty, "%" + envVar + "%", RegistryValueKind.ExpandString); @@ -3550,7 +3550,7 @@ public void PropertyFunctionGetRegistryValueFromView2() PropertyDictionary pg = new PropertyDictionary(); pg.Set(ProjectPropertyInstance.Create("SomeProperty", "Value")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\MSBuild_test"); key.SetValue(String.Empty, "%" + envVar + "%", RegistryValueKind.ExpandString); @@ -3584,7 +3584,7 @@ public void PropertyFunctionConsumingItemMetadata() ItemDictionary itemsByType = new ItemDictionary(); itemsByType.ImportItems(ig); - Expander expander = new Expander(pg, itemsByType, itemMetadata, FileSystems.Default); + Expander expander = new Expander(pg, itemsByType, itemMetadata); string result = expander.ExpandIntoStringLeaveEscaped(@"$([System.IO.Path]::Combine($(SomePath),%(Compile.Identity)))", ExpanderOptions.ExpandAll, MockElementLocation.Instance); @@ -3615,7 +3615,7 @@ public void PropertyStringConstructorConsumingItemMetadata(string metadatumName, public void PropertyFunctionHashCodeSameOnlyIfStringSame() { PropertyDictionary pg = new PropertyDictionary(); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string[] stringsToHash = { "cat1s", "cat1z", @@ -3677,7 +3677,7 @@ public void Medley() pg.Set(ProjectPropertyInstance.Create("input", @"EXPORT a")); pg.Set(ProjectPropertyInstance.Create("propertycontainingnullasastring", @"null")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); var validTests = new List { new string[] {"$(input.ToString()[1])", "X"}, @@ -3932,7 +3932,7 @@ public void PropertyFunctionEnsureTrailingSlash() pg.Set(ProjectPropertyInstance.Create("SomeProperty", path)); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); // Verify a constant expands properly string result = expander.ExpandIntoStringLeaveEscaped($"$([MSBuild]::EnsureTrailingSlash('{path}'))", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -3958,7 +3958,7 @@ public void PropertyFunctionWithNewLines() pg.Set(ProjectPropertyInstance.Create("SomeProperty", "6C8546D5297C424F962201B0E0E9F142")); - Expander expander = new Expander(pg, FileSystems.Default); + Expander expander = new Expander(pg); string result = expander.ExpandIntoStringLeaveEscaped(propertyFunction, ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -3998,7 +3998,7 @@ public void PropertyFunctionVersionParse() [Fact] public void PropertyFunctionGuidNewGuid() { - var expander = new Expander(new PropertyDictionary(), FileSystems.Default); + var expander = new Expander(new PropertyDictionary()); string result = expander.ExpandIntoStringLeaveEscaped("$([System.Guid]::NewGuid())", ExpanderOptions.ExpandProperties, MockElementLocation.Instance); @@ -4230,7 +4230,7 @@ private void TestPropertyFunction(string expression, string propertyName, string { var properties = new PropertyDictionary(); properties.Set(ProjectPropertyInstance.Create(propertyName, propertyValue)); - var expander = new Expander(properties, FileSystems.Default); + var expander = new Expander(properties); string result = expander.ExpandIntoStringLeaveEscaped(expression, ExpanderOptions.ExpandProperties, MockElementLocation.Instance); result.ShouldBe(expected); } diff --git a/src/Build.UnitTests/Evaluation/ItemSpec_Tests.cs b/src/Build.UnitTests/Evaluation/ItemSpec_Tests.cs index f0564b0dcba..74349ef360d 100644 --- a/src/Build.UnitTests/Evaluation/ItemSpec_Tests.cs +++ b/src/Build.UnitTests/Evaluation/ItemSpec_Tests.cs @@ -85,7 +85,7 @@ private ProjectInstanceExpander CreateExpander(Dictionary item { var itemDictionary = ToItemDictionary(items); - return new ProjectInstanceExpander(new PropertyDictionary(), itemDictionary, (IFileSystem) FileSystems.Default); + return new ProjectInstanceExpander(new PropertyDictionary(), itemDictionary); } private static ItemDictionary ToItemDictionary(Dictionary itemTypes) diff --git a/src/Build.UnitTests/ExpressionTreeExpression_Tests.cs b/src/Build.UnitTests/ExpressionTreeExpression_Tests.cs index 6c0dd4d9db9..ce400029e7c 100644 --- a/src/Build.UnitTests/ExpressionTreeExpression_Tests.cs +++ b/src/Build.UnitTests/ExpressionTreeExpression_Tests.cs @@ -396,7 +396,7 @@ public ExpressionTest(ITestOutputHelper output) metadataDictionary["Culture"] = "french"; StringMetadataTable itemMetadata = new StringMetadataTable(metadataDictionary); - _expander = new Expander(propertyBag, itemBag, itemMetadata, FileSystems.Default); + _expander = new Expander(propertyBag, itemBag, itemMetadata); foreach (string file in FilesWithExistenceChecks) { diff --git a/src/Build.UnitTests/ExpressionTree_Tests.cs b/src/Build.UnitTests/ExpressionTree_Tests.cs index 5124da86a6a..833f6f5b5ed 100644 --- a/src/Build.UnitTests/ExpressionTree_Tests.cs +++ b/src/Build.UnitTests/ExpressionTree_Tests.cs @@ -25,7 +25,7 @@ public class ExpressionTreeTest public void SimpleEvaluationTests() { Parser p = new Parser(); - Expander expander = new Expander(new PropertyDictionary(), FileSystems.Default); + Expander expander = new Expander(new PropertyDictionary()); AssertParseEvaluate(p, "true", expander, true); AssertParseEvaluate(p, "on", expander, true); @@ -41,7 +41,7 @@ public void SimpleEvaluationTests() public void EqualityTests() { Parser p = new Parser(); - Expander expander = new Expander(new PropertyDictionary(), FileSystems.Default); + Expander expander = new Expander(new PropertyDictionary()); AssertParseEvaluate(p, "true == on", expander, true); AssertParseEvaluate(p, "TrUe == On", expander, true); @@ -66,7 +66,7 @@ public void EqualityTests() public void RelationalTests() { Parser p = new Parser(); - Expander expander = new Expander(new PropertyDictionary(), FileSystems.Default); + Expander expander = new Expander(new PropertyDictionary()); AssertParseEvaluate(p, "1234 < 1235", expander, true); AssertParseEvaluate(p, "1234 <= 1235", expander, true); @@ -85,7 +85,7 @@ public void RelationalTests() public void AndandOrTests() { Parser p = new Parser(); - Expander expander = new Expander(new PropertyDictionary(), FileSystems.Default); + Expander expander = new Expander(new PropertyDictionary()); AssertParseEvaluate(p, "true == on and 1234 < 1235", expander, true); } @@ -97,7 +97,7 @@ public void FunctionTests() { Parser p = new Parser(); GenericExpressionNode tree; - Expander expander = new Expander(new PropertyDictionary(), new ItemDictionary(), FileSystems.Default); + Expander expander = new Expander(new PropertyDictionary(), new ItemDictionary()); expander.Metadata = new StringMetadataTable(null); bool value; @@ -149,7 +149,7 @@ public void PropertyTests() propertyBag.Set(ProjectPropertyInstance.Create("x86", "x86")); propertyBag.Set(ProjectPropertyInstance.Create("no", "no")); - Expander expander = new Expander(propertyBag, new ItemDictionary(), FileSystems.Default); + Expander expander = new Expander(propertyBag, new ItemDictionary()); AssertParseEvaluate(p, "$(foo)", expander, true); AssertParseEvaluate(p, "!$(foo)", expander, false); // Test properties with strings @@ -187,7 +187,7 @@ public void ItemListTests() itemBag.Add(new ProjectItemInstance(parentProject, "Compile", "baz.cs", parentProject.FullPath)); itemBag.Add(new ProjectItemInstance(parentProject, "Boolean", "true", parentProject.FullPath)); - Expander expander = new Expander(new PropertyDictionary(), itemBag, FileSystems.Default); + Expander expander = new Expander(new PropertyDictionary(), itemBag); AssertParseEvaluate(p, "@(Compile) == 'foo.cs;bar.cs;baz.cs'", expander, true); AssertParseEvaluate(p, "@(Compile,' ') == 'foo.cs bar.cs baz.cs'", expander, true); @@ -230,7 +230,7 @@ public void StringExpansionTests() propertyBag.Set(ProjectPropertyInstance.Create("AnotherTestQuote", "Here's Johnny!")); propertyBag.Set(ProjectPropertyInstance.Create("Atsign", "Test the @ replacement")); - Expander expander = new Expander(propertyBag, itemBag, FileSystems.Default); + Expander expander = new Expander(propertyBag, itemBag); AssertParseEvaluate(p, "'simplestring: true foo.cs;bar.cs;baz.cs' == '$(simple): $(foo) @(compile)'", expander, true); AssertParseEvaluate(p, "'$(c1) $(c2)' == 'Another (complex) one. Another (complex) one.'", expander, true); @@ -262,7 +262,7 @@ public void ComplexTests() propertyBag.Set(ProjectPropertyInstance.Create("c1", "Another (complex) one.")); propertyBag.Set(ProjectPropertyInstance.Create("c2", "Another (complex) one.")); - Expander expander = new Expander(propertyBag, itemBag, FileSystems.Default); + Expander expander = new Expander(propertyBag, itemBag); AssertParseEvaluate(p, "(($(foo) != 'two' and $(bar)) and 5 >= 1) or $(one) == 1", expander, true); AssertParseEvaluate(p, "(($(foo) != 'twoo' or !$(bar)) and 5 >= 1) or $(two) == 1", expander, true); @@ -283,7 +283,7 @@ public void InvalidItemInConditionEvaluation() PropertyDictionary propertyBag = new PropertyDictionary(); - Expander expander = new Expander(propertyBag, itemBag, FileSystems.Default); + Expander expander = new Expander(propertyBag, itemBag); AssertParseEvaluateThrow(p, "@(Compile) > 0", expander, null); } @@ -312,7 +312,7 @@ public void OldSyntaxTests() propertyBag.Set(ProjectPropertyInstance.Create("c1", "Another (complex) one.")); propertyBag.Set(ProjectPropertyInstance.Create("c2", "Another (complex) one.")); - Expander expander = new Expander(propertyBag, itemBag, FileSystems.Default); + Expander expander = new Expander(propertyBag, itemBag); AssertParseEvaluate(p, "(($(foo) != 'two' and $(bar)) and 5 >= 1) or $(one) == 1", expander, true); } @@ -329,7 +329,7 @@ public void ConditionedPropertyUpdateTests() itemBag.Add(new ProjectItemInstance(parentProject, "Compile", "bar.cs", parentProject.FullPath)); itemBag.Add(new ProjectItemInstance(parentProject, "Compile", "baz.cs", parentProject.FullPath)); - Expander expander = new Expander(new PropertyDictionary(), itemBag, FileSystems.Default); + Expander expander = new Expander(new PropertyDictionary(), itemBag); Dictionary> conditionedProperties = new Dictionary>(); ConditionEvaluator.IConditionEvaluationState state = new ConditionEvaluator.ConditionEvaluationState @@ -418,7 +418,7 @@ public void NotTests() propertyBag.Set(ProjectPropertyInstance.Create("foo", "4")); propertyBag.Set(ProjectPropertyInstance.Create("bar", "32")); - Expander expander = new Expander(propertyBag, new ItemDictionary(), FileSystems.Default); + Expander expander = new Expander(propertyBag, new ItemDictionary()); AssertParseEvaluate(p, "!true", expander, false); AssertParseEvaluate(p, "!(true)", expander, false); @@ -509,7 +509,7 @@ private void AssertParseEvaluateThrow(Parser p, string expression, Expander expander = new Expander(new PropertyDictionary(), FileSystems.Default); + Expander expander = new Expander(new PropertyDictionary()); AssertParseEvaluateThrow(p, "foo", expander); AssertParseEvaluateThrow(p, "0", expander); diff --git a/src/Build/BackEnd/Components/RequestBuilder/ItemBucket.cs b/src/Build/BackEnd/Components/RequestBuilder/ItemBucket.cs index 1779d6ba70f..faceb4c727b 100644 --- a/src/Build/BackEnd/Components/RequestBuilder/ItemBucket.cs +++ b/src/Build/BackEnd/Components/RequestBuilder/ItemBucket.cs @@ -96,7 +96,7 @@ int bucketSequenceNumber } _metadata = metadata; - _expander = new Expander(_lookup, _lookup, new StringMetadataTable(metadata), FileSystems.Default); + _expander = new Expander(_lookup, _lookup, new StringMetadataTable(metadata)); _bucketSequenceNumber = bucketSequenceNumber; } diff --git a/src/Build/BackEnd/Components/RequestBuilder/TargetEntry.cs b/src/Build/BackEnd/Components/RequestBuilder/TargetEntry.cs index d3a925b34a8..0c71bf57487 100644 --- a/src/Build/BackEnd/Components/RequestBuilder/TargetEntry.cs +++ b/src/Build/BackEnd/Components/RequestBuilder/TargetEntry.cs @@ -173,7 +173,7 @@ internal TargetEntry(BuildRequestEntry requestEntry, ITargetBuilderCallback targ _targetSpecification = targetSpecification; _parentTarget = parentTarget; _buildReason = buildReason; - _expander = new Expander(baseLookup, baseLookup, FileSystems.Default); + _expander = new Expander(baseLookup, baseLookup); _state = TargetEntryState.Dependencies; _baseLookup = baseLookup; _host = host; diff --git a/src/Build/Definition/ProjectItem.cs b/src/Build/Definition/ProjectItem.cs index 0b3c28e1562..bb1aa48eaa2 100644 --- a/src/Build/Definition/ProjectItem.cs +++ b/src/Build/Definition/ProjectItem.cs @@ -490,7 +490,7 @@ string IItem.GetMetadataValueEscaped(string name) if (metadatum != null && Expander.ExpressionMayContainExpandableExpressions(metadatum.EvaluatedValueEscaped)) { - Expander expander = new Expander(null, null, new BuiltInMetadataTable(this), FileSystems.Default); + Expander expander = new Expander(null, null, new BuiltInMetadataTable(this)); value = expander.ExpandIntoStringLeaveEscaped(metadatum.EvaluatedValueEscaped, ExpanderOptions.ExpandBuiltInMetadata, metadatum.Location); } diff --git a/src/Build/Definition/Toolset.cs b/src/Build/Definition/Toolset.cs index 77d32963bf6..ca57f96dd15 100644 --- a/src/Build/Definition/Toolset.cs +++ b/src/Build/Definition/Toolset.cs @@ -967,7 +967,7 @@ private void InitializeProperties(ILoggingService loggingServices, BuildEventCon if (_expander == null) { - _expander = new Expander(_propertyBag, FileSystems.Default); + _expander = new Expander(_propertyBag); } } catch (Exception e) when (ExceptionHandling.IsIoRelatedException(e)) diff --git a/src/Build/Definition/ToolsetReader.cs b/src/Build/Definition/ToolsetReader.cs index 869b3318ea4..3b241b8b1a7 100644 --- a/src/Build/Definition/ToolsetReader.cs +++ b/src/Build/Definition/ToolsetReader.cs @@ -451,7 +451,7 @@ bool accumulateProperties IEnumerable rawProperties = GetPropertyDefinitions(toolsVersion.Name); - Expander expander = new Expander(initialProperties, FileSystems.Default); + Expander expander = new Expander(initialProperties); foreach (ToolsetPropertyDefinition property in rawProperties) { @@ -668,7 +668,7 @@ private void EvaluateAndSetProperty(ToolsetPropertyDefinition property, Property if (accumulateProperties) { - expander = new Expander(initialProperties, FileSystems.Default); + expander = new Expander(initialProperties); } } diff --git a/src/Build/Evaluation/Context/EvaluationContext.cs b/src/Build/Evaluation/Context/EvaluationContext.cs index 5bc1e2ec3df..19510f6d663 100644 --- a/src/Build/Evaluation/Context/EvaluationContext.cs +++ b/src/Build/Evaluation/Context/EvaluationContext.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; -using System.Runtime.CompilerServices; using System.Threading; using Microsoft.Build.BackEnd.SdkResolution; using Microsoft.Build.FileSystem; diff --git a/src/Build/Evaluation/Expander.cs b/src/Build/Evaluation/Expander.cs index a4d8ee3bafa..15b890add52 100644 --- a/src/Build/Evaluation/Expander.cs +++ b/src/Build/Evaluation/Expander.cs @@ -311,11 +311,11 @@ private void FlushFirstValueIfNeeded() /// Creates an expander passing it some properties to use. /// Properties may be null. /// - internal Expander(IPropertyProvider

properties, IFileSystem fileSystem) + internal Expander(IPropertyProvider

properties) { _properties = properties; _usedUninitializedProperties = new UsedUninitializedProperties(); - _fileSystem = fileSystem; + _fileSystem = FileSystems.Default; } ///

@@ -334,8 +334,8 @@ internal Expander(IPropertyProvider

properties, EvaluationContext evaluationC /// Creates an expander passing it some properties and items to use. /// Either or both may be null. ///

- internal Expander(IPropertyProvider

properties, IItemProvider items, IFileSystem fileSystem) - : this(properties, fileSystem) + internal Expander(IPropertyProvider

properties, IItemProvider items) + : this(properties) { _items = items; } @@ -354,8 +354,8 @@ internal Expander(IPropertyProvider

properties, IItemProvider items, Evalu /// Creates an expander passing it some properties, items, and/or metadata to use. /// Any or all may be null. /// - internal Expander(IPropertyProvider

properties, IItemProvider items, IMetadataTable metadata, IFileSystem fileSystem) - : this(properties, items, fileSystem) + internal Expander(IPropertyProvider

properties, IItemProvider items, IMetadataTable metadata) + : this(properties, items) { _metadata = metadata; } diff --git a/src/Build/Evaluation/LazyItemEvaluator.EvaluatorData.cs b/src/Build/Evaluation/LazyItemEvaluator.EvaluatorData.cs index fc3996350a3..c493969feb5 100644 --- a/src/Build/Evaluation/LazyItemEvaluator.EvaluatorData.cs +++ b/src/Build/Evaluation/LazyItemEvaluator.EvaluatorData.cs @@ -7,8 +7,8 @@ using Microsoft.Build.BackEnd; using Microsoft.Build.BackEnd.SdkResolution; using Microsoft.Build.Construction; -using Microsoft.Build.Execution; using Microsoft.Build.Evaluation.Context; +using Microsoft.Build.Execution; namespace Microsoft.Build.Evaluation { diff --git a/src/Build/Evaluation/LazyItemEvaluator.cs b/src/Build/Evaluation/LazyItemEvaluator.cs index 25a073da960..9bdfb67d223 100644 --- a/src/Build/Evaluation/LazyItemEvaluator.cs +++ b/src/Build/Evaluation/LazyItemEvaluator.cs @@ -28,7 +28,7 @@ internal partial class LazyItemEvaluator private readonly Expander _outerExpander; private readonly IEvaluatorData _evaluatorData; private readonly Expander _expander; - protected readonly IItemFactory _itemFactory; + private readonly IItemFactory _itemFactory; private readonly LoggingContext _loggingContext; private readonly EvaluationProfiler _evaluationProfiler; diff --git a/src/Build/Instance/ProjectInstance.cs b/src/Build/Instance/ProjectInstance.cs index 502370f337a..6d084b857a6 100644 --- a/src/Build/Instance/ProjectInstance.cs +++ b/src/Build/Instance/ProjectInstance.cs @@ -1876,7 +1876,7 @@ public bool Build(string[] targets, IEnumerable loggers, IEnumerable public string ExpandString(string unexpandedValue) { - Expander expander = new Expander(this, this, FileSystems.Default); + Expander expander = new Expander(this, this); string result = expander.ExpandIntoStringAndUnescape(unexpandedValue, ExpanderOptions.ExpandPropertiesAndItems, ProjectFileLocation); @@ -1894,7 +1894,7 @@ public string ExpandString(string unexpandedValue) /// public bool EvaluateCondition(string condition) { - Expander expander = new Expander(this, this, FileSystems.Default); + Expander expander = new Expander(this, this); bool result = ConditionEvaluator.EvaluateCondition( condition, @@ -2761,7 +2761,7 @@ out var usingDifferentToolsVersionFromProjectFile Evaluator.Evaluate( this, - null, // TODO? + null, xml, projectLoadSettings ?? buildParameters.ProjectLoadSettings, /* Use override ProjectLoadSettings if specified */ buildParameters.MaxNodeCount, diff --git a/src/Build/Instance/ProjectItemInstance.cs b/src/Build/Instance/ProjectItemInstance.cs index 2a34f84a2d9..94e9d311be8 100644 --- a/src/Build/Instance/ProjectItemInstance.cs +++ b/src/Build/Instance/ProjectItemInstance.cs @@ -1330,7 +1330,7 @@ public string GetMetadataEscaped(string metadataName) if (metadatum != null && Expander.ExpressionMayContainExpandableExpressions(metadatum.EvaluatedValueEscaped)) { - Expander expander = new Expander(null, null, new BuiltInMetadataTable(null, this), FileSystems.Default); + Expander expander = new Expander(null, null, new BuiltInMetadataTable(null, this)); // We don't have a location to use, but this is very unlikely to error return expander.ExpandIntoStringLeaveEscaped(metadatum.EvaluatedValueEscaped, ExpanderOptions.ExpandBuiltInMetadata, ElementLocation.EmptyLocation); diff --git a/src/Shared/FileMatcher.cs b/src/Shared/FileMatcher.cs index 466ece84f00..b1f8aa45166 100644 --- a/src/Shared/FileMatcher.cs +++ b/src/Shared/FileMatcher.cs @@ -94,7 +94,7 @@ public FileMatcher(IFileSystem fileSystem, ConcurrentDictionary> fileEntryExpansionCache = null) + internal FileMatcher(IFileSystem fileSystem, GetFileSystemEntries getFileSystemEntries, ConcurrentDictionary> getFileSystemDirectoryEntriesCache = null) { if (Traits.Instance.MSBuildCacheFileEnumerations) { @@ -103,12 +103,12 @@ internal FileMatcher(IFileSystem fileSystem, GetFileSystemEntries getFileSystemE } else { - _cachedGlobExpansions = fileEntryExpansionCache; + _cachedGlobExpansions = getFileSystemDirectoryEntriesCache; } _fileSystem = fileSystem; - _getFileSystemEntries = fileEntryExpansionCache == null + _getFileSystemEntries = getFileSystemDirectoryEntriesCache == null ? getFileSystemEntries : (type, path, pattern, directory, stripProjectDirectory) => { @@ -123,7 +123,7 @@ internal FileMatcher(IFileSystem fileSystem, GetFileSystemEntries getFileSystemE FileSystemEntity.FilesAndDirectories => "A", _ => throw new NotImplementedException() } + ";" + path; - IReadOnlyList allEntriesForPath = fileEntryExpansionCache.GetOrAdd( + IReadOnlyList allEntriesForPath = getFileSystemDirectoryEntriesCache.GetOrAdd( cacheKey, s => getFileSystemEntries( type, @@ -144,7 +144,7 @@ internal FileMatcher(IFileSystem fileSystem, GetFileSystemEntries getFileSystemE // Cache only directories, for files we won't hit the cache because the file name patterns tend to be unique if (type == FileSystemEntity.Directories) { - return fileEntryExpansionCache.GetOrAdd( + return getFileSystemDirectoryEntriesCache.GetOrAdd( $"D;{path};{pattern ?? "*"}", s => getFileSystemEntries( type,