mirror of
https://github.com/filecoin-project/lotus.git
synced 2025-08-24 09:22:17 +08:00

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
25 lines
539 B
Go
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)
|
|
}
|
|
}
|