From bea3fa086f8c658346347523169a202b0414bb92 Mon Sep 17 00:00:00 2001 From: zhangrengao Date: Tue, 23 Aug 2022 19:44:25 +0800 Subject: [PATCH] fix xts abc size is empty Signed-off-by: zhangrengao Change-Id: Ibf2e02471b75c494046b48211673b96389091fdf --- 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 8f37cea..a8c4a3a 100644 --- a/compiler/src/gen_abc_plugin.ts +++ b/compiler/src/gen_abc_plugin.ts @@ -797,8 +797,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]); } @@ -835,8 +837,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) {