@@ -118,7 +118,7 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
118118 }
119119 builderCtx .UseCachedLibrariesResolution = req .GetSkipLibrariesDiscovery ()
120120 builderCtx .FQBN = fqbn
121- builderCtx .SketchLocation = sk . FullPath
121+ builderCtx .Sketch = sk
122122 builderCtx .ProgressCB = progressCB
123123
124124 // FIXME: This will be redundant when arduino-builder will be part of the cli
@@ -130,7 +130,7 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
130130 builderCtx .OtherLibrariesDirs .Add (configuration .LibrariesDir (configuration .Settings ))
131131 builderCtx .LibraryDirs = paths .NewPathList (req .Library ... )
132132 if req .GetBuildPath () == "" {
133- builderCtx .BuildPath = sk .BuildPath
133+ builderCtx .BuildPath = sk .DefaultBuildPath ()
134134 } else {
135135 builderCtx .BuildPath = paths .New (req .GetBuildPath ()).Canonical ()
136136 }
@@ -150,7 +150,6 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
150150
151151 // Optimize for debug
152152 builderCtx .OptimizeForDebug = req .GetOptimizeForDebug ()
153- builderCtx .CoreBuildCachePath = paths .TempDir ().Join ("arduino" , "cores" )
154153
155154 builderCtx .Jobs = int (req .GetJobs ())
156155
@@ -160,12 +159,17 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
160159 builderCtx .CustomBuildProperties = append (req .GetBuildProperties (), "build.warn_data_percentage=75" )
161160 builderCtx .CustomBuildProperties = append (req .GetBuildProperties (), securityKeysOverride ... )
162161
163- if req .GetBuildCachePath () != "" {
164- builderCtx .BuildCachePath = paths .New (req .GetBuildCachePath ())
165- err = builderCtx .BuildCachePath .MkdirAll ()
162+ if req .GetBuildCachePath () == "" {
163+ builderCtx .CoreBuildCachePath = paths .TempDir ().Join ("arduino" , "cores" )
164+ } else {
165+ buildCachePath , err := paths .New (req .GetBuildCachePath ()).Abs ()
166166 if err != nil {
167167 return nil , & arduino.PermissionDeniedError {Message : tr ("Cannot create build cache directory" ), Cause : err }
168168 }
169+ if err := buildCachePath .MkdirAll (); err != nil {
170+ return nil , & arduino.PermissionDeniedError {Message : tr ("Cannot create build cache directory" ), Cause : err }
171+ }
172+ builderCtx .CoreBuildCachePath = buildCachePath .Join ("core" )
169173 }
170174
171175 builderCtx .BuiltInLibrariesDirs = configuration .IDEBuiltinLibrariesDir (configuration .Settings )
0 commit comments