From a3663ddb1d8be39cd46786e67855cb3d518f9055 Mon Sep 17 00:00:00 2001 From: lihao Date: Sun, 8 Jun 2025 20:21:07 +0800 Subject: [PATCH] Filter the files in the rootFileNames array MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: [新需求]: Filter the files in the rootFileNames array https://gitee.com/openharmony/developtools_ace_ets2bundle/issues/ICDH42 Signed-off-by: lihao --- .../ets_ui/rollup-plugin-ets-checker.ts | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/compiler/src/fast_build/ets_ui/rollup-plugin-ets-checker.ts b/compiler/src/fast_build/ets_ui/rollup-plugin-ets-checker.ts index 89cd4cd54..b53f53253 100644 --- a/compiler/src/fast_build/ets_ui/rollup-plugin-ets-checker.ts +++ b/compiler/src/fast_build/ets_ui/rollup-plugin-ets-checker.ts @@ -47,7 +47,12 @@ import { MemoryMonitor } from '../meomry_monitor/rollup-plugin-memory-monitor'; import { MemoryDefine } from '../meomry_monitor/memory_define'; import { LINTER_SUBSYSTEM_CODE } from '../../hvigor_error_code/hvigor_error_info'; import { ErrorCodeModule } from '../../hvigor_error_code/const/error_code_module'; -import { collectArkTSEvolutionModuleInfo } from '../../process_arkts_evolution'; +import { + arkTSModuleMap, + arkTSEvolutionModuleMap, + arkTSHybridModuleMap, + collectArkTSEvolutionModuleInfo +} from '../../process_arkts_evolution'; import { initFileManagerInRollup, FileManager @@ -163,7 +168,30 @@ function getErrorCodeLogger(code: string, share: Object): Object | undefined { function rootFileNamesCollect(rootFileNames: string[]): void { const entryFiles: string[] = projectConfig.widgetCompile ? Object.values(projectConfig.cardEntryObj) : Object.values(projectConfig.entryObj); + + const bridgeCodePaths = collectDeclgenBridgePaths(); entryFiles.forEach((fileName: string) => { + const isUnderBridgeDir = Array.from(bridgeCodePaths).some(bridgeCodePath => { + return fileName.startsWith(bridgeCodePath + path.sep) || fileName === bridgeCodePath; + }); + + if (isUnderBridgeDir) { + return; + } + rootFileNames.push(path.resolve(fileName)); }); +} + +function collectDeclgenBridgePaths(): Set { + const paths = new Set(); + [arkTSModuleMap, arkTSEvolutionModuleMap, arkTSHybridModuleMap].forEach(map => { + for (const value of map.values()) { + if (value.declgenBridgeCodePath) { + paths.add(value.declgenBridgeCodePath); + } + } + }); + + return paths; } \ No newline at end of file -- Gitee