github.com/consensys/gnark-crypto@v0.14.0/internal/generator/gkr/generate.go (about)

     1  package gkr
     2  
     3  import (
     4  	"github.com/consensys/bavard"
     5  	"github.com/consensys/gnark-crypto/internal/generator/config"
     6  	"path/filepath"
     7  )
     8  
     9  type Config struct {
    10  	config.FieldDependency
    11  	GenerateTests           bool
    12  	RetainTestCaseRawInfo   bool
    13  	OutsideGkrPackage       bool
    14  	TestVectorsRelativePath string
    15  }
    16  
    17  func Generate(config Config, baseDir string, bgen *bavard.BatchGenerator) error {
    18  	entries := []bavard.Entry{
    19  		{File: filepath.Join(baseDir, "gkr.go"), Templates: []string{"gkr.go.tmpl"}},
    20  	}
    21  
    22  	if config.GenerateTests {
    23  		entries = append(entries,
    24  			bavard.Entry{File: filepath.Join(baseDir, "gkr_test.go"), Templates: []string{"gkr.test.go.tmpl", "gkr.test.vectors.go.tmpl"}})
    25  	}
    26  
    27  	return bgen.Generate(config, "gkr", "./gkr/template/", entries...)
    28  }