From 4454ea58fd1fc2cfb9560bc7c1290b8fc1a6a02d Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 7 Dec 2022 23:31:51 +0300 Subject: [PATCH] [Build-System] Improve build time on Windows: Do not download a pre-compiled binary if it's found in a folder pointed by the FreeSWITCHBuildCachePath environment variable. --- w32/downloadpackage.task | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/w32/downloadpackage.task b/w32/downloadpackage.task index 0c7081a0fb..ef5322cfd7 100644 --- a/w32/downloadpackage.task +++ b/w32/downloadpackage.task @@ -100,7 +100,14 @@ using System.Diagnostics; Uri uri = new Uri(package); string urifilename = Path.GetFileName(uri.LocalPath); string output = Path.Combine(outputfolder ?? librarypath, (outputfilename ?? urifilename)); + string cachedir = Environment.GetEnvironmentVariable("FreeSWITCHBuildCachePath") ?? ""; + string cached_file = cachedir != "" ? Path.Combine(cachedir, (outputfilename ?? urifilename)) : ""; + if (cached_file != "" && File.Exists(cached_file)) { + Log.LogMessage(MessageImportance.High, + "Found package in cache \"" + cached_file + "\"."); + File.Copy(cached_file, output); + } else //if (!File.Exists(output)) // Uncomment to skip download if exists { var syncObject = new State