Skip to content

Commit

Permalink
remove clean from Context
Browse files Browse the repository at this point in the history
  • Loading branch information
alessio-perugini committed Sep 12, 2023
1 parent 1b3a6e5 commit a3b9cb6
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 17 deletions.
8 changes: 1 addition & 7 deletions arduino/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,9 @@ type Builder struct {
coreBuildCachePath *paths.Path

logger *logger.BuilderLogger
clean bool

*BuildOptionsManager

hardwareDirs, builtInToolsDirs, otherLibrariesDirs paths.PathList
builtInLibrariesDirs *paths.Path
clean bool

compilerOptimizationFlags string
runtimePlatformPath, buildCorePath *paths.Path
}

// NewBuilder creates a sketch Builder.
Expand Down
8 changes: 4 additions & 4 deletions arduino/builder/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (
// BuildCore fixdoc
func (b *Builder) BuildCore(
actualPlatform *cores.PlatformRelease,
onlyUpdateCompilationDatabase, clean bool,
onlyUpdateCompilationDatabase bool,
compilationDatabase *compilation.Database,
progress *progress.Struct, progressCB rpc.TaskProgressCB,
) (paths.PathList, *paths.Path, error) {
Expand All @@ -58,7 +58,7 @@ func (b *Builder) BuildCore(
}

archiveFile, objectFiles, err := b.compileCore(
onlyUpdateCompilationDatabase, clean,
onlyUpdateCompilationDatabase,
actualPlatform,
compilationDatabase,
progress, progressCB,
Expand All @@ -71,7 +71,7 @@ func (b *Builder) BuildCore(
}

func (b *Builder) compileCore(
onlyUpdateCompilationDatabase, clean bool,
onlyUpdateCompilationDatabase bool,
actualPlatform *cores.PlatformRelease,
compilationDatabase *compilation.Database,
progress *progress.Struct, progressCB rpc.TaskProgressCB,
Expand Down Expand Up @@ -117,7 +117,7 @@ func (b *Builder) compileCore(
}

var canUseArchivedCore bool
if onlyUpdateCompilationDatabase || clean {
if onlyUpdateCompilationDatabase || b.clean {
canUseArchivedCore = false
} else if isOlder, err := utils.DirContentIsOlderThan(realCoreFolder, targetArchivedCore); err != nil || !isOlder {
// Recreate the archive if ANY of the core files (including platform.txt) has changed
Expand Down
3 changes: 1 addition & 2 deletions commands/compile/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream

builderCtx.BuiltInLibrariesDirs = configuration.IDEBuiltinLibrariesDir(configuration.Settings)

builderCtx.Clean = req.GetClean()
builderCtx.OnlyUpdateCompilationDatabase = req.GetCreateCompilationDatabaseOnly()
builderCtx.SourceOverride = req.GetSourceOverride()

Expand All @@ -212,7 +211,7 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
builderCtx.OtherLibrariesDirs,
builderCtx.BuiltInLibrariesDirs,
fqbn,
builderCtx.Clean,
req.GetClean(),
builderLogger,
)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion legacy/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func (s *Builder) Run(ctx *types.Context) error {
types.BareCommand(func(ctx *types.Context) error {
objectFiles, archiveFile, err := ctx.Builder.BuildCore(
ctx.ActualPlatform,
ctx.OnlyUpdateCompilationDatabase, ctx.Clean,
ctx.OnlyUpdateCompilationDatabase,
ctx.CompilationDatabase,
&ctx.Progress, ctx.ProgressCB,
)
Expand Down
4 changes: 2 additions & 2 deletions legacy/builder/test/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func prepareBuilderTestContext(t *testing.T, ctx *types.Context, sketchPath *pat
ctx.Builder, err = bldr.NewBuilder(
sk, nil, buildPath, false, nil, 0, nil,
ctx.HardwareDirs, ctx.BuiltInToolsDirs, ctx.OtherLibrariesDirs,
ctx.BuiltInLibrariesDirs, parseFQBN(t, "a:b:c"), ctx.Clean, builderLogger,
ctx.BuiltInLibrariesDirs, parseFQBN(t, "a:b:c"), false, builderLogger,
)
require.NoError(t, err)
if fqbnString != "" {
Expand All @@ -119,7 +119,7 @@ func prepareBuilderTestContext(t *testing.T, ctx *types.Context, sketchPath *pat
ctx.Builder, err = bldr.NewBuilder(
sk, boardBuildProperties, buildPath, false, nil, 0, nil,
ctx.HardwareDirs, ctx.BuiltInToolsDirs, ctx.OtherLibrariesDirs,
ctx.BuiltInLibrariesDirs, fqbn, ctx.Clean, builderLogger)
ctx.BuiltInLibrariesDirs, fqbn, false, builderLogger)
require.NoError(t, err)

ctx.PackageManager = pme
Expand Down
1 change: 0 additions & 1 deletion legacy/builder/types/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ type Context struct {
BuiltInToolsDirs paths.PathList
BuiltInLibrariesDirs *paths.Path
OtherLibrariesDirs paths.PathList
Clean bool

PackageManager *packagemanager.Explorer
RequiredTools []*cores.ToolRelease
Expand Down

0 comments on commit a3b9cb6

Please sign in to comment.