@@ -48,10 +48,15 @@ var tr = i18n.Tr
48
48
// Compile FIXMEDOC
49
49
func Compile (ctx context.Context , req * rpc.CompileRequest , outStream , errStream io.Writer , progressCB commands.TaskProgressCB , debug bool ) (r * rpc.CompileResponse , e error ) {
50
50
51
+ instance := commands .GetInstance (req .GetInstance ().GetId ())
52
+ if instance == nil {
53
+ return nil , & arduino.InvalidInstanceError {}
54
+ }
55
+
51
56
// There is a binding between the export binaries setting and the CLI flag to explicitly set it,
52
57
// since we want this binding to work also for the gRPC interface we must read it here in this
53
58
// package instead of the cli/compile one, otherwise we'd lose the binding.
54
- exportBinaries := configuration .Settings .GetBool ("sketch.always_export_binaries" )
59
+ exportBinaries := instance .Settings .GetBool ("sketch.always_export_binaries" )
55
60
// If we'd just read the binding in any case, even if the request sets the export binaries setting,
56
61
// the settings value would always overwrite the request one and it wouldn't have any effect
57
62
// setting it for individual requests. To solve this we use a wrapper.BoolValue to handle
@@ -135,11 +140,11 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
135
140
builderCtx .ProgressCB = progressCB
136
141
137
142
// FIXME: This will be redundant when arduino-builder will be part of the cli
138
- builderCtx .HardwareDirs = configuration .HardwareDirectories (configuration .Settings )
139
- builderCtx .BuiltInToolsDirs = configuration .BundleToolsDirectories (configuration .Settings )
143
+ builderCtx .HardwareDirs = configuration .HardwareDirectories (instance .Settings )
144
+ builderCtx .BuiltInToolsDirs = configuration .BundleToolsDirectories (instance .Settings )
140
145
141
146
builderCtx .OtherLibrariesDirs = paths .NewPathList (req .GetLibraries ()... )
142
- builderCtx .OtherLibrariesDirs .Add (configuration .LibrariesDir (configuration .Settings ))
147
+ builderCtx .OtherLibrariesDirs .Add (configuration .LibrariesDir (instance .Settings ))
143
148
144
149
builderCtx .LibraryDirs = paths .NewPathList (req .Library ... )
145
150
@@ -187,7 +192,7 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
187
192
builderCtx .ArduinoAPIVersion = "10607"
188
193
189
194
// Check if Arduino IDE is installed and get it's libraries location.
190
- dataDir := paths .New (configuration .Settings .GetString ("directories.Data" ))
195
+ dataDir := paths .New (instance .Settings .GetString ("directories.Data" ))
191
196
preferencesTxt := dataDir .Join ("preferences.txt" )
192
197
ideProperties , err := properties .LoadFromPath (preferencesTxt )
193
198
if err == nil {
0 commit comments