Skip to content

Latest commit

 

History

History
51 lines (37 loc) · 2.44 KB

devguide.md

File metadata and controls

51 lines (37 loc) · 2.44 KB

Developer Guide

The repository contains two main components located in cmd/protoc-gen-gorums:

  • dev: Contains static code and code generated by templates. In other words, this is the code that the protoc-gen-gorums plugin will output. All files that are not prefixed by zorums* and do not end in _test.go get bundled into template_static.go.
  • gengorums: Contains the code for the protoc-gen-gorums plugin, as well as templates.

Workflow and File Endings

  1. Changes should be made to the development code in dev:

    • Changes to "dynamic" code, i.e. code that is dependent on protobuf definitions, should by done be editing the respective .tmpl files.
    • Changes to "static" code, i.e. code that is not dependent on protobuf definitions, should be done by editing the respective .go files.
  2. Any changes to templates or static code requires the invocation of make. This is to:

    • Bundle the static code into template_static.go
    • Rebuild the protoc-gen-gorums plugin
    • Update the zorums_*_gorums.pb.go files

See the Makefile for more details.

Testing

Testing the protoc-gen-gorums plugin itself can be done by running the make gentests. These tests verify that the code generated by the plugin is correct and stable.

Testing the generated code can be done by running tests in the tests/ folder.

Benchmarking

See benchmarking.md

Makefile

Below is a description of the current Makefile targets. The Makefile itself also serves as documentation; inspect it for details.

Target Description
dev updates template_static.go and regenerates generated files from templates.
benchmark Compiles the benchmark.
tools Installs required tools such as protoc-gen-go and protoc-gen-go-grpc.
installgorums Reinstalls the protoc-gen-gorums plugin.
bootstrapgorums Used to bootstrap the plugin.
gentests Generate code from test files.
stability Used to test that plugin output is stable across consecutive runs.