Files
lotus/api/docgen/cmd/docgen.go
Masih H. Derkani 312fa3a5cc Simplify code generation logic for a faster and better UX (#12493)
The changes here simplify the string of targets executed as part of
`make gen`. The simplifications include:
* parallelised code generation whenever possible
* re-implementation of documentation generation for a significant
  simplification and improved readability.
* unified mocks generation to avoid multiple slow calls to `go run` per
  package.

Note, the changes introduced here are purely mechanical and do not alter
the Lotus node functionality.

Fixes #8392
2024-09-20 16:32:54 +00:00

25 lines
539 B
Go

package main
import (
"fmt"
"os"
"github.com/filecoin-project/lotus/api/docgen"
)
func main() {
var (
apiFile = os.Args[1]
iface = os.Args[2]
pkg = os.Args[3]
dir = os.Args[4]
)
if ainfo, err := docgen.ParseApiASTInfo(apiFile, iface, pkg, dir); err != nil {
_, _ = fmt.Fprintf(os.Stderr, "Failed to parse API AST info: %v\n", err)
os.Exit(1)
} else if err := docgen.Generate(os.Stdout, iface, pkg, ainfo); err != nil {
_, _ = fmt.Fprintf(os.Stderr, "Failed to generate docs: %v\n", err)
os.Exit(1)
}
}