From 8b364d8039e6c6acfa86ad1e021ce37d5d8e56f9 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 24 May 2024 14:25:22 +0200 Subject: [PATCH 01/10] Small refactoring of compileCore function This change helps to better understand next commits. --- internal/arduino/builder/core.go | 38 +++++++++++++++++--------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/internal/arduino/builder/core.go b/internal/arduino/builder/core.go index f19169f8990..4a8105a25e6 100644 --- a/internal/arduino/builder/core.go +++ b/internal/arduino/builder/core.go @@ -89,28 +89,30 @@ func (b *Builder) compileCore() (*paths.Path, paths.PathList, error) { b.buildProperties.Get("compiler.optimization_flags"), realCoreFolder, ) - targetArchivedCore = b.coreBuildCachePath.Join(archivedCoreName, "core.a") - if _, err := buildcache.New(b.coreBuildCachePath).GetOrCreate(archivedCoreName); errors.Is(err, buildcache.CreateDirErr) { - return nil, nil, errors.New(i18n.Tr("creating core cache folder: %s", err)) + canUseArchivedCore := func(archivedCore *paths.Path) bool { + if b.onlyUpdateCompilationDatabase || b.clean { + return false + } + if isOlder, err := utils.DirContentIsOlderThan(realCoreFolder, archivedCore); err != nil || !isOlder { + // Recreate the archive if ANY of the core files (including platform.txt) has changed + return false + } + if targetCoreFolder == nil || realCoreFolder.EquivalentTo(targetCoreFolder) { + return true + } + if isOlder, err := utils.DirContentIsOlderThan(targetCoreFolder, archivedCore); err != nil || !isOlder { + // Recreate the archive if ANY of the build core files (including platform.txt) has changed + return false + } + return true } - var canUseArchivedCore bool - if b.onlyUpdateCompilationDatabase || b.clean { - canUseArchivedCore = false - } else if isOlder, err := utils.DirContentIsOlderThan(realCoreFolder, targetArchivedCore); err != nil || !isOlder { - // Recreate the archive if ANY of the core files (including platform.txt) has changed - canUseArchivedCore = false - } else if targetCoreFolder == nil || realCoreFolder.EquivalentTo(targetCoreFolder) { - canUseArchivedCore = true - } else if isOlder, err := utils.DirContentIsOlderThan(targetCoreFolder, targetArchivedCore); err != nil || !isOlder { - // Recreate the archive if ANY of the build core files (including platform.txt) has changed - canUseArchivedCore = false - } else { - canUseArchivedCore = true + if _, err := buildcache.New(b.coreBuildCachePath).GetOrCreate(archivedCoreName); errors.Is(err, buildcache.CreateDirErr) { + return nil, nil, errors.New(i18n.Tr("creating core cache folder: %s", err)) } - - if canUseArchivedCore { + targetArchivedCore = b.coreBuildCachePath.Join(archivedCoreName, "core.a") + if canUseArchivedCore(targetArchivedCore) { // use archived core if b.logger.Verbose() { b.logger.Info(i18n.Tr("Using precompiled core: %[1]s", targetArchivedCore)) From 8687f9d038ba601af336180dda4c81339b20788a Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 24 May 2024 15:58:24 +0200 Subject: [PATCH 02/10] Added possibility to set extra build-cache dirs for cores --- commands/service_compile.go | 7 + internal/arduino/builder/builder.go | 5 +- internal/arduino/builder/core.go | 14 ++ internal/cli/configuration/build_cache.go | 27 ++- internal/cli/configuration/defaults.go | 2 + rpc/cc/arduino/cli/commands/v1/compile.pb.go | 215 ++++++++++--------- rpc/cc/arduino/cli/commands/v1/compile.proto | 3 + 7 files changed, 170 insertions(+), 103 deletions(-) diff --git a/commands/service_compile.go b/commands/service_compile.go index 3dbc4e3fbc7..0fca53c2f74 100644 --- a/commands/service_compile.go +++ b/commands/service_compile.go @@ -191,6 +191,12 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu } coreBuildCachePath = buildCachePath.Join("core") } + var extraCoreBuildCachePaths paths.PathList + if len(req.GetBuildCacheExtraPaths()) == 0 { + extraCoreBuildCachePaths = s.settings.GetBuildCacheExtraPaths() + } else { + extraCoreBuildCachePaths = paths.NewPathList(req.GetBuildCacheExtraPaths()...) + } if _, err := pme.FindToolsRequiredForBuild(targetPlatform, buildPlatform); err != nil { return err @@ -229,6 +235,7 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu buildPath, req.GetOptimizeForDebug(), coreBuildCachePath, + extraCoreBuildCachePaths, int(req.GetJobs()), req.GetBuildProperties(), s.settings.HardwareDirectories(), diff --git a/internal/arduino/builder/builder.go b/internal/arduino/builder/builder.go index d5ab7b35135..608baead6ee 100644 --- a/internal/arduino/builder/builder.go +++ b/internal/arduino/builder/builder.go @@ -62,7 +62,8 @@ type Builder struct { customBuildProperties []string // core related - coreBuildCachePath *paths.Path + coreBuildCachePath *paths.Path + extraCoreBuildCachePaths paths.PathList logger *logger.BuilderLogger clean bool @@ -121,6 +122,7 @@ func NewBuilder( buildPath *paths.Path, optimizeForDebug bool, coreBuildCachePath *paths.Path, + extraCoreBuildCachePaths paths.PathList, jobs int, requestBuildProperties []string, hardwareDirs, otherLibrariesDirs paths.PathList, @@ -211,6 +213,7 @@ func NewBuilder( jobs: jobs, customBuildProperties: customBuildPropertiesArgs, coreBuildCachePath: coreBuildCachePath, + extraCoreBuildCachePaths: extraCoreBuildCachePaths, logger: logger, clean: clean, sourceOverrides: sourceOverrides, diff --git a/internal/arduino/builder/core.go b/internal/arduino/builder/core.go index 4a8105a25e6..a21dca94032 100644 --- a/internal/arduino/builder/core.go +++ b/internal/arduino/builder/core.go @@ -108,6 +108,7 @@ func (b *Builder) compileCore() (*paths.Path, paths.PathList, error) { return true } + // If there is an archived core in the current build cache, use it if _, err := buildcache.New(b.coreBuildCachePath).GetOrCreate(archivedCoreName); errors.Is(err, buildcache.CreateDirErr) { return nil, nil, errors.New(i18n.Tr("creating core cache folder: %s", err)) } @@ -119,6 +120,19 @@ func (b *Builder) compileCore() (*paths.Path, paths.PathList, error) { } return targetArchivedCore, variantObjectFiles, nil } + + // Otherwise try the extra build cache paths to see if there is a precompiled core + // that can be used + for _, extraCoreBuildCachePath := range b.extraCoreBuildCachePaths { + extraTargetArchivedCore := extraCoreBuildCachePath.Join(archivedCoreName, "core.a") + if canUseArchivedCore(extraTargetArchivedCore) { + // use archived core + if b.logger.Verbose() { + b.logger.Info(i18n.Tr("Using precompiled core: %[1]s", extraTargetArchivedCore)) + } + return extraTargetArchivedCore, variantObjectFiles, nil + } + } } coreObjectFiles, err := b.compileFiles( diff --git a/internal/cli/configuration/build_cache.go b/internal/cli/configuration/build_cache.go index a4bca322307..b790e18c2b2 100644 --- a/internal/cli/configuration/build_cache.go +++ b/internal/cli/configuration/build_cache.go @@ -15,7 +15,11 @@ package configuration -import "time" +import ( + "time" + + "github.com/arduino/go-paths-helper" +) // GetCompilationsBeforeBuildCachePurge returns the number of compilations before the build cache is purged. func (s *Settings) GetCompilationsBeforeBuildCachePurge() uint { @@ -32,3 +36,24 @@ func (s *Settings) GetBuildCacheTTL() time.Duration { } return s.Defaults.GetDuration("build_cache.ttl") } + +// GetBuildCachePath returns the path to the build cache. +func (s *Settings) GetBuildCachePath() (*paths.Path, bool) { + p, ok, _ := s.GetStringOk("build_cache.path") + if !ok { + return nil, false + } + return paths.New(p), true +} + +// GetBuildCacheExtraPaths returns the extra paths to the core build cache. +// Those paths are visited before the main core build cache to check for cached items. +func (s *Settings) GetBuildCacheExtraPaths() paths.PathList { + var res paths.PathList + if ps, ok, _ := s.GetStringSliceOk("build_cache.extra_paths"); ok { + for _, p := range ps { + res.Add(paths.New(p, "cores")) + } + } + return res +} diff --git a/internal/cli/configuration/defaults.go b/internal/cli/configuration/defaults.go index 8c05b793d19..953bd4762f5 100644 --- a/internal/cli/configuration/defaults.go +++ b/internal/cli/configuration/defaults.go @@ -52,6 +52,8 @@ func SetDefaults(settings *Settings) { setDefaultValueAndKeyTypeSchema("sketch.always_export_binaries", false) setDefaultValueAndKeyTypeSchema("build_cache.ttl", (time.Hour * 24 * 30).String()) setDefaultValueAndKeyTypeSchema("build_cache.compilations_before_purge", uint(10)) + setKeyTypeSchema("build_cache.path", "") + setKeyTypeSchema("build_cache.extra_paths", []string{}) // daemon settings setDefaultValueAndKeyTypeSchema("daemon.port", "50051") diff --git a/rpc/cc/arduino/cli/commands/v1/compile.pb.go b/rpc/cc/arduino/cli/commands/v1/compile.pb.go index f71c4b5b2f1..c0eb2bad757 100644 --- a/rpc/cc/arduino/cli/commands/v1/compile.pb.go +++ b/rpc/cc/arduino/cli/commands/v1/compile.pb.go @@ -110,6 +110,9 @@ type CompileRequest struct { // If set to true the returned build properties will be left unexpanded, with // the variables placeholders exactly as defined in the platform. DoNotExpandBuildProperties bool `protobuf:"varint,29,opt,name=do_not_expand_build_properties,json=doNotExpandBuildProperties,proto3" json:"do_not_expand_build_properties,omitempty"` + // Search for precompiled cores in the given paths and use them if found. + // This search is performed before the standard build_cache directory. + BuildCacheExtraPaths []string `protobuf:"bytes,30,rep,name=build_cache_extra_paths,json=buildCacheExtraPaths,proto3" json:"build_cache_extra_paths,omitempty"` } func (x *CompileRequest) Reset() { @@ -319,6 +322,13 @@ func (x *CompileRequest) GetDoNotExpandBuildProperties() bool { return false } +func (x *CompileRequest) GetBuildCacheExtraPaths() []string { + if x != nil { + return x.BuildCacheExtraPaths + } + return nil +} + type CompileResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -901,7 +911,7 @@ var file_cc_arduino_cli_commands_v1_compile_proto_rawDesc = []byte{ 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x24, 0x63, 0x63, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2f, 0x63, 0x6c, 0x69, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x6c, 0x69, 0x62, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd5, 0x08, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8c, 0x09, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x40, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, @@ -965,108 +975,111 @@ var file_cc_arduino_cli_commands_v1_compile_proto_rawDesc = []byte{ 0x61, 0x6e, 0x64, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x1d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x1a, 0x64, 0x6f, 0x4e, 0x6f, 0x74, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x50, 0x72, 0x6f, 0x70, - 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x1a, 0x41, 0x0a, 0x13, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, - 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, - 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x65, 0x78, - 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x69, 0x65, 0x73, 0x22, 0xeb, 0x01, - 0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x1f, 0x0a, 0x0a, 0x6f, 0x75, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x09, 0x6f, 0x75, 0x74, 0x53, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x12, 0x1f, 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x09, 0x65, 0x72, 0x72, 0x53, 0x74, 0x72, - 0x65, 0x61, 0x6d, 0x12, 0x46, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, - 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x48, - 0x00, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x12, 0x43, 0x0a, 0x06, 0x72, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, 0x63, - 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, - 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, - 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x48, 0x00, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x24, 0x0a, 0x22, 0x49, - 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x4e, 0x65, 0x65, 0x64, 0x73, 0x52, 0x65, 0x69, 0x6e, - 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, - 0x72, 0x22, 0xa1, 0x04, 0x0a, 0x0d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x70, 0x61, 0x74, - 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x50, 0x61, - 0x74, 0x68, 0x12, 0x4a, 0x0a, 0x0e, 0x75, 0x73, 0x65, 0x64, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, - 0x72, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x63, 0x63, 0x2e, - 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, - 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, - 0x0d, 0x75, 0x73, 0x65, 0x64, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x12, 0x6b, - 0x0a, 0x18, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x73, 0x65, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x31, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, - 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, - 0x65, 0x63, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, - 0x69, 0x7a, 0x65, 0x52, 0x16, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x53, - 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x5d, 0x0a, 0x0e, 0x62, - 0x6f, 0x61, 0x72, 0x64, 0x5f, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, - 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, - 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, - 0x72, 0x6d, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x61, - 0x72, 0x64, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x5d, 0x0a, 0x0e, 0x62, 0x75, - 0x69, 0x6c, 0x64, 0x5f, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, + 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, 0x35, 0x0a, 0x17, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, + 0x63, 0x61, 0x63, 0x68, 0x65, 0x5f, 0x65, 0x78, 0x74, 0x72, 0x61, 0x5f, 0x70, 0x61, 0x74, 0x68, + 0x73, 0x18, 0x1e, 0x20, 0x03, 0x28, 0x09, 0x52, 0x14, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x43, 0x61, + 0x63, 0x68, 0x65, 0x45, 0x78, 0x74, 0x72, 0x61, 0x50, 0x61, 0x74, 0x68, 0x73, 0x1a, 0x41, 0x0a, + 0x13, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, + 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x62, 0x69, 0x6e, 0x61, + 0x72, 0x69, 0x65, 0x73, 0x22, 0xeb, 0x01, 0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0a, 0x6f, 0x75, 0x74, 0x5f, + 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x09, + 0x6f, 0x75, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x1f, 0x0a, 0x0a, 0x65, 0x72, 0x72, + 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, + 0x09, 0x65, 0x72, 0x72, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x46, 0x0a, 0x08, 0x70, 0x72, + 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x63, + 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, + 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x50, 0x72, + 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x48, 0x00, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, + 0x73, 0x73, 0x12, 0x43, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, - 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, - 0x6d, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x0d, 0x62, 0x75, 0x69, 0x6c, - 0x64, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x29, 0x0a, 0x10, 0x62, 0x75, 0x69, - 0x6c, 0x64, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x07, 0x20, - 0x03, 0x28, 0x09, 0x52, 0x0f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, - 0x74, 0x69, 0x65, 0x73, 0x12, 0x4f, 0x0a, 0x0b, 0x64, 0x69, 0x61, 0x67, 0x6e, 0x6f, 0x73, 0x74, - 0x69, 0x63, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x63, 0x2e, 0x61, + 0x42, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x48, 0x00, 0x52, + 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x22, 0x24, 0x0a, 0x22, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x4e, 0x65, + 0x65, 0x64, 0x73, 0x52, 0x65, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, 0xa1, 0x04, 0x0a, 0x0d, 0x42, 0x75, 0x69, + 0x6c, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x75, + 0x69, 0x6c, 0x64, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x62, 0x75, 0x69, 0x6c, 0x64, 0x50, 0x61, 0x74, 0x68, 0x12, 0x4a, 0x0a, 0x0e, 0x75, 0x73, 0x65, + 0x64, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x23, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, + 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, + 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x0d, 0x75, 0x73, 0x65, 0x64, 0x4c, 0x69, 0x62, 0x72, + 0x61, 0x72, 0x69, 0x65, 0x73, 0x12, 0x6b, 0x0a, 0x18, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x61, + 0x62, 0x6c, 0x65, 0x5f, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5f, 0x73, 0x69, 0x7a, + 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, + 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, + 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x53, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x69, 0x7a, 0x65, 0x52, 0x16, 0x65, 0x78, 0x65, 0x63, + 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x53, 0x69, + 0x7a, 0x65, 0x12, 0x5d, 0x0a, 0x0e, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x5f, 0x70, 0x6c, 0x61, 0x74, + 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x63, 0x63, 0x2e, + 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, + 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, + 0x64, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, + 0x63, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, + 0x6d, 0x12, 0x5d, 0x0a, 0x0e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x70, 0x6c, 0x61, 0x74, 0x66, + 0x6f, 0x72, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, - 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x44, 0x69, - 0x61, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x52, 0x0b, 0x64, 0x69, 0x61, 0x67, 0x6e, 0x6f, - 0x73, 0x74, 0x69, 0x63, 0x73, 0x22, 0x5a, 0x0a, 0x15, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x61, - 0x62, 0x6c, 0x65, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x12, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x5f, 0x73, 0x69, - 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x53, 0x69, 0x7a, - 0x65, 0x22, 0xa2, 0x02, 0x0a, 0x11, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x44, 0x69, 0x61, - 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x76, 0x65, 0x72, - 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x76, 0x65, 0x72, - 0x69, 0x74, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, - 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x69, 0x6c, - 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, 0x4e, 0x0a, - 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x34, - 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, - 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x70, - 0x69, 0x6c, 0x65, 0x44, 0x69, 0x61, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x43, 0x6f, 0x6e, - 0x74, 0x65, 0x78, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x47, 0x0a, - 0x05, 0x6e, 0x6f, 0x74, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x63, - 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, - 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, - 0x65, 0x44, 0x69, 0x61, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x4e, 0x6f, 0x74, 0x65, 0x52, - 0x05, 0x6e, 0x6f, 0x74, 0x65, 0x73, 0x22, 0x74, 0x0a, 0x18, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, - 0x65, 0x44, 0x69, 0x61, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x43, 0x6f, 0x6e, 0x74, 0x65, - 0x78, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, - 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, - 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, - 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x22, 0x71, 0x0a, 0x15, - 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x44, 0x69, 0x61, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, - 0x63, 0x4e, 0x6f, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, - 0x12, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, - 0x69, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, - 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x42, - 0x48, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x72, - 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2d, 0x63, 0x6c, - 0x69, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x63, 0x63, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, - 0x2f, 0x63, 0x6c, 0x69, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2f, 0x76, 0x31, - 0x3b, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, + 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, + 0x65, 0x52, 0x0d, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, + 0x12, 0x29, 0x0a, 0x10, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, + 0x74, 0x69, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x62, 0x75, 0x69, 0x6c, + 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, 0x4f, 0x0a, 0x0b, 0x64, + 0x69, 0x61, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x2d, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, + 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, + 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x44, 0x69, 0x61, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x52, + 0x0b, 0x64, 0x69, 0x61, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x73, 0x22, 0x5a, 0x0a, 0x15, + 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x19, 0x0a, + 0x08, 0x6d, 0x61, 0x78, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x07, 0x6d, 0x61, 0x78, 0x53, 0x69, 0x7a, 0x65, 0x22, 0xa2, 0x02, 0x0a, 0x11, 0x43, 0x6f, 0x6d, + 0x70, 0x69, 0x6c, 0x65, 0x44, 0x69, 0x61, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x12, 0x1a, + 0x0a, 0x08, 0x73, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x73, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x16, 0x0a, 0x06, + 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x63, 0x6f, + 0x6c, 0x75, 0x6d, 0x6e, 0x12, 0x4e, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, + 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, + 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, + 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x44, 0x69, 0x61, 0x67, 0x6e, 0x6f, + 0x73, 0x74, 0x69, 0x63, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, + 0x74, 0x65, 0x78, 0x74, 0x12, 0x47, 0x0a, 0x05, 0x6e, 0x6f, 0x74, 0x65, 0x73, 0x18, 0x07, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, + 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, + 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x44, 0x69, 0x61, 0x67, 0x6e, 0x6f, 0x73, 0x74, + 0x69, 0x63, 0x4e, 0x6f, 0x74, 0x65, 0x52, 0x05, 0x6e, 0x6f, 0x74, 0x65, 0x73, 0x22, 0x74, 0x0a, + 0x18, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x44, 0x69, 0x61, 0x67, 0x6e, 0x6f, 0x73, 0x74, + 0x69, 0x63, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, + 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x63, 0x6f, 0x6c, + 0x75, 0x6d, 0x6e, 0x22, 0x71, 0x0a, 0x15, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x44, 0x69, + 0x61, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x4e, 0x6f, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, + 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x16, + 0x0a, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, + 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x42, 0x48, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x72, 0x64, + 0x75, 0x69, 0x6e, 0x6f, 0x2d, 0x63, 0x6c, 0x69, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x63, 0x63, 0x2f, + 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2f, 0x63, 0x6c, 0x69, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, + 0x61, 0x6e, 0x64, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/rpc/cc/arduino/cli/commands/v1/compile.proto b/rpc/cc/arduino/cli/commands/v1/compile.proto index ee86ea2fe45..ea060453e00 100644 --- a/rpc/cc/arduino/cli/commands/v1/compile.proto +++ b/rpc/cc/arduino/cli/commands/v1/compile.proto @@ -93,6 +93,9 @@ message CompileRequest { // If set to true the returned build properties will be left unexpanded, with // the variables placeholders exactly as defined in the platform. bool do_not_expand_build_properties = 29; + // Search for precompiled cores in the given paths and use them if found. + // This search is performed before the standard build_cache directory. + repeated string build_cache_extra_paths = 30; } message CompileResponse { From 1b6d3edb39f7458e596e4ca42fc64350115534e4 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 24 May 2024 16:39:11 +0200 Subject: [PATCH 03/10] [breaking] --build-cache-path now saves under 'cores' subdir instead of 'core' --- commands/service_compile.go | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/commands/service_compile.go b/commands/service_compile.go index 0fca53c2f74..e7b4f739232 100644 --- a/commands/service_compile.go +++ b/commands/service_compile.go @@ -178,19 +178,23 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu s.settings.GetCompilationsBeforeBuildCachePurge(), s.settings.GetBuildCacheTTL().Abs()) - var coreBuildCachePath *paths.Path - if req.GetBuildCachePath() == "" { - coreBuildCachePath = paths.TempDir().Join("arduino", "cores") - } else { - buildCachePath, err := paths.New(req.GetBuildCachePath()).Abs() + var buildCachePath *paths.Path + if req.GetBuildCachePath() != "" { + p, err := paths.New(req.GetBuildCachePath()).Abs() if err != nil { return &cmderrors.PermissionDeniedError{Message: i18n.Tr("Cannot create build cache directory"), Cause: err} } - if err := buildCachePath.MkdirAll(); err != nil { - return &cmderrors.PermissionDeniedError{Message: i18n.Tr("Cannot create build cache directory"), Cause: err} - } - coreBuildCachePath = buildCachePath.Join("core") + buildCachePath = p + } else if p, ok := s.settings.GetBuildCachePath(); ok { + buildCachePath = p + } else { + buildCachePath = paths.TempDir().Join("arduino") + } + if err := buildCachePath.MkdirAll(); err != nil { + return &cmderrors.PermissionDeniedError{Message: i18n.Tr("Cannot create build cache directory"), Cause: err} } + coreBuildCachePath := buildCachePath.Join("cores") + var extraCoreBuildCachePaths paths.PathList if len(req.GetBuildCacheExtraPaths()) == 0 { extraCoreBuildCachePaths = s.settings.GetBuildCacheExtraPaths() From 8acaadeddb35a78a116e88657275406a65ede75c Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 24 May 2024 16:39:22 +0200 Subject: [PATCH 04/10] Added integration tests --- .../compile_4/core_caching_test.go | 121 ++++++++++++++++++ .../testdata/BareMinimum/BareMinimum.ino | 2 + 2 files changed, 123 insertions(+) create mode 100644 internal/integrationtest/compile_4/core_caching_test.go create mode 100644 internal/integrationtest/compile_4/testdata/BareMinimum/BareMinimum.ino diff --git a/internal/integrationtest/compile_4/core_caching_test.go b/internal/integrationtest/compile_4/core_caching_test.go new file mode 100644 index 00000000000..6b1a74e4cca --- /dev/null +++ b/internal/integrationtest/compile_4/core_caching_test.go @@ -0,0 +1,121 @@ +// This file is part of arduino-cli. +// +// Copyright 2023 ARDUINO SA (http://www.arduino.cc/) +// +// This software is released under the GNU General Public License version 3, +// which covers the main part of arduino-cli. +// The terms of this license can be found at: +// https://www.gnu.org/licenses/gpl-3.0.en.html +// +// You can be released from the requirements of the above licenses by purchasing +// a commercial license. Buying such a license is mandatory if you want to +// modify or otherwise use the software for commercial activities involving the +// Arduino software without disclosing the source code of your own applications. +// To purchase a commercial license, send an email to license@arduino.cc. + +package compile_test + +import ( + "testing" + + "github.com/arduino/arduino-cli/internal/integrationtest" + "github.com/arduino/go-paths-helper" + "github.com/stretchr/testify/require" +) + +func TestBuildCacheCoreWithExtraDirs(t *testing.T) { + env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t) + t.Cleanup(env.CleanUp) + + // Install Arduino AVR Boards + _, _, err := cli.Run("core", "install", "arduino:avr@1.8.6") + require.NoError(t, err) + + // Main core cache + defaultCache := paths.TempDir().Join("arduino") + cache1, err := paths.MkTempDir("", "core_cache") + require.NoError(t, err) + t.Cleanup(func() { cache1.RemoveAll() }) + cache2, err := paths.MkTempDir("", "extra_core_cache") + require.NoError(t, err) + t.Cleanup(func() { cache2.RemoveAll() }) + + sketch, err := paths.New("testdata", "BareMinimum").Abs() + require.NoError(t, err) + + { + // Compile sketch with empty cache + out, _, err := cli.Run("compile", "-v", "-b", "arduino:avr:uno", sketch.String()) + require.NoError(t, err) + require.Contains(t, string(out), "Archiving built core (caching) in: "+defaultCache.String()) + + // Check that the core cache is re-used + out, _, err = cli.Run("compile", "-v", "-b", "arduino:avr:uno", sketch.String()) + require.NoError(t, err) + require.Contains(t, string(out), "Using precompiled core: "+defaultCache.String()) + } + + { + env := cli.GetDefaultEnv() + env["ARDUINO_BUILD_CACHE_PATH"] = cache1.String() + + // Compile sketch with empty cache user-defined core cache + out, _, err := cli.RunWithCustomEnv(env, "compile", "-v", "-b", "arduino:avr:uno", sketch.String()) + require.NoError(t, err) + require.Contains(t, string(out), "Archiving built core (caching) in: "+cache1.String()) + + // Check that the core cache is re-used with user-defined core cache + out, _, err = cli.RunWithCustomEnv(env, "compile", "-v", "-b", "arduino:avr:uno", sketch.String()) + require.NoError(t, err) + require.Contains(t, string(out), "Using precompiled core: "+cache1.String()) + + // Clean run should rebuild and save in user-defined core cache + out, _, err = cli.RunWithCustomEnv(env, "compile", "-v", "-b", "arduino:avr:uno", "--clean", sketch.String()) + require.NoError(t, err) + require.Contains(t, string(out), "Archiving built core (caching) in: "+cache1.String()) + } + + { + env := cli.GetDefaultEnv() + env["ARDUINO_BUILD_CACHE_EXTRA_PATHS"] = cache1.String() + + // Both extra and default cache are full, should use the default one + out, _, err := cli.RunWithCustomEnv(env, "compile", "-v", "-b", "arduino:avr:uno", sketch.String()) + require.NoError(t, err) + require.Contains(t, string(out), "Using precompiled core: "+defaultCache.String()) + + // Clean run, should rebuild and save in default cache + out, _, err = cli.RunWithCustomEnv(env, "compile", "-v", "-b", "arduino:avr:uno", "--clean", sketch.String()) + require.NoError(t, err) + require.Contains(t, string(out), "Archiving built core (caching) in: "+defaultCache.String()) + + // Clean default cache + require.NoError(t, defaultCache.RemoveAll()) + + // Now, extra is full and default is empty, should use extra + out, _, err = cli.RunWithCustomEnv(env, "compile", "-v", "-b", "arduino:avr:uno", sketch.String()) + require.NoError(t, err) + require.Contains(t, string(out), "Using precompiled core: "+cache1.String()) + } + + { + env := cli.GetDefaultEnv() + env["ARDUINO_BUILD_CACHE_EXTRA_PATHS"] = cache1.String() // Populated + env["ARDUINO_BUILD_CACHE_PATH"] = cache2.String() // Empty + + // Extra cache is full, should use the cache1 (extra) + out, _, err := cli.RunWithCustomEnv(env, "compile", "-v", "-b", "arduino:avr:uno", sketch.String()) + require.NoError(t, err) + require.Contains(t, string(out), "Using precompiled core: "+cache1.String()) + + // Clean run, should rebuild and save in cache2 (user defined default cache) + out, _, err = cli.RunWithCustomEnv(env, "compile", "-v", "-b", "arduino:avr:uno", "--clean", sketch.String()) + require.NoError(t, err) + require.Contains(t, string(out), "Archiving built core (caching) in: "+cache2.String()) + + // Both caches are full, should use the cache2 (user defined default) + out, _, err = cli.RunWithCustomEnv(env, "compile", "-v", "-b", "arduino:avr:uno", sketch.String()) + require.NoError(t, err) + require.Contains(t, string(out), "Using precompiled core: "+cache2.String()) + } +} diff --git a/internal/integrationtest/compile_4/testdata/BareMinimum/BareMinimum.ino b/internal/integrationtest/compile_4/testdata/BareMinimum/BareMinimum.ino new file mode 100644 index 00000000000..660bdbccfdb --- /dev/null +++ b/internal/integrationtest/compile_4/testdata/BareMinimum/BareMinimum.ino @@ -0,0 +1,2 @@ +void setup() {} +void loop() {} From 264f5b49bedcf9fe1517aa26ceac646f68107cb6 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 24 May 2024 16:58:32 +0200 Subject: [PATCH 05/10] Updated docs and fixed semantics of GetBuildCacheExtraPaths method --- commands/service_compile.go | 3 +++ docs/UPGRADING.md | 6 ++++++ docs/configuration.md | 2 ++ internal/cli/configuration/build_cache.go | 10 ++++------ 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/commands/service_compile.go b/commands/service_compile.go index e7b4f739232..a8c5cbabb4e 100644 --- a/commands/service_compile.go +++ b/commands/service_compile.go @@ -201,6 +201,9 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu } else { extraCoreBuildCachePaths = paths.NewPathList(req.GetBuildCacheExtraPaths()...) } + for i, p := range extraCoreBuildCachePaths { + extraCoreBuildCachePaths[i] = p.Join("cores") + } if _, err := pme.FindToolsRequiredForBuild(targetPlatform, buildPlatform); err != nil { return err diff --git a/docs/UPGRADING.md b/docs/UPGRADING.md index e213d3959c0..b41ecd30076 100644 --- a/docs/UPGRADING.md +++ b/docs/UPGRADING.md @@ -4,6 +4,12 @@ Here you can find a list of migration guides to handle breaking changes between ## 1.0.0 +### `compile --build-cache-path` slightly changed directory format + +Now compiled cores are cached under the `cores` subdir of the path specified in `--build-cache-path`, previously it was +saved under the `core` subdir. The new behaviour is coherent with the default cache directory `/tmp/arduino/cores/...` +when the cache directory is not set by the user. + ### Configuration file now supports only YAML format. The Arduino CLI configuration file now supports only the YAML format. diff --git a/docs/configuration.md b/docs/configuration.md index bfde1372dac..ecbc25d65a5 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -35,6 +35,8 @@ - `updater` - configuration options related to Arduino CLI updates - `enable_notification` - set to `false` to disable notifications of new Arduino CLI releases, defaults to `true` - `build_cache` configuration options related to the compilation cache + - `path` - the path to the build cache, default is `$TMP/arduino`. + - `extra_paths` - a list of paths to look for precompiled artifacts if not found on `build_cache.path` setting. - `compilations_before_purge` - interval, in number of compilations, at which the cache is purged, defaults to `10`. When `0` the cache is never purged. - `ttl` - cache expiration time of build folders. If the cache is hit by a compilation the corresponding build files diff --git a/internal/cli/configuration/build_cache.go b/internal/cli/configuration/build_cache.go index b790e18c2b2..29628fd155f 100644 --- a/internal/cli/configuration/build_cache.go +++ b/internal/cli/configuration/build_cache.go @@ -46,14 +46,12 @@ func (s *Settings) GetBuildCachePath() (*paths.Path, bool) { return paths.New(p), true } -// GetBuildCacheExtraPaths returns the extra paths to the core build cache. -// Those paths are visited before the main core build cache to check for cached items. +// GetBuildCacheExtraPaths returns the extra paths to the build cache. +// Those paths are visited to look for precompiled items if not found elsewhere. func (s *Settings) GetBuildCacheExtraPaths() paths.PathList { var res paths.PathList - if ps, ok, _ := s.GetStringSliceOk("build_cache.extra_paths"); ok { - for _, p := range ps { - res.Add(paths.New(p, "cores")) - } + if p, ok, _ := s.GetStringSliceOk("build_cache.extra_paths"); ok { + return paths.NewPathList(p...) } return res } From d10c92c4f5c184e5f8e1232cf3eecaf28b9c9f42 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 24 May 2024 17:22:03 +0200 Subject: [PATCH 06/10] Updated json-schema for configuration --- internal/cli/configuration/configuration.schema.json | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/internal/cli/configuration/configuration.schema.json b/internal/cli/configuration/configuration.schema.json index a273353967b..2f696904972 100644 --- a/internal/cli/configuration/configuration.schema.json +++ b/internal/cli/configuration/configuration.schema.json @@ -20,6 +20,17 @@ "build_cache": { "description": "configuration options related to the compilation cache", "properties": { + "path": { + "description": "the path to the build cache, default is `$TMP/arduino`.", + "type": "string" + }, + "extra_paths": { + "description": "a list of paths to look for precompiled artifacts if not found on `build_cache.path` setting.", + "type": "array", + "items": { + "type": "string" + } + }, "compilations_before_purge": { "description": "interval, in number of compilations, at which the cache is purged, defaults to `10`. When `0` the cache is never purged.", "type": "integer", From 686e75eece1546b135abdc12f9ffafff52ca60a5 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 24 May 2024 17:40:10 +0200 Subject: [PATCH 07/10] Update rpc/cc/arduino/cli/commands/v1/compile.proto Co-authored-by: Alessio Perugini --- rpc/cc/arduino/cli/commands/v1/compile.pb.go | 2 +- rpc/cc/arduino/cli/commands/v1/compile.proto | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rpc/cc/arduino/cli/commands/v1/compile.pb.go b/rpc/cc/arduino/cli/commands/v1/compile.pb.go index c0eb2bad757..f64c3edf128 100644 --- a/rpc/cc/arduino/cli/commands/v1/compile.pb.go +++ b/rpc/cc/arduino/cli/commands/v1/compile.pb.go @@ -111,7 +111,7 @@ type CompileRequest struct { // the variables placeholders exactly as defined in the platform. DoNotExpandBuildProperties bool `protobuf:"varint,29,opt,name=do_not_expand_build_properties,json=doNotExpandBuildProperties,proto3" json:"do_not_expand_build_properties,omitempty"` // Search for precompiled cores in the given paths and use them if found. - // This search is performed before the standard build_cache directory. + // This search is performed after the standard build_cache directory. BuildCacheExtraPaths []string `protobuf:"bytes,30,rep,name=build_cache_extra_paths,json=buildCacheExtraPaths,proto3" json:"build_cache_extra_paths,omitempty"` } diff --git a/rpc/cc/arduino/cli/commands/v1/compile.proto b/rpc/cc/arduino/cli/commands/v1/compile.proto index ea060453e00..a51810d1980 100644 --- a/rpc/cc/arduino/cli/commands/v1/compile.proto +++ b/rpc/cc/arduino/cli/commands/v1/compile.proto @@ -94,7 +94,7 @@ message CompileRequest { // the variables placeholders exactly as defined in the platform. bool do_not_expand_build_properties = 29; // Search for precompiled cores in the given paths and use them if found. - // This search is performed before the standard build_cache directory. + // This search is performed after the standard build_cache directory. repeated string build_cache_extra_paths = 30; } From 8797c635727034e67944bf28b3dbb6e07a0872c1 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 24 May 2024 18:19:34 +0200 Subject: [PATCH 08/10] Start integration test from a clean state --- internal/integrationtest/compile_4/core_caching_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/integrationtest/compile_4/core_caching_test.go b/internal/integrationtest/compile_4/core_caching_test.go index 6b1a74e4cca..582a2e29ec7 100644 --- a/internal/integrationtest/compile_4/core_caching_test.go +++ b/internal/integrationtest/compile_4/core_caching_test.go @@ -44,6 +44,9 @@ func TestBuildCacheCoreWithExtraDirs(t *testing.T) { require.NoError(t, err) { + // Clean cache + require.NoError(t, defaultCache.RemoveAll()) + // Compile sketch with empty cache out, _, err := cli.Run("compile", "-v", "-b", "arduino:avr:uno", sketch.String()) require.NoError(t, err) From 94b19833c7a3e91123318eb25a246eabd6372799 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Mon, 27 May 2024 14:31:00 +0200 Subject: [PATCH 09/10] Do not force build-cache path creation if not needed --- internal/arduino/builder/core.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/internal/arduino/builder/core.go b/internal/arduino/builder/core.go index a21dca94032..f407ed60c41 100644 --- a/internal/arduino/builder/core.go +++ b/internal/arduino/builder/core.go @@ -109,11 +109,12 @@ func (b *Builder) compileCore() (*paths.Path, paths.PathList, error) { } // If there is an archived core in the current build cache, use it - if _, err := buildcache.New(b.coreBuildCachePath).GetOrCreate(archivedCoreName); errors.Is(err, buildcache.CreateDirErr) { - return nil, nil, errors.New(i18n.Tr("creating core cache folder: %s", err)) - } targetArchivedCore = b.coreBuildCachePath.Join(archivedCoreName, "core.a") if canUseArchivedCore(targetArchivedCore) { + // Extend the build cache expiration time + if _, err := buildcache.New(b.coreBuildCachePath).GetOrCreate(archivedCoreName); errors.Is(err, buildcache.CreateDirErr) { + return nil, nil, errors.New(i18n.Tr("creating core cache folder: %s", err)) + } // use archived core if b.logger.Verbose() { b.logger.Info(i18n.Tr("Using precompiled core: %[1]s", targetArchivedCore)) @@ -133,6 +134,11 @@ func (b *Builder) compileCore() (*paths.Path, paths.PathList, error) { return extraTargetArchivedCore, variantObjectFiles, nil } } + + // Create the build cache folder for the core + if _, err := buildcache.New(b.coreBuildCachePath).GetOrCreate(archivedCoreName); errors.Is(err, buildcache.CreateDirErr) { + return nil, nil, errors.New(i18n.Tr("creating core cache folder: %s", err)) + } } coreObjectFiles, err := b.compileFiles( From 8bdda04fde5c1169b1109dcdcd82ccffcce53547 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 29 May 2024 17:05:02 +0200 Subject: [PATCH 10/10] Update internal/cli/configuration/build_cache.go Co-authored-by: Umberto Baldi <34278123+umbynos@users.noreply.github.com> --- internal/cli/configuration/build_cache.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/cli/configuration/build_cache.go b/internal/cli/configuration/build_cache.go index 29628fd155f..f7ea225d54c 100644 --- a/internal/cli/configuration/build_cache.go +++ b/internal/cli/configuration/build_cache.go @@ -49,9 +49,8 @@ func (s *Settings) GetBuildCachePath() (*paths.Path, bool) { // GetBuildCacheExtraPaths returns the extra paths to the build cache. // Those paths are visited to look for precompiled items if not found elsewhere. func (s *Settings) GetBuildCacheExtraPaths() paths.PathList { - var res paths.PathList if p, ok, _ := s.GetStringSliceOk("build_cache.extra_paths"); ok { return paths.NewPathList(p...) } - return res + return nil }