Rename Lumi.yaml to Pulumi.yaml
And also eliminate lots of accumulated cruft around "packfiles", etc. in the workspace code.
This commit is contained in:
parent
1e00bc7db4
commit
590e9e539b
|
@ -40,7 +40,7 @@ func (eng *Engine) readPackageFromArg(arg string) (*pkginfo, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Errorf("could not locate a package to load: %v", err)
|
return nil, errors.Errorf("could not locate a package to load: %v", err)
|
||||||
} else if pkgpath == "" {
|
} else if pkgpath == "" {
|
||||||
return nil, errors.Errorf("no package found at: %v", err)
|
return nil, errors.Errorf("no package found by searching upwards from '%v'", path)
|
||||||
}
|
}
|
||||||
path = pkgpath
|
path = pkgpath
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -4,13 +4,11 @@ package plugin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
|
|
||||||
"github.com/pulumi/pulumi-fabric/pkg/tokens"
|
"github.com/pulumi/pulumi-fabric/pkg/tokens"
|
||||||
"github.com/pulumi/pulumi-fabric/pkg/workspace"
|
|
||||||
lumirpc "github.com/pulumi/pulumi-fabric/sdk/proto/go"
|
lumirpc "github.com/pulumi/pulumi-fabric/sdk/proto/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -27,15 +25,9 @@ type langhost struct {
|
||||||
// NewLanguageRuntime binds to a language's runtime plugin and then creates a gRPC connection to it. If the
|
// NewLanguageRuntime binds to a language's runtime plugin and then creates a gRPC connection to it. If the
|
||||||
// plugin could not be found, or an error occurs while creating the child process, an error is returned.
|
// plugin could not be found, or an error occurs while creating the child process, an error is returned.
|
||||||
func NewLanguageRuntime(host Host, ctx *Context, runtime string) (LanguageRuntime, error) {
|
func NewLanguageRuntime(host Host, ctx *Context, runtime string) (LanguageRuntime, error) {
|
||||||
// Setup the search paths; first, the naked name (found on the PATH); next, the fully qualified name.
|
// Go ahead and attempt to load the plugin from the PATH.
|
||||||
srvexe := LanguagePluginPrefix + strings.Replace(runtime, tokens.QNameDelimiter, "_", -1)
|
srvexe := LanguagePluginPrefix + strings.Replace(runtime, tokens.QNameDelimiter, "_", -1)
|
||||||
paths := []string{
|
plug, err := newPlugin(host, ctx, []string{srvexe}, fmt.Sprintf("langhost[%v]", runtime))
|
||||||
srvexe, // naked PATH.
|
|
||||||
filepath.Join(workspace.InstallRoot(), srvexe), // qualified name.
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now go ahead and attempt to load the plugin.
|
|
||||||
plug, err := newPlugin(host, ctx, paths, fmt.Sprintf("langhost[%v]", runtime))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ package plugin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
|
@ -13,7 +12,6 @@ import (
|
||||||
"github.com/pulumi/pulumi-fabric/pkg/resource"
|
"github.com/pulumi/pulumi-fabric/pkg/resource"
|
||||||
"github.com/pulumi/pulumi-fabric/pkg/tokens"
|
"github.com/pulumi/pulumi-fabric/pkg/tokens"
|
||||||
"github.com/pulumi/pulumi-fabric/pkg/util/contract"
|
"github.com/pulumi/pulumi-fabric/pkg/util/contract"
|
||||||
"github.com/pulumi/pulumi-fabric/pkg/workspace"
|
|
||||||
lumirpc "github.com/pulumi/pulumi-fabric/sdk/proto/go"
|
lumirpc "github.com/pulumi/pulumi-fabric/sdk/proto/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -30,16 +28,9 @@ type provider struct {
|
||||||
// NewProvider attempts to bind to a given package's resource plugin and then creates a gRPC connection to it. If the
|
// NewProvider attempts to bind to a given package's resource plugin and then creates a gRPC connection to it. If the
|
||||||
// plugin could not be found, or an error occurs while creating the child process, an error is returned.
|
// plugin could not be found, or an error occurs while creating the child process, an error is returned.
|
||||||
func NewProvider(host Host, ctx *Context, pkg tokens.Package) (Provider, error) {
|
func NewProvider(host Host, ctx *Context, pkg tokens.Package) (Provider, error) {
|
||||||
// Setup the search paths; first, the naked name (found on the PATH); next, the fully qualified name.
|
// Go ahead and attempt to load the plugin from the PATH.
|
||||||
srvexe := ProviderPluginPrefix + strings.Replace(string(pkg), tokens.QNameDelimiter, "_", -1)
|
srvexe := ProviderPluginPrefix + strings.Replace(string(pkg), tokens.QNameDelimiter, "_", -1)
|
||||||
paths := []string{
|
plug, err := newPlugin(host, ctx, []string{srvexe}, fmt.Sprintf("resource[%v]", pkg))
|
||||||
srvexe, // naked PATH.
|
|
||||||
filepath.Join(
|
|
||||||
workspace.InstallRoot(), workspace.InstallRootLibdir, string(pkg), srvexe), // qualified name.
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now go ahead and attempt to load the plugin.
|
|
||||||
plug, err := newPlugin(host, ctx, paths, fmt.Sprintf("resource[%v]", pkg))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,28 +14,12 @@ import (
|
||||||
"github.com/pulumi/pulumi-fabric/pkg/tokens"
|
"github.com/pulumi/pulumi-fabric/pkg/tokens"
|
||||||
)
|
)
|
||||||
|
|
||||||
const ProjectFile = "Lumi" // the base name of a Project.
|
const ProjectFile = "Pulumi" // the base name of a Project.
|
||||||
const Dir = ".lumi" // the default name of the LumiPack output directory.
|
const Dir = ".lumi" // the default name of the LumiPack output directory.
|
||||||
const PackFile = "Lumipack" // the base name of a compiled LumiPack.
|
|
||||||
const BinDir = "bin" // the default name of the LumiPack binary output directory.
|
|
||||||
const EnvDir = "env" // the default name of the LumiPack environment directory.
|
const EnvDir = "env" // the default name of the LumiPack environment directory.
|
||||||
const DepDir = "packs" // the directory in which dependencies exist, either local or global.
|
const DepDir = "packs" // the directory in which dependencies exist, either local or global.
|
||||||
const SettingsFile = "workspace" // the base name of a markup file for shared settings in a workspace.
|
const SettingsFile = "workspace" // the base name of a markup file for shared settings in a workspace.
|
||||||
|
|
||||||
const InstallRootEnvvar = "LUMIROOT" // the envvar describing where Lumi has been installed.
|
|
||||||
const InstallRootLibdir = "packs" // the directory in which the Lumi standard library exists.
|
|
||||||
const DefaultInstallRoot = "/usr/local/lumi" // where Lumi is installed by default.
|
|
||||||
|
|
||||||
// InstallRoot returns Lumi's installation location. This is controlled my the LUMIROOT envvar.
|
|
||||||
func InstallRoot() string {
|
|
||||||
// TODO[pulumi/pulumi-fabric#208]: support Windows.
|
|
||||||
root := os.Getenv(InstallRootEnvvar)
|
|
||||||
if root == "" {
|
|
||||||
return DefaultInstallRoot
|
|
||||||
}
|
|
||||||
return root
|
|
||||||
}
|
|
||||||
|
|
||||||
// EnvPath returns a path to the given environment's default location.
|
// EnvPath returns a path to the given environment's default location.
|
||||||
func EnvPath(env tokens.QName) string {
|
func EnvPath(env tokens.QName) string {
|
||||||
path := filepath.Join(Dir, EnvDir)
|
path := filepath.Join(Dir, EnvDir)
|
||||||
|
@ -77,17 +61,6 @@ func DetectPackage(path string, d diag.Sink) (string, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
// See if there's a compiled package in the expected location.
|
|
||||||
pack := filepath.Join(curr, Dir, BinDir, PackFile)
|
|
||||||
for _, ext := range encoding.Exts {
|
|
||||||
packfile := pack + ext
|
|
||||||
if IsPack(packfile, d) {
|
|
||||||
return packfile, nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now look for uncompiled project files.
|
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
name := file.Name()
|
name := file.Name()
|
||||||
path := filepath.Join(curr, name)
|
path := filepath.Join(curr, name)
|
||||||
|
@ -126,12 +99,6 @@ func IsProject(path string, d diag.Sink) bool {
|
||||||
return isMarkupFile(path, ProjectFile, d)
|
return isMarkupFile(path, ProjectFile, d)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsPack returns true if the path references what appears to be a valid package. If problems are detected -- like
|
|
||||||
// an incorrect extension -- they are logged to the provided diag.Sink (if non-nil).
|
|
||||||
func IsPack(path string, d diag.Sink) bool {
|
|
||||||
return isMarkupFile(path, PackFile, d)
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsSettings returns true if the path references what appears to be a valid settings file. If problems are detected --
|
// IsSettings returns true if the path references what appears to be a valid settings file. If problems are detected --
|
||||||
// like an incorrect extension -- they are logged to the provided diag.Sink (if non-nil).
|
// like an incorrect extension -- they are logged to the provided diag.Sink (if non-nil).
|
||||||
func IsSettings(path string, d diag.Sink) bool {
|
func IsSettings(path string, d diag.Sink) bool {
|
||||||
|
|
Loading…
Reference in a new issue