A fork of https://github.com/teal-fm/piper

work on lexgen build

+32 -3
+5 -3
Makefile
··· 1 1 .PHONY: lexgen-types 2 2 lexgen-types: 3 3 rm -rf ../atproto \ 4 - && git clone git@github.com:bluesky-social/atproto ../ \ 5 - go run github.com/bluesky-social/indigo/cmd/lexgen \ 4 + && rm -rf ./api/cbor/cbor_gen.go \ 5 + && git clone git@github.com:bluesky-social/atproto ../atproto \ 6 + && go run github.com/bluesky-social/indigo/cmd/lexgen \ 6 7 --build-file ./lexcfg.json \ 7 8 ../atproto/lexicons \ 8 - ./lexicons/teal 9 + ./lexicons/teal \ 10 + && go run ./util/gencbor/gencbor.go
+27
util/gencbor/gencbor.go
··· 1 + package main 2 + 3 + import ( 4 + "reflect" 5 + 6 + "github.com/bluesky-social/indigo/mst" 7 + "github.com/teal-fm/piper/api/teal" 8 + 9 + cbg "github.com/whyrusleeping/cbor-gen" 10 + ) 11 + 12 + func main() { 13 + var typeVals []any 14 + for _, typ := range mst.CBORTypes() { 15 + typeVals = append(typeVals, reflect.New(typ).ELem().Interface()) 16 + } 17 + 18 + genCfg := cbg.Gen{ 19 + MaxStringLength: 1_000_000, 20 + } 21 + 22 + if err := genCfg.WriteMapEncodersToFile("api/cbor/cbor_gen.go", "teal", 23 + teal.AlphaFeedPlay{}, 24 + ); err != nil { 25 + panic(err) 26 + } 27 + }