Skip to content

legacy: Builder refactorization (part 4...) #2310

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 21 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
b735f49
move CoreBuilder in arduino/builder and move CompilationDatabase in c…
alessio-perugini Sep 11, 2023
76bb3f7
rename CompilationDatabse in Database
alessio-perugini Sep 11, 2023
9a05ce5
move libraries phases in arduino/builder
alessio-perugini Sep 11, 2023
98ca4ee
move linker phases in arduino/builder
alessio-perugini Sep 11, 2023
8f8fe39
move sketch_builder phases in arduino/builder
alessio-perugini Sep 11, 2023
b13222c
move sizer phases in arduino/builder/sizer
alessio-perugini Sep 11, 2023
9f489d6
create bulder logger
alessio-perugini Sep 11, 2023
7e80526
use builder logger in the sketLibrariesDetector
alessio-perugini Sep 11, 2023
35ffce9
replace context Info logger with BuilderLogger
alessio-perugini Sep 11, 2023
b0add32
replace context Warn logger with BuilderLogger
alessio-perugini Sep 11, 2023
73ec654
replace context WriteStdout logger with BuilderLogger
alessio-perugini Sep 11, 2023
46aaac6
replace context WriteStderr logger with BuilderLogger
alessio-perugini Sep 11, 2023
1a7dc47
directly pass the BuilderLogger to RecipeByPrefixSuffixRunner func
alessio-perugini Sep 11, 2023
9f5bd52
directly pass the BuilderLogger to part2
alessio-perugini Sep 11, 2023
93d74de
directly pass the BuilderLogger to Linker func
alessio-perugini Sep 11, 2023
455ce61
directly pass the BuilderLogger to sizer.Size func
alessio-perugini Sep 11, 2023
ce5276c
remove Stdout, Stderr and stdlock from Context
alessio-perugini Sep 11, 2023
1dc6fcc
appease golint
alessio-perugini Sep 11, 2023
396faa8
add missinig license headers
alessio-perugini Sep 11, 2023
91419cf
remove WarningsLevel from context
alessio-perugini Sep 11, 2023
2ad132c
remove Verbose from context
alessio-perugini Sep 11, 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
appease golint
  • Loading branch information
alessio-perugini committed Sep 11, 2023
commit 1dc6fcceb3736a0817d6ea7accf17d59a8f00b9d
10 changes: 5 additions & 5 deletions arduino/builder/compilation/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ var tr = i18n.Tr

// Database keeps track of all the compile commands run by the builder
type Database struct {
Contents []CompilationCommand
Contents []Command
File *paths.Path
}

// CompilationCommand keeps track of a single run of a compile command
type CompilationCommand struct {
// Command keeps track of a single run of a compile command
type Command struct {
Directory string `json:"directory"`
Command string `json:"command,omitempty"`
Arguments []string `json:"arguments,omitempty"`
Expand All @@ -45,7 +45,7 @@ type CompilationCommand struct {
func NewDatabase(filename *paths.Path) *Database {
return &Database{
File: filename,
Contents: []CompilationCommand{},
Contents: []Command{},
}
}

Expand Down Expand Up @@ -83,7 +83,7 @@ func (db *Database) Add(target *paths.Path, command *executils.Process) {
commandDir = dir
}

entry := CompilationCommand{
entry := Command{
Directory: commandDir,
Arguments: command.GetArgs(),
File: target.String(),
Expand Down
1 change: 1 addition & 0 deletions arduino/builder/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func (b *Builder) CoreBuildCachePath() *paths.Path {
return b.coreBuildCachePath
}

// CoreBuilder fixdoc
func CoreBuilder(
buildPath, coreBuildPath, coreBuildCachePath *paths.Path,
buildProperties *properties.Map,
Expand Down
12 changes: 8 additions & 4 deletions arduino/builder/libraries.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ import (
"github.com/pkg/errors"
)

var FLOAT_ABI_CFLAG = "float-abi"
var FPU_CFLAG = "fpu"
// nolint
var (
FloatAbiCflag = "float-abi"
FpuCflag = "fpu"
)

// LibrariesBuilder fixdoc
func LibrariesBuilder(
librariesBuildPath *paths.Path,
buildProperties *properties.Map,
Expand Down Expand Up @@ -87,7 +91,7 @@ func findExpectedPrecompiledLibFolder(
command, _ := utils.PrepareCommandForRecipe(buildProperties, "recipe.cpp.o.pattern", true)
fpuSpecs := ""
for _, el := range command.GetArgs() {
if strings.Contains(el, FPU_CFLAG) {
if strings.Contains(el, FpuCflag) {
toAdd := strings.Split(el, "=")
if len(toAdd) > 1 {
fpuSpecs += strings.TrimSpace(toAdd[1]) + "-"
Expand All @@ -96,7 +100,7 @@ func findExpectedPrecompiledLibFolder(
}
}
for _, el := range command.GetArgs() {
if strings.Contains(el, FLOAT_ABI_CFLAG) {
if strings.Contains(el, FloatAbiCflag) {
toAdd := strings.Split(el, "=")
if len(toAdd) > 1 {
fpuSpecs += strings.TrimSpace(toAdd[1]) + "-"
Expand Down
1 change: 1 addition & 0 deletions arduino/builder/linker.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/pkg/errors"
)

// Linker fixdoc
func Linker(
onlyUpdateCompilationDatabase bool,
sketchObjectFiles, librariesObjectFiles, coreObjectsFiles paths.PathList,
Expand Down
1 change: 1 addition & 0 deletions arduino/builder/sketch.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ func writeIfDifferent(source []byte, destPath *paths.Path) error {
return nil
}

// SketchBuilder fixdoc
func SketchBuilder(
sketchBuildPath *paths.Path,
buildProperties *properties.Map,
Expand Down