Commit 083de9eb authored by Eric Myhre's avatar Eric Myhre

sane generation commands for the schemadmt package.

Move the existing setup from the schema-schema "demo" dir to here;
and rig it up with go generate conventions that I'm hoisting back from
mvdan's https://github.com/ipld/go-ipld-adl-hamt/blob/master/gen.go .

Move the parse tests with it.
parent 2e68fd35
package schemaschema
// +build ignore
package main
import (
"fmt"
"os"
"github.com/ipld/go-ipld-prime"
"github.com/ipld/go-ipld-prime/schema"
gengo "github.com/ipld/go-ipld-prime/schema/gen/go"
)
func init() {
func main() {
ts := schema.TypeSystem{}
ts.Init()
adjCfg := &gengo.AdjunctCfg{
......@@ -385,6 +386,5 @@ func init() {
panic("not happening")
}
os.Mkdir("./schema", 0755)
gengo.Generate("./schema", "schema", ts, adjCfg)
gengo.Generate(".", "schemadmt", ts, adjCfg)
}
//go:generate go run gen.go
//go:generate gofmt -w .
package schemadmt
package schema
package schemadmt
import (
"strings"
......@@ -7,11 +7,6 @@ import (
"github.com/ipld/go-ipld-prime/codec/dagjson"
)
// Note! This test file will not *compile*, much less *run*, unless you've invoked codegen.
// (We're inside a package with "_" prefixed to the name for a reason!
// `go test ./...` should not generally have gotten you here unawares.)
// Codegen outputs are not currently committed because we're rapidly iterating on them.
// TestSchemaSchemaParse takes the schema-schema.json document -- the self-describing schema --
// and attempts to unmarshal it into our code-generated schema DMT types.
//
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment