Skip to content

Commit

Permalink
Rename CSnake project to CSnake.SourceGeneration
Browse files Browse the repository at this point in the history
Resolves #290
  • Loading branch information
RussKie committed Sep 18, 2024
1 parent 00aecf0 commit d3037d6
Showing 31 changed files with 1,603 additions and 1,591 deletions.
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CSnakes" Version="1.*-*" />
<PackageReference Include="CSnakes.SourceGeneration" Version="1.*-*" />
<PackageReference Include="CSnakes.Runtime" Version="1.*-*" />
</ItemGroup>

Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
<NoWarn>$(NoWarn);RS1035</NoWarn>
<IsPackable>true</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
<PackageReference Include="Microsoft.SourceLink.GitHub">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Superpower" GeneratePathProperty="true" PrivateAssets="all" />
</ItemGroup>

<PropertyGroup>
<GetTargetPathDependsOn>$(GetTargetPathDependsOn);GetDependencyTargetPaths</GetTargetPathDependsOn>
</PropertyGroup>

<Target Name="GetDependencyTargetPaths">
<ItemGroup>
<TargetPathWithTargetPlatformMoniker Include="$(PKGSuperpower)\lib\netstandard2.0\Superpower.dll" IncludeRuntimeDependency="false" />
</ItemGroup>
</Target>

<Import Project="Packaging.targets" />
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
<NoWarn>$(NoWarn);RS1035</NoWarn>
<IsPackable>true</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
<PackageReference Include="Microsoft.SourceLink.GitHub">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Superpower" GeneratePathProperty="true" PrivateAssets="all" />
</ItemGroup>

<PropertyGroup>
<GetTargetPathDependsOn>$(GetTargetPathDependsOn);GetDependencyTargetPaths</GetTargetPathDependsOn>
</PropertyGroup>

<Target Name="GetDependencyTargetPaths">
<ItemGroup>
<TargetPathWithTargetPlatformMoniker Include="$(PKGSuperpower)\lib\netstandard2.0\Superpower.dll" IncludeRuntimeDependency="false" />
</ItemGroup>
</Target>

<Import Project="Packaging.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
// credit: https://github.com/SimonCropp/Polyfill/blob/main/src/Polyfill/CallerArgumentExpressionAttribute.cs
// Bringing in the file rather than using the library to avoid problems of additional libraries
// within a source generator.

// <auto-generated />
#pragma warning disable

#if NETFRAMEWORK || NETSTANDARD || NETCOREAPP2X

namespace System.Runtime.CompilerServices;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Link = System.ComponentModel.DescriptionAttribute;

/// <summary>
/// Indicates that a parameter captures the expression passed for another parameter as a string.
/// </summary>
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
[AttributeUsage(AttributeTargets.Parameter)]
[Link("https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.callerargumentexpressionattribute")]
#if PolyPublic
public
#endif
sealed class CallerArgumentExpressionAttribute :
Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="CallerArgumentExpressionAttribute"/> class.
/// </summary>
/// <param name="parameterName">
/// The name of the parameter whose expression should be captured as a string.
/// </param>
public CallerArgumentExpressionAttribute(string parameterName) =>
ParameterName = parameterName;

/// <summary>
/// Gets the name of the parameter whose expression should be captured as a string.
/// </summary>
public string ParameterName { get; }
}

// credit: https://github.com/SimonCropp/Polyfill/blob/main/src/Polyfill/CallerArgumentExpressionAttribute.cs
// Bringing in the file rather than using the library to avoid problems of additional libraries
// within a source generator.

// <auto-generated />
#pragma warning disable

#if NETFRAMEWORK || NETSTANDARD || NETCOREAPP2X

namespace System.Runtime.CompilerServices;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Link = System.ComponentModel.DescriptionAttribute;

/// <summary>
/// Indicates that a parameter captures the expression passed for another parameter as a string.
/// </summary>
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
[AttributeUsage(AttributeTargets.Parameter)]
[Link("https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.callerargumentexpressionattribute")]
#if PolyPublic
public
#endif
sealed class CallerArgumentExpressionAttribute :
Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="CallerArgumentExpressionAttribute"/> class.
/// </summary>
/// <param name="parameterName">
/// The name of the parameter whose expression should be captured as a string.
/// </param>
public CallerArgumentExpressionAttribute(string parameterName) =>
ParameterName = parameterName;

/// <summary>
/// Gets the name of the parameter whose expression should be captured as a string.
/// </summary>
public string ParameterName { get; }
}

#endif
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
namespace CSnakes
{
public static class CaseHelper
{
public static string ToPascalCase(this string snakeCase)
{
return string.Join("", snakeCase.Split('_').Select(s => s.Length > 1 ? char.ToUpperInvariant(s[0]) + s.Substring(1) : "_"));
}

public static string ToLowerPascalCase(this string snakeCase)
{
// Make sure the first letter is lowercase
return char.ToLowerInvariant(snakeCase[0]) + ToPascalCase(snakeCase).Substring(1);
}
}
}
namespace CSnakes
{
public static class CaseHelper
{
public static string ToPascalCase(this string snakeCase)
{
return string.Join("", snakeCase.Split('_').Select(s => s.Length > 1 ? char.ToUpperInvariant(s[0]) + s.Substring(1) : "_"));
}

public static string ToLowerPascalCase(this string snakeCase)
{
// Make sure the first letter is lowercase
return char.ToLowerInvariant(snakeCase[0]) + ToPascalCase(snakeCase).Substring(1);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
namespace CSnakes;

public class GeneratorError
{

public string Message { get; }

public int StartLine { get; }

public int StartColumn { get; }

public int EndLine { get; }

public int EndColumn { get; }

public string Code { get; }

public GeneratorError(int startLine, int endLine, int startColumn, int endColumn, string message)
{
Message = message;
StartLine = startLine;
StartColumn = startColumn;
EndLine = endLine == -1 ? startLine : endLine;
EndColumn = endColumn;
Code = "hello";
}
}
namespace CSnakes;

public class GeneratorError
{

public string Message { get; }

public int StartLine { get; }

public int StartColumn { get; }

public int EndLine { get; }

public int EndColumn { get; }

public string Code { get; }

public GeneratorError(int startLine, int endLine, int startColumn, int endColumn, string message)
{
Message = message;
StartLine = startLine;
StartColumn = startColumn;
EndLine = endLine == -1 ? startLine : endLine;
EndColumn = endColumn;
Code = "hello";
}
}
Loading

0 comments on commit d3037d6

Please sign in to comment.