build: make msd flash faster

This commit is contained in:
sago35
2021-03-15 23:02:13 +09:00
parent 99b129d366
commit 20883b9fac
2 changed files with 17 additions and 7 deletions
+9 -1
View File
@@ -44,7 +44,7 @@ type BuildResult struct {
//
// The error value may be of type *MultiError. Callers will likely want to check
// for this case and print such errors individually.
func Build(pkgName, outpath string, config *compileopts.Config, action func(BuildResult) error) error {
func Build(pkgName, outpath string, config *compileopts.Config, preAction func() error, action func(BuildResult) error) error {
compilerConfig := &compiler.Config{
Triple: config.Triple(),
CPU: config.CPU(),
@@ -87,6 +87,14 @@ func Build(pkgName, outpath string, config *compileopts.Config, action func(Buil
// Makefile target.
var jobs []*compileJob
if preAction != nil {
// Add job to preAction.
jobs = append(jobs, &compileJob{
description: "preAction",
run: preAction,
})
}
// Add job to compile and optimize all Go files at once.
// TODO: parallelize this.
var mod llvm.Module