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

     1  package polynomial
     2  
     3  import (
     4  	"path/filepath"
     5  
     6  	"github.com/consensys/bavard"
     7  	"github.com/consensys/gnark-crypto/internal/generator/config"
     8  )
     9  
    10  func Generate(conf config.FieldDependency, baseDir string, generateTests bool, bgen *bavard.BatchGenerator) error {
    11  
    12  	entries := []bavard.Entry{
    13  		{File: filepath.Join(baseDir, "doc.go"), Templates: []string{"doc.go.tmpl"}},
    14  		{File: filepath.Join(baseDir, "polynomial.go"), Templates: []string{"polynomial.go.tmpl"}},
    15  		{File: filepath.Join(baseDir, "multilin.go"), Templates: []string{"multilin.go.tmpl"}},
    16  		{File: filepath.Join(baseDir, "pool.go"), Templates: []string{"pool.go.tmpl"}},
    17  	}
    18  
    19  	if generateTests {
    20  		entries = append(entries,
    21  			bavard.Entry{File: filepath.Join(baseDir, "polynomial_test.go"), Templates: []string{"polynomial.test.go.tmpl"}},
    22  			bavard.Entry{File: filepath.Join(baseDir, "multilin_test.go"), Templates: []string{"multilin.test.go.tmpl"}},
    23  		)
    24  	}
    25  
    26  	return bgen.Generate(conf, "polynomial", "./polynomial/template/", entries...)
    27  }