Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/GobieGenerator/Gobie
Simple C# source generation based on custom templates
https://github.com/GobieGenerator/Gobie
csharp-sourcegenerator dotnet generator roslyn-generator
Last synced: 3 months ago
JSON representation
Simple C# source generation based on custom templates
- Host: GitHub
- URL: https://github.com/GobieGenerator/Gobie
- Owner: GobieGenerator
- License: mit
- Created: 2021-11-07T18:45:58.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-07T15:25:22.000Z (about 1 year ago)
- Last Synced: 2024-05-22T04:33:05.661Z (6 months ago)
- Topics: csharp-sourcegenerator, dotnet, generator, roslyn-generator
- Language: C#
- Homepage:
- Size: 1.37 MB
- Stars: 90
- Watchers: 4
- Forks: 5
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- csharp-source-generators - Gobie - ![stars](https://img.shields.io/github/stars/GobieGenerator/Gobie?style=flat-square&cacheSeconds=604800) ![last commit](https://img.shields.io/github/last-commit/GobieGenerator/Gobie?style=flat-square&cacheSeconds=86400) - Allows developers define and use custom source generation without writing any generator code themselves or learning the Roslyn APIs. Instead, devs define the generator they want, in C#, and can then use that generator throughout their project. (Source Generators / Metaprogramming)
README
# Gobie
[![NuGet](https://shields.io/nuget/v/Gobie.svg)](https://www.nuget.org/packages/Gobie/)
[![Code coverage](https://codecov.io/gh/GobieGenerator/Gobie/branch/main/graph/badge.svg)](https://codecov.io/gh/GobieGenerator/Gobie)
## Overview
![](docs/images/gobie-simple-demo.gif)Source generation in C# is a very powerful tool, but its complexity reduces how and where it is used.
This is my attempt to make source generation for low/medium complexity scenarios easily accessible. Gobie allows developers define and use custom source generation without writing any generator code themselves or learning the Roslyn APIs. This happens in two steps.
1. Devs define what they want to generate in C#. Typically this would be text templates, along with definitions for what parameters are needed to populate the template.
1. From step 1, Gobie creates marker attributes which can be used to tag classes, fields, ... that need code generation.
2. Using the marker attributes, devs mark their code with the generated attributes, and provide custom arguments where needed. This step work just like consuming any other source generator.
1. Code is generated based on the templates provided.While this is in early development I'm going to keep a dev log [on my blog](https://mjconrad.com/).
## Feedback & Contribution
I am very much looking for feedback at this point. I can see several possible use cases for this approach to generation and am very interested in hearing whether others are interested in this concept or not. There are quite a few remaining technical challenges and substantial development work ahead, so it would be great to learn if this is something the community would find useful.
Contributors are welcome, but given the early state of this project please open an issue so we can discuss anything you are interested in working on.