From 8384cb9caf1e0e330dd29a254c5e7e15be1cffb0 Mon Sep 17 00:00:00 2001 From: Shimenkov Mikhail Date: Tue, 26 Aug 2025 17:39:34 +0300 Subject: [PATCH] [BUILD SYSTEM] Refactor build system * Removed destroyContext in processErrorState * Removed arkts.clearContext in memo-plugin * Removed arkts.clearContext in ui-plugin * Removed arkts.clearContext in interop-plugin Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/pulls/8011 Tests: python ./test/xts/acts/build.py product_name=rk3568 system_size=standard xts_suitetype=hap_static Change-Id: I1537948e32d7e1f32a08df46e1123b2d70bc8543 Signed-off-by: Shimenkov Mikhail --- arkui-plugins/interop-plugins/index.ts | 6 ++--- arkui-plugins/memo-plugins/index.ts | 3 +-- arkui-plugins/ui-plugins/index.ts | 1 - .../src/arkts-api/utilities/public.ts | 23 ++++++++----------- koala-wrapper/src/es2panda.ts | 5 ---- 5 files changed, 12 insertions(+), 26 deletions(-) diff --git a/arkui-plugins/interop-plugins/index.ts b/arkui-plugins/interop-plugins/index.ts index dc69677c9..94f3d2d01 100644 --- a/arkui-plugins/interop-plugins/index.ts +++ b/arkui-plugins/interop-plugins/index.ts @@ -28,9 +28,7 @@ export function interopTransform():Plugins { name: 'interop-plugin', parsed: parsedTransform, checked: checkedTransform, - clean(): void { - arkts.arktsGlobal.clearContext(); - }, + clean(): void {}, }; } @@ -89,7 +87,7 @@ function checkedTransform(this: PluginContext): arkts.EtsScript | undefined { program = programVisitor.programVisitor(program); script = program.astNode; arkts.recheckSubtree(script); - this.setArkTSAst(script); + this.setArkTSAst(script); debugLog('interopTransform:checked exit'); return script; } diff --git a/arkui-plugins/memo-plugins/index.ts b/arkui-plugins/memo-plugins/index.ts index ca4c52e15..407e83623 100644 --- a/arkui-plugins/memo-plugins/index.ts +++ b/arkui-plugins/memo-plugins/index.ts @@ -32,7 +32,6 @@ export function unmemoizeTransform(): Plugins { checked: checkedTransform, clean() { ProgramSkipper.clear(); - arkts.arktsGlobal.clearContext(); }, }; } @@ -52,7 +51,7 @@ function checkedTransform(this: PluginContext): arkts.EtsScript | undefined { program = checkedProgramVisit(program, this, canSkipPhases, isFrameworkMode); script = program.astNode; arkts.Performance.getInstance().stopEvent('memo-checked', true); - + arkts.Performance.getInstance().memoryTrackerGetDelta('UIPlugin:Memo-AfterCheck'); arkts.Performance.getInstance().memoryTrackerReset(); diff --git a/arkui-plugins/ui-plugins/index.ts b/arkui-plugins/ui-plugins/index.ts index f34b9b1e8..80310401b 100644 --- a/arkui-plugins/ui-plugins/index.ts +++ b/arkui-plugins/ui-plugins/index.ts @@ -30,7 +30,6 @@ export function uiTransform(): Plugins { checked: checkedTransform, clean() { ProgramSkipper.clear(); - arkts.arktsGlobal.clearContext(); }, }; } diff --git a/koala-wrapper/src/arkts-api/utilities/public.ts b/koala-wrapper/src/arkts-api/utilities/public.ts index b7e570619..87cd9b840 100644 --- a/koala-wrapper/src/arkts-api/utilities/public.ts +++ b/koala-wrapper/src/arkts-api/utilities/public.ts @@ -60,21 +60,16 @@ export function proceedToState(state: Es2pandaContextState, context: KNativePoin } function processErrorState(state: Es2pandaContextState, context: KNativePointer, forceDtsEmit = false): void { - try { - if (global.es2panda._ContextState(context) === Es2pandaContextState.ES2PANDA_STATE_ERROR && !forceDtsEmit) { - const errorMessage = withStringResult(global.es2panda._ContextErrorMessage(context)); - if (errorMessage === undefined) { - throwError(`Could not get ContextErrorMessage`); - } - const allErrorMessages = withStringResult(global.es2panda._GetAllErrorMessages(context)); - if (allErrorMessages === undefined) { - throwError(`Could not get AllErrorMessages`); - } - throwError([`Failed to proceed to ${Es2pandaContextState[state]}`, errorMessage, allErrorMessages].join(`\n`)); + if (global.es2panda._ContextState(context) === Es2pandaContextState.ES2PANDA_STATE_ERROR && !forceDtsEmit) { + const errorMessage = withStringResult(global.es2panda._ContextErrorMessage(context)); + if (errorMessage === undefined) { + throwError(`Could not get ContextErrorMessage`); } - } catch (e) { - global.es2panda._DestroyContext(context); - throw e; + const allErrorMessages = withStringResult(global.es2panda._GetAllErrorMessages(context)); + if (allErrorMessages === undefined) { + throwError(`Could not get AllErrorMessages`); + } + throwError([`Failed to proceed to ${Es2pandaContextState[state]}`, errorMessage, allErrorMessages].join(`\n`)); } } diff --git a/koala-wrapper/src/es2panda.ts b/koala-wrapper/src/es2panda.ts index 9e0e14f4e..7a05dea34 100644 --- a/koala-wrapper/src/es2panda.ts +++ b/koala-wrapper/src/es2panda.ts @@ -13,12 +13,7 @@ * limitations under the License. */ -import * as fs from "node:fs" -import * as path from "node:path" import { global } from "./arkts-api/static/global" -import { isNumber, throwError, withWarning, filterSource } from "./utils" -import { Es2pandaContextState } from "./generated/Es2pandaEnums" -import { AstNode, Config, Context, EtsScript, proceedToState } from "./arkts-api" import * as arkts from "./arkts-api" export {arkts, global as arktsGlobal} -- Gitee