From 30dd8d3fc82f230e089bc7601754b2ecb693330e Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Mon, 11 Nov 2019 13:12:28 +0100 Subject: [PATCH] Auto-disable (deep) caching of core builds if needed When build-path and cache-path are on different partitions it will not be possible (on windows) to reference them with a relative path. This commit allows this by automatically disabling the aggressive core caching. Previously an error was emitted and the build interrupted. --- legacy/builder/phases/core_builder.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/legacy/builder/phases/core_builder.go b/legacy/builder/phases/core_builder.go index b72a628005b..dc6540f16ad 100644 --- a/legacy/builder/phases/core_builder.go +++ b/legacy/builder/phases/core_builder.go @@ -53,7 +53,13 @@ func (s *CoreBuilder) Run(ctx *types.Context) error { } if coreBuildCachePath != nil { - if err := coreBuildCachePath.MkdirAll(); err != nil { + if _, err := coreBuildCachePath.RelTo(ctx.BuildPath); err != nil { + logger := ctx.GetLogger() + logger.Println(constants.LOG_LEVEL_INFO, "Couldn't deeply cache core build: {0}", err) + logger.Println(constants.LOG_LEVEL_INFO, "Running normal build of the core...") + coreBuildCachePath = nil + ctx.CoreBuildCachePath = nil + } else if err := coreBuildCachePath.MkdirAll(); err != nil { return i18n.WrapError(err) } }