Skip to content
This repository was archived by the owner on Aug 17, 2025. It is now read-only.
Draft
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
15 changes: 12 additions & 3 deletions internal/buildengine/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"github.com/block/ftl/internal/exec"
"github.com/block/ftl/internal/projectconfig"
"github.com/block/ftl/internal/sql"
"github.com/block/ftl/internal/watch"
)

const (
Expand All @@ -35,24 +36,25 @@
// 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, projectConfig projectconfig.Config, m Module, plugin *languageplugin.LanguagePlugin, bctx languageplugin.BuildContext, devMode bool, devModeEndpoints chan dev.LocalEndpoint) (moduleSchema *schema.Module, tmpDeployDir string, deployPaths []string, err error) {
func build(ctx context.Context, projectConfig projectconfig.Config, m Module, plugin *languageplugin.LanguagePlugin, fileTransaction watch.ModifyFilesTransaction, bctx languageplugin.BuildContext, devMode bool, devModeEndpoints chan dev.LocalEndpoint) (moduleSchema *schema.Module, tmpDeployDir string, deployPaths []string, err error) {
logger := log.FromContext(ctx).Module(bctx.Config.Module).Scope("build")
ctx = log.ContextWithLogger(ctx, logger)

err = sql.AddDatabaseDeclsToSchema(ctx, projectConfig.Root(), bctx.Config.Abs(), bctx.Schema)
if err != nil {
return nil, "", nil, errors.WithStack(errors.Join(errSQLError, err))
}

stubsRoot := stubsLanguageDir(projectConfig.Root(), bctx.Config.Language)
moduleSchema, tmpDeployDir, deployPaths, err = handleBuildResult(ctx, projectConfig, m, result.From(plugin.Build(ctx, projectConfig, stubsRoot, bctx, devMode)), devMode, devModeEndpoints, optional.Some(bctx.Schema))
moduleSchema, tmpDeployDir, deployPaths, err = handleBuildResult(ctx, projectConfig, m, fileTransaction, result.From(plugin.Build(ctx, projectConfig, stubsRoot, bctx, devMode)), devMode, devModeEndpoints, optional.Some(bctx.Schema))
if err != nil {
return nil, "", nil, errors.WithStack(err)
}
return moduleSchema, tmpDeployDir, deployPaths, nil
}

// handleBuildResult processes the result of a build
func handleBuildResult(ctx context.Context, projectConfig projectconfig.Config, m Module, eitherResult result.Result[languageplugin.BuildResult], devMode bool, devModeEndpoints chan dev.LocalEndpoint, schemaOpt optional.Option[*schema.Schema]) (moduleSchema *schema.Module, tmpDeployDir string, deployPaths []string, err error) {
func handleBuildResult(ctx context.Context, projectConfig projectconfig.Config, m Module, fileTransaction watch.ModifyFilesTransaction, eitherResult result.Result[languageplugin.BuildResult], devMode bool, devModeEndpoints chan dev.LocalEndpoint, schemaOpt optional.Option[*schema.Schema]) (moduleSchema *schema.Module, tmpDeployDir string, deployPaths []string, err error) {
logger := log.FromContext(ctx)
config := m.Config.Abs()

Expand All @@ -61,6 +63,13 @@
return nil, "", nil, errors.Wrap(err, "failed to build module")
}

if len(result.ModifiedFiles) > 0 {
logger.Infof("Modified files: %v", result.ModifiedFiles)

Check failure on line 67 in internal/buildengine/build.go

View workflow job for this annotation

GitHub Actions / Lint

use of `logger.Infof` forbidden because "Infof should only be used for user-facing messages, use //nolint to suppress" (forbidigo)
}
if err := fileTransaction.ModifiedFiles(result.ModifiedFiles...); err != nil {
return nil, "", nil, errors.Wrap(err, "failed to apply modified files")
}

if result.InvalidateDependencies {
return nil, "", nil, errors.WithStack(errInvalidateDependencies)
}
Expand Down
Loading
Loading