@@ -118,7 +118,7 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
118
118
}
119
119
builderCtx .UseCachedLibrariesResolution = req .GetSkipLibrariesDiscovery ()
120
120
builderCtx .FQBN = fqbn
121
- builderCtx .SketchLocation = sk . FullPath
121
+ builderCtx .Sketch = sk
122
122
builderCtx .ProgressCB = progressCB
123
123
124
124
// 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
130
130
builderCtx .OtherLibrariesDirs .Add (configuration .LibrariesDir (configuration .Settings ))
131
131
builderCtx .LibraryDirs = paths .NewPathList (req .Library ... )
132
132
if req .GetBuildPath () == "" {
133
- builderCtx .BuildPath = sk .BuildPath
133
+ builderCtx .BuildPath = sk .DefaultBuildPath ()
134
134
} else {
135
135
builderCtx .BuildPath = paths .New (req .GetBuildPath ()).Canonical ()
136
136
}
@@ -150,7 +150,6 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
150
150
151
151
// Optimize for debug
152
152
builderCtx .OptimizeForDebug = req .GetOptimizeForDebug ()
153
- builderCtx .CoreBuildCachePath = paths .TempDir ().Join ("arduino" , "cores" )
154
153
155
154
builderCtx .Jobs = int (req .GetJobs ())
156
155
@@ -160,12 +159,17 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
160
159
builderCtx .CustomBuildProperties = append (req .GetBuildProperties (), "build.warn_data_percentage=75" )
161
160
builderCtx .CustomBuildProperties = append (req .GetBuildProperties (), securityKeysOverride ... )
162
161
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 ()
166
166
if err != nil {
167
167
return nil , & arduino.PermissionDeniedError {Message : tr ("Cannot create build cache directory" ), Cause : err }
168
168
}
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" )
169
173
}
170
174
171
175
builderCtx .BuiltInLibrariesDirs = configuration .IDEBuiltinLibrariesDir (configuration .Settings )
0 commit comments