Skip to content

Commit

Permalink
chore: no LanguagePlugin interface with internalPlugin / externalPlug…
Browse files Browse the repository at this point in the history
…in (#3285)

All we need is a single LanguagePlugin now that there are no internal
plugins
  • Loading branch information
matt2e authored Nov 1, 2024
1 parent 7d29045 commit 5e2b31c
Show file tree
Hide file tree
Showing 9 changed files with 436 additions and 710 deletions.
4 changes: 2 additions & 2 deletions frontend/cli/cmd_new.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type newCmd struct {
// - environment variable overrides
//
// Language plugins take time to launch, so we return the one we created so it can be reused in Run().
func prepareNewCmd(ctx context.Context, k *kong.Kong, args []string) (optionalPlugin optional.Option[languageplugin.LanguagePlugin], err error) {
func prepareNewCmd(ctx context.Context, k *kong.Kong, args []string) (optionalPlugin optional.Option[*languageplugin.LanguagePlugin], err error) {
if len(args) < 2 {
return optionalPlugin, nil
} else if args[0] != "new" {
Expand Down Expand Up @@ -85,7 +85,7 @@ func prepareNewCmd(ctx context.Context, k *kong.Kong, args []string) (optionalPl
return optional.Some(plugin), nil
}

func (i newCmd) Run(ctx context.Context, ktctx *kong.Context, config projectconfig.Config, plugin languageplugin.LanguagePlugin) error {
func (i newCmd) Run(ctx context.Context, ktctx *kong.Context, config projectconfig.Config, plugin *languageplugin.LanguagePlugin) error {
name, path, err := validateModule(i.Dir, i.Name)
if err != nil {
return err
Expand Down
3 changes: 1 addition & 2 deletions frontend/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1beta1/provisioner/provisionerconnect"
"github.com/TBD54566975/ftl/internal"
_ "github.com/TBD54566975/ftl/internal/automaxprocs" // Set GOMAXPROCS to match Linux container CPU quota.
"github.com/TBD54566975/ftl/internal/buildengine/languageplugin"
"github.com/TBD54566975/ftl/internal/configuration"
"github.com/TBD54566975/ftl/internal/configuration/providers"
"github.com/TBD54566975/ftl/internal/log"
Expand Down Expand Up @@ -98,7 +97,7 @@ func main() {

if plugin, ok := languagePlugin.Get(); ok {
// Plugins take time to launch, so we bind the "ftl new" plugin to the kong context.
kctx.BindTo(plugin, (*languageplugin.LanguagePlugin)(nil))
kctx.Bind(plugin)
}

if !cli.Plain {
Expand Down
2 changes: 1 addition & 1 deletion internal/buildengine/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var errInvalidateDependencies = errors.New("dependencies need to be updated")
// Plugins must use a lock file to ensure that only one build is running at a time.
//
// Returns invalidateDependenciesError if the build failed due to a change in dependencies.
func build(ctx context.Context, plugin languageplugin.LanguagePlugin, projectConfig projectconfig.Config, bctx languageplugin.BuildContext, buildEnv []string, devMode bool) (moduleSchema *schema.Module, deploy []string, err error) {
func build(ctx context.Context, plugin *languageplugin.LanguagePlugin, projectConfig projectconfig.Config, bctx languageplugin.BuildContext, buildEnv []string, devMode bool) (moduleSchema *schema.Module, deploy []string, err error) {
logger := log.FromContext(ctx).Module(bctx.Config.Module).Scope("build")
ctx = log.ContextWithLogger(ctx, logger)

Expand Down
2 changes: 1 addition & 1 deletion internal/buildengine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type schemaChange struct {
// moduleMeta is a wrapper around a module that includes the last build's start time.
type moduleMeta struct {
module Module
plugin languageplugin.LanguagePlugin
plugin *languageplugin.LanguagePlugin
events chan languageplugin.PluginEvent
configDefaults moduleconfig.CustomDefaults
}
Expand Down
Loading

0 comments on commit 5e2b31c

Please sign in to comment.