From d34154412e71b44addf39d0bf6cb8c6096a97452 Mon Sep 17 00:00:00 2001 From: galargh Date: Thu, 9 Jan 2025 20:01:19 +0100 Subject: [PATCH] chore: check if wasm compiler is already downloaded --- .../solidity/build-system/compiler/index.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/v-next/hardhat/src/internal/builtin-plugins/solidity/build-system/compiler/index.ts b/v-next/hardhat/src/internal/builtin-plugins/solidity/build-system/compiler/index.ts index 1815b9764c..c74ed3e4bf 100644 --- a/v-next/hardhat/src/internal/builtin-plugins/solidity/build-system/compiler/index.ts +++ b/v-next/hardhat/src/internal/builtin-plugins/solidity/build-system/compiler/index.ts @@ -58,16 +58,18 @@ export async function downloadConfiguredCompilers( await wasmCompilerDownloader.updateCompilerListIfNeeded(versions); for (const version of versions) { - if (!quiet) { - console.log(`Downloading solc ${version} (WASM build)`); - } + if (!(await wasmCompilerDownloader.isCompilerDownloaded(version))) { + if (!quiet) { + console.log(`Downloading solc ${version} (WASM build)`); + } - const success = await wasmCompilerDownloader.downloadCompiler(version); + const success = await wasmCompilerDownloader.downloadCompiler(version); - if (!success) { - throw new HardhatError(HardhatError.ERRORS.SOLIDITY.DOWNLOAD_FAILED, { - remoteVersion: version, - }); + if (!success) { + throw new HardhatError(HardhatError.ERRORS.SOLIDITY.DOWNLOAD_FAILED, { + remoteVersion: version, + }); + } } } }