Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: no LanguagePlugin interface with internalPlugin / externalPlugin #3285

Merged
merged 3 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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