From 5fa13c6a135e2244c4c894f0c251718fc65fb8de Mon Sep 17 00:00:00 2001 From: dongchao Date: Thu, 12 Jun 2025 19:55:19 +0800 Subject: [PATCH] Fix incremental bug of filename case Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/ICG6LP Signed-off-by: dongchao Change-Id: I2bbb7a9890e4f6a1ea37c93b2563135286a5c7c3 --- .../driver/build_system/src/build/base_mode.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ets2panda/driver/build_system/src/build/base_mode.ts b/ets2panda/driver/build_system/src/build/base_mode.ts index 99fad43361..e25ef54615 100644 --- a/ets2panda/driver/build_system/src/build/base_mode.ts +++ b/ets2panda/driver/build_system/src/build/base_mode.ts @@ -402,10 +402,16 @@ export abstract class BaseMode { private loadHashCache(): Record { try { - if (fs.existsSync(this.hashCacheFile)) { - const cacheContent = fs.readFileSync(this.hashCacheFile, 'utf-8'); - return JSON.parse(cacheContent); + if (!fs.existsSync(this.hashCacheFile)) { + return {}; } + + const cacheContent: string = fs.readFileSync(this.hashCacheFile, 'utf-8'); + const cacheData: Record = JSON.parse(cacheContent); + const filteredCache: Record = Object.fromEntries( + Object.entries(cacheData).filter(([file]) => this.entryFiles.has(file)) + ); + return filteredCache; } catch (error) { if (error instanceof Error) { const logData: LogData = LogDataFactory.newInstance( @@ -415,8 +421,8 @@ export abstract class BaseMode { ); this.logger.printError(logData); } + return {}; } - return {}; } private saveHashCache(): void { -- Gitee