Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -44,9 +44,13 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
<Choose>
<When Condition=""'$(Configuration)' == ''"">
<!-- A user comment is allowed here -->
<ItemGroup>
<A Include='a' />
</ItemGroup>
</When>
</Choose>
</Project>

View File

@@ -39,14 +39,14 @@ public static class Consts {
public static string BinPath {
get {
if (RunningOnMono ()) {
#if XBUILD_12
#if XBUILD_14
string profile = "xbuild_14";
#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";
#elif NET_3_5
string profile = "net_3_5";
#else
string profile = "net_2_0";
#endif
@@ -54,14 +54,14 @@ public static class Consts {
var lib = Path.GetDirectoryName (Path.GetDirectoryName (corlib));
return Path.Combine (lib, profile);
} else {
#if XBUILD_12
#if XBUILD_14
return ToolLocationHelper.GetPathToBuildTools ("14.0");
#elif XBUILD_12
return ToolLocationHelper.GetPathToBuildTools ("12.0");
#elif NET_4_5
return ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version45);
#elif NET_4_0
return ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version40);
#elif NET_3_5
return ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version35);
#else
return ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version20);
#endif
@@ -71,12 +71,12 @@ public static class Consts {
public static string ToolsVersionString {
get {
#if XBUILD_12
#if XBUILD_14
return " ToolsVersion='14.0'";
#elif XBUILD_12
return " ToolsVersion='12.0'";
#elif NET_4_0
return " ToolsVersion='4.0'";
#elif NET_3_5
return " ToolsVersion='3.5'";
#else
return String.Empty;
#endif
@@ -85,12 +85,12 @@ public static class Consts {
public static string GetTasksAsmPath ()
{
#if XBUILD_12
#if XBUILD_14
return Path.Combine (BinPath, "Microsoft.Build.Tasks.Core.dll");
#elif XBUILD_12
return Path.Combine (BinPath, "Microsoft.Build.Tasks.v12.0.dll");
#elif NET_4_0
return Path.Combine (BinPath, "Microsoft.Build.Tasks.v4.0.dll");
#elif NET_3_5
return Path.Combine (BinPath, "Microsoft.Build.Tasks.v3.5.dll");
#else
return Path.Combine (BinPath, "Microsoft.Build.Tasks.dll");
#endif

View File

@@ -209,7 +209,38 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
project.LoadXml (documentString);
}
#if NET_4_0
[Test]
public void TestImportEmptyVariableWithConditionFalse ()
{
string documentString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
<Import Project='$(ImportPath)' Condition='false' />
<Target Name='Build' />
</Project>";
engine = new Engine (Consts.BinPath);
project = engine.CreateNewProject ();
project.LoadXml (documentString);
Assert.IsTrue (project.Build ("Build"), "Build failed");
}
[Test]
public void TestImportProjectWithConditionReferencingExtensionPath ()
{
string documentString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
<Import Project='$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets' Condition=""Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets')"" />
<Target Name='Build' />
</Project>";
engine = new Engine (Consts.BinPath);
project = engine.CreateNewProject ();
project.LoadXml (documentString);
Assert.IsTrue (project.Build ("Build"), "Build failed");
}
[Test]
public void TestImportWildcard ()
{
@@ -264,7 +295,6 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
File.Delete (second_project);
}
}
#endif
}
}

View File

@@ -0,0 +1,78 @@
//
// PredefinedPropertyFunctionsTest.cs
//
// Authors:
// Alexander Köplinger (alex.koeplinger@outlook.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System;
using Microsoft.Build.BuildEngine;
using NUnit.Framework;
namespace MonoTests.Microsoft.Build.BuildEngine {
[TestFixture]
public class PredefinedPropertyFunctionsTest {
[Test]
public void TestMakeRelative ()
{
string documentString = @"
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
<PropertyGroup>
<Path1>c:\users\</Path1>
<Path2>c:\users\username\</Path2>
<Path3>/home/user/</Path3>
<Path4>/home/user/username/</Path4>
<Path5>/home/user/</Path5>
<Path6>/tmp/test/file</Path6>
<Path7>/home/user/</Path7>
<Path8>/home/user/username/path with spaces + special? chars (1)/</Path8>
<Path9>c:\users</Path9>
<Path10>c:\users\username\test\</Path10>
<Path11>/home/user</Path11>
<Path12>/home/user/username/test/</Path12>
<MakeRelative1>$([MSBuild]::MakeRelative($(Path1), $(Path2)))</MakeRelative1>
<MakeRelative2>$([MSBuild]::MakeRelative($(Path2), $(Path1)))</MakeRelative2>
<MakeRelative3>$([MSBuild]::MakeRelative($(Path3), $(Path4)))</MakeRelative3>
<MakeRelative4>$([MSBuild]::MakeRelative($(Path4), $(Path3)))</MakeRelative4>
<MakeRelative5>$([MSBuild]::MakeRelative($(Path5), $(Path6)))</MakeRelative5>
<MakeRelative6>$([MSBuild]::MakeRelative($(Path7), $(Path8)))</MakeRelative6>
<MakeRelative7>$([MSBuild]::MakeRelative($(Path9), $(Path10)))</MakeRelative7>
<MakeRelative8>$([MSBuild]::MakeRelative($(Path11), $(Path12)))</MakeRelative8>
</PropertyGroup>
</Project>
";
var engine = new Engine (Consts.BinPath);
var project = engine.CreateNewProject ();
project.LoadXml (documentString);
Assert.AreEqual (@"username\", project.EvaluatedProperties ["MakeRelative1"].FinalValue, "#1");
Assert.AreEqual (@"..\", project.EvaluatedProperties ["MakeRelative2"].FinalValue, "#2");
Assert.AreEqual (@"username\", project.EvaluatedProperties ["MakeRelative3"].FinalValue, "#3");
Assert.AreEqual (@"..\", project.EvaluatedProperties ["MakeRelative4"].FinalValue, "#4");
Assert.AreEqual (@"..\..\tmp\test\file", project.EvaluatedProperties ["MakeRelative5"].FinalValue, "#5");
Assert.AreEqual (@"username\path with spaces + special? chars (1)\", project.EvaluatedProperties ["MakeRelative6"].FinalValue, "#6");
Assert.AreEqual (@"username\test\", project.EvaluatedProperties ["MakeRelative7"].FinalValue, "#7");
Assert.AreEqual (@"username\test\", project.EvaluatedProperties ["MakeRelative8"].FinalValue, "#8");
}
}
}

View File

@@ -180,7 +180,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
[ExpectedException (typeof (ArgumentOutOfRangeException))]
public void TestCopyTo4 ()
{
string documentString = @"

View File

@@ -349,7 +349,6 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
}
}
#if NET_3_5
bool Build (string projectXml, ILogger logger)
{
if (Environment.OSVersion.Platform == PlatformID.Win32NT) {
@@ -786,7 +785,6 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
3, "COMPILE: input1a;input1b - output1", "COMPILE: input2a;input2b - output2");
}
#endif
[Test]
public void TestTargetOutputsIncludingMetadata ()