This change adds a Backend Phase to the compiler, implemented by each of the cloud/scheduler implementations. It also reorganizes some of the modules to ensure we can do everything we need without cycles, including introducing the mu/pkg/compiler/backends package, under which the clouds/ and schedulers/ sub-packages now reside. The backends.New(Arch) factory function acts as the entrypoint into the entire thing so callers can easily create new Backend instances.
24 lines
707 B
Go
24 lines
707 B
Go
// Copyright 2016 Marapongo, Inc. All rights reserved.
|
|
|
|
package compiler
|
|
|
|
import (
|
|
"github.com/marapongo/mu/pkg/compiler/backends"
|
|
"github.com/marapongo/mu/pkg/diag"
|
|
)
|
|
|
|
// Options contains all of the settings a user can use to control the compiler's behavior.
|
|
type Options struct {
|
|
Diag diag.Sink // a sink to use for all diagnostics.
|
|
SkipCodegen bool // if true, no code-generation phases run.
|
|
Arch backends.Arch // a target cloud architecture.
|
|
Target string // a named target to generate outputs against.
|
|
}
|
|
|
|
// DefaultOpts returns the default set of compiler options.
|
|
func DefaultOpts(pwd string) Options {
|
|
return Options{
|
|
Diag: diag.DefaultSink(pwd),
|
|
}
|
|
}
|