Skip to content

legacy: Builder refactorization (part 5...) #2312

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

Merged
merged 34 commits into from
Sep 15, 2023
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
remove unsued properties in Context
  • Loading branch information
alessio-perugini committed Sep 15, 2023
commit 870f624b7d3f0c1497a58d874cf585055f98c4d2
8 changes: 2 additions & 6 deletions commands/compile/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
if err != nil {
return nil, &arduino.InvalidFQBNError{Cause: err}
}
targetPackage, targetPlatform, targetBoard, boardBuildProperties, buildPlatform, err := pme.ResolveFQBN(fqbn)
_, targetPlatform, targetBoard, boardBuildProperties, buildPlatform, err := pme.ResolveFQBN(fqbn)
if err != nil {
if targetPlatform == nil {
return nil, &arduino.PlatformNotFoundError{
Expand Down Expand Up @@ -170,18 +170,14 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
coreBuildCachePath = buildCachePath.Join("core")
}

requiredTools, err := pme.FindToolsRequiredForBuild(targetPlatform, buildPlatform)
if err != nil {
if _, err := pme.FindToolsRequiredForBuild(targetPlatform, buildPlatform); err != nil {
return nil, err
}

builderCtx := &types.Context{}
builderCtx.PackageManager = pme
builderCtx.TargetBoard = targetBoard
builderCtx.TargetPlatform = targetPlatform
builderCtx.TargetPackage = targetPackage
builderCtx.ActualPlatform = buildPlatform
builderCtx.RequiredTools = requiredTools
builderCtx.ProgressCB = progressCB

// FIXME: This will be redundant when arduino-builder will be part of the cli
Expand Down
7 changes: 2 additions & 5 deletions legacy/builder/test/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ func prepareBuilderTestContext(t *testing.T, ctx *types.Context, sketchPath *pat
require.NoError(t, err)
if fqbnString != "" {
fqbn := parseFQBN(t, fqbnString)
targetPackage, targetPlatform, targetBoard, boardBuildProperties, buildPlatform, err := pme.ResolveFQBN(fqbn)
_, targetPlatform, _, boardBuildProperties, buildPlatform, err := pme.ResolveFQBN(fqbn)
require.NoError(t, err)
requiredTools, err := pme.FindToolsRequiredForBuild(targetPlatform, buildPlatform)
_, err = pme.FindToolsRequiredForBuild(targetPlatform, buildPlatform)
require.NoError(t, err)

ctx.Builder, err = bldr.NewBuilder(
Expand All @@ -123,11 +123,8 @@ func prepareBuilderTestContext(t *testing.T, ctx *types.Context, sketchPath *pat
require.NoError(t, err)

ctx.PackageManager = pme
ctx.TargetBoard = targetBoard
ctx.TargetPlatform = targetPlatform
ctx.TargetPackage = targetPackage
ctx.ActualPlatform = buildPlatform
ctx.RequiredTools = requiredTools
}

if !stepToSkip[skipLibraries] {
Expand Down
3 changes: 0 additions & 3 deletions legacy/builder/types/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ type Context struct {
OtherLibrariesDirs paths.PathList

PackageManager *packagemanager.Explorer
RequiredTools []*cores.ToolRelease
TargetBoard *cores.Board
TargetPackage *cores.Package
TargetPlatform *cores.PlatformRelease
ActualPlatform *cores.PlatformRelease

Expand Down