This change detects the target cloud earlier on in the compilation process. Prior to this change, we didn't know this information until the backend code-generation. Clearly we need to know this at least by then, however, templates can specialize on this information, so we actually need it sooner. This change moves it into the frontend part. Note that to support this we now eliminate the ability to specify target clusters in the Mufile alone. That "feels" right to me anyway, since Mufiles are supposed to be agnostic to their deployment environment, other than template specialization. Instead, this information can come from the CLI and/or the workspace settings file.
25 lines
799 B
Go
25 lines
799 B
Go
// Copyright 2016 Marapongo, Inc. All rights reserved.
|
|
|
|
package compiler
|
|
|
|
import (
|
|
"github.com/golang/glog"
|
|
|
|
"github.com/marapongo/mu/pkg/ast"
|
|
"github.com/marapongo/mu/pkg/compiler/backends"
|
|
"github.com/marapongo/mu/pkg/compiler/core"
|
|
"github.com/marapongo/mu/pkg/workspace"
|
|
)
|
|
|
|
// buildDocumentBE runs the back-end phases of the compiler.
|
|
func (c *compiler) buildDocumentBE(w workspace.W, stack *ast.Stack) {
|
|
if c.opts.SkipCodegen {
|
|
glog.V(2).Infof("Skipping code-generation (opts.SkipCodegen=true)")
|
|
} else {
|
|
glog.V(2).Infof("Stack %v targets cluster=%v arch=%v", stack.Name, c.ctx.Cluster.Name, c.ctx.Arch)
|
|
|
|
// Now get the backend cloud provider to process the stack from here on out.
|
|
be := backends.New(c.ctx.Arch, c.Diag())
|
|
be.CodeGen(core.Compiland{c.ctx.Cluster, stack})
|
|
}
|
|
}
|