Open 0x6e6562 opened 10 years ago
There's not really a standard way. I would suggest using a Makefile that has dependencies on encoder/decoder files to have it trigger megajson for make
and make test
.
I need to update megajson to take a list of Go files to encode. Currently it just does a single file or single directory. That way you could do something like this in your Makefile:
MEGAJSONSRC=myfile.go mypkg/other_file.go
make: jsonify
go build
make: jsonify
go test
megajson:
megajson $MEGAJSONSRC
.PHONY: megajson
I'm wrapping up another project and then coming back to refactor megajson in the next week or so. I got some good suggestions from improvements on the go-nuts mailing list. Let me know if there's anything you want to see included.
This is question rather than a bug - I was wondering if there is any standard way to build the code generation into the build phase of your project, other than either running the megajson tool manually before you build everything else, or maintaining a custom makefile to make sure that the generated artifacts are up to date.