Skip to content

Commit

Permalink
Use DotNet command template
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayPianikov committed Sep 27, 2024
1 parent e0b8f49 commit 080a6d7
Show file tree
Hide file tree
Showing 11 changed files with 1,204 additions and 673 deletions.
16 changes: 8 additions & 8 deletions CSharpInteractive.HostApi/CSharpInteractive.HostApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@
</None>

<Compile Update="CommandLines.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>CommandLines.tt</DependentUpon>
</Compile>

<None Update="SimpleDotNetCommands.tt">
<LastGenOutput>SimpleDotNetCommands.cs</LastGenOutput>
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>SimpleDotNetCommands.cs</LastGenOutput>
<Generator>TextTemplatingFileGenerator</Generator>
</None>

<Compile Update="SimpleDotNetCommands.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>SimpleDotNetCommands.tt</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>SimpleDotNetCommands.tt</DependentUpon>
</Compile>
</ItemGroup>

Expand Down
530 changes: 367 additions & 163 deletions CSharpInteractive.HostApi/CommandLines.cs

Large diffs are not rendered by default.

24 changes: 15 additions & 9 deletions CSharpInteractive.HostApi/CommandLines.tt
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
// ReSharper disable InconsistentNaming
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="System.Text" #>
// ReSharper disable InconsistentNaming
namespace HostApi;

<#
var commandLineTypes = new[]
{
"CommandLine",

// Dotnet
"DotNetCustom",
"DotNet",
"DotNetExec",
"DotNetAddPackage",
"DotNetListPackage",
"DotNetRemovePackage",
"DotNetAddReference",
"DotNetListReference",
"DotNetRemoveReference",
"DotNetBuild",
"DotNetBuildServerShutdown",
"DotNetClean",
"DotNetCustom",
"MSBuild",
"DotNetNew",
"DotNetNuGetPush",
"DotNetPack",
Expand All @@ -19,13 +31,7 @@ namespace HostApi;
"DotNetRun",
"DotNetTest",
"DotNetToolRestore",
"MSBuild",
"VSTest",
"DotNet",
"DotNetExec",
"DotNetAddPackage",
"DotNetListPackage",
"DotNetRemovePackage",

// Docker
"DockerCustom",
Expand Down
133 changes: 0 additions & 133 deletions CSharpInteractive.HostApi/DotNetBuild.cs

This file was deleted.

12 changes: 12 additions & 0 deletions CSharpInteractive.HostApi/DotNetBuildServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,16 @@ public enum DotNetBuildServer
/// Razor build server
/// </summary>
Razor
}

internal static class DotNetBuildServerExtensions
{
public static string[] ToArgs(this IEnumerable<DotNetBuildServer> servers, string name) =>
servers.Select(server => server switch
{
DotNetBuildServer.MSBuild => "--msbuild",
DotNetBuildServer.VbCsCompiler => "--vbcscompiler",
DotNetBuildServer.Razor => "--razor",
_ => throw new ArgumentOutOfRangeException()
}).ToArray();
}
71 changes: 0 additions & 71 deletions CSharpInteractive.HostApi/DotNetBuildServerShutdown.cs

This file was deleted.

89 changes: 0 additions & 89 deletions CSharpInteractive.HostApi/DotNetClean.cs

This file was deleted.

Loading

0 comments on commit 080a6d7

Please sign in to comment.