From aab84292402d80d67d999322acb732778642817f Mon Sep 17 00:00:00 2001 From: x30053363 Date: Tue, 26 Aug 2025 20:28:03 +0800 Subject: [PATCH] Skip emit dts for files in oh_module Issue: https://gitee.com/openharmony/developtools_ace_ets2bundle/issues/ICUXGQ Signed-off-by: x30053363 Change-Id: If569961bf2aee6d751cf8013992708f9a45ea5c1 --- compiler/src/ets_checker.ts | 11 +++++++++-- compiler/src/interop/src/ets_checker.ts | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/compiler/src/ets_checker.ts b/compiler/src/ets_checker.ts index a56cd183d..e1f19b2e0 100644 --- a/compiler/src/ets_checker.ts +++ b/compiler/src/ets_checker.ts @@ -769,6 +769,9 @@ function processBuildHap(cacheFile: string, rootFileNames: string[], parentEvent [...allResolvedModules, ...rootFileNames].forEach(moduleFile => { if (!(moduleFile.match(new RegExp(projectConfig.packageDir)) && projectConfig.compileHar)) { try { + if (toUnixPath(moduleFile).includes('/oh_modules/')) { + return; + } if ((/\.d\.e?ts$/).test(moduleFile)) { generateSourceFilesInHar(moduleFile, fs.readFileSync(moduleFile, 'utf-8'), path.extname(moduleFile), projectConfig, projectConfig.modulePathMap); @@ -790,9 +793,13 @@ function processBuildHap(cacheFile: string, rootFileNames: string[], parentEvent } function printDeclarationDiagnostics(errorCodeLogger?: Object | undefined): void { - globalProgram.builderProgram.getDeclarationDiagnostics().forEach((diagnostic: ts.Diagnostic) => { + globalProgram.builderProgram.getSourceFiles().forEach((sourceFile: ts.SourceFile) => { + if (toUnixPath(sourceFile.fileName).includes('/oh_modules/')) { + return; + } + const diagnostic: ts.Diagnostic = globalProgram.builderProgram.getDeclarationDiagnostics(sourceFile); printDiagnostic(diagnostic, ErrorCodeModule.TSC, errorCodeLogger); - }); + }) } function containFormError(message: string): boolean { diff --git a/compiler/src/interop/src/ets_checker.ts b/compiler/src/interop/src/ets_checker.ts index cf94e3828..244f21295 100644 --- a/compiler/src/interop/src/ets_checker.ts +++ b/compiler/src/interop/src/ets_checker.ts @@ -789,6 +789,9 @@ function processBuildHap(cacheFile: string, rootFileNames: string[], parentEvent [...allResolvedModules, ...rootFileNames].forEach(moduleFile => { if (!(moduleFile.match(new RegExp(projectConfig.packageDir)) && projectConfig.compileHar)) { try { + if (toUnixPath(moduleFile).includes('/oh_modules/')) { + return; + } if ((/\.d\.e?ts$/).test(moduleFile)) { generateSourceFilesInHar(moduleFile, fs.readFileSync(moduleFile, 'utf-8'), path.extname(moduleFile), projectConfig, projectConfig.modulePathMap); @@ -810,9 +813,13 @@ function processBuildHap(cacheFile: string, rootFileNames: string[], parentEvent } function printDeclarationDiagnostics(errorCodeLogger?: Object | undefined): void { - globalProgram.builderProgram.getDeclarationDiagnostics().forEach((diagnostic: ts.Diagnostic) => { + globalProgram.builderProgram.getSourceFiles().forEach((sourceFile: ts.SourceFile) => { + if (toUnixPath(sourceFile.fileName).includes('/oh_modules/')) { + return; + } + const diagnostic: ts.Diagnostic = globalProgram.builderProgram.getDeclarationDiagnostics(sourceFile); printDiagnostic(diagnostic, ErrorCodeModule.TSC, errorCodeLogger); - }); + }) } function containFormError(message: string): boolean { -- Gitee