Test Infra

This commit is contained in:
piotrp 2016-03-26 17:16:39 -07:00 committed by Piotr Puszkiewicz
parent 8df6f5405d
commit d85e516c23
10 changed files with 73 additions and 19 deletions

View file

@ -0,0 +1,12 @@
using System;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}

View file

@ -0,0 +1,27 @@
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"dotnet-desktop-and-portable": "1.0.0"
},
"frameworks": {
"netstandardapp1.5": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0-rc2-23925"
}
},
"imports": [
"portable-net45+win8",
"dnxcore50"
]
},
"net451":{}
},
"tools": {
"dotnet-dependency-tool-invoker":"1.0.0-*"
}
}

View file

@ -3,7 +3,7 @@
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-23928", "NETStandard.Library": "1.5.0-rc2-23928",
"System.Diagnostics.Process": "4.1.0-rc2-23928", "System.Diagnostics.Process": "4.1.0-rc2-23928",
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-16537" "Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-20100"
}, },
"frameworks": { "frameworks": {
"netstandard1.3": { "netstandard1.3": {

View file

@ -13,11 +13,19 @@ namespace Microsoft.DotNet.Cli.Build
{ {
public class TestTargets public class TestTargets
{ {
public static readonly string[] TestPackageProjects = new[] public static readonly dynamic[] TestPackageProjects = new[]
{ {
"dotnet-hello/v1/dotnet-hello", new { Name = "Microsoft.DotNet.Cli.Utils", IsTool = false, Path = "src/Microsoft.DotNet.Cli.Utils", IsApplicable = new Func<bool>(() => true) },
"dotnet-hello/v2/dotnet-hello", new { Name = "Microsoft.DotNet.ProjectModel", IsTool = false, Path = "src/Microsoft.DotNet.ProjectModel", IsApplicable = new Func<bool>(() => true) },
"dotnet-portable" new { Name = "Microsoft.DotNet.Compiler.Common", IsTool = false, Path = "src/Microsoft.DotNet.Compiler.Common", IsApplicable = new Func<bool>(() => true) },
new { Name = "Microsoft.Extensions.DependencyModel", IsTool = false, Path = "src/Microsoft.Extensions.DependencyModel", IsApplicable = new Func<bool>(() => true) },
new { Name = "Microsoft.DotNet.Files", IsTool = false, Path = "src/Microsoft.DotNet.Files", IsApplicable = new Func<bool>(() => true) },
new { Name = "Microsoft.DotNet.InternalAbstractions", IsTool = false, Path = "src/Microsoft.DotNet.InternalAbstractions", IsApplicable = new Func<bool>(() => true) },
new { Name = "dotnet-hello", IsTool = true, Path = "TestAssets/TestPackages/dotnet-hello/v1/dotnet-hello", IsApplicable = new Func<bool>(() => true) },
new { Name = "dotnet-hello", IsTool = true, Path = "TestAssets/TestPackages/dotnet-hello/v2/dotnet-hello", IsApplicable = new Func<bool>(() => true) },
new { Name = "dotnet-portable", IsTool = true, Path = "TestAssets/TestPackages/dotnet-portable", IsApplicable = new Func<bool>(() => true) },
new { Name = "dotnet-dependency-tool-invoker", IsTool = true, Path = "TestAssets/TestPackages/dotnet-dependency-tool-invoker", IsApplicable = new Func<bool>(() => true) },
new { Name = "dotnet-desktop-and-portable", IsTool = true, Path = "TestAssets/TestPackages/dotnet-desktop-and-portable", IsApplicable = new Func<bool>(() => CurrentPlatform.IsWindows) }
}; };
public static readonly string[] TestProjects = new[] public static readonly string[] TestProjects = new[]
@ -103,9 +111,9 @@ namespace Microsoft.DotNet.Cli.Build
Rmdir(Dirs.TestPackages); Rmdir(Dirs.TestPackages);
Mkdirp(Dirs.TestPackages); Mkdirp(Dirs.TestPackages);
foreach (var relativePath in TestPackageProjects) foreach (var relativePath in TestPackageProjects.Where(p => p.IsApplicable()).Select(p => p.Path))
{ {
var fullPath = Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "TestPackages", relativePath.Replace('/', Path.DirectorySeparatorChar)); var fullPath = Path.Combine(c.BuildContext.BuildDirectory, relativePath.Replace('/', Path.DirectorySeparatorChar));
c.Info($"Packing: {fullPath}"); c.Info($"Packing: {fullPath}");
dotnet.Pack("--output", Dirs.TestPackages) dotnet.Pack("--output", Dirs.TestPackages)
.WorkingDirectory(fullPath) .WorkingDirectory(fullPath)
@ -119,9 +127,14 @@ namespace Microsoft.DotNet.Cli.Build
[Target] [Target]
public static BuildTargetResult CleanTestPackages(BuildTargetContext c) public static BuildTargetResult CleanTestPackages(BuildTargetContext c)
{ {
Rmdir(Path.Combine(Dirs.NuGetPackages, "dotnet-hello")); foreach (var packageProject in TestPackageProjects.Where(p => p.IsApplicable()))
Rmdir(Path.Combine(Dirs.NuGetPackages, "dotnet-portable")); {
Rmdir(Path.Combine(Dirs.NuGetPackages, ".tools", "dotnet-portable")); Rmdir(Path.Combine(Dirs.NuGetPackages, packageProject.Name));
if(packageProject.IsTool)
{
Rmdir(Path.Combine(Dirs.NuGetPackages, ".tools", packageProject.Name));
}
}
return c.Success(); return c.Success();
} }

View file

@ -5,12 +5,14 @@
"emitEntryPoint": true "emitEntryPoint": true
}, },
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-23928", "NETStandard.Library": "1.5.0-rc2-23928",
"Microsoft.CSharp": "4.0.1-rc2-23928",
"Microsoft.DotNet.Cli.Build.Framework": "1.0.0-*",
"System.Dynamic.Runtime": "4.0.11-rc2-23928",
"System.Reflection.Metadata": "1.3.0-rc2-23928",
"System.Runtime.Serialization.Primitives": "4.1.1-rc2-23928", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-23928",
"System.Xml.XmlSerializer": "4.0.11-rc2-23928", "System.Xml.XmlSerializer": "4.0.11-rc2-23928",
"Microsoft.DotNet.Cli.Build.Framework": "1.0.0-*", "WindowsAzure.Storage": "6.2.2-preview"
"WindowsAzure.Storage": "6.2.2-preview",
"System.Reflection.Metadata": "1.3.0-rc2-23928"
}, },
"frameworks": { "frameworks": {
"netstandardapp1.5": { "netstandardapp1.5": {

View file

@ -6,7 +6,7 @@
}, },
"dependencies": { "dependencies": {
"Microsoft.DotNet.ProjectModel": "1.0.0-*", "Microsoft.DotNet.ProjectModel": "1.0.0-*",
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-16537", "Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-20100",
"NuGet.Versioning": "3.5.0-beta-1083", "NuGet.Versioning": "3.5.0-beta-1083",
"NuGet.Packaging": "3.5.0-beta-1083", "NuGet.Packaging": "3.5.0-beta-1083",
"NuGet.Frameworks": "3.5.0-beta-1083", "NuGet.Frameworks": "3.5.0-beta-1083",

View file

@ -10,7 +10,7 @@
"keyFile": "../../tools/Key.snk" "keyFile": "../../tools/Key.snk"
}, },
"dependencies": { "dependencies": {
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-16537" "Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-20100"
}, },
"frameworks": { "frameworks": {
"net451": {}, "net451": {},

View file

@ -19,7 +19,7 @@
"version": "1.0.0-*" "version": "1.0.0-*"
}, },
"Newtonsoft.Json": "7.0.1", "Newtonsoft.Json": "7.0.1",
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-16537" "Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-20100"
}, },
"frameworks": { "frameworks": {
"net451": {}, "net451": {},

View file

@ -14,7 +14,7 @@
"Microsoft.DotNet.TestFramework": "1.0.0-*", "Microsoft.DotNet.TestFramework": "1.0.0-*",
"Microsoft.DotNet.Cli.Utils": "1.0.0-*", "Microsoft.DotNet.Cli.Utils": "1.0.0-*",
"Microsoft.DotNet.ProjectModel": "1.0.0-*", "Microsoft.DotNet.ProjectModel": "1.0.0-*",
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-16537", "Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-20100",
"Microsoft.DotNet.InternalAbstractions": { "Microsoft.DotNet.InternalAbstractions": {
"target": "project", "target": "project",
"version": "1.0.0-*" "version": "1.0.0-*"

View file

@ -10,7 +10,7 @@
"System.Runtime.Serialization.Json": "4.0.2-rc2-23928", "System.Runtime.Serialization.Json": "4.0.2-rc2-23928",
"Microsoft.DotNet.ProjectModel": "1.0.0-*", "Microsoft.DotNet.ProjectModel": "1.0.0-*",
"Microsoft.DotNet.Cli.Utils": "1.0.0-*", "Microsoft.DotNet.Cli.Utils": "1.0.0-*",
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-16537", "Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-20100",
"Microsoft.NETCore.ConsoleHost": "1.0.0-rc2-23928", "Microsoft.NETCore.ConsoleHost": "1.0.0-rc2-23928",
"NETStandard.Library": "1.5.0-rc2-23928" "NETStandard.Library": "1.5.0-rc2-23928"
}, },