Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

<ItemGroup>
<PackageReference Include="Kysect.SolutionDefaults">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MinVer">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
18 changes: 10 additions & 8 deletions Sources/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="IsExternalInit" Version="1.0.3" />
<PackageVersion Include="Kysect.CommonLib" Version="0.1.14" />
<PackageVersion Include="Kysect.CommonLib" Version="0.1.22" />
<PackageVersion Include="Kysect.DotnetProjectSystem" Version="1.0.0" />
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="Kysect.CommonLib.DependencyInjection" Version="0.1.14" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="NUnit" Version="4.0.1" />
<PackageVersion Include="Kysect.CommonLib.DependencyInjection" Version="0.1.22" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageVersion Include="NUnit" Version="4.1.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageVersion Include="NUnit.Analyzers" Version="3.10.0" />
<PackageVersion Include="NUnit.Analyzers" Version="4.2.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<PackageVersion Include="Nullable" Version="1.3.1" />
<PackageVersion Include="Kysect.DotnetSlnParser" Version="0.1.6" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" />
<PackageVersion Include="PowerShellStandard.Library" Version="5.1.1" />
<PackageVersion Include="MinVer" Version="5.0.0" />
<PackageVersion Include="Kysect.SolutionDefaults" Version="0.1.2" />
</ItemGroup>
<PackageVersion Include="Kysect.SolutionDefaults" Version="0.1.3" />
<PackageVersion Include="TestableIO.System.IO.Abstractions.Wrappers" Version="21.0.2" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Kysect.CommonLib" />
<PackageReference Include="Kysect.DotnetSlnParser" />
<PackageReference Include="Kysect.DotnetProjectSystem" />
<PackageReference Include="Microsoft.Bcl.HashCode" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
<PackageReference Include="PowerShellStandard.Library" />
<PackageReference Include="TestableIO.System.IO.Abstractions.Wrappers" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Kysect.CommonLib.ProgressTracking;
using Kysect.DotnetSlnParser.Parsers;
using Kysect.DotnetProjectSystem.Parsing;
using Kysect.DotnetProjectSystem.Traversing;
using Kysect.PowerShellRunner.CodeGeneration.Compilation;
using Kysect.PowerShellRunner.CodeGeneration.SemanticParsing;
using Kysect.PowerShellRunner.CodeGeneration.SolutionReading;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using Kysect.CommonLib.BaseTypes.Extensions;
using Kysect.CommonLib.FileSystem.Extensions;
using Kysect.CommonLib.FileSystem;
using Kysect.PowerShellRunner.CodeGeneration.SchemaGenerating;
using Kysect.PowerShellRunner.CodeGeneration.UsedModelSearching;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using System.IO.Abstractions;

namespace Kysect.PowerShellRunner.CodeGeneration.SdkGenerating;

Expand All @@ -12,12 +13,14 @@ public class PowerShellSchemaCodeGenerator
private readonly string _outputPath;
private readonly string _namespaceName;
private readonly IPowerShellCodeGeneratorNamespaceProvider _namespaceProvider;
private readonly FileSystem _fileSystem;

public PowerShellSchemaCodeGenerator(string outputPath, string namespaceName, IPowerShellCodeGeneratorNamespaceProvider namespaceProvider)
{
_outputPath = outputPath;
_namespaceName = namespaceName;
_namespaceProvider = namespaceProvider;
_fileSystem = new FileSystem();
}

public void GenerateSdkCode(PowerShellSchemaDto powerShellSchema)
Expand Down Expand Up @@ -54,7 +57,7 @@ public void GenerateSdkCode(PowerShellSchemaDto powerShellSchema)

private void WriteToCsFile(string directoryPath, string typeName, MemberDeclarationSyntax declarationSyntax, string[] usingList)
{
DirectoryExtensions.EnsureFileExists(directoryPath);
_fileSystem.EnsureDirectoryExists(directoryPath);
string fullPath = Path.Combine(directoryPath, $"{typeName}.g.cs");
string content = CodeGenerationNamespaceWrapper.Wrap(declarationSyntax, _namespaceName, usingList).NormalizeWhitespace().ToString();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Kysect.CommonLib.ProgressTracking;
using Kysect.DotnetSlnParser.Models;
using Kysect.DotnetSlnParser.Parsers;
using Kysect.DotnetProjectSystem.Parsing;
using Kysect.DotnetProjectSystem.Traversing;
using Microsoft.Extensions.Logging;
using System.IO.Abstractions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="NUnit.Analyzers" >
<PackageReference Include="NUnit.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
8 changes: 6 additions & 2 deletions Sources/Kysect.PowerShellRunner.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.6.33829.357
Expand All @@ -11,7 +10,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kysect.PowerShellRunner", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kysect.PowerShellRunner.CodeGeneration", "Kysect.PowerShellRunner.CodeGeneration\Kysect.PowerShellRunner.CodeGeneration.csproj", "{427C6CA2-F555-40E5-9E8D-C2EAE16A07D5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kysect.PowerShellRunner.Configuration", "Kysect.PowerShellRunner.Configuration\Kysect.PowerShellRunner.Configuration.csproj", "{1985E7C6-3826-4232-B9F5-089CBF67B464}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kysect.PowerShellRunner.Configuration", "Kysect.PowerShellRunner.Configuration\Kysect.PowerShellRunner.Configuration.csproj", "{1985E7C6-3826-4232-B9F5-089CBF67B464}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1D69C86F-577E-4246-B9E7-B7D2C3F6E0A3}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down