You've already forked linux-packaging-mono
Imported Upstream version 4.3.2.467
Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
This commit is contained in:
@@ -26,13 +26,17 @@ EXTRA_DISTFILES = \
|
||||
Test/resources/*.*proj \
|
||||
Test/resources/*.csproj
|
||||
|
||||
Test/resources/TestTasks.dll: Test/resources/TestTasks.cs
|
||||
$(CSCOMPILE) Test/resources/TestTasks.cs /r:$(XBUILD_FRAMEWORK) /r:$(XBUILD_UTILITIES) /target:library
|
||||
Test/resources/TestTasks-$(PROFILE).dll: Test/resources/TestTasks.cs
|
||||
$(CSCOMPILE) /out:$@ Test/resources/TestTasks.cs /r:$(XBUILD_FRAMEWORK) /r:$(XBUILD_UTILITIES) /target:library
|
||||
|
||||
clean-test-resources:
|
||||
rm -f Test/resources/TestTasks.dll
|
||||
rm -f Test/resources/TestTasks*.dll Test/resources/TestTasks*.dll.mdb
|
||||
|
||||
test-local: Test/resources/TestTasks.dll
|
||||
test-local: compile-resources
|
||||
|
||||
compile-resources: Test/resources/TestTasks-$(PROFILE).dll
|
||||
cp Test/resources/TestTasks-$(PROFILE).dll Test/resources/TestTasks.dll
|
||||
cp Test/resources/TestTasks-$(PROFILE).dll.mdb Test/resources/TestTasks.dll.mdb
|
||||
|
||||
clean-local: clean-test-resources
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
{
|
||||
this.binPath = binPath;
|
||||
this.buildEnabled = true;
|
||||
this.projects = new Dictionary <string, Project> ();
|
||||
this.projects = new Dictionary <string, Project> (StringComparer.OrdinalIgnoreCase);
|
||||
this.eventSource = new EventSource ();
|
||||
this.loggers = new List <ILogger> ();
|
||||
this.buildStarted = false;
|
||||
@@ -118,6 +118,9 @@ namespace Microsoft.Build.BuildEngine {
|
||||
ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version40)));
|
||||
#if XBUILD_12
|
||||
Toolsets.Add (new Toolset ("12.0", ToolLocationHelper.GetPathToBuildTools ("12.0")));
|
||||
#endif
|
||||
#if XBUILD_14
|
||||
Toolsets.Add (new Toolset ("14.0", ToolLocationHelper.GetPathToBuildTools ("14.0")));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -464,6 +464,8 @@ namespace Microsoft.Build.BuildEngine {
|
||||
List<string> args = new List<string> ();
|
||||
int parens = 0;
|
||||
bool backticks = false;
|
||||
bool inDoubleQuotes = false;
|
||||
bool inSingleQuotes = false;
|
||||
int start = pos;
|
||||
for (; pos < text.Length; ++pos) {
|
||||
var ch = text [pos];
|
||||
@@ -476,6 +478,16 @@ namespace Microsoft.Build.BuildEngine {
|
||||
if (backticks)
|
||||
continue;
|
||||
|
||||
if(ch == '\'' && !inDoubleQuotes) {
|
||||
inSingleQuotes = !inSingleQuotes;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ch == '\"' && !inSingleQuotes) {
|
||||
inDoubleQuotes = !inDoubleQuotes;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ch == '(') {
|
||||
++parens;
|
||||
continue;
|
||||
@@ -498,7 +510,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
if (parens != 0)
|
||||
continue;
|
||||
|
||||
if (ch == ',') {
|
||||
if (ch == ',' && !inDoubleQuotes && !inSingleQuotes) {
|
||||
args.Add (text.Substring (start, pos - start));
|
||||
start = pos + 1;
|
||||
continue;
|
||||
|
||||
@@ -32,6 +32,7 @@ using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Globalization;
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.Build.BuildEngine
|
||||
@@ -123,6 +124,14 @@ namespace Microsoft.Build.BuildEngine
|
||||
return value;
|
||||
}
|
||||
|
||||
static string TrimFirstAndLast(string unTrimmed)
|
||||
{
|
||||
if (unTrimmed.Length > 1 && Array.IndexOf (ArgumentTrimChars, unTrimmed [0]) != -1 && Array.IndexOf (ArgumentTrimChars, unTrimmed [unTrimmed.Length - 1]) != -1) {
|
||||
return unTrimmed.Substring (1, unTrimmed.Length - 2);
|
||||
}
|
||||
return unTrimmed;
|
||||
}
|
||||
|
||||
void ExpandArguments (Project project, ExpressionOptions options)
|
||||
{
|
||||
for (int i = 0; i < Arguments.Count; ++i) {
|
||||
@@ -133,7 +142,7 @@ namespace Microsoft.Build.BuildEngine
|
||||
arg = Expression.ParseAs<string> (arg, ParseOptions.None,
|
||||
project, options);
|
||||
|
||||
arg = arg.Trim (ArgumentTrimChars);
|
||||
arg = TrimFirstAndLast (arg);
|
||||
}
|
||||
|
||||
Arguments [i] = arg;
|
||||
@@ -280,7 +289,10 @@ namespace Microsoft.Build.BuildEngine
|
||||
|
||||
public ITaskItem[] ConvertToITaskItemArray (Project project, ExpressionOptions options)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
var items = new ITaskItem[1];
|
||||
items[0] = new TaskItem (ConvertToString (project, options));
|
||||
|
||||
return items;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,11 +44,9 @@ public static class Consts {
|
||||
#elif XBUILD_12
|
||||
string profile = "xbuild_12";
|
||||
#elif NET_4_5
|
||||
string profile = "net_4_5";
|
||||
#elif NET_4_0
|
||||
string profile = "net_4_0";
|
||||
string profile = "net_4_x";
|
||||
#else
|
||||
string profile = "net_2_0";
|
||||
#error "Unknown profile"
|
||||
#endif
|
||||
var corlib = typeof (object).Assembly.Location;
|
||||
var lib = Path.GetDirectoryName (Path.GetDirectoryName (corlib));
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
void Message (object sender, BuildMessageEventArgs args)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void Warning (object sender, BuildWarningEventArgs args)
|
||||
{
|
||||
}
|
||||
@@ -97,7 +97,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
Project project;
|
||||
string documentString =
|
||||
"<Project></Project>";
|
||||
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
|
||||
DateTime time = DateTime.Now;
|
||||
@@ -127,7 +127,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
Project project;
|
||||
string documentString =
|
||||
"<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"></Project>";
|
||||
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
DateTime time = DateTime.Now;
|
||||
project = engine.CreateNewProject ();
|
||||
@@ -310,7 +310,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
|
||||
string documentString = @"
|
||||
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
|
||||
<Target
|
||||
<Target
|
||||
Name='Main'
|
||||
Inputs='a;b;c'
|
||||
Outputs='d;e;f'
|
||||
@@ -345,7 +345,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
Engine engine;
|
||||
Project project;
|
||||
IDictionary hashtable = new Hashtable ();
|
||||
|
||||
|
||||
string documentString = @"
|
||||
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
|
||||
<Target Name='Main'>
|
||||
@@ -353,7 +353,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
</Target>
|
||||
</Project>
|
||||
";
|
||||
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
project = engine.CreateNewProject ();
|
||||
project.LoadXml (documentString);
|
||||
@@ -769,12 +769,12 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
{
|
||||
Engine engine;
|
||||
Project project;
|
||||
|
||||
|
||||
string documentString = @"
|
||||
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
|
||||
</Project>
|
||||
";
|
||||
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
project = engine.CreateNewProject ();
|
||||
project.LoadXml (documentString);
|
||||
@@ -787,15 +787,15 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
{
|
||||
Engine engine;
|
||||
Project project;
|
||||
|
||||
|
||||
string documentString = @"
|
||||
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
|
||||
</Project>
|
||||
";
|
||||
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
engine.GlobalProperties.SetProperty ("Property", "Value");
|
||||
|
||||
|
||||
project = engine.CreateNewProject ();
|
||||
project.LoadXml (documentString);
|
||||
|
||||
@@ -815,12 +815,12 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
{
|
||||
Engine engine;
|
||||
Project project;
|
||||
|
||||
|
||||
string documentString = @"
|
||||
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
|
||||
</Project>
|
||||
";
|
||||
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
project = engine.CreateNewProject ();
|
||||
project.LoadXml (documentString);
|
||||
@@ -834,7 +834,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
{
|
||||
Engine engine;
|
||||
Project project;
|
||||
|
||||
|
||||
string documentString = @"
|
||||
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
|
||||
<PropertyGroup>
|
||||
@@ -842,7 +842,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
";
|
||||
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
project = engine.CreateNewProject ();
|
||||
project.LoadXml (documentString);
|
||||
@@ -861,7 +861,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
{
|
||||
Engine engine;
|
||||
Project project;
|
||||
|
||||
|
||||
string documentString = @"
|
||||
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
|
||||
<PropertyGroup>
|
||||
@@ -869,7 +869,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
";
|
||||
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
project = engine.CreateNewProject ();
|
||||
project.LoadXml (documentString);
|
||||
@@ -914,7 +914,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
{
|
||||
Engine engine;
|
||||
Project project;
|
||||
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
project = engine.CreateNewProject ();
|
||||
|
||||
@@ -1076,18 +1076,18 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
Assert.AreEqual (3, tl.TargetStartedEvents, "A1");
|
||||
Assert.AreEqual (3, tl.TargetFinishedEvents, "A1");
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void TestSchemaFile ()
|
||||
{
|
||||
Engine engine;
|
||||
Project project;
|
||||
|
||||
|
||||
string documentString = @"
|
||||
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
|
||||
</Project>
|
||||
";
|
||||
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
project = engine.CreateNewProject ();
|
||||
project.LoadXml (documentString);
|
||||
@@ -2092,7 +2092,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
<MeTAdata1>md3</MeTAdata1>
|
||||
<Metadata2>md4</Metadata2>
|
||||
</Abc>
|
||||
</ItemGroup>
|
||||
</ItemGroup>
|
||||
<PropertyGroup><ProP1>ValueProp</ProP1></PropertyGroup>
|
||||
<Target Name=""Main"">
|
||||
<MesSAGE Text=""Full item: @(ABC)""/>
|
||||
@@ -2159,7 +2159,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
Path.Combine ("fr-FR", "Lib2.resources.dll"),
|
||||
"Lib4.dll", "Lib4" + debug_extn
|
||||
},
|
||||
|
||||
|
||||
// lib1
|
||||
new string [] {
|
||||
// lib1 files
|
||||
@@ -2216,7 +2216,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
|
||||
Project project = engine.CreateNewProject ();
|
||||
project.Load (Path.Combine (basepath, "Project01.sln.proj"));
|
||||
|
||||
|
||||
bool result = project.Build ();
|
||||
if (!result) {
|
||||
logger.DumpMessages ();
|
||||
@@ -2373,5 +2373,24 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
|
||||
return project;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckCommaInQuotes ()
|
||||
{
|
||||
string testString = "Test.string.with.Commas";
|
||||
string documentString = string.Format (@"
|
||||
<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
|
||||
<PropertyGroup>
|
||||
<TestString>{0}</TestString>
|
||||
<TestString2>$(TestString.Replace(".",","))</TestString2>
|
||||
</PropertyGroup>
|
||||
</Project>", testString);
|
||||
|
||||
Project project = new Project ();
|
||||
project.LoadXml (documentString);
|
||||
|
||||
string result = project.EvaluatedProperties ["TestString2"].FinalValue;
|
||||
Assert.AreEqual (testString.Replace (".", ","), result, "A1");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -905,7 +905,6 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
[Test]
|
||||
[Category ("NotDotNet")]
|
||||
public void TestBeforeAndAfterTargets ()
|
||||
@@ -960,7 +959,6 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
//warnings for referencing unknown targets: NonExistant and Foo
|
||||
Assert.AreEqual (2, logger.WarningsCount, "Expected warnings not raised");
|
||||
}
|
||||
#endif
|
||||
|
||||
[Test]
|
||||
public void TestTargetReturns ()
|
||||
|
||||
@@ -101,11 +101,17 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
|
||||
<Config>debug</Config>
|
||||
<NullValue>null</NullValue>
|
||||
<TargetValue> </TargetValue>
|
||||
<StringWithQuotes>abc""def</StringWithQuotes>
|
||||
<Prop1>$(Config.Substring(0,3)) </Prop1>
|
||||
<Prop2>$(Config.Length )</Prop2>
|
||||
<Prop3>$(Config.StartsWith ('DE', System.StringComparison.OrdinalIgnoreCase))</Prop3>
|
||||
<Prop4>$(NullValue.StartsWith ('Te', StringComparison.OrdinalIgnoreCase))</Prop4>
|
||||
<Prop5>$(TargetValue.Trim('\\'))</Prop5>
|
||||
<Prop6>$(StringWithQuotes.Replace('""', ""'""))</Prop6>
|
||||
<Prop7>$(StringWithQuotes.Replace('""', ''))</Prop7>
|
||||
<Prop8>$(StringWithQuotes.Replace('""', """"))</Prop8>
|
||||
<Prop9>$(StringWithQuotes.Replace('""', ``))</Prop9>
|
||||
<Prop9>$(StringWithQuotes.Replace(`c""d`, `2""'3`))</Prop9>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
";
|
||||
@@ -116,6 +122,10 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
|
||||
Assert.AreEqual ("True", proj.GetEvaluatedProperty ("Prop3"), "#3");
|
||||
Assert.AreEqual ("False", proj.GetEvaluatedProperty ("Prop4"), "#4");
|
||||
Assert.AreEqual ("", proj.GetEvaluatedProperty ("Prop5"), "#5");
|
||||
Assert.AreEqual ("abc'def", proj.GetEvaluatedProperty ("Prop6"), "#6");
|
||||
Assert.AreEqual ("abcdef", proj.GetEvaluatedProperty ("Prop7"), "#7");
|
||||
Assert.AreEqual ("abcdef", proj.GetEvaluatedProperty ("Prop8"), "#8");
|
||||
Assert.AreEqual ("ab2\"'3ef", proj.GetEvaluatedProperty ("Prop9"), "#9");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
Reference in New Issue
Block a user