diff --git a/Razor.sln b/Razor.sln index 469db66c4d..9f42afa18e 100644 --- a/Razor.sln +++ b/Razor.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.27130.2010 +VisualStudioVersion = 15.0.27107.3000 MinimumVisualStudioVersion = 15.0.26730.03 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3C0D6505-79B3-49D0-B4C3-176F0F1836ED}" ProjectSection(SolutionItems) = preProject @@ -80,12 +80,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Design.Test", "test\Microsoft.AspNetCore.Razor.Design.Test\Microsoft.AspNetCore.Razor.Design.Test.csproj", "{1D90F276-E1CA-4FDF-A173-EB889E7D3150}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.GenerateTool", "src\Microsoft.AspNetCore.Razor.GenerateTool\Microsoft.AspNetCore.Razor.GenerateTool.csproj", "{8052F088-1204-427B-BB0D-BE3D3BA6811B}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Tasks", "src\Microsoft.AspNetCore.Razor.Tasks\Microsoft.AspNetCore.Razor.Tasks.csproj", "{043B9497-C0BA-4770-9210-4456D2F81CE0}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.TagHelperTool", "src\Microsoft.AspNetCore.Razor.TagHelperTool\Microsoft.AspNetCore.Razor.TagHelperTool.csproj", "{AFD77E2F-1A4A-4C2C-9EA9-7E48C8926780}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Test", "test\Microsoft.AspNetCore.Razor.Test\Microsoft.AspNetCore.Razor.Test.csproj", "{323553F0-14AB-4FBD-9CF0-1CC0BE8056F8}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Performance", "benchmarks\Microsoft.AspNetCore.Razor.Performance\Microsoft.AspNetCore.Razor.Performance.csproj", "{6205467F-E381-4C42-AEEC-763BD62B3D5E}" @@ -342,14 +338,6 @@ Global {1D90F276-E1CA-4FDF-A173-EB889E7D3150}.Release|Any CPU.Build.0 = Release|Any CPU {1D90F276-E1CA-4FDF-A173-EB889E7D3150}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU {1D90F276-E1CA-4FDF-A173-EB889E7D3150}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU - {8052F088-1204-427B-BB0D-BE3D3BA6811B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8052F088-1204-427B-BB0D-BE3D3BA6811B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8052F088-1204-427B-BB0D-BE3D3BA6811B}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU - {8052F088-1204-427B-BB0D-BE3D3BA6811B}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU - {8052F088-1204-427B-BB0D-BE3D3BA6811B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8052F088-1204-427B-BB0D-BE3D3BA6811B}.Release|Any CPU.Build.0 = Release|Any CPU - {8052F088-1204-427B-BB0D-BE3D3BA6811B}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU - {8052F088-1204-427B-BB0D-BE3D3BA6811B}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU {043B9497-C0BA-4770-9210-4456D2F81CE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {043B9497-C0BA-4770-9210-4456D2F81CE0}.Debug|Any CPU.Build.0 = Debug|Any CPU {043B9497-C0BA-4770-9210-4456D2F81CE0}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU @@ -358,14 +346,6 @@ Global {043B9497-C0BA-4770-9210-4456D2F81CE0}.Release|Any CPU.Build.0 = Release|Any CPU {043B9497-C0BA-4770-9210-4456D2F81CE0}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU {043B9497-C0BA-4770-9210-4456D2F81CE0}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU - {AFD77E2F-1A4A-4C2C-9EA9-7E48C8926780}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AFD77E2F-1A4A-4C2C-9EA9-7E48C8926780}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AFD77E2F-1A4A-4C2C-9EA9-7E48C8926780}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU - {AFD77E2F-1A4A-4C2C-9EA9-7E48C8926780}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU - {AFD77E2F-1A4A-4C2C-9EA9-7E48C8926780}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AFD77E2F-1A4A-4C2C-9EA9-7E48C8926780}.Release|Any CPU.Build.0 = Release|Any CPU - {AFD77E2F-1A4A-4C2C-9EA9-7E48C8926780}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU - {AFD77E2F-1A4A-4C2C-9EA9-7E48C8926780}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU {323553F0-14AB-4FBD-9CF0-1CC0BE8056F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {323553F0-14AB-4FBD-9CF0-1CC0BE8056F8}.Debug|Any CPU.Build.0 = Debug|Any CPU {323553F0-14AB-4FBD-9CF0-1CC0BE8056F8}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU @@ -382,14 +362,6 @@ Global {6205467F-E381-4C42-AEEC-763BD62B3D5E}.Release|Any CPU.Build.0 = Release|Any CPU {6205467F-E381-4C42-AEEC-763BD62B3D5E}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU {6205467F-E381-4C42-AEEC-763BD62B3D5E}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU - {3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU - {3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU - {3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB}.Release|Any CPU.Build.0 = Release|Any CPU - {3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU - {3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU {933101DA-C4CC-401A-AA01-2784E1025B7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {933101DA-C4CC-401A-AA01-2784E1025B7F}.Debug|Any CPU.Build.0 = Debug|Any CPU {933101DA-C4CC-401A-AA01-2784E1025B7F}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU @@ -398,6 +370,14 @@ Global {933101DA-C4CC-401A-AA01-2784E1025B7F}.Release|Any CPU.Build.0 = Release|Any CPU {933101DA-C4CC-401A-AA01-2784E1025B7F}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU {933101DA-C4CC-401A-AA01-2784E1025B7F}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU + {3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU + {3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU + {3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB}.Release|Any CPU.Build.0 = Release|Any CPU + {3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU + {3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -433,13 +413,11 @@ Global {B8A3E4CA-D54A-441F-A3BF-E00F060CA042} = {92463391-81BE-462B-AC3C-78C6C760741F} {5257B25D-330A-4DCF-ACED-B4709CFBF916} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED} {1D90F276-E1CA-4FDF-A173-EB889E7D3150} = {92463391-81BE-462B-AC3C-78C6C760741F} - {8052F088-1204-427B-BB0D-BE3D3BA6811B} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED} {043B9497-C0BA-4770-9210-4456D2F81CE0} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED} - {AFD77E2F-1A4A-4C2C-9EA9-7E48C8926780} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED} {323553F0-14AB-4FBD-9CF0-1CC0BE8056F8} = {92463391-81BE-462B-AC3C-78C6C760741F} {6205467F-E381-4C42-AEEC-763BD62B3D5E} = {C2C98051-0F39-47F2-80B6-E72B29159F2C} - {3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED} {933101DA-C4CC-401A-AA01-2784E1025B7F} = {92463391-81BE-462B-AC3C-78C6C760741F} + {3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {0035341D-175A-4D05-95E6-F1C2785A1E26} diff --git a/src/Microsoft.AspNetCore.Razor.Design/Microsoft.AspNetCore.Razor.Design.csproj b/src/Microsoft.AspNetCore.Razor.Design/Microsoft.AspNetCore.Razor.Design.csproj index 2ec3cab3bc..e3993b61c4 100644 --- a/src/Microsoft.AspNetCore.Razor.Design/Microsoft.AspNetCore.Razor.Design.csproj +++ b/src/Microsoft.AspNetCore.Razor.Design/Microsoft.AspNetCore.Razor.Design.csproj @@ -41,8 +41,6 @@ - - diff --git a/src/Microsoft.AspNetCore.Razor.Design/build/netstandard2.0/Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets b/src/Microsoft.AspNetCore.Razor.Design/build/netstandard2.0/Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets index 4c3949fa69..515e51a02e 100644 --- a/src/Microsoft.AspNetCore.Razor.Design/build/netstandard2.0/Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets +++ b/src/Microsoft.AspNetCore.Razor.Design/build/netstandard2.0/Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets @@ -13,9 +13,7 @@ <_RazorTagHelperOutputCache>$(IntermediateOutputPath)$(TargetName).TagHelpers.output.cache - <_RazorGenerateToolAssembly>$(_RazorMSBuildRoot)tools\Microsoft.AspNetCore.Razor.GenerateTool.dll - <_RazorTagHelperToolAssembly>$(_RazorMSBuildRoot)tools\Microsoft.AspNetCore.Razor.TagHelperTool.dll - <_RazorBuildServerAssembly>$(_RazorMSBuildRoot)tools\rzc.dll + <_RazorToolAssembly>$(_RazorMSBuildRoot)tools\rzc.dll <_RazorGenerateInputsHash> @@ -74,9 +72,8 @@ @@ -109,9 +106,8 @@ (); - return attribute.InformationalVersion; - } - - private static string[] ExpandResponseFiles(string[] args) - { - var expandedArgs = new List(); - foreach (var arg in args) - { - if (!arg.StartsWith("@", StringComparison.Ordinal)) - { - expandedArgs.Add(arg); - } - else - { - var fileName = arg.Substring(1); - expandedArgs.AddRange(File.ReadLines(fileName)); - } - } - - return expandedArgs.ToArray(); - } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Razor.GenerateTool/DebugMode.cs b/src/Microsoft.AspNetCore.Razor.GenerateTool/DebugMode.cs deleted file mode 100644 index 0de1f0b078..0000000000 --- a/src/Microsoft.AspNetCore.Razor.GenerateTool/DebugMode.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Diagnostics; -using System.Linq; -using System.Threading; - -namespace Microsoft.AspNetCore.Razor.GenerateTool -{ - internal static class DebugMode - { - public static void HandleDebugSwitch(ref string[] args) - { - if (args.Length > 0 && string.Equals("--debug", args[0], StringComparison.OrdinalIgnoreCase)) - { - args = args.Skip(1).ToArray(); - - while (!Debugger.IsAttached) - { - Console.WriteLine("Waiting for debugger in pid: {0}", Process.GetCurrentProcess().Id); - Thread.Sleep(TimeSpan.FromSeconds(3)); - } - } - } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Razor.GenerateTool/Microsoft.AspNetCore.Razor.GenerateTool.csproj b/src/Microsoft.AspNetCore.Razor.GenerateTool/Microsoft.AspNetCore.Razor.GenerateTool.csproj deleted file mode 100644 index 97a97a920b..0000000000 --- a/src/Microsoft.AspNetCore.Razor.GenerateTool/Microsoft.AspNetCore.Razor.GenerateTool.csproj +++ /dev/null @@ -1,31 +0,0 @@ - - - - Razor is a markup syntax for adding server-side logic to web pages. This assembly contains infrastructure supporting Razor MSBuild integration. - netcoreapp2.0 - Exe - - - false - false - - - - - Shared\RazorDiagnosticJsonConverter.cs - - - Shared\TagHelperDescriptorJsonConverter.cs - - - - - - - - - - - - - diff --git a/src/Microsoft.AspNetCore.Razor.GenerateTool/Program.cs b/src/Microsoft.AspNetCore.Razor.GenerateTool/Program.cs deleted file mode 100644 index 6a433eff5e..0000000000 --- a/src/Microsoft.AspNetCore.Razor.GenerateTool/Program.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.AspNetCore.Razor.GenerateTool -{ - internal static class Program - { - public static int Main(string[] args) - { - DebugMode.HandleDebugSwitch(ref args); - - var application = new Application(); - return application.Execute(args); - } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Razor.GenerateTool/RunCommand.cs b/src/Microsoft.AspNetCore.Razor.GenerateTool/RunCommand.cs deleted file mode 100644 index 479d71e708..0000000000 --- a/src/Microsoft.AspNetCore.Razor.GenerateTool/RunCommand.cs +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.IO; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc.Razor.Extensions; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.VisualStudio.LanguageServices.Razor; -using Newtonsoft.Json; - -namespace Microsoft.AspNetCore.Razor.GenerateTool -{ - internal class RunCommand - { - public void Configure(Application application) - { - application.OnExecute(() => Execute(application)); - } - - private int Execute(Application application) - { - if (!ValidateArguments(application)) - { - application.ShowHelp(); - return 1; - } - - return ExecuteCore( - projectDirectory: application.ProjectDirectory.Value() ?? Environment.CurrentDirectory, - outputDirectory: application.OutputDirectory.Value(), - tagHelperManifest: application.TagHelperManifest.Value(), - sources: application.Sources.Values.ToArray()); - } - - private int ExecuteCore(string projectDirectory, string outputDirectory, string tagHelperManifest, string[] sources) - { - var tagHelpers = GetTagHelpers(tagHelperManifest); - - var engine = RazorEngine.Create(b => - { - RazorExtensions.Register(b); - - b.Features.Add(new StaticTagHelperFeature() { TagHelpers = tagHelpers, }); - }); - - var templateEngine = new MvcRazorTemplateEngine(engine, RazorProject.Create(projectDirectory)); - - var sourceItems = GetRazorFiles(projectDirectory, sources); - var results = GenerateCode(templateEngine, sourceItems); - - var success = true; - - foreach (var result in results) - { - if (result.CSharpDocument.Diagnostics.Count > 0) - { - success = false; - foreach (var error in result.CSharpDocument.Diagnostics) - { - Console.Error.WriteLine(error.ToString()); - } - } - - var outputFilePath = Path.Combine(outputDirectory, Path.ChangeExtension(result.ViewFileInfo.ViewEnginePath.Substring(1), ".cs")); - File.WriteAllText(outputFilePath, result.CSharpDocument.GeneratedCode); - } - - return success ? 0 : -1; - } - - private IReadOnlyList GetTagHelpers(string tagHelperManifest) - { - if (!File.Exists(tagHelperManifest)) - { - return Array.Empty(); - } - - using (var stream = File.OpenRead(tagHelperManifest)) - { - var reader = new JsonTextReader(new StreamReader(stream)); - - var serializer = new JsonSerializer(); - serializer.Converters.Add(new RazorDiagnosticJsonConverter()); - serializer.Converters.Add(new TagHelperDescriptorJsonConverter()); - - return serializer.Deserialize>(reader); - } - } - - private List GetRazorFiles(string projectDirectory, string[] sources) - { - var trimLength = projectDirectory.EndsWith("/") ? projectDirectory.Length - 1 : projectDirectory.Length; - - var items = new List(sources.Length); - for (var i = 0; i < sources.Length; i++) - { - var fullPath = Path.Combine(projectDirectory, sources[i]); - if (fullPath.StartsWith(projectDirectory, StringComparison.OrdinalIgnoreCase)) - { - var viewEnginePath = fullPath.Substring(trimLength).Replace('\\', '/'); - items.Add(new SourceItem(fullPath, viewEnginePath)); - } - } - - return items; - } - - private OutputItem[] GenerateCode(RazorTemplateEngine templateEngine, IReadOnlyList sources) - { - var outputs = new OutputItem[sources.Count]; - Parallel.For(0, outputs.Length, new ParallelOptions() { MaxDegreeOfParallelism = 4 }, i => - { - var source = sources[i]; - - var csharpDocument = templateEngine.GenerateCode(source.ViewEnginePath); - outputs[i] = new OutputItem(source, csharpDocument); - }); - - return outputs; - } - - private bool ValidateArguments(Application application) - { - if (string.IsNullOrEmpty(application.OutputDirectory.Value())) - { - application.Error.WriteLine($"{application.OutputDirectory.ValueName} not specified."); - return false; - } - - if (application.Sources.Values.Count == 0) - { - application.Error.WriteLine($"{application.Sources.Name} should have at least one value."); - return false; - } - - return true; - } - - private struct OutputItem - { - public OutputItem( - SourceItem viewFileInfo, - RazorCSharpDocument cSharpDocument) - { - ViewFileInfo = viewFileInfo; - CSharpDocument = cSharpDocument; - } - - public SourceItem ViewFileInfo { get; } - - public RazorCSharpDocument CSharpDocument { get; } - } - - private struct SourceItem - { - public SourceItem(string fullPath, string viewEnginePath) - { - FullPath = fullPath; - ViewEnginePath = viewEnginePath; - } - - public string FullPath { get; } - - public string ViewEnginePath { get; } - - public Stream CreateReadStream() - { - // We are setting buffer size to 1 to prevent FileStream from allocating it's internal buffer - // 0 causes constructor to throw - var bufferSize = 1; - return new FileStream( - FullPath, - FileMode.Open, - FileAccess.Read, - FileShare.ReadWrite, - bufferSize, - FileOptions.Asynchronous | FileOptions.SequentialScan); - } - } - - private class StaticTagHelperFeature : ITagHelperFeature - { - public RazorEngine Engine { get; set; } - - public IReadOnlyList TagHelpers { get; set; } - - public IReadOnlyList GetDescriptors() => TagHelpers; - } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Razor.TagHelperTool/Application.cs b/src/Microsoft.AspNetCore.Razor.TagHelperTool/Application.cs deleted file mode 100644 index 992482a82c..0000000000 --- a/src/Microsoft.AspNetCore.Razor.TagHelperTool/Application.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using Microsoft.Extensions.CommandLineUtils; - -namespace Microsoft.AspNetCore.Razor.TagHelperTool -{ - internal class Application : CommandLineApplication - { - public Application() - { - Name = "razor-taghelpertool"; - FullName = "Microsoft ASP.NET Core Razor Tag Helper tool"; - Description = "Discovers tag helpers in an assembly graph."; - ShortVersionGetter = GetInformationalVersion; - - HelpOption("-?|-h|--help"); - - Assemblies = Argument("assemblies", "assemblies to search for tag helpers", multipleValues: true); - TagHelperManifest = Option("-o", "output file", CommandOptionType.SingleValue); - ProjectRoot = Option("-p", "project root directory", CommandOptionType.SingleValue); - - new RunCommand().Configure(this); - } - - public CommandArgument Assemblies { get; } - - public CommandOption TagHelperManifest { get; } - - public CommandOption ProjectRoot { get; } - - public new int Execute(params string[] args) - { - try - { - return base.Execute(ExpandResponseFiles(args)); - } - catch (AggregateException ex) when (ex.InnerException != null) - { - Error.WriteLine(ex.InnerException.Message); - Error.WriteLine(ex.InnerException.StackTrace); - return 1; - } - catch (Exception ex) - { - Error.WriteLine(ex.Message); - Error.WriteLine(ex.StackTrace); - return 1; - } - } - - private string GetInformationalVersion() - { - var assembly = typeof(Application).GetTypeInfo().Assembly; - var attribute = assembly.GetCustomAttribute(); - return attribute.InformationalVersion; - } - - private static string[] ExpandResponseFiles(string[] args) - { - var expandedArgs = new List(); - foreach (var arg in args) - { - if (!arg.StartsWith("@", StringComparison.Ordinal)) - { - expandedArgs.Add(arg); - } - else - { - var fileName = arg.Substring(1); - expandedArgs.AddRange(File.ReadLines(fileName)); - } - } - - return expandedArgs.ToArray(); - } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Razor.TagHelperTool/DebugMode.cs b/src/Microsoft.AspNetCore.Razor.TagHelperTool/DebugMode.cs deleted file mode 100644 index 38799a9791..0000000000 --- a/src/Microsoft.AspNetCore.Razor.TagHelperTool/DebugMode.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Diagnostics; -using System.Linq; -using System.Threading; - -namespace Microsoft.AspNetCore.Razor.TagHelperTool -{ - internal static class DebugMode - { - public static void HandleDebugSwitch(ref string[] args) - { - if (args.Length > 0 && string.Equals("--debug", args[0], StringComparison.OrdinalIgnoreCase)) - { - args = args.Skip(1).ToArray(); - - while (!Debugger.IsAttached) - { - Console.WriteLine("Waiting for debugger in pid: {0}", Process.GetCurrentProcess().Id); - Thread.Sleep(TimeSpan.FromSeconds(3)); - } - } - } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Razor.TagHelperTool/Microsoft.AspNetCore.Razor.TagHelperTool.csproj b/src/Microsoft.AspNetCore.Razor.TagHelperTool/Microsoft.AspNetCore.Razor.TagHelperTool.csproj deleted file mode 100644 index 9dc83d788d..0000000000 --- a/src/Microsoft.AspNetCore.Razor.TagHelperTool/Microsoft.AspNetCore.Razor.TagHelperTool.csproj +++ /dev/null @@ -1,31 +0,0 @@ - - - - Razor is a markup syntax for adding server-side logic to web pages. This assembly contains infrastructure supporting Razor MSBuild integration. - - netcoreapp2.0 - Exe - - - false - false - - - - - Shared\RazorDiagnosticJsonConverter.cs - - - Shared\TagHelperDescriptorJsonConverter.cs - - - - - - - - - - - - diff --git a/src/Microsoft.AspNetCore.Razor.TagHelperTool/Program.cs b/src/Microsoft.AspNetCore.Razor.TagHelperTool/Program.cs deleted file mode 100644 index 29afc1f466..0000000000 --- a/src/Microsoft.AspNetCore.Razor.TagHelperTool/Program.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.AspNetCore.Razor.TagHelperTool -{ - internal static class Program - { - public static int Main(string[] args) - { - DebugMode.HandleDebugSwitch(ref args); - - var application = new Application(); - return application.Execute(args); - } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Razor.TagHelperTool/RunCommand.cs b/src/Microsoft.AspNetCore.Razor.TagHelperTool/RunCommand.cs deleted file mode 100644 index 8cedb19955..0000000000 --- a/src/Microsoft.AspNetCore.Razor.TagHelperTool/RunCommand.cs +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Security.Cryptography; -using System.Text; -using Microsoft.AspNetCore.Mvc.Razor.Extensions; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.LanguageServices.Razor; -using Newtonsoft.Json; - -namespace Microsoft.AspNetCore.Razor.TagHelperTool -{ - internal class RunCommand - { - public void Configure(Application application) - { - application.OnExecute(() => Execute(application)); - } - - private int Execute(Application application) - { - if (!ValidateArguments(application)) - { - application.ShowHelp(); - return 1; - } - - return ExecuteCore( - projectDirectory: application.ProjectRoot.Value(), - outputFilePath: application.TagHelperManifest.Value(), - assemblies: application.Assemblies.Values.ToArray()); - } - - private int ExecuteCore(string projectDirectory, string outputFilePath, string[] assemblies) - { - outputFilePath = Path.Combine(projectDirectory, outputFilePath); - - var metadataReferences = new MetadataReference[assemblies.Length]; - for (var i = 0; i < assemblies.Length; i++) - { - metadataReferences[i] = MetadataReference.CreateFromFile(assemblies[i]); - } - - var engine = RazorEngine.Create((b) => - { - RazorExtensions.Register(b); - - b.Features.Add(new DefaultMetadataReferenceFeature() { References = metadataReferences }); - b.Features.Add(new CompilationTagHelperFeature()); - - // TagHelperDescriptorProviders (actually do tag helper discovery) - b.Features.Add(new Microsoft.CodeAnalysis.Razor.DefaultTagHelperDescriptorProvider()); - b.Features.Add(new ViewComponentTagHelperDescriptorProvider()); - }); - - var feature = engine.Features.OfType().Single(); - var tagHelpers = feature.GetDescriptors(); - - using (var stream = new MemoryStream()) - { - Serialize(stream, tagHelpers); - - stream.Position = 0L; - - var newHash = Hash(stream); - var existingHash = Hash(outputFilePath); - - if (!HashesEqual(newHash, existingHash)) - { - stream.Position = 0; - using (var output = File.OpenWrite(outputFilePath)) - { - stream.CopyTo(output); - } - } - } - - return 0; - } - - private static byte[] Hash(string path) - { - if (!File.Exists(path)) - { - return Array.Empty(); - } - - using (var stream = File.OpenRead(path)) - { - return Hash(stream); - } - } - - private static byte[] Hash(Stream stream) - { - using (var sha = SHA256.Create()) - { - sha.ComputeHash(stream); - return sha.Hash; - } - } - - private bool HashesEqual(byte[] x, byte[] y) - { - if (x.Length != y.Length) - { - return false; - } - - for (var i = 0; i < x.Length; i++) - { - if (x[i] != y[i]) - { - return false; - } - } - - return true; - } - - private static void Serialize(Stream stream, IReadOnlyList tagHelpers) - { - using (var writer = new StreamWriter(stream, Encoding.UTF8, bufferSize: 4096, leaveOpen: true)) - { - var serializer = new JsonSerializer(); - serializer.Converters.Add(new TagHelperDescriptorJsonConverter()); - serializer.Converters.Add(new RazorDiagnosticJsonConverter()); - - serializer.Serialize(writer, tagHelpers); - } - } - - private bool ValidateArguments(Application application) - { - if (string.IsNullOrEmpty(application.TagHelperManifest.Value())) - { - application.Error.WriteLine($"{application.TagHelperManifest.ValueName} not specified."); - return false; - } - - if (application.Assemblies.Values.Count == 0) - { - application.Error.WriteLine($"{application.Assemblies.Name} should have at least one value."); - return false; - } - - if (string.IsNullOrEmpty(application.ProjectRoot.Value())) - { - application.ProjectRoot.Values.Add(Environment.CurrentDirectory); - } - - return true; - } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Razor.Tasks/DotnetToolTask.cs b/src/Microsoft.AspNetCore.Razor.Tasks/DotnetToolTask.cs index e9ef11dae4..03f55808d1 100644 --- a/src/Microsoft.AspNetCore.Razor.Tasks/DotnetToolTask.cs +++ b/src/Microsoft.AspNetCore.Razor.Tasks/DotnetToolTask.cs @@ -7,7 +7,6 @@ using System.Diagnostics; using System.IO; using System.Linq; using System.Threading; -using Microsoft.AspNetCore.Razor.Tools; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using Microsoft.CodeAnalysis.CommandLine; @@ -27,9 +26,6 @@ namespace Microsoft.AspNetCore.Razor.Tasks [Required] public string ToolAssembly { get; set; } - [Required] - public string ServerAssembly { get; set; } - public bool UseServer { get; set; } protected override string ToolName => "dotnet"; @@ -39,7 +35,7 @@ namespace Microsoft.AspNetCore.Razor.Tasks protected override MessageImportance StandardErrorLoggingImportance => MessageImportance.High; - internal abstract RequestCommand Command { get; } + internal abstract string Command { get; } protected override string GenerateFullPathToTool() { @@ -83,7 +79,6 @@ namespace Microsoft.AspNetCore.Razor.Tasks protected override int ExecuteTool(string pathToTool, string responseFileCommands, string commandLineCommands) { if (UseServer && - !string.IsNullOrEmpty(ServerAssembly) && TryExecuteOnServer(pathToTool, responseFileCommands, commandLineCommands, out var result)) { return result; @@ -120,7 +115,7 @@ namespace Microsoft.AspNetCore.Razor.Tasks CompilerServerLogger.Log($"BuildResponseFile = '{responseFileCommands}'"); // The server contains the tools for discovering tag helpers and generating Razor code. - var clientDir = Path.GetDirectoryName(ServerAssembly); + var clientDir = Path.GetDirectoryName(ToolAssembly); var workingDir = CurrentDirectoryToUse(); var tempDir = BuildServerConnection.GetTempPath(workingDir); @@ -132,7 +127,6 @@ namespace Microsoft.AspNetCore.Razor.Tasks tempDir: tempDir); var responseTask = BuildServerConnection.RunServerCompilation( - Command, GetArguments(responseFileCommands), buildPaths, keepAlive: null, diff --git a/src/Microsoft.AspNetCore.Razor.Tasks/RazorGenerate.cs b/src/Microsoft.AspNetCore.Razor.Tasks/RazorGenerate.cs index 15fdf00319..06ed7088e2 100644 --- a/src/Microsoft.AspNetCore.Razor.Tasks/RazorGenerate.cs +++ b/src/Microsoft.AspNetCore.Razor.Tasks/RazorGenerate.cs @@ -21,11 +21,14 @@ namespace Microsoft.AspNetCore.Razor.Tasks [Required] public string TagHelperManifest { get; set; } - internal override RequestCommand Command => RequestCommand.RazorGenerate; + internal override string Command => "generate"; protected override string GenerateResponseFileCommands() { var builder = new StringBuilder(); + + builder.AppendLine(Command); + for (var i = 0; i < Sources.Length; i++) { builder.AppendLine(Sources[i]); diff --git a/src/Microsoft.AspNetCore.Razor.Tasks/RazorTagHelper.cs b/src/Microsoft.AspNetCore.Razor.Tasks/RazorTagHelper.cs index 6e9023b978..4064163c34 100644 --- a/src/Microsoft.AspNetCore.Razor.Tasks/RazorTagHelper.cs +++ b/src/Microsoft.AspNetCore.Razor.Tasks/RazorTagHelper.cs @@ -5,7 +5,6 @@ using System.IO; using System.Text; using Microsoft.Build.Framework; -using Microsoft.CodeAnalysis.CommandLine; namespace Microsoft.AspNetCore.Razor.Tasks { @@ -20,7 +19,7 @@ namespace Microsoft.AspNetCore.Razor.Tasks public string ProjectRoot { get; set; } - internal override RequestCommand Command => RequestCommand.RazorTagHelper; + internal override string Command => "discover"; protected override bool SkipTaskExecution() { @@ -38,6 +37,9 @@ namespace Microsoft.AspNetCore.Razor.Tasks protected override string GenerateResponseFileCommands() { var builder = new StringBuilder(); + + builder.AppendLine(Command); + for (var i = 0; i < Assemblies.Length; i++) { builder.AppendLine(Assemblies[i]); diff --git a/src/Microsoft.AspNetCore.Razor.Tools/Application.cs b/src/Microsoft.AspNetCore.Razor.Tools/Application.cs index 21678b4195..483ab8c64c 100644 --- a/src/Microsoft.AspNetCore.Razor.Tools/Application.cs +++ b/src/Microsoft.AspNetCore.Razor.Tools/Application.cs @@ -23,9 +23,10 @@ namespace Microsoft.AspNetCore.Razor.Tools HelpOption("-?|-h|--help"); - Commands.Add(new DiscoverCommand(this)); Commands.Add(new ServerCommand(this)); Commands.Add(new ShutdownCommand(this)); + Commands.Add(new DiscoverCommand(this)); + Commands.Add(new GenerateCommand(this)); } public CancellationToken CancellationToken { get; } diff --git a/src/Microsoft.AspNetCore.Razor.Tools/CompilerHost.cs b/src/Microsoft.AspNetCore.Razor.Tools/CompilerHost.cs index 7721490412..e551b656ea 100644 --- a/src/Microsoft.AspNetCore.Razor.Tools/CompilerHost.cs +++ b/src/Microsoft.AspNetCore.Razor.Tools/CompilerHost.cs @@ -30,18 +30,8 @@ namespace Microsoft.AspNetCore.Razor.Tools var app = new Application(cancellationToken); var commandArgs = parsed.args.ToArray(); - CommandBase command = null; - if (request.Command == RequestCommand.RazorGenerate) - { - command = new GenerateCommand(app); - } - else if (request.Command == RequestCommand.RazorTagHelper) - { - command = new DiscoverCommand(app); - } - - var exitCode = command?.Execute(commandArgs) ?? 0; - var output = command?.Out.ToString() ?? string.Empty; + var exitCode = app.Execute(commandArgs); + var output = app.Out.ToString() ?? string.Empty; return new CompletedBuildResponse(exitCode, utf8output: false, output: output); } diff --git a/src/Microsoft.AspNetCore.Razor.Tools/DiscoverCommand.cs b/src/Microsoft.AspNetCore.Razor.Tools/DiscoverCommand.cs index e431a6cc5b..2b3cee612e 100644 --- a/src/Microsoft.AspNetCore.Razor.Tools/DiscoverCommand.cs +++ b/src/Microsoft.AspNetCore.Razor.Tools/DiscoverCommand.cs @@ -62,6 +62,7 @@ namespace Microsoft.AspNetCore.Razor.Tools projectDirectory: ProjectDirectory.Value(), outputFilePath: TagHelperManifest.Value(), assemblies: Assemblies.Values.ToArray()); + return Task.FromResult(result); } @@ -83,7 +84,7 @@ namespace Microsoft.AspNetCore.Razor.Tools b.Features.Add(new CompilationTagHelperFeature()); // TagHelperDescriptorProviders (actually do tag helper discovery) - b.Features.Add(new Microsoft.CodeAnalysis.Razor.DefaultTagHelperDescriptorProvider()); + b.Features.Add(new DefaultTagHelperDescriptorProvider()); b.Features.Add(new ViewComponentTagHelperDescriptorProvider()); }); diff --git a/src/Microsoft.AspNetCore.Razor.Tools/GenerateCommand.cs b/src/Microsoft.AspNetCore.Razor.Tools/GenerateCommand.cs index 63b4e16efa..41c935b8b1 100644 --- a/src/Microsoft.AspNetCore.Razor.Tools/GenerateCommand.cs +++ b/src/Microsoft.AspNetCore.Razor.Tools/GenerateCommand.cs @@ -35,7 +35,7 @@ namespace Microsoft.AspNetCore.Razor.Tools protected override Task ExecuteCoreAsync() { var result = ExecuteCore( - projectDirectory: ProjectDirectory.Value() ?? Environment.CurrentDirectory, + projectDirectory: ProjectDirectory.Value(), outputDirectory: OutputDirectory.Value(), tagHelperManifest: TagHelperManifest.Value(), sources: Sources.Values.ToArray()); @@ -57,6 +57,11 @@ namespace Microsoft.AspNetCore.Razor.Tools return false; } + if (string.IsNullOrEmpty(ProjectDirectory.Value())) + { + ProjectDirectory.Values.Add(Environment.CurrentDirectory); + } + return true; } @@ -92,7 +97,10 @@ namespace Microsoft.AspNetCore.Razor.Tools } } - var outputFilePath = Path.Combine(outputDirectory, Path.ChangeExtension(result.ViewFileInfo.ViewEnginePath.Substring(1), ".cs")); + var viewFile = result.ViewFileInfo.ViewEnginePath.Substring(1); + var outputFileName = Path.ChangeExtension(viewFile, ".cs"); + + var outputFilePath = Path.Combine(outputDirectory, outputFileName); File.WriteAllText(outputFilePath, result.CSharpDocument.GeneratedCode); } @@ -114,7 +122,8 @@ namespace Microsoft.AspNetCore.Razor.Tools serializer.Converters.Add(new RazorDiagnosticJsonConverter()); serializer.Converters.Add(new TagHelperDescriptorJsonConverter()); - return serializer.Deserialize>(reader); + var descriptors = serializer.Deserialize>(reader); + return descriptors; } } diff --git a/src/Microsoft.AspNetCore.Razor.Tools/RequestDispatcher.cs b/src/Microsoft.AspNetCore.Razor.Tools/RequestDispatcher.cs index 3fd18ff273..ea488b52d9 100644 --- a/src/Microsoft.AspNetCore.Razor.Tools/RequestDispatcher.cs +++ b/src/Microsoft.AspNetCore.Razor.Tools/RequestDispatcher.cs @@ -69,7 +69,6 @@ namespace Microsoft.AspNetCore.Razor.Tools private CancellationTokenSource _listenCancellationTokenSource; private List> _connections = new List>(); - public DefaultRequestDispatcher(ConnectionHost connectionHost, CompilerHost compilerHost, CancellationToken cancellationToken) { _connectionHost = connectionHost; diff --git a/src/Microsoft.AspNetCore.Razor.Tools/Roslyn/BuildProtocol.cs b/src/Microsoft.AspNetCore.Razor.Tools/Roslyn/BuildProtocol.cs index 205949d3c2..f2745e3e58 100644 --- a/src/Microsoft.AspNetCore.Razor.Tools/Roslyn/BuildProtocol.cs +++ b/src/Microsoft.AspNetCore.Razor.Tools/Roslyn/BuildProtocol.cs @@ -28,7 +28,6 @@ namespace Microsoft.CodeAnalysis.CommandLine /// Field Name Type Size (bytes) /// ---------------------------------------------------- /// Length Integer 4 - /// Language RequestLanguage 4 /// Argument Count UInteger 4 /// Arguments Argument[] Variable /// @@ -39,13 +38,11 @@ namespace Microsoft.CodeAnalysis.CommandLine internal class BuildRequest { public readonly uint ProtocolVersion; - public readonly RequestCommand Command; public readonly ReadOnlyCollection Arguments; - public BuildRequest(uint protocolVersion, RequestCommand command, IEnumerable arguments) + public BuildRequest(uint protocolVersion, IEnumerable arguments) { ProtocolVersion = protocolVersion; - Command = command; Arguments = new ReadOnlyCollection(arguments.ToList()); if (Arguments.Count > ushort.MaxValue) @@ -80,7 +77,6 @@ namespace Microsoft.CodeAnalysis.CommandLine } public static BuildRequest Create( - RequestCommand command, string workingDirectory, string tempDirectory, IList args, @@ -115,18 +111,22 @@ namespace Microsoft.CodeAnalysis.CommandLine requestArgs.Add(new Argument(ArgumentId.CommandLineArgument, i, arg)); } - return new BuildRequest(BuildProtocolConstants.ProtocolVersion, command, requestArgs); + return new BuildRequest(BuildProtocolConstants.ProtocolVersion, requestArgs); } public static BuildRequest CreateShutdown() { - var requestArgs = new[] { new Argument(ArgumentId.Shutdown, argumentIndex: 0, value: "") }; - return new BuildRequest(BuildProtocolConstants.ProtocolVersion, RequestCommand.None, requestArgs); + var requestArgs = new[] + { + new Argument(ArgumentId.Shutdown, argumentIndex: 0, value: ""), + new Argument(ArgumentId.CommandLineArgument, argumentIndex: 1, value: "shutdown"), + }; + return new BuildRequest(BuildProtocolConstants.ProtocolVersion, requestArgs); } public bool IsShutdownRequest() { - return Arguments.Count == 1 && Arguments[0].ArgumentId == ArgumentId.Shutdown; + return Arguments.Count >= 1 && Arguments[0].ArgumentId == ArgumentId.Shutdown; } /// @@ -163,7 +163,6 @@ namespace Microsoft.CodeAnalysis.CommandLine using (var reader = new BinaryReader(new MemoryStream(requestBuffer), Encoding.Unicode)) { var protocolVersion = reader.ReadUInt32(); - var command = (RequestCommand)reader.ReadUInt32(); uint argumentCount = reader.ReadUInt32(); var argumentsBuilder = new List((int)argumentCount); @@ -174,9 +173,7 @@ namespace Microsoft.CodeAnalysis.CommandLine argumentsBuilder.Add(BuildRequest.Argument.ReadFromBinaryReader(reader)); } - return new BuildRequest(protocolVersion, - command, - argumentsBuilder); + return new BuildRequest(protocolVersion, argumentsBuilder); } } @@ -191,7 +188,6 @@ namespace Microsoft.CodeAnalysis.CommandLine // Format the request. Log("Formatting request"); writer.Write(ProtocolVersion); - writer.Write((uint)Command); writer.Write(Arguments.Count); foreach (Argument arg in Arguments) { @@ -504,15 +500,6 @@ namespace Microsoft.CodeAnalysis.CommandLine protected override void AddResponseBody(BinaryWriter writer) { } } - // The id numbers below are just random. It's useful to use id numbers - // that won't occur accidentally for debugging. - internal enum RequestCommand - { - None = 0x44532621, - RazorTagHelper = 0x44532622, - RazorGenerate = 0x44532623, - } - /// /// Constants about the protocol. /// diff --git a/src/Microsoft.AspNetCore.Razor.Tools/Roslyn/BuildServerConnection.cs b/src/Microsoft.AspNetCore.Razor.Tools/Roslyn/BuildServerConnection.cs index 990d64c1c0..2a431d27e8 100644 --- a/src/Microsoft.AspNetCore.Razor.Tools/Roslyn/BuildServerConnection.cs +++ b/src/Microsoft.AspNetCore.Razor.Tools/Roslyn/BuildServerConnection.cs @@ -63,7 +63,6 @@ namespace Microsoft.CodeAnalysis.CommandLine internal const int TimeOutMsNewProcess = 20000; public static Task RunServerCompilation( - RequestCommand command, List arguments, BuildPathsAlt buildPaths, string keepAlive, @@ -72,7 +71,6 @@ namespace Microsoft.CodeAnalysis.CommandLine var pipeName = PipeName.ComputeDefault(); return RunServerCompilationCore( - command, arguments, buildPaths, pipeName: pipeName, @@ -84,7 +82,6 @@ namespace Microsoft.CodeAnalysis.CommandLine } internal static async Task RunServerCompilationCore( - RequestCommand language, List arguments, BuildPathsAlt buildPaths, string pipeName, @@ -156,12 +153,12 @@ namespace Microsoft.CodeAnalysis.CommandLine var pipe = await pipeTask.ConfigureAwait(false); if (pipe != null) { - var request = BuildRequest.Create(language, - buildPaths.WorkingDirectory, - buildPaths.TempDirectory, - arguments, - keepAlive, - libEnvVariable); + var request = BuildRequest.Create( + buildPaths.WorkingDirectory, + buildPaths.TempDirectory, + arguments, + keepAlive, + libEnvVariable); return await TryCompile(pipe, request, cancellationToken).ConfigureAwait(false); }