Skip to content

Commit

Permalink
Check for lanugage targets and check for failure if missing
Browse files Browse the repository at this point in the history
  • Loading branch information
Oren Novotny committed Feb 27, 2017
1 parent 95ecae4 commit 32d0e46
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 148 deletions.

This file was deleted.

15 changes: 0 additions & 15 deletions TestAssets/TestProjects/CrossTargeting/AllSupported/Helper.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -83,114 +83,6 @@ public void It_builds_desktop_library_successfully_on_windows()
});
}

[Fact]
public void It_builds_all_targets_library_successfully_on_windows()
{
if (!UsingFullFrameworkMSBuild)
{
return;
}

var testAsset = _testAssetsManager
.CopyTestAsset("CrossTargeting")
.WithSource()
.Restore("AllSupported");

var libraryProjectDirectory = Path.Combine(testAsset.TestRoot, "AllSupported");

var buildCommand = new BuildCommand(Stage0MSBuild, libraryProjectDirectory);
buildCommand
.Execute()
.Should()
.Pass();

var outputDirectory = buildCommand.GetOutputDirectory(targetFramework: "");
outputDirectory.Should().HaveFiles(new[] {

"monoandroid/AllSupported.dll",
"monoandroid/AllSupported.pdb",

"net40/AllSupported.dll",
"net40/AllSupported.pdb",
"net40/Newtonsoft.Json.dll",

"net40-client/AllSupported.dll",
"net40-client/AllSupported.pdb",
"net40-client/Newtonsoft.Json.dll",

"net45/AllSupported.dll",
"net45/AllSupported.pdb",
"net45/Newtonsoft.Json.dll",

"netstandard1.5/AllSupported.dll",
"netstandard1.5/AllSupported.pdb",
"netstandard1.5/AllSupported.deps.json",

"portable-net451+wpa81+win81/AllSupported.dll",
"portable-net451+wpa81+win81/AllSupported.pdb",
"portable-net451+wpa81+win81/Newtonsoft.Json.dll",

"portable-net4+sl50+win8+wpa81+wp8/AllSupported.dll",
"portable-net4+sl50+win8+wpa81+wp8/AllSupported.pdb",
"portable-net4+sl50+win8+wpa81+wp8/Newtonsoft.Json.dll",

"portable-net45+win8+wp8+wpa81/AllSupported.dll",
"portable-net45+win8+wp8+wpa81/AllSupported.pdb",
"portable-net45+win8+wp8+wpa81/Newtonsoft.Json.dll",

"portable-win81+wpa81/AllSupported.dll",
"portable-win81+wpa81/AllSupported.pri",
"portable-win81+wpa81/AllSupported.pdb",
"portable-win81+wpa81/Newtonsoft.Json.dll",

"sl5/AllSupported.dll",
"sl5/AllSupported.pdb",
"sl5/Newtonsoft.Json.dll",

"win8/AllSupported.dll",
"win8/AllSupported.pdb",
"win8/AllSupported.pri",
"win8/Newtonsoft.Json.dll",

"win81/AllSupported.dll",
"win81/AllSupported.pdb",
"win81/AllSupported.pri",
"win81/Newtonsoft.Json.dll",

"wp8/AllSupported.dll",
"wp8/AllSupported.pdb",
"wp8/Newtonsoft.Json.dll",

"wp81/AllSupported.dll",
"wp81/AllSupported.pdb",
"wp81/Newtonsoft.Json.dll",

"wpa81/AllSupported.dll",
"wpa81/AllSupported.pdb",
"wpa81/AllSupported.pri",
"wpa81/Newtonsoft.Json.dll",

"uap10.0/AllSupported.dll",
"uap10.0/AllSupported.pri",
"uap10.0/AllSupported.pdb",

"xamarinios/AllSupported.dll",
"xamarinios/AllSupported.pdb",
"xamarinios/AllSupported.dll.mdb",

"xamarinmac/AllSupported.dll",
"xamarinmac/AllSupported.pdb",

"xamarintvos/AllSupported.dll",
"xamarintvos/AllSupported.dll.mdb",
"xamarintvos/AllSupported.pdb",

"xamarinwatchos/AllSupported.dll",
"xamarinwatchos/AllSupported.dll.mdb",
"xamarinwatchos/AllSupported.pdb",
});
}

