@@ -116,7 +116,7 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
116
116
}
117
117
builderCtx .UseCachedLibrariesResolution = req .GetSkipLibrariesDiscovery ()
118
118
builderCtx .FQBN = fqbn
119
- builderCtx .SketchLocation = sk . FullPath
119
+ builderCtx .Sketch = sk
120
120
builderCtx .ProgressCB = progressCB
121
121
122
122
// FIXME: This will be redundant when arduino-builder will be part of the cli
@@ -128,7 +128,7 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
128
128
builderCtx .OtherLibrariesDirs .Add (configuration .LibrariesDir (configuration .Settings ))
129
129
builderCtx .LibraryDirs = paths .NewPathList (req .Library ... )
130
130
if req .GetBuildPath () == "" {
131
- builderCtx .BuildPath = sk .BuildPath
131
+ builderCtx .BuildPath = sk .DefaultBuildPath ()
132
132
} else {
133
133
builderCtx .BuildPath = paths .New (req .GetBuildPath ()).Canonical ()
134
134
}
@@ -144,8 +144,6 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
144
144
// Optimize for debug
145
145
builderCtx .OptimizeForDebug = req .GetOptimizeForDebug ()
146
146
147
- builderCtx .CoreBuildCachePath = paths .TempDir ().Join ("arduino" , "core-cache" )
148
-
149
147
builderCtx .Jobs = int (req .GetJobs ())
150
148
151
149
builderCtx .USBVidPid = req .GetVidPid ()
@@ -154,12 +152,17 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
154
152
builderCtx .CustomBuildProperties = append (req .GetBuildProperties (), "build.warn_data_percentage=75" )
155
153
builderCtx .CustomBuildProperties = append (req .GetBuildProperties (), securityKeysOverride ... )
156
154
157
- if req .GetBuildCachePath () != "" {
158
- builderCtx .BuildCachePath = paths .New (req .GetBuildCachePath ())
159
- err = builderCtx .BuildCachePath .MkdirAll ()
155
+ if req .GetBuildCachePath () == "" {
156
+ builderCtx .CoreBuildCachePath = paths .TempDir ().Join ("arduino" , "core-cache" )
157
+ } else {
158
+ buildCachePath , err := paths .New (req .GetBuildCachePath ()).Abs ()
160
159
if err != nil {
161
160
return nil , & arduino.PermissionDeniedError {Message : tr ("Cannot create build cache directory" ), Cause : err }
162
161
}
162
+ if err := buildCachePath .MkdirAll (); err != nil {
163
+ return nil , & arduino.PermissionDeniedError {Message : tr ("Cannot create build cache directory" ), Cause : err }
164
+ }
165
+ builderCtx .CoreBuildCachePath = buildCachePath .Join ("core" )
163
166
}
164
167
165
168
builderCtx .BuiltInLibrariesDirs = configuration .IDEBuiltinLibrariesDir (configuration .Settings )
0 commit comments