spago build
spago bundle --platform node --minify --bundle-type app --outfile protoc-gen-purescript.mjs
protoc --plugin=protoc-gen-purescript=./protoc-gen-purescript.mjs --purescript_out=. google/protobuf/timestamp.proto
To test purescript-protobuf, run nix develop
from the top level directory
of the repo, then:
protoc --purescript_out=./plugin/test/Test/generated ./plugin/test/*.proto
Or, for the bundled plugin, not the Nix store:
protoc --plugin=protoc-gen-purescript=./protoc-gen-purescript.mjs --purescript_out=./test/Test/generated --proto_path ./test ./test/*.proto
then
spago test
To run the benchmarks, run nix develop
from the top level directory, then:
cd plugin
spago test --main Test.Bench
The funny thing about writing a protoc
compiler plugin codec is that it
bootstraps itself. We just have to write enough of the compiler plugin codec
that it can handle the plugin.proto
and descriptor.proto
files, and
then we call the compiler plugin on these .proto
files and the compiler
plugin codec generates the rest of itself.
Then we can delete the hand-written code and generate code to replace it with this command.
protoc --plugin=protoc-gen-purescript=./protoc-gen-purescript.mjs --purescript_out=./src google/protobuf/compiler/plugin.proto
See