From 29896699475755a7c9160c28de40d6849646c15d Mon Sep 17 00:00:00 2001 From: kleene Date: Sun, 13 Jul 2025 23:25:06 +0800 Subject: [PATCH] add native ohmurl to declgen Issue: https://gitee.com/openharmony/developtools_ace_ets2bundle/issues/ICLYB5?from=project-issue Signed-off-by: kleene Change-Id: I952375893cb47c80adaff49989f59c763d2f286b --- .../interop/run_declgen_standalone.ts | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/compiler/src/fast_build/ark_compiler/interop/run_declgen_standalone.ts b/compiler/src/fast_build/ark_compiler/interop/run_declgen_standalone.ts index 8345d0453..124c4ccbb 100644 --- a/compiler/src/fast_build/ark_compiler/interop/run_declgen_standalone.ts +++ b/compiler/src/fast_build/ark_compiler/interop/run_declgen_standalone.ts @@ -173,15 +173,16 @@ class DeclfileProductor { } writeDeclFileInfo(moduleInfo: ArkTSEvolutionModule, mainModuleName: string): void { - moduleInfo.dynamicFiles.forEach(file => { - this.addDeclFilesConfig(file, mainModuleName, this.projectConfig.bundleName, moduleInfo); - }); - - const declFilesConfigFile: string = toUnixPath(moduleInfo.declFilesPath); - mkdirsSync(path.dirname(declFilesConfigFile)); - if (this.pkgDeclFilesConfig[moduleInfo.packageName]) { - fs.writeFileSync(declFilesConfigFile, JSON.stringify(this.pkgDeclFilesConfig[moduleInfo.packageName], null, 2), 'utf-8'); - } + moduleInfo.isNative = moduleInfo.isNative ?? moduleInfo.packageName.endsWith('.so'); + moduleInfo.dynamicFiles.forEach(file => { + this.addDeclFilesConfig(file, mainModuleName, this.projectConfig.bundleName, moduleInfo); + }); + + const declFilesConfigFile: string = toUnixPath(moduleInfo.declFilesPath); + mkdirsSync(path.dirname(declFilesConfigFile)); + if (this.pkgDeclFilesConfig[moduleInfo.packageName]) { + fs.writeFileSync(declFilesConfigFile, JSON.stringify(this.pkgDeclFilesConfig[moduleInfo.packageName], null, 2), 'utf-8'); + } } addDeclFilesConfig(filePath: string, mainModuleName: string, bundleName: string, moduleInfo: ArkTSEvolutionModule): void { @@ -201,9 +202,12 @@ class DeclfileProductor { return; } // The module name of the entry module of the project during the current compilation process. - const normalizedFilePath: string = `${moduleInfo.packageName}/${projectFilePath}`; + const normalizedFilePath: string = moduleInfo.isNative + ? moduleInfo.moduleName + : `${moduleInfo.packageName}/${projectFilePath}`; const declPath: string = path.join(toUnixPath(declgenV2OutPath), projectFilePath) + EXTNAME_D_ETS; - const ohmUrl: string = `N&${mainModuleName}&${bundleName}&${normalizedFilePath}&${moduleInfo.packageVersion}`; + const isNativeFlag = moduleInfo.isNative ? 'Y' : 'N'; + const ohmUrl: string = `${isNativeFlag}&${mainModuleName}&${bundleName}&${normalizedFilePath}&${moduleInfo.packageVersion}`; this.pkgDeclFilesConfig[moduleInfo.packageName].files[projectFilePath] = { declPath, ohmUrl: `@normalized:${ohmUrl}` }; } -- Gitee