From 173b24e6d38d502d2591c3592b10990974fa7cd8 Mon Sep 17 00:00:00 2001 From: sunfei Date: Mon, 12 May 2025 11:06:55 +0800 Subject: [PATCH] supprot paths config for build_system Issue: https://gitee.com/openharmony/build/issues/ICA7PN Signed-off-by: sunfei Change-Id: I6a7a52bac1c96731c220266e3ebb6f40f33a199c --- ets2panda/driver/build_system/src/build/base_mode.ts | 3 ++- .../driver/build_system/src/build/generate_arktsconfig.ts | 8 +++++++- ets2panda/driver/build_system/src/types.ts | 5 +++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ets2panda/driver/build_system/src/build/base_mode.ts b/ets2panda/driver/build_system/src/build/base_mode.ts index 1c05abf17a..dccb49481f 100644 --- a/ets2panda/driver/build_system/src/build/base_mode.ts +++ b/ets2panda/driver/build_system/src/build/base_mode.ts @@ -314,7 +314,8 @@ export abstract class BaseMode { } finally { if (!errorStatus) { // when error occur,wrapper will destroy context. - arktsGlobal.es2panda._DestroyContext(arktsGlobal.compilerContext.peer); + // comment this in 0603 to solve free() invalid pointer + //arktsGlobal.es2panda._DestroyContext(arktsGlobal.compilerContext.peer); } PluginDriver.getInstance().runPluginHook(PluginHook.CLEAN); arkts.destroyConfig(arktsGlobal.config); diff --git a/ets2panda/driver/build_system/src/build/generate_arktsconfig.ts b/ets2panda/driver/build_system/src/build/generate_arktsconfig.ts index edb1224fb7..c34333082c 100644 --- a/ets2panda/driver/build_system/src/build/generate_arktsconfig.ts +++ b/ets2panda/driver/build_system/src/build/generate_arktsconfig.ts @@ -32,7 +32,8 @@ import { } from '../utils'; import { BuildConfig, - ModuleInfo + ModuleInfo, + PathsConfig } from '../types'; import { LANGUAGE_VERSION, @@ -252,6 +253,11 @@ export class ArkTSConfigGenerator { } let baseUrl: string = path.resolve(moduleInfo.moduleRootPath, moduleInfo.sourceRoots[0]); + if (buildConfig.paths) { + Object.entries(buildConfig.paths).map(([key, value]) => { + pathSection[key] = value + }); + } let arktsConfig: ArkTSConfigObject = { compilerOptions: { package: moduleInfo.packageName, diff --git a/ets2panda/driver/build_system/src/types.ts b/ets2panda/driver/build_system/src/types.ts index 37745789b4..613cde8acc 100644 --- a/ets2panda/driver/build_system/src/types.ts +++ b/ets2panda/driver/build_system/src/types.ts @@ -18,6 +18,10 @@ export interface PluginsConfig { [pluginName: string]: string; } +export interface PathsConfig { + [pathName: string]: string[]; +} + export interface BuildBaseConfig { buildType: 'build' | 'preview' | 'hotreload' | 'coldreload'; buildMode: 'Debug' | 'Release'; @@ -139,6 +143,7 @@ export interface DependentModuleConfig { export interface BuildConfig extends BuildBaseConfig, DeclgenConfig, LoggerConfig, ModuleConfig, PathConfig, FrameworkConfig { plugins: PluginsConfig; + paths: PathsConfig; // paths config passed from template to generate arktsconfig.json "paths" configs. compileFiles: string[]; dependentModuleList: DependentModuleConfig[]; } -- Gitee