From 8e809449f55f9f9f881fde2a92fbe54ce267472d Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Tue, 24 Mar 2020 22:44:02 -0700 Subject: [PATCH] PR feedback --- src/Microsoft.Tye.Core/DockerContainerBuilder.cs | 6 +++--- src/Microsoft.Tye.Core/ProjectReader.cs | 9 +++++++++ src/Microsoft.Tye.Core/ProjectServiceBuilder.cs | 3 +++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.Tye.Core/DockerContainerBuilder.cs b/src/Microsoft.Tye.Core/DockerContainerBuilder.cs index c5829d13..92f34b89 100644 --- a/src/Microsoft.Tye.Core/DockerContainerBuilder.cs +++ b/src/Microsoft.Tye.Core/DockerContainerBuilder.cs @@ -59,8 +59,8 @@ namespace Microsoft.Tye else { // We need to write the file, let's stick it under obj. - Directory.CreateDirectory(Path.Combine(project.ProjectFile.DirectoryName, "obj")); - dockerFilePath = Path.Combine(project.ProjectFile.DirectoryName, "obj", "Dockerfile"); + Directory.CreateDirectory(project.IntermediateOutputPath); + dockerFilePath = Path.Combine(project.IntermediateOutputPath, "Dockerfile"); // Clean up file when done building image tempFile = new TempFile(dockerFilePath); @@ -83,7 +83,7 @@ namespace Microsoft.Tye // Clean up directory when done building image tempDirectory = new TempDirectory(publishOutput.Directory); - if (File.Exists(dockerFilePath) & container.UseMultiphaseDockerfile == false) + if (File.Exists(dockerFilePath)) { output.WriteDebugLine($"Using existing Dockerfile '{dockerFilePath}'."); File.Copy(dockerFilePath, Path.Combine(contextDirectory, "Dockerfile")); diff --git a/src/Microsoft.Tye.Core/ProjectReader.cs b/src/Microsoft.Tye.Core/ProjectReader.cs index 43ed2afc..ac65dd11 100644 --- a/src/Microsoft.Tye.Core/ProjectReader.cs +++ b/src/Microsoft.Tye.Core/ProjectReader.cs @@ -201,12 +201,21 @@ namespace Microsoft.Tye project.TargetPath = projectInstance.GetPropertyValue("TargetPath"); project.PublishDir = projectInstance.GetPropertyValue("PublishDir"); project.AssemblyName = projectInstance.GetPropertyValue("AssemblyName"); + project.IntermediateOutputPath = projectInstance.GetPropertyValue("AssemblyName"); + + output.WriteDebugLine($"RunCommand={project.RunCommand}"); output.WriteDebugLine($"RunArguments={project.RunArguments}"); output.WriteDebugLine($"TargetPath={project.TargetPath}"); output.WriteDebugLine($"PublishDir={project.PublishDir}"); output.WriteDebugLine($"AssemblyName={project.AssemblyName}"); + output.WriteDebugLine($"IntermediateOutputPath={project.IntermediateOutputPath}"); + + if (!Path.IsPathRooted(project.IntermediateOutputPath)) + { + project.IntermediateOutputPath = Path.Combine(project.ProjectFile.DirectoryName, project.IntermediateOutputPath); + } var targetFramework = projectInstance.GetPropertyValue("TargetFramework"); project.TargetFramework = targetFramework; diff --git a/src/Microsoft.Tye.Core/ProjectServiceBuilder.cs b/src/Microsoft.Tye.Core/ProjectServiceBuilder.cs index d150cfcb..221d1698 100644 --- a/src/Microsoft.Tye.Core/ProjectServiceBuilder.cs +++ b/src/Microsoft.Tye.Core/ProjectServiceBuilder.cs @@ -50,6 +50,9 @@ namespace Microsoft.Tye // This is always set on the ApplicationFactory codepath. public string PublishDir { get; set; } = default!; + // This is always set on the ApplicationFactory codepath. + public string IntermediateOutputPath { get; set; } = default!; + // Data used for building containers public ContainerInfo? ContainerInfo { get; set; }