All Projects → inigolabs → revgen

inigolabs / revgen

Licence: MIT license
Speed up go:generate by auto detecting code changes

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Labels

Projects that are alternatives of or similar to revgen

butte
No description or website provided.
Stars: ✭ 69 (+245%)
Mutual labels:  codegen
EasyEE-Auto
EasyEE 自动化代码生成器。EasyEE Automated code generator.
Stars: ✭ 39 (+95%)
Mutual labels:  codegen
TypedocConverter
This is a typedoc json to C# type bindings converter. Can be used as a TypeScript to C# bindings converter.
Stars: ✭ 89 (+345%)
Mutual labels:  codegen
graphql-ts-client
Typescript DSL for GraphQL.
Stars: ✭ 124 (+520%)
Mutual labels:  codegen
graphql-codegen-apollo-next-ssr
Autogenerate apollo code for nextjs ssr
Stars: ✭ 176 (+780%)
Mutual labels:  codegen
sbt-guardrail
Principled code generation from OpenAPI specifications
Stars: ✭ 24 (+20%)
Mutual labels:  codegen
cmake-reflection-template
A template for simple C++ reflection done with CMake and Python (no other external tools)
Stars: ✭ 37 (+85%)
Mutual labels:  codegen
apollo-typed-documents
Get type safety for your apollo documents.
Stars: ✭ 21 (+5%)
Mutual labels:  codegen
domainrobot-api
Swagger documentation for different APIs powered by InterNetX GmbH.
Stars: ✭ 14 (-30%)
Mutual labels:  codegen
codegen
Generator for dart_native bindings. Codegen can transform native SDK to Flutter plugin.
Stars: ✭ 75 (+275%)
Mutual labels:  codegen
ogen
OpenAPI v3 code generator for go
Stars: ✭ 436 (+2080%)
Mutual labels:  codegen
rosetta
Easy to use Rust i18n library based on code generation
Stars: ✭ 37 (+85%)
Mutual labels:  codegen
qpmodel
A Relational Optimizer and Executor
Stars: ✭ 54 (+170%)
Mutual labels:  codegen
graphql-cli-codegen
apollo-codegen plugin for graphql-cli
Stars: ✭ 22 (+10%)
Mutual labels:  codegen
graphql-java-codegen
Make your GraphQL Java application schema-driven.
Stars: ✭ 167 (+735%)
Mutual labels:  codegen
startle
Startle C Library
Stars: ✭ 15 (-25%)
Mutual labels:  codegen
gqty
a GraphQL client built for rapid iteration
Stars: ✭ 420 (+2000%)
Mutual labels:  codegen
vertx-codegen
Vert.x code generator for asynchronous polyglot APIs
Stars: ✭ 95 (+375%)
Mutual labels:  codegen
react-native-xaml
A React Native Windows library to use XAML / WinUI controls
Stars: ✭ 55 (+175%)
Mutual labels:  codegen
aws-mobile-appsync-sdk-android
Android SDK for AWS AppSync.
Stars: ✭ 101 (+405%)
Mutual labels:  codegen

logo

License: MIT ReportCard Doc

Speed up go:generate by auto detecting code changes.

At Inigo we generate a lot of go code. While our compile and build time runs in a matter of seconds thanks to the great go toolchain, running all the generators takes a few minutes on a good day. Running a single generator is fairly fast, but having to keep track of which generator to run gets annoying very fast.
Revgen keeps track of all the go:generate dependencies and only runs the generators for code that has been updated. By running one to a handful of generators at most, the go:generate run time goes down from minutes to seconds.
Each go:generate command is configured with a list of dependent files. When revgen is run, it calculates the hash of all these files, compares it with the latest hash, if they differ, runs the corresponding go:generate command and updates the stored hash.

Installation

Go

> go install github.com/inigolabs/revgen@latest

Brew

> brew tap inigolabs/homebrew-tap
> brew install revgen

Manual

Download the right pre-compiled binary for your system from the releases page and install.

Operation

> revgen init

The very first time, run revgen init to initialize and create a .revgen.yml config file.
Run this command in the root go dir, the config file will be created in this directory. See the configuration section for more information on setting go generate file dependecies.


> revgen

Run revgen anywhere inside your go workspace to call all the generators for code that has changed.


> revgen --force

Run revgen --force to run all the genrators regardless of code updates.


> revgen update

Run revgen update to update the config file when go::generate commands are added or removed from the code.


> revgen check

Run revgen check to check that all hashes match the current state of the code.
Can be useful in continious integration pipelines to make sure all needed code has been generated.

Configuration

  • Each go:generate command has a list of file dependencies which can be configured in .revgen.yml.
  • Gen deps can be configured with one or more glob strings. Revgen will compute the hash of all the files matched by the list of globs, and use this hash to determine if the generator needs to be called.
  • File deps can be configured to make sure generated code isn't edited manutally without calling generate. Running revgen check will check both the gen deps and file deps to make sure all the generated code is generated and not manually tampered.
  • Revgen stores the currently generated hashes in .revgen.sum, in general this file doesn't need to be edited. When in doubt, entries from .revgen.sum can be safely removed or the hash edited, they will be recomputed the next time revgen runs.

Example .revgen.yml:

auto_update: true
configs:
    - path: super/cool/generator.go
      gen_cmd: go run github.com/super/cool
      gen_deps:
        - super/cool/generator.yml
        - super/cool/*.go
      file_deps:
        - super/cool/gen/generated.go
    - path: another/cool/generator.go
      gen_cmd: go run github.com/another/generator
      gen_deps:
        - another/cool/generator.yml

License

Happy Coding!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].