mirror of
https://github.com/AssetRipper/AssetRipper.Text.SourceGeneration.git
synced 2026-11-13 18:06:49 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1493ad3736 | ||
|
|
d431e08d70 | ||
|
|
fbed176eaf | ||
|
|
3eb78aa0f0 | ||
|
|
2f536575c5 | ||
|
|
ea3375afab | ||
|
|
a1a99501d9 | ||
|
|
1b8a01dcbb | ||
|
|
8d6876dca9 | ||
|
|
034dac2dac | ||
|
|
a0afb95b2b | ||
|
|
b3c876fe78 |
No files matched your search
@@ -0,0 +1,18 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "nuget" # See documentation for possible values
|
||||
directory: "/" # Location of package manifests
|
||||
schedule:
|
||||
interval: "daily"
|
||||
|
||||
- package-ecosystem: "github-actions"
|
||||
# Workflow files stored in the
|
||||
# default location of `.github/workflows`
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
@@ -0,0 +1,28 @@
|
||||
# This workflow will build a .NET project
|
||||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
|
||||
|
||||
name: .NET
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 9.0.x
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
- name: Build
|
||||
run: dotnet build --no-restore
|
||||
- name: Test
|
||||
run: dotnet test --no-build --verbosity normal
|
||||
+9
-6
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<LangVersion>Latest</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
@@ -11,11 +11,14 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
|
||||
<PackageReference Include="NUnit" Version="3.13.3" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
||||
<PackageReference Include="NUnit.Analyzers" Version="3.6.1" />
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.0">
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||
<PackageReference Include="NUnit" Version="4.3.2" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="5.0.0" />
|
||||
<PackageReference Include="NUnit.Analyzers" Version="4.6.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Reflection;
|
||||
|
||||
namespace AssetRipper.Text.SourceGeneration.Tests;
|
||||
|
||||
@@ -65,8 +64,10 @@ public class DocumentationTests
|
||||
{
|
||||
NewLine = "\n",
|
||||
};
|
||||
typeof(IndentedTextWriter).GetField("_tabsPending", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(indentedWriter, true);
|
||||
#if !NET8_0_OR_GREATER
|
||||
typeof(IndentedTextWriter).GetField("_tabsPending", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)!.SetValue(indentedWriter, true);
|
||||
//https://github.com/dotnet/runtime/issues/92039
|
||||
#endif
|
||||
writeAction(indentedWriter);
|
||||
Assert.That(writer.ToString(), Is.EqualTo(expectedOutput));
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFrameworks>netstandard2.0;net9.0</TargetFrameworks>
|
||||
<LangVersion>Latest</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<IsTrimmable>true</IsTrimmable>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<Authors>ds5678</Authors>
|
||||
<Company>AssetRipper</Company>
|
||||
<Version>1.1.0</Version>
|
||||
<Version>1.2.1</Version>
|
||||
<AssemblyVersion>$(Version)</AssemblyVersion>
|
||||
<PackageId>AssetRipper.Text.SourceGeneration</PackageId>
|
||||
<PackageTags>C# Text</PackageTags>
|
||||
@@ -18,7 +17,7 @@
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<PackageProjectUrl>https://github.com/AssetRipper/AssetRipper.Text.SourceGeneration</PackageProjectUrl>
|
||||
<Copyright>Copyright (c) 2023 ds5678</Copyright>
|
||||
<Copyright>Copyright (c) ds5678</Copyright>
|
||||
<Description>Extension library for generating C# source code.</Description>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<Deterministic>true</Deterministic>
|
||||
@@ -26,12 +25,20 @@
|
||||
<NoWarn>1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">
|
||||
<IsTrimmable>true</IsTrimmable>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
|
||||
<IsAotCompatible>true</IsAotCompatible>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="PolySharp" Version="1.13.2">
|
||||
<PackageReference Include="PolySharp" Version="1.15.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
@@ -22,12 +22,13 @@ public static class IndentedTextWriterExtensions
|
||||
{
|
||||
writer.WriteLine($"/// <returns>{description}</returns>");
|
||||
}
|
||||
public static void WriteInheritDocumentation(this IndentedTextWriter writer) => writer.WriteLine("/// <inheritdoc/>");
|
||||
private static void WriteXmlDocumentation(this IndentedTextWriter writer, string tag, string content)
|
||||
{
|
||||
writer.WriteLine($"/// <{tag}>");
|
||||
if (content.Contains('\n') || content.Contains('\r'))
|
||||
{
|
||||
string[] lines = content.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
|
||||
string[] lines = content.Split(NewLineSeparators, StringSplitOptions.None);
|
||||
for (int i = 0; ; i++)
|
||||
{
|
||||
if (i == lines.Length - 1)
|
||||
@@ -47,4 +48,6 @@ public static class IndentedTextWriterExtensions
|
||||
}
|
||||
writer.WriteLine($"/// </{tag}>");
|
||||
}
|
||||
|
||||
private static readonly string[] NewLineSeparators = ["\r\n", "\r", "\n"];
|
||||
}
|
||||
@@ -16,12 +16,35 @@ public static class IndentedTextWriterFactory
|
||||
string path = Path.Combine(directoryPath, $"{fileName}.g.cs");
|
||||
Directory.CreateDirectory(directoryPath);
|
||||
FileStream stream = File.Create(path);
|
||||
StreamWriter streamWriter = new StreamWriter(stream, leaveOpen: false)
|
||||
return Create(stream);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make a new <see cref="IndentedTextWriter"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This writer uses <see cref="StreamWriter.AutoFlush"/>, LF line endings, and tab indentation.
|
||||
/// </remarks>
|
||||
/// <param name="stream">The stream to write to.</param>
|
||||
/// <returns>An <see cref="IndentedTextWriter"/> for the specified <paramref name="stream"/>.</returns>
|
||||
public static IndentedTextWriter Create(Stream stream)
|
||||
{
|
||||
StreamWriter streamWriter = new StreamWriter(stream)
|
||||
{
|
||||
NewLine = "\n",
|
||||
AutoFlush = true,
|
||||
};
|
||||
return new IndentedTextWriter(streamWriter, "\t")
|
||||
return Create(streamWriter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make a new <see cref="IndentedTextWriter"/>.
|
||||
/// </summary>
|
||||
/// <param name="writer">The <see cref="TextWriter"/> to use for output.</param>
|
||||
/// <returns>An <see cref="IndentedTextWriter"/> that outputs to the specified <paramref name="writer"/>.</returns>
|
||||
public static IndentedTextWriter Create(TextWriter writer)
|
||||
{
|
||||
return new IndentedTextWriter(writer, "\t")
|
||||
{
|
||||
NewLine = "\n",
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user