From 5b5d69c95dade6d84f4cbbd980bcfeeda76aa266 Mon Sep 17 00:00:00 2001 From: Yanchen Wu Date: Wed, 17 Jan 2018 11:12:19 -0800 Subject: [PATCH] Adds Microsoft.Docker.Sdk to CLI This change is to add Sdk.props and Sdk.targets of Microsoft.Docker.Sdk into CLI. This unblocks the scenario where a VS solution contains a few .NET Core projects as well as a docker-compose.dcproj project and people want to build the solution from command line with .NET Core CLI. With the Sdk.props and Sdk.targets being present in CLI, building docker-compose.dcproj becomes no-op so it won't block building the other .NET Core projects. --- .../docker-compose/docker-compose.dcproj | 13 ++++++++ .../docker-compose/docker-compose.yml | 8 +++++ build/BundledSdks.props | 1 + build/NugetConfigFile.targets | 3 +- .../GivenDotnetBuildBuildsDcproj.cs | 32 +++++++++++++++++++ 5 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 TestAssets/TestProjects/docker-compose/docker-compose.dcproj create mode 100644 TestAssets/TestProjects/docker-compose/docker-compose.yml create mode 100644 test/dotnet-build.Tests/GivenDotnetBuildBuildsDcproj.cs diff --git a/TestAssets/TestProjects/docker-compose/docker-compose.dcproj b/TestAssets/TestProjects/docker-compose/docker-compose.dcproj new file mode 100644 index 000000000..17ed6f924 --- /dev/null +++ b/TestAssets/TestProjects/docker-compose/docker-compose.dcproj @@ -0,0 +1,13 @@ + + + + 2.0 + Linux + LaunchBrowser + http://localhost:{ServicePort} + testwebapplication + + + + + \ No newline at end of file diff --git a/TestAssets/TestProjects/docker-compose/docker-compose.yml b/TestAssets/TestProjects/docker-compose/docker-compose.yml new file mode 100644 index 000000000..9903b7748 --- /dev/null +++ b/TestAssets/TestProjects/docker-compose/docker-compose.yml @@ -0,0 +1,8 @@ +version: '3.0' + +services: + testwebapplication: + image: testwebapplication + build: + context: . + dockerfile: testwebapplication/Dockerfile diff --git a/build/BundledSdks.props b/build/BundledSdks.props index d665ef7f3..f4fd195ac 100644 --- a/build/BundledSdks.props +++ b/build/BundledSdks.props @@ -6,5 +6,6 @@ + diff --git a/build/NugetConfigFile.targets b/build/NugetConfigFile.targets index 128a68954..4a5692ef8 100644 --- a/build/NugetConfigFile.targets +++ b/build/NugetConfigFile.targets @@ -30,7 +30,8 @@ - + + ]]> diff --git a/test/dotnet-build.Tests/GivenDotnetBuildBuildsDcproj.cs b/test/dotnet-build.Tests/GivenDotnetBuildBuildsDcproj.cs new file mode 100644 index 000000000..eb062eb71 --- /dev/null +++ b/test/dotnet-build.Tests/GivenDotnetBuildBuildsDcproj.cs @@ -0,0 +1,32 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using FluentAssertions; +using Microsoft.DotNet.Tools.Test.Utilities; +using Xunit; + +namespace Microsoft.DotNet.Cli.Build.Tests +{ + public class GivenDotnetBuildBuildsDcproj : TestBase + { + [Fact] + public void ItPrintsBuildSummary() + { + var testAppName = "docker-compose"; + var testInstance = TestAssets.Get(testAppName) + .CreateInstance(testAppName) + .WithSourceFiles() + .WithRestoreFiles(); + + string expectedBuildSummary = @"Build succeeded. + 0 Warning(s) + 0 Error(s)"; + + var cmd = new BuildCommand() + .WithWorkingDirectory(testInstance.Root) + .ExecuteWithCapturedOutput(); + cmd.Should().Pass(); + cmd.StdOut.Should().ContainVisuallySameFragment(expectedBuildSummary); + } + } +} \ No newline at end of file