Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1709a8f
move customBuildProperties to arduino/builder
alessio-perugini Sep 12, 2023
c19a712
remove BuildProperties from context
alessio-perugini Sep 12, 2023
c22f1c7
remove BuildPath from context
alessio-perugini Sep 12, 2023
2c22616
remove sketch,libraries,core build path from Context
alessio-perugini Sep 12, 2023
0afe884
remove buildPath parameter to PrepareSketchBuildPath func
alessio-perugini Sep 12, 2023
7ff4427
Make CoreBuilder a method recevier of arduino/builder
alessio-perugini Sep 12, 2023
2297f2b
Add BuilderLogger in arduino/builder
alessio-perugini Sep 12, 2023
d704e4c
Remove BuilderLogger from CoreBuild parameter
alessio-perugini Sep 12, 2023
f8cbfe5
Make getCachedCoreArchiveDirName unexported
alessio-perugini Sep 12, 2023
5916daa
heavily refactored the ContainerBuildOptions
alessio-perugini Sep 12, 2023
895c593
remove fqbn from Context
alessio-perugini Sep 12, 2023
b4891ea
remove clean from Context
alessio-perugini Sep 12, 2023
870f624
remove unsued properties in Context
alessio-perugini Sep 12, 2023
a6e1ef2
remove sourceOverrides from Context
alessio-perugini Sep 12, 2023
776ed23
make SketchBuilder a method recevier of arduino/builder
alessio-perugini Sep 12, 2023
93a9cfa
make BuildLibraries a method recevier of arduino/builder
alessio-perugini Sep 12, 2023
e965599
make RunRecipe a method recevier of arduino/builder
alessio-perugini Sep 12, 2023
f1fdf17
make RemoveUnusedCompiledLibraries a method recevier of arduino/builder
alessio-perugini Sep 12, 2023
41b47b7
make MergeSketchWithBootloader a method recevier of arduino/builder
alessio-perugini Sep 12, 2023
4f99d33
make WarnAboutArchIncompatibleLibraries a method recevier of arduino/…
alessio-perugini Sep 12, 2023
16f7fe0
make PrintUsedLibraries a method recevier of arduino/builder
alessio-perugini Sep 12, 2023
97a15a4
make ExportCmake and PreprocessorSketch a method recevier of arduino/…
alessio-perugini Sep 12, 2023
f4f7298
remove legacy/constans pkg
alessio-perugini Sep 12, 2023
5e9f9ca
make Linker a method recevier of arduino/builder
alessio-perugini Sep 12, 2023
290e8b1
make Size a method recevier of arduino/builder
alessio-perugini Sep 12, 2023
2279e9b
remove onlyUpdateCompilationDatabase from Context
alessio-perugini Sep 12, 2023
a0f8e30
remove Progress from Context
alessio-perugini Sep 12, 2023
aa904b6
remove ExecutableSectionSize from Context
alessio-perugini Sep 12, 2023
34e6204
remove CompilationDatabase from Context
alessio-perugini Sep 12, 2023
d5c040f
remove LineOffset from Context
alessio-perugini Sep 12, 2023
8995aff
introduce BuilderArtifacts to better isolate write operations
alessio-perugini Sep 12, 2023
e005586
remove ActualPlatform and TargetPlatform from Context
alessio-perugini Sep 13, 2023
a7963f4
directly pass the remaining properties of Context in the builder cons…
alessio-perugini Sep 13, 2023
6004057
polish legacy test
alessio-perugini Sep 13, 2023
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
Prev Previous commit
Next Next commit
Add BuilderLogger in arduino/builder
  • Loading branch information
alessio-perugini committed Sep 15, 2023
commit 2297f2b1b90a35e2c7efb840a8488aa5d3b0ba70
5 changes: 5 additions & 0 deletions arduino/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"errors"
"fmt"