[Theory]
[InlineData("1", "win7-x86", "win7-x86;win7-x64", "win10-arm", "win7-x86;linux;WIN7-X86;unix", "osx-10.12", "win8-arm;win8-arm-aot",
"win7-x86;win7-x64;win10-arm;linux;unix;osx-10.12;win8-arm;win8-arm-aot")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static IEnumerable<object[]> GetTestData()
{
new object[]
{
"monoandroid", "", false, false, false, false
"monoandroid", "$(MSBuildExtensionsPath)\\Xamarin\\Android\\Xamarin.Android.CSharp.targets", false, false, false, false
},
new object[]
{
Expand All @@ -44,59 +44,63 @@ public static IEnumerable<object[]> GetTestData()
},
new object[]
{
"portable-win81+wpa81", "", true, false, false, true
"portable-win81+wpa81", "$(MSBuildExtensionsPath)\\Microsoft\\Portable\\v4.6\\Microsoft.Portable.CSharp.targets", true, false, false, true
},
new object[]
{
"portable-net451+wpa81+win81", "", true, false, false, false
"portable-net451+wpa81+win81", "$(MSBuildExtensionsPath)\\Microsoft\\Portable\\v4.6\\Microsoft.Portable.CSharp.targets", true, false, false, false
},
new object[]
{
"portable-net45+win8+wp8+wpa81", "", true, false, false, false
"portable-net45+win8+wp8+wpa81", "$(MSBuildExtensionsPath)\\Microsoft\\Portable\\v4.5\\Microsoft.Portable.CSharp.targets", true, false, false, false
},
new object[]
{
"sl5", "", true, false, false, false
"portable-net4+sl5+win8+wpa81+wp8", "$(MSBuildExtensionsPath)\\Microsoft\\Portable\\v4.0\\Microsoft.Portable.CSharp.targets", true, false, false, false
},
new object[]
{
"win8", "", true, false, false, true
"sl5", "$(MSBuildProgramFiles32)\\MSBuild\\Microsoft\\Silverlight\\v5.0\\Microsoft.Silverlight.CSharp.targets", true, false, false, false
},
new object[]
{
"win81", "", true, false, false, true
"win8", "$(MSBuildExtensionsPath)\\Microsoft\\WindowsXaml\\v15.0\\Microsoft.Windows.UI.Xaml.CSharp.targets", true, false, false, true
},
new object[]
{
"wp8", "", true, false, false, false
"win81", "$(MSBuildExtensionsPath)\\Microsoft\\WindowsXaml\\v15.0\\Microsoft.Windows.UI.Xaml.CSharp.targets", true, false, false, true
},
new object[]
{
"wp81", "", true, false, false, false
"wp8", "$(MSBuildProgramFiles32)\\MSBuild\\Microsoft\\WindowsPhone\\v8.0\\Microsoft.WindowsPhone.CSharp.targets", true, false, false, false
},
new object[]
{
"wpa81", "", true, false, false, true
"wp81", "$(MSBuildProgramFiles32)\\MSBuild\\Microsoft\\WindowsPhone\\v8.1\\Microsoft.WindowsPhone.CSharp.targets", true, false, false, false
},
new object[]
{
"uap10.0", "", false, false, false, true
"wpa81", "$(MSBuildExtensionsPath)\\Microsoft\\WindowsXaml\\v15.0\\Microsoft.Windows.UI.Xaml.CSharp.targets", true, false, false, true
},
new object[]
{
"xamarinios", "", false, true, false, false
"uap10.0", "$(MSBuildExtensionsPath)\\Microsoft\\WindowsXaml\\v15.0\\Microsoft.Windows.UI.Xaml.CSharp.targets", false, false, false, true
},
new object[]
{
"xamarinmac", "", false, false, false, false
"xamarinios", "$(MSBuildExtensionsPath)\\Xamarin\\iOS\\Xamarin.iOS.CSharp.targets", false, true, false, false
},
new object[]
{
"xamarintvos", "", false, true, false, false
"xamarinmac", "$(MSBuildExtensionsPath)\\Xamarin\\Mac\\Xamarin.Mac.CSharp.targets", false, false, false, false
},
new object[]
{
"xamarinwatchos", "", false, true, false, false
"xamarintvos", "$(MSBuildExtensionsPath)\\Xamarin\\TVOS\\Xamarin.TVOS.CSharp.targets", false, true, false, false
},
new object[]
{
"xamarinwatchos", "$(MSBuildExtensionsPath)\\Xamarin\\WatchOS\\Xamarin.WatchOS.CSharp.targets", false, true, false, false
},
};
}
Expand All @@ -110,8 +114,10 @@ public void It_builds_the_tfm_library_successfully_on_windows(string tfm, string
{
return;
}

// TODO: Check existence of targets

var targetsExist = TargetsExist(langTargets);
if (!targetsExist)
return;

var testAsset = _testAssetsManager
.CopyTestAsset("LibraryWithTfm")
Expand Down Expand Up @@ -153,5 +159,29 @@ public void It_builds_the_tfm_library_successfully_on_windows(string tfm, string

outputDirectory.Should().HaveFiles(filesToCheck);
}

private bool TargetsExist(string targets)
{
if (!UsingFullFrameworkMSBuild)
return false;

if (targets == null)
return true; // default for SDK, not testing here

// MSBuild\15.0\bin\MSBuild.exe
string msbuildPath = Environment.GetEnvironmentVariable("DOTNET_SDK_TEST_MSBUILD_PATH");

// MSBuild
var msbuildRoot = new DirectoryInfo(Path.GetDirectoryName(msbuildPath)).Parent.Parent;

// program files (x86)
var progFiles = Environment.GetEnvironmentVariable("ProgramFiles(x86)");

// do our substitutions
var fullPathToTargets = targets.Replace("$(MSBuildExtensionsPath)", msbuildRoot.FullName)
.Replace("$(MSBuildProgramFiles32)", progFiles);

return File.Exists(fullPathToTargets);
}
}
}

0 comments on commit 32d0e46

Please sign in to comment.