From 39b17410b197da00ef709084c1aa977d66c13bd4 Mon Sep 17 00:00:00 2001 From: zhangrengao Date: Tue, 23 Aug 2022 19:59:26 +0800 Subject: [PATCH] fix xts abc size is empty Signed-off-by: zhangrengao Change-Id: Ib2aed85633e077ecb252f0fccdcee0e16541a667 --- compiler/src/gen_abc_plugin.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/compiler/src/gen_abc_plugin.ts b/compiler/src/gen_abc_plugin.ts index b72d782..a7714a5 100644 --- a/compiler/src/gen_abc_plugin.ts +++ b/compiler/src/gen_abc_plugin.ts @@ -687,8 +687,10 @@ function filterIntermediateJsBundleByHashJson(buildPath: string, inputPaths: Fil if (jsonObject[cacheOutputPath] === hashInputContentData && jsonObject[cacheAbcFilePath] === hashAbcContentData) { updateJsonObject[cacheOutputPath] = hashInputContentData; updateJsonObject[cacheAbcFilePath] = hashAbcContentData; - mkdirsSync(path.dirname(abcPath)); - fs.copyFileSync(cacheAbcFilePath, abcPath); + if (!fs.existsSync(abcPath)) { + mkdirsSync(path.dirname(abcPath)); + fs.copyFileSync(cacheAbcFilePath, abcPath); + } } else { fileterIntermediateJsBundle.push(inputPaths[i]); } @@ -724,8 +726,13 @@ function writeHashJson(): void { process.exitCode = FAIL; break; } - mkdirsSync(path.dirname(abcFile)); - fs.copyFileSync(cacheAbcFilePath, abcFile); + if (!fs.existsSync(abcFile)) { + mkdirsSync(path.dirname(abcFile)); + fs.copyFileSync(cacheAbcFilePath, abcFile); + } + if (fs.existsSync(intermediateJsBundle[i].path)) { + fs.unlinkSync(intermediateJsBundle[i].path); + } } const hashFilePath: string = genHashJsonPath(buildPathInfo); if (hashFilePath.length === 0) {