"github.com/arduino/arduino-cli/arduino/builder/logger"
"github.com/arduino/arduino-cli/arduino/sketch"
"github.com/arduino/go-paths-helper"
"github.com/arduino/go-properties-orderedmap"
Expand All @@ -45,6 +46,8 @@ type Builder struct {

// core related
coreBuildCachePath *paths.Path

logger *logger.BuilderLogger
}

// NewBuilder creates a sketch Builder.
Expand All @@ -56,6 +59,7 @@ func NewBuilder(
coreBuildCachePath *paths.Path,
jobs int,
requestBuildProperties []string,
logger *logger.BuilderLogger,
) (*Builder, error) {
buildProperties := properties.NewMap()
if boardBuildProperties != nil {
Expand Down Expand Up @@ -113,6 +117,7 @@ func NewBuilder(
jobs: jobs,
customBuildProperties: append(requestBuildProperties, "build.warn_data_percentage=75"),
coreBuildCachePath: coreBuildCachePath,
logger: logger,
}, nil
}

Expand Down
6 changes: 3 additions & 3 deletions arduino/builder/sketch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestMergeSketchSources(t *testing.T) {
}
mergedSources := strings.ReplaceAll(string(mergedBytes), "%s", pathToGoldenSource)

b, err := NewBuilder(sk, nil, paths.New("testdata"), false, nil, 0, nil)
b, err := NewBuilder(sk, nil, paths.New("testdata"), false, nil, 0, nil, nil)
require.NoError(t, err)

offset, source, err := b.sketchMergeSources(nil)
Expand All @@ -63,7 +63,7 @@ func TestMergeSketchSourcesArduinoIncluded(t *testing.T) {
require.NotNil(t, sk)

// ensure not to include Arduino.h when it's already there
b, err := NewBuilder(sk, nil, paths.New("testdata"), false, nil, 0, nil)
b, err := NewBuilder(sk, nil, paths.New("testdata"), false, nil, 0, nil, nil)
require.NoError(t, err)

_, source, err := b.sketchMergeSources(nil)
Expand All @@ -80,7 +80,7 @@ func TestCopyAdditionalFiles(t *testing.T) {
sk1, err := sketch.New(paths.New("testdata", t.Name()))
require.Nil(t, err)
require.Equal(t, sk1.AdditionalFiles.Len(), 1)
b1, err := NewBuilder(sk1, nil, paths.New("testdata"), false, nil, 0, nil)
b1, err := NewBuilder(sk1, nil, paths.New("testdata"), false, nil, 0, nil, nil)
require.NoError(t, err)

// copy the sketch over, create a fake main file we don't care about it
Expand Down
1 change: 1 addition & 0 deletions commands/compile/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
coreBuildCachePath,
int(req.GetJobs()),
req.GetBuildProperties(),
builderLogger,
)
if err != nil {
if strings.Contains(err.Error(), "invalid build properties") {
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 @@ -103,7 +103,7 @@ func prepareBuilderTestContext(t *testing.T, ctx *types.Context, sketchPath *pat

builderLogger := logger.New(nil, nil, false, "")
ctx.BuilderLogger = builderLogger
ctx.Builder, err = bldr.NewBuilder(sk, nil, buildPath, false, nil, 0, nil)
ctx.Builder, err = bldr.NewBuilder(sk, nil, buildPath, false, nil, 0, nil, builderLogger)
require.NoError(t, err)
if fqbn != "" {
ctx.FQBN = parseFQBN(t, fqbn)
Expand All @@ -112,7 +112,7 @@ func prepareBuilderTestContext(t *testing.T, ctx *types.Context, sketchPath *pat
requiredTools, err := pme.FindToolsRequiredForBuild(targetPlatform, buildPlatform)
require.NoError(t, err)

ctx.Builder, err = bldr.NewBuilder(sk, boardBuildProperties, buildPath, false /*OptimizeForDebug*/, nil, 0, nil)
ctx.Builder, err = bldr.NewBuilder(sk, boardBuildProperties, buildPath, false /*OptimizeForDebug*/, nil, 0, nil, builderLogger)
require.NoError(t, err)

ctx.PackageManager = pme
Expand Down