Move compiler options to its own struct

Also add Clean attribute, to handle a future build clean method
This commit is contained in:
Ettore Di Giacinto
2020-01-05 14:32:26 +01:00
parent 9db9c1bf19
commit bcc6ce19ea
6 changed files with 51 additions and 31 deletions

View File

@@ -16,6 +16,8 @@
package compiler
import (
"runtime"
pkg "github.com/mudler/luet/pkg/package"
"github.com/mudler/luet/pkg/solver"
)
@@ -40,6 +42,24 @@ type CompilerBackendOptions struct {
Destination string
}
type CompilerOptions struct {
ImageRepository string
PullFirst, KeepImg bool
Concurrency int
CompressionType CompressionImplementation
Clean bool
}
func NewDefaultCompilerOptions() CompilerOptions {
return CompilerOptions{
ImageRepository: "luet/cache",
PullFirst: true,
CompressionType: None,
KeepImg: true,
Concurrency: runtime.NumCPU(),
}
}
type CompilerBackend interface {
BuildImage(CompilerBackendOptions) error
ExportImage(CompilerBackendOptions) error