From 3f043518156006507a7304a2319d651e406f19b7 Mon Sep 17 00:00:00 2001 From: Ilya Trubachev Date: Tue, 19 Aug 2025 15:03:52 +0300 Subject: [PATCH] Rename build modes Signed-off-by: Ilya Trubachev Change-Id: Icd5e070c6bbfac18cfab9a6c91d9c68b39e9679a --- .../build_system/src/build/base_mode.ts | 20 +++++++++++++++++-- .../src/build/build_framework_mode.ts | 2 +- .../build_system/src/build/build_mode.ts | 11 ++++++---- ets2panda/driver/build_system/src/types.ts | 4 ++-- 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/ets2panda/driver/build_system/src/build/base_mode.ts b/ets2panda/driver/build_system/src/build/base_mode.ts index 86e78db7b9..f743d1b244 100644 --- a/ets2panda/driver/build_system/src/build/base_mode.ts +++ b/ets2panda/driver/build_system/src/build/base_mode.ts @@ -152,7 +152,7 @@ export abstract class BaseMode { this.es2pandaMode = buildConfig?.es2pandaMode ?? ( isMixCompileProject(buildConfig) ? ES2PANDA_MODE.RUN_PARALLEL - : ES2PANDA_MODE.RUN + : ES2PANDA_MODE.RUN_SIMULTANEOUS ); this.skipDeclCheck = buildConfig?.skipDeclCheck as boolean ?? true; } @@ -263,6 +263,7 @@ export abstract class BaseMode { const arkts = this.buildConfig.arkts; let errorStatus = false; try { + console.log("compiling " + fileInfo.filePath) arktsGlobal.filePath = fileInfo.filePath; arktsGlobal.config = arkts.Config.create(ets2pandaCmd).peer; const source = fs.readFileSync(fileInfo.filePath).toString(); @@ -850,7 +851,22 @@ export abstract class BaseMode { await Promise.all(compilePromises); } - public async run(): Promise { + public async runSequential(): Promise { + this.generateModuleInfos(); + + const compilePromises: Promise[] = []; + this.compileFiles.forEach((fileInfo: CompileFileInfo, _: string) => { + compilePromises.push(new Promise((resolve) => { + this.compile(fileInfo); + resolve(); + })); + }); + await Promise.all(compilePromises); + + this.mergeAbcFiles(); + } + + public async runSimultaneous(): Promise { this.generateModuleInfos(); const compilePromises: Promise[] = []; diff --git a/ets2panda/driver/build_system/src/build/build_framework_mode.ts b/ets2panda/driver/build_system/src/build/build_framework_mode.ts index ca40ca6642..4da3400fee 100644 --- a/ets2panda/driver/build_system/src/build/build_framework_mode.ts +++ b/ets2panda/driver/build_system/src/build/build_framework_mode.ts @@ -33,7 +33,7 @@ export class BuildFrameworkMode extends BaseMode { } public async run(): Promise { - super.run(); + super.runSimultaneous(); } protected generateModuleInfos(): void { diff --git a/ets2panda/driver/build_system/src/build/build_mode.ts b/ets2panda/driver/build_system/src/build/build_mode.ts index ceb492b3e0..a099962b73 100644 --- a/ets2panda/driver/build_system/src/build/build_mode.ts +++ b/ets2panda/driver/build_system/src/build/build_mode.ts @@ -35,12 +35,15 @@ export class BuildMode extends BaseMode { } else if (this.es2pandaMode === ES2PANDA_MODE.RUN_CONCURRENT) { // RUN_CONCURRENT: Executes tasks using multiple threads with astcache await super.runConcurrent(); - } else if (this.es2pandaMode === ES2PANDA_MODE.RUN) { + } else if (this.es2pandaMode === ES2PANDA_MODE.RUN_SEQUENTIAL) { // RUN: Executes tasks sequentially in a single process and single thread - await super.run(); + await super.runSequential(); + } else if (this.es2pandaMode === ES2PANDA_MODE.RUN_SIMULTANEOUS) { + // RUN: Executes tasks simultaneously + await super.runSimultaneous(); } else { - // Default fallback: Uses parallel execution (same as RUN_PARALLEL) - await super.run(); + // Default fallback + await super.runSequential(); } } } \ No newline at end of file diff --git a/ets2panda/driver/build_system/src/types.ts b/ets2panda/driver/build_system/src/types.ts index e909926c44..5aa6ff282a 100644 --- a/ets2panda/driver/build_system/src/types.ts +++ b/ets2panda/driver/build_system/src/types.ts @@ -299,8 +299,8 @@ export enum Es2pandaImportFlags { export enum ES2PANDA_MODE { RUN_PARALLEL = 0, RUN_CONCURRENT = 1, - RUN = 2, - RUN_WITH_MUTIL = 3 + RUN_SEQUENTIAL = 2, + RUN_SIMULTANEOUS = 3 }; export interface DynamicFileContext { -- Gitee