Skip to content

Commit

Permalink
Merge pull request #9 from tpwalke2/tpwalke2/update-nuget
Browse files Browse the repository at this point in the history
Tpwalke2/update nuget
  • Loading branch information
tpwalke2 authored Jul 15, 2023
2 parents 9c864a3 + 9088622 commit 697aa2a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CodePointEnumGenerator.Tests/AdditionalFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public AdditionalFile(string path, string contents)
_sourceText = SourceText.From(contents, Encoding.UTF8);
}

public override SourceText? GetText(CancellationToken cancellationToken = new()) =>
public override SourceText GetText(CancellationToken cancellationToken = new()) =>
_sourceText;

public override string Path { get; }
Expand Down
2 changes: 1 addition & 1 deletion CodePointEnumGenerator.Tests/GeneratorTestFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static (Compilation? Compilation,
var references = new MetadataReference[]
{
MetadataReference.CreateFromFile(typeof(object).Assembly.Location),
MetadataReference.CreateFromFile(typeof(CodePointEnumGenerator).Assembly.Location),
MetadataReference.CreateFromFile(typeof(CodePointEnumGenerator).Assembly.Location)
};

var compilation = CSharpCompilation.Create(
Expand Down
1 change: 1 addition & 0 deletions CodePointEnumGenerator.Tests/Helpers/ToEnumEntryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public class ToEnumEntryTests
[Theory]
[InlineData("add_comment", "AddComment")]
[InlineData("add", "Add")]
// ReSharper disable twice StringLiteralTypo
[InlineData("addcomment", "Addcomment")]
[InlineData("1k_plus", "OneKPlus")]
[InlineData("2k_plus", "TwoKPlus")]
Expand Down
1 change: 1 addition & 0 deletions CodePointEnumGenerator/CodePointEnumGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public void Execute(GeneratorExecutionContext context)
context.ReportDiagnostic(
Diagnostic.Create(
new DiagnosticDescriptor(
// ReSharper disable once StringLiteralTypo
"NOFILES",
"No Codepoint files found",
"",
Expand Down
1 change: 0 additions & 1 deletion CodePointEnumGenerator/Helpers/AdditionalTextExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.CodeAnalysis;
using System;
using System.IO;

namespace CodePointEnumGenerator.Helpers;
Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# CodePointEnumGenerator
CodePointEnumGenerator
======================

A C# source generator that generates enums for all font codepoint files are contained in the project as Additional Files.

Each resulting enum can be used for strongly-typed references to the byte value of specific glyphs in the associated font.

## Links
# Links
[![Build status](https://ci.appveyor.com/api/projects/status/2lgs7mbehdvls38q?svg=true)](https://ci.appveyor.com/project/tpwalke2/codepointenumgenerator)

[![NuGet](https://img.shields.io/nuget/v/CodePointEnumGenerator.svg)](https://www.nuget.org/packages/CodePointEnumGenerator/)

## To Use
# To Use

1. Reference the Generator package as an analyzer:
```xml
Expand All @@ -23,10 +24,14 @@ Each resulting enum can be used for strongly-typed references to the byte value
1. Include codepoints files for fonts with a build action of `AddtionalFiles`.
2. Rebuild the solution.

## Troubleshooting
# Troubleshooting
The `Source Generators` folder should appear under `Dependencies\.NET 6.0` for the project that references the generator. There should also
be a separate generated C# file that contains the enum for each `codepoints` file in the project. If either or both of these are not the case:
- Verify that the generator project is referenced as an `Analyzer`.
- Verify that the `codepoints` files have a build action of `AdditionalFiles`.
- Clean the solution and then rebuild.
- Close the solution, delete the bin and obj folders for the project, then reopen the solution and rebuild.
- Close the solution, delete the bin and obj folders for the project, then reopen the solution and rebuild.

# Build Pipeline
- Requires a Github personal access token with read/write on Contents
- Requires a Nuget API key

0 comments on commit 697aa2a

Please sign in to comment.