@@ -85,7 +85,7 @@ func (handler *InoHandler) rebuildEnvironmentLoop() {
85
85
}
86
86
}
87
87
88
- func (handler * InoHandler ) generateBuildEnvironment () ( * paths.Path , error ) {
88
+ func (handler * InoHandler ) generateBuildEnvironment (buildPath * paths.Path ) error {
89
89
sketchDir := handler .sketchRoot
90
90
fqbn := handler .config .SelectedBoard .Fqbn
91
91
@@ -97,15 +97,15 @@ func (handler *InoHandler) generateBuildEnvironment() (*paths.Path, error) {
97
97
for uri , trackedFile := range handler .docs {
98
98
rel , err := paths .New (uri ).RelFrom (handler .sketchRoot )
99
99
if err != nil {
100
- return nil , errors .WithMessage (err , "dumping tracked files" )
100
+ return errors .WithMessage (err , "dumping tracked files" )
101
101
}
102
102
data .Overrides [rel .String ()] = trackedFile .Text
103
103
}
104
104
var overridesJSON * paths.Path
105
105
if jsonBytes , err := json .MarshalIndent (data , "" , " " ); err != nil {
106
- return nil , errors .WithMessage (err , "dumping tracked files" )
106
+ return errors .WithMessage (err , "dumping tracked files" )
107
107
} else if tmpFile , err := paths .WriteToTempFile (jsonBytes , nil , "" ); err != nil {
108
- return nil , errors .WithMessage (err , "dumping tracked files" )
108
+ return errors .WithMessage (err , "dumping tracked files" )
109
109
} else {
110
110
overridesJSON = tmpFile
111
111
defer tmpFile .Remove ()
@@ -118,21 +118,23 @@ func (handler *InoHandler) generateBuildEnvironment() (*paths.Path, error) {
118
118
"--only-compilation-database" ,
119
119
"--clean" ,
120
120
"--source-override" , overridesJSON .String (),
121
+ "--build-path" , buildPath .String (),
121
122
"--format" , "json" ,
122
123
sketchDir .String (),
123
124
}
124
125
cmd , err := executils .NewProcess (args ... )
125
126
if err != nil {
126
- return nil , errors .Errorf ("running %s: %s" , strings .Join (args , " " ), err )
127
+ return errors .Errorf ("running %s: %s" , strings .Join (args , " " ), err )
127
128
}
128
129
cmdOutput := & bytes.Buffer {}
129
130
cmd .RedirectStdoutTo (cmdOutput )
130
131
cmd .SetDirFromPath (sketchDir )
131
132
log .Println ("running: " , strings .Join (args , " " ))
132
133
if err := cmd .Run (); err != nil {
133
- return nil , errors .Errorf ("running %s: %s" , strings .Join (args , " " ), err )
134
+ return errors .Errorf ("running %s: %s" , strings .Join (args , " " ), err )
134
135
}
135
136
137
+ // Currently those values are not used, keeping here for future improvements
136
138
type cmdBuilderRes struct {
137
139
BuildPath * paths.Path `json:"build_path"`
138
140
UsedLibraries []* libraries.Library
@@ -145,9 +147,9 @@ func (handler *InoHandler) generateBuildEnvironment() (*paths.Path, error) {
145
147
}
146
148
var res cmdRes
147
149
if err := json .Unmarshal (cmdOutput .Bytes (), & res ); err != nil {
148
- return nil , errors .Errorf ("parsing arduino-cli output: %s" , err )
150
+ return errors .Errorf ("parsing arduino-cli output: %s" , err )
149
151
}
150
- // Return only the build path
151
152
log .Println ("arduino-cli output:" , cmdOutput )
152
- return res .BuilderResult .BuildPath , nil
153
+
154
+ return nil
153
155
}
0 commit comments