@@ -116,7 +116,7 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
116116 }
117117 builderCtx .UseCachedLibrariesResolution = req .GetSkipLibrariesDiscovery ()
118118 builderCtx .FQBN = fqbn
119- builderCtx .SketchLocation = sk . FullPath
119+ builderCtx .Sketch = sk
120120 builderCtx .ProgressCB = progressCB
121121
122122 // 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
128128 builderCtx .OtherLibrariesDirs .Add (configuration .LibrariesDir (configuration .Settings ))
129129 builderCtx .LibraryDirs = paths .NewPathList (req .Library ... )
130130 if req .GetBuildPath () == "" {
131- builderCtx .BuildPath = sk .BuildPath
131+ builderCtx .BuildPath = sk .DefaultBuildPath ()
132132 } else {
133133 builderCtx .BuildPath = paths .New (req .GetBuildPath ()).Canonical ()
134134 }
@@ -144,8 +144,6 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
144144 // Optimize for debug
145145 builderCtx .OptimizeForDebug = req .GetOptimizeForDebug ()
146146
147- builderCtx .CoreBuildCachePath = paths .TempDir ().Join ("arduino" , "core-cache" )
148-
149147 builderCtx .Jobs = int (req .GetJobs ())
150148
151149 builderCtx .USBVidPid = req .GetVidPid ()
@@ -154,12 +152,17 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
154152 builderCtx .CustomBuildProperties = append (req .GetBuildProperties (), "build.warn_data_percentage=75" )
155153 builderCtx .CustomBuildProperties = append (req .GetBuildProperties (), securityKeysOverride ... )
156154
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 ()
160159 if err != nil {
161160 return nil , & arduino.PermissionDeniedError {Message : tr ("Cannot create build cache directory" ), Cause : err }
162161 }
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" )
163166 }
164167
165168 builderCtx .BuiltInLibrariesDirs = configuration .IDEBuiltinLibrariesDir (configuration .Settings )
0 commit comments