Skip to content

Commit 264f5b4

Browse files
committed
Updated docs and fixed semantics of GetBuildCacheExtraPaths method
1 parent 8acaade commit 264f5b4

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

commands/service_compile.go

+3
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,9 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
201201
} else {
202202
extraCoreBuildCachePaths = paths.NewPathList(req.GetBuildCacheExtraPaths()...)
203203
}
204+
for i, p := range extraCoreBuildCachePaths {
205+
extraCoreBuildCachePaths[i] = p.Join("cores")
206+
}
204207

205208
if _, err := pme.FindToolsRequiredForBuild(targetPlatform, buildPlatform); err != nil {
206209
return err

docs/UPGRADING.md

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ Here you can find a list of migration guides to handle breaking changes between
44

55
## 1.0.0
66

7+
### `compile --build-cache-path` slightly changed directory format
8+
9+
Now compiled cores are cached under the `cores` subdir of the path specified in `--build-cache-path`, previously it was
10+
saved under the `core` subdir. The new behaviour is coherent with the default cache directory `/tmp/arduino/cores/...`
11+
when the cache directory is not set by the user.
12+
713
### Configuration file now supports only YAML format.
814

915
The Arduino CLI configuration file now supports only the YAML format.

docs/configuration.md

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
- `updater` - configuration options related to Arduino CLI updates
3636
- `enable_notification` - set to `false` to disable notifications of new Arduino CLI releases, defaults to `true`
3737
- `build_cache` configuration options related to the compilation cache
38+
- `path` - the path to the build cache, default is `$TMP/arduino`.
39+
- `extra_paths` - a list of paths to look for precompiled artifacts if not found on `build_cache.path` setting.
3840
- `compilations_before_purge` - interval, in number of compilations, at which the cache is purged, defaults to `10`.
3941
When `0` the cache is never purged.
4042
- `ttl` - cache expiration time of build folders. If the cache is hit by a compilation the corresponding build files

internal/cli/configuration/build_cache.go

+4-6
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,12 @@ func (s *Settings) GetBuildCachePath() (*paths.Path, bool) {
4646
return paths.New(p), true
4747
}
4848

49-
// GetBuildCacheExtraPaths returns the extra paths to the core build cache.
50-
// Those paths are visited before the main core build cache to check for cached items.
49+
// GetBuildCacheExtraPaths returns the extra paths to the build cache.
50+
// Those paths are visited to look for precompiled items if not found elsewhere.
5151
func (s *Settings) GetBuildCacheExtraPaths() paths.PathList {
5252
var res paths.PathList
53-
if ps, ok, _ := s.GetStringSliceOk("build_cache.extra_paths"); ok {
54-
for _, p := range ps {
55-
res.Add(paths.New(p, "cores"))
56-
}
53+
if p, ok, _ := s.GetStringSliceOk("build_cache.extra_paths"); ok {
54+
return paths.NewPathList(p...)
5755
}
5856
return res
5957
}

0 commit comments

Comments
 (0)