Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
8 changes: 4 additions & 4 deletions arduino/builder/compilation_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"encoding/json"
"fmt"
"os"
"os/exec"

"github.com/arduino/arduino-cli/executils"
"github.com/arduino/go-paths-helper"
)

Expand Down Expand Up @@ -68,8 +68,8 @@ func (db *CompilationDatabase) SaveToFile() {
}

// Add adds a new CompilationDatabase entry
func (db *CompilationDatabase) Add(target *paths.Path, command *exec.Cmd) {
commandDir := command.Dir
func (db *CompilationDatabase) Add(target *paths.Path, command *executils.Process) {
commandDir := command.GetDir()
if commandDir == "" {
// This mimics what Cmd.Run also does: Use Dir if specified,
// current directory otherwise
Expand All @@ -82,7 +82,7 @@ func (db *CompilationDatabase) Add(target *paths.Path, command *exec.Cmd) {

entry := CompilationCommand{
Directory: commandDir,
Arguments: command.Args,
Arguments: command.GetArgs(),
File: target.String(),
}

Expand Down
5 changes: 3 additions & 2 deletions arduino/builder/compilation_database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
package builder

import (
"os/exec"
"testing"

"github.com/arduino/arduino-cli/executils"
"github.com/arduino/go-paths-helper"
"github.com/stretchr/testify/require"
)
Expand All @@ -28,7 +28,8 @@ func TestCompilationDatabase(t *testing.T) {
require.NoError(t, err)
defer tmpfile.Remove()

cmd := exec.Command("gcc", "arg1", "arg2")
cmd, err := executils.NewProcess(nil, "gcc", "arg1", "arg2")
require.NoError(t, err)
db := NewCompilationDatabase(tmpfile)
db.Add(paths.New("test"), cmd)
db.SaveToFile()
Expand Down
5 changes: 5 additions & 0 deletions arduino/builder/cpp/cpp.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,8 @@ func ParseString(line string) (string, string, bool) {
i += width
}
}

// WrapWithHyphenI fixdoc
func WrapWithHyphenI(value string) string {
return "\"-I" + value + "\""
}
Loading