diff --git a/BUILD.gn b/BUILD.gn index f97a5eb55099359174e849b501a7959f1f5b399c..22af5308643e3b1dee13863f13d58f23754b117c 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -41,7 +41,7 @@ action("build_ets_loader_library") { deps = [ ":components", ":form_components", - ":install_arkguard_tsc", + ":install_arkguard_tsc_declgen", ":server", "//interface/sdk-js:bundle_arkts", "//interface/sdk-js:bundle_kits", @@ -173,7 +173,7 @@ ets_loader_sources = [ ohos_copy("ets_loader") { deps = [ ":build_ets_loader_library", - ":install_arkguard_tsc", + ":install_arkguard_tsc_declgen", ] sources = ets_loader_sources deps += [ ":build_ets_sysResource" ] @@ -260,7 +260,7 @@ ohos_copy("ets_loader_declaration") { ohos_copy("ets_loader_ark") { deps = [ ":build_ets_loader_library", - ":install_arkguard_tsc", + ":install_arkguard_tsc_declgen", ] sources = ets_loader_sources deps += [ ":build_ets_sysResource" ] @@ -347,18 +347,22 @@ group("ets_loader_ark_hap") { typescript_dir = get_label_info("//third_party/typescript:build_typescript", "target_out_dir") -action("install_arkguard_tsc") { +action("install_arkguard_tsc_declgen") { + static_core = "//arkcompiler/runtime_core/static_core" deps = [ + "${static_core}/plugins/ets/tools/declgen_ts2sts:build_declgen", "//arkcompiler/ets_frontend/arkguard:build_arkguard", "//third_party/typescript:build_typescript", ] - script = "install_arkguard_tsc.py" + script = "install_arkguard_tsc_declgen.py" args = [ rebase_path("${typescript_dir}/ohos-typescript-4.9.5-r4.tgz"), rebase_path( "${root_out_dir}/obj/arkcompiler/ets_frontend/arkguard/arkguard-1.1.3.tgz"), rebase_path("//developtools/ace_ets2bundle/compiler"), current_os, + rebase_path( + "${root_out_dir}/obj/arkcompiler/runtime_core/static_core/plugins/ets/tools/declgen_ts2sts/panda-declgen-1.0.0.tgz"), ] outputs = [ "${target_out_dir}/${target_name}.stamp" ] } diff --git a/compiler/main.js b/compiler/main.js index fe52a7825d6ba5650ea1f53fc1f99f08f3c6b0a2..1b6cb7ef348aa8df90f9e12f7ee86c0264ee8d87 100644 --- a/compiler/main.js +++ b/compiler/main.js @@ -150,6 +150,7 @@ function loadEntryObj(projectConfig) { initProjectConfig(projectConfig); loadMemoryTrackingConfig(projectConfig); loadBuildJson(); + initMixCompileHar(projectConfig); if (process.env.aceManifestPath && aceCompileMode === 'page') { setEntryFile(projectConfig); setFaTestRunnerFile(projectConfig); @@ -160,7 +161,9 @@ function loadEntryObj(projectConfig) { setStageTestRunnerFile(projectConfig); loadNavigationConfig(aceBuildJson); } - + if (projectConfig.mixCompile && projectConfig.isRemoteModule) { + return; + } if (staticPreviewPage) { projectConfig.entryObj['./' + staticPreviewPage] = projectConfig.projectPath + path.sep + staticPreviewPage + '.ets?entry'; @@ -265,7 +268,23 @@ function buildManifest(manifest, aceConfigPath) { } function getPackageJsonEntryPath() { - const rootPackageJsonPath = path.resolve(projectConfig.projectPath, '../../../' + projectConfig.packageJson); + /** + * adapt to oh_modules compile + * origin local module => project/library/src/main/ets + * oh_module => project/library/src/main + * bcs some oh_module don't contain ets dir + */ + + const candidatePaths = [ + path.resolve(projectConfig.projectPath, '../../../', projectConfig.packageJson), + path.resolve(projectConfig.projectPath, '../../', projectConfig.packageJson), + ]; + + const rootPackageJsonPath = + candidatePaths.find(fs.existsSync) ?? + (() => { + throw new Error('package.json not found'); + })(); if (fs.existsSync(rootPackageJsonPath)) { let rootPackageJsonContent; try { @@ -394,6 +413,9 @@ function setIntentEntryPages(projectConfig) { } function setAbilityPages(projectConfig) { + if (projectConfig.isRemoteModule) { + return; + } let abilityPages = []; if (projectConfig.aceModuleJsonPath && fs.existsSync(projectConfig.aceModuleJsonPath)) { const moduleJson = JSON.parse(fs.readFileSync(projectConfig.aceModuleJsonPath).toString()); @@ -1154,6 +1176,27 @@ function initMain() { abilityConfig.abilityType = process.env.abilityType || 'page'; } +/** + * due to some oh_modules is different with the original arkTs module. + * Some branches were not reached, causing some information to be uninitialized. + */ +function initMixCompileHar(projectConfig) { + projectConfig.isRemoteModule = process.env.isRemoteModule === 'true'; + projectConfig.mixCompile = process.env.mixCompile === 'true'; + if (projectConfig.isRemoteModule && projectConfig.mixCompile) { + projectConfig.compileHar = true; + process.env.compileMode = 'moduleJson'; + getPackageJsonEntryPath(); + /** + * ets-loader will generate decl file from projectConfig.intentEntry which init in setIntentEntryPages. + * aceModuleJsonPath->ark_modules.json + * when compile oh_module with ets-loader, aceModuleJsonPath will be undefined. + * so projectConfig.intentEntry is empty. + */ + setIntentEntryPages(projectConfig); + } +} + exports.globalProgram = globalProgram; exports.projectConfig = projectConfig; exports.loadEntryObj = loadEntryObj; diff --git a/compiler/package.json b/compiler/package.json index c9ebc37e36cc3cc44585b4ff51c29416e44dd1bf..ccdb99ec28c32619dc793b0fb5edf7762dc09086 100644 --- a/compiler/package.json +++ b/compiler/package.json @@ -42,6 +42,7 @@ "chai": "4.3.7", "eslint": "8.34.0", "mocha": "10.2.0", + "proxyquire": "^2.1.3", "uglify-js": "3.17.4" }, "dependencies": { diff --git a/compiler/script/install_declgen.sh b/compiler/script/install_declgen.sh new file mode 100755 index 0000000000000000000000000000000000000000..ca35365e44c76bfe92c8df4734ac8d3c1116b7a4 --- /dev/null +++ b/compiler/script/install_declgen.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#!/bin/bash +set -e + +if [ ! -d "../compiler" ]; then + echo "Error: must run this script in ace_ets2bundle/compiler root directory" + exit 1 +fi + +oriDir=$(pwd) + +DECLGEN_ROOT_DIR="../../../arkcompiler/runtime_core/static_core/plugins/ets/tools/declgen_ts2sts" + +cd "$DECLGEN_ROOT_DIR" || { echo "Failed to change directory to $DECLGEN_ROOT_DIR"; exit 1; } + +npm install +npm run build + +# Generate the npm package using `npm pack` +if npm pack; then + tarball=$(ls *.tgz) # Get the generated tarball file name + if [ -f "$tarball" ]; then + # Move the tarball to the original directory + mv "$tarball" "$oriDir/" + + # Go back to the original directory and extract the tarball + cd "$oriDir" + tar -xvzf "$tarball" + + # Rename the extracted directory (assuming it is named after the package) + extracted_dir=$(tar -tf "$tarball" | head -n 1 | cut -f1 -d"/") # Get the extracted folder name + mv "$extracted_dir" "./node_modules/declgen" # Rename to 'declgen' + + # Optionally, remove the tarball after extraction + rm "$tarball" + + echo "Build successfully packed, extracted, and renamed to 'declgen' in $oriDir" + else + echo "Error: No tarball found, cannot proceed" + exit 1 + fi +else + echo "Error: npm pack failed" + exit 1 +fi diff --git a/compiler/src/ark_utils.ts b/compiler/src/ark_utils.ts index 3adf3e7109f860754ba940109359df31448b3e57..9017550761c57c3e6269f648bf88a006b9e3b24e 100644 --- a/compiler/src/ark_utils.ts +++ b/compiler/src/ark_utils.ts @@ -48,6 +48,7 @@ import { EXTNAME_CJS, EXTNAME_ABC, EXTNAME_ETS, + EXTNAME_D_ETS, EXTNAME_TS_MAP, EXTNAME_JS_MAP, ESMODULE, @@ -108,6 +109,17 @@ export const packageCollection: Map> = new Map(); export function getNormalizedOhmUrlByFilepath(filePath: string, projectConfig: Object, logger: Object, pkgParams: Object, importerFile: string): string { const { pkgName, pkgPath, isRecordName } = pkgParams; + const { projectFilePath, pkgInfo } = getPkgInfo(filePath, projectConfig, logger, pkgPath, pkgName, importerFile); + const recordName: string = `${pkgInfo.bundleName}&${pkgName}/${projectFilePath}&${pkgInfo.version}`; + if (isRecordName) { + // record name style: &/entry/ets/xxx/yyy& + return recordName; + } + return `${pkgInfo.isSO ? 'Y' : 'N'}&${pkgInfo.moduleName}&${recordName}`; +} + +export function getPkgInfo(filePath: string, projectConfig: Object, logger: Object, pkgPath: string, + pkgName: string, importerFile?: string): Object { // rollup uses commonjs plugin to handle commonjs files, // the commonjs files are prefixed with '\x00' and need to be removed. if (filePath.startsWith('\x00')) { @@ -136,13 +148,8 @@ export function getNormalizedOhmUrlByFilepath(filePath: string, projectConfig: O logger.printError(errInfo); return filePath; } - let projectFilePath: string = unixFilePath.replace(toUnixPath(pkgPath), ''); - let recordName = `${pkgInfo.bundleName}&${pkgName}${projectFilePath}&${pkgInfo.version}`; - if (isRecordName) { - // record name style: &/entry/ets/xxx/yyy& - return recordName; - } - return `${pkgInfo.isSO ? 'Y' : 'N'}&${pkgInfo.moduleName}&${recordName}`; + const projectFilePath: string = unixFilePath.replace(toUnixPath(pkgPath) + '/', ''); + return { projectFilePath, pkgInfo }; } export function getOhmUrlByFilepath(filePath: string, projectConfig: Object, logger: Object, namespace?: string, diff --git a/compiler/src/ets_checker.ts b/compiler/src/ets_checker.ts index 31c90643368a7c462129366099caf2a92b02e594..63ee2bb16d63c2f5488abf67e5565ab3eddd4e92 100644 --- a/compiler/src/ets_checker.ts +++ b/compiler/src/ets_checker.ts @@ -46,6 +46,7 @@ import { ESMODULE, EXTNAME_D_ETS, EXTNAME_JS, + EXTNAME_ETS, FOREACH_LAZYFOREACH, COMPONENT_IF, TS_WATCH_END_MSG, @@ -103,6 +104,14 @@ import { import { ErrorCodeModule } from './hvigor_error_code/const/error_code_module'; import { buildErrorInfoFromDiagnostic } from './hvigor_error_code/utils'; import { concatenateEtsOptions, getExternalComponentPaths } from './external_component_map'; +import { + RunnerParms, + generateInteropDecls +} from '../node_modules/declgen/build/src/generateInteropDecls'; +import { + arkTSEvolutionModuleMap, + getArkTSEvoDeclFilePath +} from './process_arkts_evolution'; export interface LanguageServiceCache { service?: ts.LanguageService; @@ -595,12 +604,16 @@ export function serviceChecker(rootFileNames: string[], newLogger: Object = null MemoryMonitor.stopRecordStage(runArkTSLinterRecordInfo); ts.PerformanceDotting.stopAdvanced('runArkTSLinterTime'); - if (process.env.watchMode !== 'true') { + if (process.env.watchMode !== 'true' && !projectConfig.isRemoteModule) { const processBuildHaprrecordInfo = MemoryMonitor.recordStage(MemoryDefine.PROCESS_BUILD_HAP); processBuildHap(cacheFile, rootFileNames, parentEvent, rollupShareObject); MemoryMonitor.stopRecordStage(processBuildHaprrecordInfo); } + if (rollupShareObject?.projectConfig.mixCompile) { + generateDeclarationFileForSTS(rootFileNames); + } + maxMemoryInServiceChecker = process.memoryUsage().heapUsed; // Release the typeChecker early and perform GC in the following scenarios: // In memory-priority mode or default mode, when the preview mode is disabled in a full compilation scenario, @@ -1122,6 +1135,20 @@ export function resolveModuleNames(moduleNames: string[], containingFile: string } else { resolvedModules.push(result.resolvedModule); } + } else if (result.resolvedModule.resolvedFileName && /\.ets$/.test(result.resolvedModule.resolvedFileName) && + !/\.d\.ets$/.test(result.resolvedModule.resolvedFileName) && arkTSEvolutionModuleMap.size !== 0) { + // When result has a value and the path parsed is the source code file path of module 1.2, + // the parsing result needs to be modified to the glue code path of module 1.2 + let arktsEvoDeclFilePathExist: boolean = false; + const resolvedFileName: string = toUnixPath(result.resolvedModule.resolvedFileName); + const resultDETSPath: string = getArkTSEvoDeclFilePath({ moduleRequest: '', resolvedFileName }); + if (ts.sys.fileExists(resultDETSPath)) { + resolvedModules.push(getResolveModule(resultDETSPath, EXTNAME_D_ETS)); + arktsEvoDeclFilePathExist = true; + } + if (!arktsEvoDeclFilePathExist) { + resolvedModules.push(result.resolvedModule); + } } else { resolvedModules.push(result.resolvedModule); } @@ -1166,6 +1193,7 @@ export function resolveModuleNames(moduleNames: string[], containingFile: string path.resolve(__dirname, '../node_modules', moduleName + '/index.js'); const DETSModulePath: string = path.resolve(path.dirname(containingFile), /\.d\.ets$/.test(moduleName) ? moduleName : moduleName + EXTNAME_D_ETS); + const arktsEvoDeclFilePath: string = getArkTSEvoDeclFilePath({ moduleRequest: moduleName, resolvedFileName: '' }); if (ts.sys.fileExists(modulePath)) { resolvedModules.push(getResolveModule(modulePath, '.d.ts')); } else if (ts.sys.fileExists(systemDETSModulePath)) { @@ -1180,6 +1208,8 @@ export function resolveModuleNames(moduleNames: string[], containingFile: string resolvedModules.push(getResolveModule(fileModulePath, '.js')); } else if (ts.sys.fileExists(DETSModulePath)) { resolvedModules.push(getResolveModule(DETSModulePath, '.d.ets')); + } else if (ts.sys.fileExists(arktsEvoDeclFilePath)) { + resolvedModules.push(getResolveModule(arktsEvoDeclFilePath, '.d.ets')); } else { const srcIndex: number = projectConfig.projectPath.indexOf('src' + path.sep + 'main'); let DETSModulePathFromModule: string; @@ -1869,3 +1899,38 @@ export function resetEtsCheck(): void { fileToIgnoreDiagnostics = undefined; maxMemoryInServiceChecker = 0; } + +export function generateDeclarationFileForSTS(rootFileNames: string[]) { + if (!(projectConfig.compileHar || projectConfig.compileShared)) { + return; + } + const unixRootFileNames = rootFileNames.map(path => { + return toUnixPath(path); + }); + + const uniqueFiles = Array.from(new Set([ + ...unixRootFileNames, + /** + * arkui lacks explicit import statements and needs to be manually added to the global rootfile, + * otherwise an error will be reported during the tsc compilation of declgen + */ + ...readDeaclareFiles() + ])); + + const config: RunnerParms = { + inputDirs: [], + inputFiles: uniqueFiles, + outDir: projectConfig.dependentModuleMap.get(projectConfig.entryPackageName).declgenV2OutPath, + // use package name as folder name + rootDir: projectConfig.modulePath, + customResolveModuleNames: resolveModuleNames, + customCompilerOptions: compilerOptions, + includePaths: [projectConfig.modulePath] + }; + if (fs.existsSync(config.outDir)) { + fs.rmSync(config.outDir, { recursive: true, force: true }); + } + fs.mkdirSync(config.outDir, { recursive: true }); + generateInteropDecls(config); + processInteropUI(projectConfig.dependentModuleMap?.get(projectConfig.entryPackageName)?.declgenV2OutPath); +} \ No newline at end of file diff --git a/compiler/src/fast_build/ark_compiler/common/ark_define.ts b/compiler/src/fast_build/ark_compiler/common/ark_define.ts index 385d49f180dff84b57075d9f3af2804eca77d2c7..9bbbb62fc611ee611f2e38892fa2296f9f0c3eff 100644 --- a/compiler/src/fast_build/ark_compiler/common/ark_define.ts +++ b/compiler/src/fast_build/ark_compiler/common/ark_define.ts @@ -123,6 +123,9 @@ export const SEPARATOR_BITWISE_AND: string = '&'; export const SEPARATOR_AT: string = '@'; export const SEPARATOR_SLASH: string = '/'; +export const GEN_ABC_CMD: string = "genAbcCmd"; +export const GEN_ABC_CMD_FILE_PATH: string = "genAbcCmd.json"; + export const ES_ANNOTATIONS = [ '_ESConcurrentModuleRequestsAnnotation', '_ESSlotNumberAnnotation', diff --git a/compiler/src/fast_build/ark_compiler/module/module_mode.ts b/compiler/src/fast_build/ark_compiler/module/module_mode.ts index a619cb2effd764279f791ab773698c2dd1b1a4b6..02326cdde148294df6bf1d4b59fc4ec9a5f00851 100644 --- a/compiler/src/fast_build/ark_compiler/module/module_mode.ts +++ b/compiler/src/fast_build/ark_compiler/module/module_mode.ts @@ -54,7 +54,8 @@ import { ETS, TS, JS, - PERFREPORT_JSON + PERFREPORT_JSON, + GEN_ABC_CMD } from '../common/ark_define'; import { needAotCompiler, @@ -90,19 +91,27 @@ import { isTs2Abc, isEs2Abc, transformOhmurlToPkgName, - transformOhmurlToRecordName + transformOhmurlToRecordName, } from '../../../ark_utils'; import { generateAot, FaultHandler } from '../../../gen_aot'; import { + ARKTS_1_2, NATIVE_MODULE } from '../../../pre_define'; import { sharedModuleSet } from '../check_shared_module'; import { SourceMapGenerator } from '../generate_sourcemap'; +import { + addDeclFilesConfig, + ArkTSEvolutionModule, + getDeclgenBridgeCodePath, + pkgDeclFilesConfig, + arkTSModuleMap +} from '../../../process_arkts_evolution'; import { MemoryMonitor } from '../../meomry_monitor/rollup-plugin-memory-monitor'; import { MemoryDefine } from '../../meomry_monitor/memory_define'; import { @@ -175,6 +184,7 @@ export class ModuleMode extends CommonMode { abcPaths: string[] = []; byteCodeHar: boolean; perfReportPath: string; + rollupCache: Object; constructor(rollupObject: Object) { super(rollupObject); @@ -208,6 +218,7 @@ export class ModuleMode extends CommonMode { if (this.useNormalizedOHMUrl) { this.compileContextInfoPath = this.generateCompileContextInfo(rollupObject); } + this.rollupCache = rollupObject.cache; } private generateCompileContextInfo(rollupObject: Object): string { @@ -249,10 +260,13 @@ export class ModuleMode extends CommonMode { ); this.logger.printErrorAndExit(errInfo); } + const isArkTSEvolution: boolean = metaInfo.language === ARKTS_1_2; + const pkgPath: string = isArkTSEvolution ? + path.join(getDeclgenBridgeCodePath(metaInfo.pkgName), metaInfo.moduleName) : metaInfo.pkgPath; const pkgParams = { pkgName: metaInfo.pkgName, - pkgPath: metaInfo.pkgPath, - isRecordName: true + pkgPath, + isRecordName: true, }; let recordName: string = getNormalizedOhmUrlByFilepath(moduleId, this.projectConfig, this.logger, pkgParams, undefined); @@ -307,10 +321,25 @@ export class ModuleMode extends CommonMode { prepareForCompilation(rollupObject: Object, parentEvent: CompileEvent): void { const eventPrepareForCompilation = createAndStartEvent(parentEvent, 'preparation for compilation'); + this.collectModuleFileList(rollupObject, rollupObject.getModuleIds()); + if (rollupObject.share.projectConfig.dependentModuleMap) { + this.writeDeclFilesConfigJson(rollupObject.share.projectConfig.entryPackageName); + } this.removeCacheInfo(rollupObject); stopEvent(eventPrepareForCompilation); } + // Write the declaration file information of the 1.1 module file to the disk of the corresponding module + writeDeclFilesConfigJson(pkgName: string): void { + if (!arkTSModuleMap.size) { + return; + } + const arkTSEvolutionModuleInfo: ArkTSEvolutionModule = arkTSModuleMap.get(pkgName); + const declFilesConfigFile: string = toUnixPath(arkTSEvolutionModuleInfo.declFilesPath); + mkdirsSync(path.dirname(declFilesConfigFile)); + fs.writeFileSync(declFilesConfigFile, JSON.stringify(pkgDeclFilesConfig[pkgName], null, 2), 'utf-8'); + } + collectModuleFileList(module: Object, fileList: IterableIterator): void { const recordInfo = MemoryMonitor.recordStage(MemoryDefine.PKG_ENTRY_INFOS_MODULE_INFOS); let moduleInfos: Map = new Map(); @@ -500,18 +529,24 @@ export class ModuleMode extends CommonMode { let moduleName: string = metaInfo.moduleName; let recordName: string = ''; - let cacheFilePath: string = + let cacheFilePath: string = metaInfo.language === ARKTS_1_2 ? originalFilePath : this.genFileCachePath(filePath, this.projectConfig.projectRootPath, this.projectConfig.cachePath, metaInfo); let packageName: string = ''; if (this.useNormalizedOHMUrl) { packageName = metaInfo.pkgName; + const isArkTSEvolution: boolean = metaInfo.language === ARKTS_1_2; + const pkgPath: string = isArkTSEvolution ? + path.join(getDeclgenBridgeCodePath(packageName), metaInfo.moduleName) : metaInfo.pkgPath; const pkgParams = { pkgName: packageName, - pkgPath: metaInfo.pkgPath, - isRecordName: true + pkgPath, + isRecordName: true, }; recordName = getNormalizedOhmUrlByFilepath(filePath, this.projectConfig, this.logger, pkgParams, undefined); + if (!isArkTSEvolution) { + addDeclFilesConfig(originalFilePath, this.projectConfig, this.logger, pkgPath, packageName); + } } else { recordName = getOhmUrlByFilepath(filePath, this.projectConfig, this.logger, moduleName); if (isPackageModules) { @@ -674,6 +709,14 @@ export class ModuleMode extends CommonMode { // collect data error from subprocess let logDataList: Object[] = []; let errMsg: string = ''; + const eventGenDescriptionsForMergedEs2abc = createAndStartEvent(parentEvent, 'generate descriptions for merged es2abc'); + stopEvent(eventGenDescriptionsForMergedEs2abc); + + if (this.projectConfig.invokeEs2abcByHvigor) { + this.rollupCache.set(GEN_ABC_CMD, this.cmdArgs); + return; + } + const genAbcCmd: string = this.cmdArgs.join(' '); let eventGenAbc: CompileEvent; try { diff --git a/compiler/src/fast_build/ark_compiler/module/module_source_file.ts b/compiler/src/fast_build/ark_compiler/module/module_source_file.ts index 2152ebdfe887683f44f2a6e0de58a01bc6628351..c7b779e532b5faad5bd3cb9aa41962e75a6d43d5 100644 --- a/compiler/src/fast_build/ark_compiler/module/module_source_file.ts +++ b/compiler/src/fast_build/ark_compiler/module/module_source_file.ts @@ -47,6 +47,8 @@ import { } from '../common/ob_config_resolver'; import { ORIGIN_EXTENTION } from '../process_mock'; import { + ARKTS_1_2, + ESMODULE, TRANSFORMED_MOCK_CONFIG, USER_DEFINE_MOCK_CONFIG } from '../../../pre_define'; @@ -77,6 +79,11 @@ import { createAndStartEvent, stopEvent } from '../../../performance'; +import { + getDeclgenBridgeCodePath, + writeBridgeCodeFileSyncByNode +} from '../../../process_arkts_evolution'; + const ROLLUP_IMPORT_NODE: string = 'ImportDeclaration'; const ROLLUP_EXPORTNAME_NODE: string = 'ExportNamedDeclaration'; const ROLLUP_EXPORTALL_NODE: string = 'ExportAllDeclaration'; @@ -90,6 +97,7 @@ export class ModuleSourceFile { private source: string | ts.SourceFile; private metaInfo: Object; private isSourceNode: boolean = false; + private isArkTSEvolution: boolean = false; private static projectConfig: Object; private static logger: CommonLogger; private static mockConfigInfo: Object = {}; @@ -109,6 +117,9 @@ export class ModuleSourceFile { if (typeof this.source !== 'string') { this.isSourceNode = true; } + if (metaInfo?.language === ARKTS_1_2) { + this.isArkTSEvolution = true; + } } static setProcessMock(rollupObject: Object): void { @@ -417,13 +428,17 @@ export class ModuleSourceFile { return this.moduleId; } - private async writeSourceFile(parentEvent: CompileEvent): Promise { - if (this.isSourceNode && !isJsSourceFile(this.moduleId)) { - await writeFileSyncByNode( this.source, ModuleSourceFile.projectConfig, this.metaInfo, - this.moduleId, parentEvent, printObfLogger); + private async writeSourceFile(parentEvent: Object): Promise { + if (!this.isArkTSEvolution) { + if (this.isSourceNode && !isJsSourceFile(this.moduleId)) { + await writeFileSyncByNode( this.source, ModuleSourceFile.projectConfig, this.metaInfo, + this.moduleId, parentEvent, ModuleSourceFile.logger); + } else { + await writeFileContentToTempDir(this.moduleId, this.source, ModuleSourceFile.projectConfig, + ModuleSourceFile.logger, parentEvent, this.metaInfo); + } } else { - await writeFileContentToTempDir(this.moduleId, this.source, ModuleSourceFile.projectConfig, - printObfLogger, parentEvent, this.metaInfo); + await writeBridgeCodeFileSyncByNode( this.source, this.moduleId); } } @@ -501,10 +516,13 @@ export class ModuleSourceFile { } private static spliceNormalizedOhmurl(moduleInfo: Object, filePath: string, importerFile?: string): string { + const isArkTSEvolution: boolean = moduleInfo.meta.language === ARKTS_1_2; + const pkgPath: string = isArkTSEvolution ? + path.join(getDeclgenBridgeCodePath(moduleInfo.meta.pkgName), moduleInfo.meta.moduleName) : moduleInfo.meta.pkgPath; const pkgParams = { pkgName: moduleInfo.meta.pkgName, - pkgPath: moduleInfo.meta.pkgPath, - isRecordName: false + pkgPath, + isRecordName: false, }; const ohmUrl: string = getNormalizedOhmUrlByFilepath(filePath, ModuleSourceFile.projectConfig, ModuleSourceFile.logger, pkgParams, diff --git a/compiler/src/fast_build/ark_compiler/rollup-plugin-gen-abc.ts b/compiler/src/fast_build/ark_compiler/rollup-plugin-gen-abc.ts index f0f4b80e5175d35b316d68d8f4d74720b7400e76..32df152df7571d4259e9dbffa8f70312b12bd32a 100644 --- a/compiler/src/fast_build/ark_compiler/rollup-plugin-gen-abc.ts +++ b/compiler/src/fast_build/ark_compiler/rollup-plugin-gen-abc.ts @@ -26,6 +26,7 @@ import { SourceMapGenerator } from './generate_sourcemap'; import { cleanUpUtilsObjects, writeDeclarationFiles } from '../../ark_utils'; import { cleanUpKitImportObjects } from '../../process_kit_import'; import { cleanUpFilesList } from './utils'; +import { cleanUpProcessArkTSEvolutionObj } from '../../process_arkts_evolution'; import { CommonLogger } from './logger'; import { getHookEventFactory, @@ -83,6 +84,7 @@ export function genAbc() { CommonLogger.destroyInstance(); cleanUpAsyncEvents(); BytecodeObfuscator.cleanBcObfuscatorObject(); + cleanUpProcessArkTSEvolutionObj(); } }; } diff --git a/compiler/src/fast_build/ark_compiler/run_es2abc_standalone.ts b/compiler/src/fast_build/ark_compiler/run_es2abc_standalone.ts new file mode 100644 index 0000000000000000000000000000000000000000..8ec011349789024eebe3cf7c8fe472149a2af769 --- /dev/null +++ b/compiler/src/fast_build/ark_compiler/run_es2abc_standalone.ts @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import fs from 'fs'; +import path from 'path'; +import childProcess from 'child_process'; +import { + COMPILE_CONTEXT_INFO_JSON, + FILESINFO_TXT, + GEN_ABC_CMD_FILE_PATH, + MODULES_ABC, + MODULES_CACHE, + NPMENTRIES_TXT, + SOURCEMAPS, + SOURCEMAPS_JSON +} from './common/ark_define'; + +/** + * A script is called by hvigor in a mixed compilation scenario which 1.0 module is not main module,np + * such as module1.2-> module1.0-> module1.2 -> module1.0, compile all 1.0 modules + * and has nothing to do with the ace_ets2bundle process. + */ + +/** + * + * @param cachePathList projectConfig.cachePath of the modules to be merged + * @param targetCachePath The merged target cache directory + * @param aceModuleBuild The aceModuleBuild path of the target module is used to write the abc file to the disk + * @returns erro.toString() + */ +export function run(cachePathList: string[], targetCachePath: string, aceModuleBuild: string): void { + if (!cachePathList || cachePathList.length == 0) { + return + } + mergeCacheData(cachePathList, targetCachePath, FILESINFO_TXT); + mergeCacheData(cachePathList, targetCachePath, MODULES_CACHE); + mergeCacheData(cachePathList, targetCachePath, NPMENTRIES_TXT); + mergeCompileContextInfo(cachePathList, targetCachePath); + mergeSourceMap(cachePathList, targetCachePath); + const cmd: string[] = JSON.parse(fs.readFileSync(path.join(cachePathList[0], GEN_ABC_CMD_FILE_PATH), 'utf-8')); + updateCmd(cmd, targetCachePath, aceModuleBuild); + execCmd(cmd); +} + +export function mergeCacheData(cachePathList: string[], targetCachePath: string, fileName: string): void { + const dataSet: Set = new Set(); + cachePathList.forEach(cachePath => { + const inputFilePath: string = path.join(cachePath, fileName); + if (fs.existsSync(inputFilePath)) { + const fileData: string = fs.readFileSync(inputFilePath).toString(); + fileData.split('\n').forEach(data => { + //eat blank line + if (data) { + dataSet.add(data); + } + }); + } + }); + + const outputFilePath: string = path.join(targetCachePath, fileName); + fs.writeFileSync(outputFilePath, Array.from(dataSet).join('\n')); +} + +function execCmd(cmd: string[]): string { + try { + const result = childProcess.execSync(cmd.join(' '), { + windowsHide: true, + encoding: 'utf-8' + }); + return result; + } catch (error) { + return error.toString(); + } +} + +export function updateCmd(cmd: string[], targetCachePath: string, aceModuleBuild: string) { + for (let i = 0; i < cmd.length; i++) { + if (cmd[i].indexOf("filesInfo.txt") != -1) { + const filesInfoPath: string = path.join(targetCachePath, FILESINFO_TXT); + cmd[i] = `"@${filesInfoPath}"`; + continue; + } + if (cmd[i] === ('--output')) { + const moduleAbcPath = path.join(aceModuleBuild, MODULES_ABC); + cmd[++i] = `"${moduleAbcPath}"`; + continue; + } + if (cmd[i] === ('--cache-file')) { + const cacheFilePath = path.join(targetCachePath, MODULES_CACHE); + cmd[++i] = `"@${cacheFilePath}"`; + continue; + } + if (cmd[i] === ('--npm-module-entry-list')) { + const npmEntriesInfoPath = path.join(targetCachePath, NPMENTRIES_TXT); + cmd[++i] = `"@${npmEntriesInfoPath}"`; + continue; + } + if (cmd[i] === (`--compile-context-info`)) { + const compileContextInfoPath = path.join(targetCachePath, COMPILE_CONTEXT_INFO_JSON); + cmd[++i] = `"${compileContextInfoPath}"`; + continue; + } + } +} + +function deepMerge(target: Object, source: Object): Object { + for (const key of Object.keys(source)) { + if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) { + target[key] = deepMerge(target[key] || {}, source[key]); + } else { + target[key] = source[key]; + } + } + return target; +} + +export function mergeCompileContextInfo(cachePathList: string[], targetCachePath: string) { + const mergedData = { + hspPkgNames: [], + compileEntries: [], + updateVersionInfo: {} + }; + + cachePathList.forEach(cachePath => { + const compileContextPath = path.join(cachePath, COMPILE_CONTEXT_INFO_JSON); + + if (fs.existsSync(compileContextPath)) { + const data = JSON.parse(fs.readFileSync(compileContextPath, 'utf-8')); + + mergedData.hspPkgNames = [...mergedData.hspPkgNames, ...data.hspPkgNames]; + mergedData.compileEntries = [...mergedData.compileEntries, ...data.compileEntries]; + + mergedData.updateVersionInfo = deepMerge(mergedData.updateVersionInfo, data.updateVersionInfo); + } + }); + + const targetPath = path.join(targetCachePath, COMPILE_CONTEXT_INFO_JSON); + fs.writeFileSync(targetPath, JSON.stringify(mergedData, null, 2)); +} + +export function mergeSourceMap(cachePathList: string[], targetCachePath: string) { + const mergedMap: Record = {}; + cachePathList.forEach((item) => { + /** + * Prevent sourcemap.json file from not being generated. + * Some bug scenarios only have one file written to disk. + */ + const possiblePaths = [ + path.join(item, SOURCEMAPS), + path.join(item, SOURCEMAPS_JSON), + ]; + + const sourceMapPath = possiblePaths.find(fs.existsSync); + if (!sourceMapPath) { + return; + } + const sourceMap = JSON.parse(fs.readFileSync(sourceMapPath, 'utf-8')); + Object.assign(mergedMap, sourceMap); + }); + + const outputPath = path.join(targetCachePath, SOURCEMAPS); + fs.writeFileSync(outputPath, JSON.stringify(mergedMap, null, 2), 'utf-8'); +} diff --git a/compiler/src/fast_build/ets_ui/rollup-plugin-ets-checker.ts b/compiler/src/fast_build/ets_ui/rollup-plugin-ets-checker.ts index 24e3276e7546307db957bc16ce95dd8c41c4de27..8ada482f3bee37dcfafda29b9ba2eaf6310ef82c 100644 --- a/compiler/src/fast_build/ets_ui/rollup-plugin-ets-checker.ts +++ b/compiler/src/fast_build/ets_ui/rollup-plugin-ets-checker.ts @@ -31,11 +31,13 @@ import { targetESVersionChanged, collectFileToIgnoreDiagnostics, TSC_SYSTEM_CODE, - traverseProgramSourceFiles + traverseProgramSourceFiles, + arkTsEvolutionModuleMap, + cleanUpArkTsEvolutionModuleMap, } from '../../ets_checker'; import { TS_WATCH_END_MSG } from '../../pre_define'; import { - setChecker + setChecker, } from '../../utils'; import { configureSyscapInfo, @@ -53,6 +55,7 @@ import { } from '../../performance'; import { LINTER_SUBSYSTEM_CODE } from '../../hvigor_error_code/hvigor_error_info'; import { ErrorCodeModule } from '../../hvigor_error_code/const/error_code_module'; +import { collectArkTSEvolutionModuleInfo } from '../../process_arkts_evolution'; export let tsWatchEmitter: EventEmitter | undefined = undefined; export let tsWatchEndPromise: Promise; @@ -62,6 +65,9 @@ export function etsChecker() { return { name: 'etsChecker', buildStart() { + if (this.share.projectConfig.dependentModuleMap) { + collectArkTSEvolutionModuleInfo(this.share); + } const recordInfo = MemoryMonitor.recordStage(MemoryDefine.ROLLUP_PLUGIN_BUILD_START); const hookEventFactory: CompileEvent = getHookEventFactory(this.share, 'etsChecker', 'buildStart'); const eventServiceChecker = createAndStartEvent(hookEventFactory, 'serviceChecker'); @@ -165,4 +171,4 @@ function rootFileNamesCollect(rootFileNames: string[]): void { entryFiles.forEach((fileName: string) => { rootFileNames.push(path.resolve(fileName)); }); -} +} \ No newline at end of file diff --git a/compiler/src/pre_define.ts b/compiler/src/pre_define.ts index 7b041ad59b0301e7d36bbda61d162339374eeb76..d153bf444f5cab8cc58da40277046a1b12f0ccc4 100644 --- a/compiler/src/pre_define.ts +++ b/compiler/src/pre_define.ts @@ -665,4 +665,7 @@ export const USE_SHARED_STORAGE: string = 'useSharedStorage'; export const ARKTS_MODULE_PREFIX: string = '@arkts'; export const ARKTS_MODULE_NAME: string = 'arkts'; export const COLD_RELOAD_MODE: string = 'coldReload'; -export const INTEGRATED_HSP: string = 'integratedHsp'; \ No newline at end of file +export const INTEGRATED_HSP: string = 'integratedHsp'; + +export const ARKTS_1_2: string = '1.2'; +export const ARKTS_1_1: string = '1.1'; \ No newline at end of file diff --git a/compiler/src/process_arkts_evolution.ts b/compiler/src/process_arkts_evolution.ts new file mode 100644 index 0000000000000000000000000000000000000000..a2f57711f919b19553ae7dd67b89070944240cf8 --- /dev/null +++ b/compiler/src/process_arkts_evolution.ts @@ -0,0 +1,187 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import fs from 'fs'; +import path from 'path'; +import ts from 'typescript'; + +import { + EXTNAME_ETS, + EXTNAME_D_ETS, + ARKTS_1_1, + ARKTS_1_2 +} from './pre_define'; +import { + toUnixPath, + mkdirsSync +} from './utils'; +import { + red, + reset +} from './fast_build/ark_compiler/common/ark_define'; +import { getPkgInfo } from './ark_utils'; + +interface DeclFileConfig { + declPath: string; + ohmUrl: string; +} + +interface DeclFilesConfig { + packageName: string; + files: { + [filePath: string]: DeclFileConfig; + } +} + +export interface ArkTSEvolutionModule { + language: string; // "1.1" | "1.2" + pkgName: string; + moduleName: string; + modulePath: string; + declgenV1OutPath?: string; + declgenV2OutPath?: string; + declgenBridgeCodePath?: string; + declFilesPath?: string; +} + +interface ResolvedFileInfo { + moduleRequest: string; + resolvedFileName: string; +} + +export let pkgDeclFilesConfig: { [pkgName: string]: DeclFilesConfig } = {}; + +export let arkTSModuleMap: Map = new Map(); + +export let arkTSEvolutionModuleMap: Map = new Map(); + +export let arkTSHybridModuleMap: Map = new Map(); + +export function addDeclFilesConfig(filePath: string, projectConfig: Object, logger: Object, + pkgPath: string, pkgName: string): void { + const { projectFilePath, pkgInfo } = getPkgInfo(filePath, projectConfig, logger, pkgPath, pkgName); + const declgenV2OutPath: string = getDeclgenV2OutPath(pkgName); + if (!declgenV2OutPath) { + return; + } + if (!pkgDeclFilesConfig[pkgName]) { + pkgDeclFilesConfig[pkgName] = { packageName: pkgName, files: {} }; + } + if (pkgDeclFilesConfig[pkgName].files[projectFilePath]) { + return; + } + const isSO: string = pkgInfo.isSO ? 'Y' : 'N'; + // The module name of the entry module of the project during the current compilation process. + const mainModuleName: string = projectConfig.mainModuleName; + const bundleName: string = projectConfig.bundleName; + const normalizedFilePath: string = `${pkgName}/${projectFilePath}`; + const declPath: string = path.join(toUnixPath(declgenV2OutPath), projectFilePath) + EXTNAME_D_ETS; + const ohmUrl: string = `${isSO}&${mainModuleName}&${bundleName}&${normalizedFilePath}&${pkgInfo.version}`; + pkgDeclFilesConfig[pkgName].files[projectFilePath] = { declPath, ohmUrl: `@normalized:${ohmUrl}` }; +} + +export function getArkTSEvoDeclFilePath(resolvedFileInfo: ResolvedFileInfo): string { + const { moduleRequest, resolvedFileName } = resolvedFileInfo; + let arktsEvoDeclFilePath: string = moduleRequest; + for (const [pkgName, arkTSEvolutionModuleInfo] of arkTSEvolutionModuleMap) { + const declgenV1OutPath: string = toUnixPath(arkTSEvolutionModuleInfo.declgenV1OutPath); + const modulePath: string = toUnixPath(arkTSEvolutionModuleInfo.modulePath); + const moduleName: string = arkTSEvolutionModuleInfo.moduleName; + const declgenBridgeCodePath: string = toUnixPath(arkTSEvolutionModuleInfo.declgenBridgeCodePath); + if (resolvedFileName && resolvedFileName.startsWith(modulePath + '/') && + !resolvedFileName.startsWith(declgenBridgeCodePath + '/')) { + arktsEvoDeclFilePath = resolvedFileName + .replace(modulePath, toUnixPath(path.join(declgenV1OutPath, moduleName))) + .replace(EXTNAME_ETS, EXTNAME_D_ETS); + break; + } + if (moduleRequest === moduleName) { + arktsEvoDeclFilePath = path.join(declgenV1OutPath, moduleName, 'Index.d.ets'); + break; + } + if (moduleRequest.startsWith(moduleName + '/')) { + arktsEvoDeclFilePath = moduleRequest.replace( + moduleName, + toUnixPath(path.join(declgenV1OutPath, moduleName, 'src/main/ets')) + ) + EXTNAME_D_ETS; + break; + } + } + return arktsEvoDeclFilePath; +} + +export function collectArkTSEvolutionModuleInfo(share: Object): void { + if (!share.projectConfig.useNormalizedOHMUrl) { + share.throwArkTsCompilerError(red, 'ArkTS:ERROR: Failed to compile mixed project.\n' + + 'Error Message: Failed to compile mixed project because useNormalizedOHMUrl is false.\n' + + 'Solutions: > Check whether useNormalizedOHMUrl is true.', reset); + } + // dependentModuleMap Contents eg. + // 1.2 hap -> 1.1 har: It contains the information of 1.1 har + // 1.1 hap -> 1.2 har -> 1.1 har : There is information about 3 modules. + for (const [pkgName, dependentModuleInfo] of share.projectConfig.dependentModuleMap) { + if (dependentModuleInfo.language === ARKTS_1_2) { + if (dependentModuleInfo.declgenV1OutPath && dependentModuleInfo.declgenBridgeCodePath) { + arkTSEvolutionModuleMap.set(pkgName, dependentModuleInfo); + } else { + share.throwArkTsCompilerError(red, 'ArkTS:INTERNAL ERROR: Failed to collect arkTs evolution module info.\n' + + `Error Message: Failed to collect arkTs evolution module "${pkgName}" info from rollup.`, reset); + } + } else if (dependentModuleInfo.language === ARKTS_1_1) { + if (dependentModuleInfo.declgenV2OutPath && dependentModuleInfo.declFilesPath) { + arkTSModuleMap.set(pkgName, dependentModuleInfo); + } else { + share.throwArkTsCompilerError(red, 'ArkTS:INTERNAL ERROR: Failed to collect arkTs evolution module info.\n' + + `Error Message: Failed to collect arkTs evolution module "${pkgName}" info from rollup.`, reset); + } + } else { + arkTSHybridModuleMap.set(pkgName, dependentModuleInfo); + } + } +} + +export function cleanUpProcessArkTSEvolutionObj(): void { + arkTSModuleMap = new Map(); + arkTSEvolutionModuleMap = new Map(); + arkTSHybridModuleMap = new Map(); + pkgDeclFilesConfig = {}; +} + +export async function writeBridgeCodeFileSyncByNode(node: ts.SourceFile, moduleId: string): Promise { + const printer: ts.Printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed }); + const writer: ts.EmitTextWriter = ts.createTextWriter( + // @ts-ignore + ts.getNewLineCharacter({ newLine: ts.NewLineKind.LineFeed, removeComments: false })); + printer.writeFile(node, writer, undefined); + mkdirsSync(path.dirname(moduleId)); + fs.writeFileSync(moduleId, writer.getText()); +} + +export function getDeclgenBridgeCodePath(pkgName: string): string { + if (arkTSEvolutionModuleMap.size && arkTSEvolutionModuleMap.get(pkgName)) { + const arkTSEvolutionModuleInfo: ArkTSEvolutionModule = arkTSEvolutionModuleMap.get(pkgName); + return arkTSEvolutionModuleInfo.declgenBridgeCodePath; + } + return ''; +} + +function getDeclgenV2OutPath(pkgName: string): string { + if (arkTSModuleMap.size && arkTSModuleMap.get(pkgName)) { + const arkTsModuleInfo: ArkTSEvolutionModule = arkTSModuleMap.get(pkgName); + return arkTsModuleInfo.declgenV2OutPath; + } + return ''; +} + diff --git a/compiler/src/process_module_files.ts b/compiler/src/process_module_files.ts index 63b38aa1a29803b3b0abfe5115d2b6af3c4db986..2a8e3a07702a8b0d21cabc81dc8122521ff0a0ee 100644 --- a/compiler/src/process_module_files.ts +++ b/compiler/src/process_module_files.ts @@ -20,7 +20,7 @@ import fs from 'fs'; import { SourceMapGenerator } from './fast_build/ark_compiler/generate_sourcemap'; import { EXTNAME_TS, - EXTNAME_ETS, + EXTNAME_ETS } from './pre_define'; import { genTemporaryPath, @@ -61,7 +61,8 @@ export async function writeFileSyncByNode(node: ts.SourceFile, projectConfig: Ob * Note: current realization is related to the moduleId mechanism in the rollup framework, which is needed to be reconsidered to improve the code robustness. * In the current realization, when moduleId mechanism is changed, there would be a compilation error. */ - let temporaryFile: string = genTemporaryPath(moduleId ? moduleId : node.fileName, projectConfig.projectPath, process.env.cachePath, + let filePath: string = moduleId ? moduleId : node.fileName; + let temporaryFile: string = genTemporaryPath(filePath, projectConfig.projectPath, process.env.cachePath, projectConfig, metaInfo); if (temporaryFile.length === 0) { return; @@ -69,7 +70,7 @@ export async function writeFileSyncByNode(node: ts.SourceFile, projectConfig: Ob if (temporaryFile.endsWith(EXTNAME_ETS)) { temporaryFile = temporaryFile.replace(/\.ets$/, EXTNAME_TS); } - let relativeFilePath = getRelativeSourcePath(moduleId ? moduleId : node.fileName, projectConfig.projectRootPath, metaInfo?.belongProjectPath); + let relativeFilePath = getRelativeSourcePath(filePath, projectConfig.projectRootPath, metaInfo?.belongProjectPath); let sourceMaps: Object; if (process.env.compileTool === 'rollup') { const key = sourceMapGenerator.isNewSourceMaps() ? moduleId! : relativeFilePath; diff --git a/compiler/test/ark_compiler_ut/common/process_arkts_evolution.test.ts b/compiler/test/ark_compiler_ut/common/process_arkts_evolution.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..42a538d8036e08fc922d892597c03a738f76c466 --- /dev/null +++ b/compiler/test/ark_compiler_ut/common/process_arkts_evolution.test.ts @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use rollupObject file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { expect } from 'chai'; +import mocha from 'mocha'; +import sinon from 'sinon'; + +import { + collectArkTSEvolutionModuleInfo, + addDeclFilesConfig, + pkgDeclFilesConfig, + arkTSModuleMap +} from '../../../lib/process_arkts_evolution'; +import RollUpPluginMock from '../mock/rollup_mock/rollup_plugin_mock'; +import { + BUNDLE_NAME_DEFAULT, + HAR_DECLGENV2OUTPATH +} from '../mock/rollup_mock/common'; + +mocha.describe('process arkts evolution tests', function () { + mocha.before(function () { + this.rollup = new RollUpPluginMock(); + }); + + mocha.after(() => { + delete this.rollup; + }); + + mocha.it('1-1: test error message of collectArkTSEvolutionModuleInfo (useNormalizedOHMUrl is false)', function () { + this.rollup.build(); + this.rollup.share.projectConfig.useNormalizedOHMUrl = false; + this.rollup.share.projectConfig.dependentModuleMap.set('evohar', { language: '1.2' }); + const throwArkTsCompilerErrorStub = sinon.stub(this.rollup.share, 'throwArkTsCompilerError'); + try { + collectArkTSEvolutionModuleInfo(this.rollup.share); + } catch(e) { + } + const errMsg: string = 'ArkTS:ERROR: Failed to compile mixed project.\n' + + `Error Message: Failed to compile mixed project because useNormalizedOHMUrl is false.\n` + + 'Solutions: > Check whether useNormalizedOHMUrl is true.'; + expect(throwArkTsCompilerErrorStub.getCall(0).args[1] === errMsg).to.be.true; + throwArkTsCompilerErrorStub.restore(); + }); + + mocha.it('1-2: test error message of collectArkTSEvolutionModuleInfo (1.2 module information is incorrect)', function () { + this.rollup.build(); + this.rollup.share.projectConfig.useNormalizedOHMUrl = true; + this.rollup.share.projectConfig.dependentModuleMap.set('evohar', { language: '1.2' }); + const throwArkTsCompilerErrorStub = sinon.stub(this.rollup.share, 'throwArkTsCompilerError'); + try { + collectArkTSEvolutionModuleInfo(this.rollup.share); + } catch(e) { + } + const errMsg: string = 'ArkTS:INTERNAL ERROR: Failed to collect arkTs evolution module info.\n' + + `Error Message: Failed to collect arkTs evolution module "evohar" info from rollup.`; + expect(throwArkTsCompilerErrorStub.getCall(0).args[1] === errMsg).to.be.true; + throwArkTsCompilerErrorStub.restore(); + }); + + mocha.it('1-3: test error message of collectArkTSEvolutionModuleInfo (1.1 module information is incorrect)', function () { + this.rollup.build(); + this.rollup.share.projectConfig.useNormalizedOHMUrl = true; + this.rollup.share.projectConfig.dependentModuleMap.set('har', { language: '1.1' }); + const throwArkTsCompilerErrorStub = sinon.stub(this.rollup.share, 'throwArkTsCompilerError'); + try { + collectArkTSEvolutionModuleInfo(this.rollup.share); + } catch(e) { + } + const errMsg: string = 'ArkTS:INTERNAL ERROR: Failed to collect arkTs evolution module info.\n' + + `Error Message: Failed to collect arkTs evolution module "har" info from rollup.`; + expect(throwArkTsCompilerErrorStub.getCall(0).args[1] === errMsg).to.be.true; + throwArkTsCompilerErrorStub.restore(); + }); + + mocha.it('2-1: test generate declFilesInfo in mixed compilation', function () { + pkgDeclFilesConfig['har'] = { + packageName: 'har', + files: {} + }; + const filePath = '/har/Index.ets' + const projectConfig = { + mainModuleName: 'entry', + bundleName: BUNDLE_NAME_DEFAULT, + pkgContextInfo: { + 'har': { + packageName: 'har', + version: '1.0.0', + isSO: false + } + } + } + arkTSModuleMap.set('har', { + language: '1.1', + pkgName: 'har', + declgenV2OutPath: HAR_DECLGENV2OUTPATH + }) + addDeclFilesConfig(filePath, projectConfig, undefined, '/har', 'har'); + const expectDeclPath: string = `${HAR_DECLGENV2OUTPATH}/Index.d.ets`; + const expectOhmUrl: string = `@normalized:N&entry&${BUNDLE_NAME_DEFAULT}&har/Index&1.0.0`; + expect(pkgDeclFilesConfig['har'].files.length !== 0).to.be.true; + expect(pkgDeclFilesConfig['har'].files['Index'].length !== 0).to.be.true; + expect(pkgDeclFilesConfig['har'].files['Index'].declPath === expectDeclPath).to.be.true; + expect(pkgDeclFilesConfig['har'].files['Index'].ohmUrl === expectOhmUrl).to.be.true; + arkTSModuleMap.clear(); + }); +}); \ No newline at end of file diff --git a/compiler/test/ark_compiler_ut/ets_checker.test.ts b/compiler/test/ark_compiler_ut/ets_checker.test.ts index b46f43c0486d5264a6a02660765e2e9f8c221977..68443f478827b0b08c76596dc014d2d1313f807b 100644 --- a/compiler/test/ark_compiler_ut/ets_checker.test.ts +++ b/compiler/test/ark_compiler_ut/ets_checker.test.ts @@ -17,10 +17,16 @@ import mocha from 'mocha'; import fs from 'fs'; import path from 'path'; import { expect } from 'chai'; -import * as sinon from 'sinon'; import * as ts from 'typescript'; +import sinon from 'sinon'; +import proxyquire from 'proxyquire'; -import { EXPECT_INDEX_ETS } from './mock/rollup_mock/path_config'; +import { + DEFAULT_ENTRY, + DEFAULT_PROJECT, + EXPECT_INDEX_ETS, + PROJECT_ROOT +} from './mock/rollup_mock/path_config'; import RollUpPluginMock from './mock/rollup_mock/rollup_plugin_mock'; import { addLocalPackageSet, @@ -29,6 +35,7 @@ import { needReCheckForChangedDepUsers, resetEtsCheck, serviceChecker, + resolveModuleNames as resolveModuleNamesMain, getMaxFlowDepth, MAX_FLOW_DEPTH_DEFAULT_VALUE, fileCache, @@ -39,6 +46,11 @@ import { globalProgram, projectConfig } from '../../main'; +import { mkdirsSync } from '../../lib/utils'; +import { + arkTSEvolutionModuleMap, + cleanUpProcessArkTSEvolutionObj +} from '../../lib/process_arkts_evolution'; mocha.describe('test ets_checker file api', function () { mocha.before(function () { @@ -190,6 +202,116 @@ mocha.describe('test ets_checker file api', function () { let program: ts.Program = ts.createProgram(fileNames, compilerOptions); expect(program.getEmitHost()).to.not.be.undefined; }); + + mocha.it('2-1: test resolveModuleNames parse 1.2 module declaration files', function () { + const code: string = 'import { a } from "har";\nconsole.log(a);\n'; + const moduleNames: string[] = [ + 'har', + 'har/test' + ]; + arkTSEvolutionModuleMap.set('har', { + language: '1.2', + packageName: 'har', + moduleName: 'har', + modulePath: `${PROJECT_ROOT}/${DEFAULT_PROJECT}/har`, + declgenV1OutPath: `${PROJECT_ROOT}/${DEFAULT_PROJECT}/har/build/default/intermediates/declgen/default/declgenV1`, + declgenBridgeCodePath: `${PROJECT_ROOT}/${DEFAULT_PROJECT}/har/build/default/intermediates/declgen/default/bridgecode` + }) + const filePath: string = `${PROJECT_ROOT}/${DEFAULT_PROJECT}/${DEFAULT_ENTRY}/src/main/entryability/test.ets`; + const arktsEvoIndexDeclFilePath: string = `${arkTSEvolutionModuleMap.get('har').declgenV1OutPath}/har/Index.d.ets`; + const arktsEvoTestDeclFilePath: string = `${arkTSEvolutionModuleMap.get('har').declgenV1OutPath}/har/src/main/ets/test.d.ets`; + fs.writeFileSync(filePath, code); + mkdirsSync(path.dirname(arktsEvoIndexDeclFilePath)); + mkdirsSync(path.dirname(arktsEvoTestDeclFilePath)); + fs.writeFileSync(arktsEvoIndexDeclFilePath, ''); + fs.writeFileSync(arktsEvoTestDeclFilePath, ''); + const resolvedModules = resolveModuleNamesMain(moduleNames, filePath); + expect(resolvedModules[0].resolvedFileName === arktsEvoIndexDeclFilePath).to.be.true; + expect(resolvedModules[1].resolvedFileName === arktsEvoTestDeclFilePath).to.be.true; + fs.unlinkSync(filePath); + fs.unlinkSync(arktsEvoIndexDeclFilePath); + fs.unlinkSync(arktsEvoTestDeclFilePath); + cleanUpProcessArkTSEvolutionObj(); + }); + + mocha.it('2-2: test resolveModuleNames parse the 1.2 module declaration file that the 1.1 module depends on (packageName)', function () { + const moduleNames: string[] = ['testhar']; + arkTSEvolutionModuleMap.set('har', { + language: '1.2', + packageName: 'testhar', + moduleName: 'testhar', + modulePath: `${PROJECT_ROOT}/${DEFAULT_PROJECT}/testhar`, + declgenV1OutPath: `${PROJECT_ROOT}/${DEFAULT_PROJECT}/testhar/build/default/intermediates/declgen/default/declgenV1`, + declgenBridgeCodePath: `${PROJECT_ROOT}/${DEFAULT_PROJECT}/testhar/build/default/intermediates/declgen/default/bridgecode` + }) + const filePath: string = `${PROJECT_ROOT}/${DEFAULT_PROJECT}/${DEFAULT_ENTRY}/src/main/entryability/test.ets`; + const arktsEvoIndexFilePath: string = `${PROJECT_ROOT}/${DEFAULT_PROJECT}/testhar/Index.ets`; + const arktsEvoIndexDeclFilePath: string = `${arkTSEvolutionModuleMap.get('har').declgenV1OutPath}/testhar/Index.d.ets`; + const resolveModuleNameStub = sinon.stub(ts, 'resolveModuleName').returns({ + resolvedModule: { + resolvedFileName: arktsEvoIndexFilePath, + extension: '.ets', + isExternalLibraryImport: false, + } + }); + const mockedTs = { + ...require('typescript'), + resolveModuleName: resolveModuleNameStub + }; + let resolveModuleNames; + ({ resolveModuleNames } = proxyquire('../../lib/ets_checker', { + 'typescript': mockedTs + })); + fs.writeFileSync(filePath, ''); + mkdirsSync(path.dirname(arktsEvoIndexFilePath)); + mkdirsSync(path.dirname(arktsEvoIndexDeclFilePath)); + fs.writeFileSync(arktsEvoIndexFilePath, ''); + fs.writeFileSync(arktsEvoIndexDeclFilePath, ''); + const resolvedModules = resolveModuleNames(moduleNames, filePath); + expect(resolvedModules[0].resolvedFileName === arktsEvoIndexDeclFilePath); + fs.unlinkSync(filePath); + fs.unlinkSync(arktsEvoIndexDeclFilePath); + resolveModuleNameStub.restore(); + }); + + mocha.it('2-3: test resolveModuleNames parse the 1.2 module declaration file that the 1.1 module depends on', function () { + const moduleNames: string[] = ['testhar/src/main/ets/test']; + arkTSEvolutionModuleMap.set('har', { + language: '1.2', + packageName: 'testhar', + moduleName: 'testhar', + modulePath: `${PROJECT_ROOT}/${DEFAULT_PROJECT}/testhar`, + declgenV1OutPath: `${PROJECT_ROOT}/${DEFAULT_PROJECT}/testhar/build/default/intermediates/declgen/default/declgenV1`, + declgenBridgeCodePath: `${PROJECT_ROOT}/${DEFAULT_PROJECT}/testhar/build/default/intermediates/declgen/default/bridgecode` + }) + const filePath: string = `${PROJECT_ROOT}/${DEFAULT_PROJECT}/${DEFAULT_ENTRY}/src/main/entryability/test.ets`; + const arktsEvoTestFilePath: string = `${PROJECT_ROOT}/${DEFAULT_PROJECT}/testhar/src/main/ets/test.ets`; + const arktsEvoTestDeclFilePath: string = `${arkTSEvolutionModuleMap.get('har').declgenV1OutPath}/testhar/src/main/ets/test.d.ets`; + const resolveModuleNameStub = sinon.stub(ts, 'resolveModuleName').returns({ + resolvedModule: { + resolvedFileName: arktsEvoTestFilePath, + extension: '.ets', + isExternalLibraryImport: false, + } + }); + const mockedTs = { + ...require('typescript'), + resolveModuleName: resolveModuleNameStub + }; + let resolveModuleNames; + ({ resolveModuleNames } = proxyquire('../../lib/ets_checker', { 'typescript': mockedTs })); + + fs.writeFileSync(filePath, ''); + mkdirsSync(path.dirname(arktsEvoTestFilePath)); + mkdirsSync(path.dirname(arktsEvoTestDeclFilePath)); + fs.writeFileSync(arktsEvoTestFilePath, ''); + fs.writeFileSync(arktsEvoTestDeclFilePath, ''); + const resolvedModules = resolveModuleNames(moduleNames, filePath); + expect(resolvedModules[0].resolvedFileName === arktsEvoTestDeclFilePath); + fs.unlinkSync(filePath); + fs.unlinkSync(arktsEvoTestDeclFilePath); + resolveModuleNameStub.restore(); + }); }); mocha.describe('getMaxFlowDepth', () => { diff --git a/compiler/test/ark_compiler_ut/mock/rollup_mock/common.ts b/compiler/test/ark_compiler_ut/mock/rollup_mock/common.ts index 1feceb88e289160a457c2e323ca03f879cd98edc..123f315d9c320526cd48e88df059975bf4a9887d 100644 --- a/compiler/test/ark_compiler_ut/mock/rollup_mock/common.ts +++ b/compiler/test/ark_compiler_ut/mock/rollup_mock/common.ts @@ -79,4 +79,8 @@ export const LOADER_AOTMODE: string = 'loader_aotMode.json'; export const UPDATESOURCEMAP: string = 'updateSourceMap.json'; export const ENTRYABILITY_JS: string = 'entry/src/main/entryability/EntryAbility.js'; export const TEST: string = 'test'; -export const NEWFILE: string = 'newFile'; \ No newline at end of file +export const NEWFILE: string = 'newFile'; + +export const DECLFILESPATH: string = '/entry/build/default/intermediates/loader_out/default/etsFortgz/decl-fileInfo.json'; +export const DECLGENV2OUTPATH: string = '/entry/build/default/intermediates/declgen/default/declgenV2'; +export const HAR_DECLGENV2OUTPATH: string = '/har/build/default/intermediates/declgen/default/declgenV2'; \ No newline at end of file diff --git a/compiler/test/ark_compiler_ut/mock/rollup_mock/project_config.ts b/compiler/test/ark_compiler_ut/mock/rollup_mock/project_config.ts index 90fe1b8e2b59e6f2ec4fae5b6a20ecf75d5962fb..fc63322daad45f5351688acf23b4a189bf1e8696 100644 --- a/compiler/test/ark_compiler_ut/mock/rollup_mock/project_config.ts +++ b/compiler/test/ark_compiler_ut/mock/rollup_mock/project_config.ts @@ -30,14 +30,16 @@ import { NODE_JS_PATH, PORT_DEFAULT, ENTRY_MODULE_VERSION_DEFAULT, - SDK_VERSION_STAGE + SDK_VERSION_STAGE, + DECLFILESPATH, + DECLGENV2OUTPATH } from "./common"; import { ESMODULE, OHPM, RELEASE } from "../../../../lib/fast_build/ark_compiler/common/ark_define"; -import EntryAbility from "../../testdata/expect/expect_EntryAbility"; +import { ArkTSEvolutionModule } from "../../../../lib/process_arkts_evolution"; interface IArkProjectConfig { projectRootPath: string, @@ -131,6 +133,7 @@ class ProjectConfig { widgetCompile: boolean; arkRouterMap: Array; declarationEntry: Array; + dependentModuleMap: Map; constructor(buildMode: string) { this.watchMode = 'false'; @@ -145,10 +148,12 @@ class ProjectConfig { this.hspNameOhmMap = {}; this.arkRouterMap = []; this.declarationEntry = []; + this.dependentModuleMap = new Map(); } public scan(testcase: string) { this.initPath(`${PROJECT_ROOT}/${testcase}`); + this.setDependentModuleMap(); } public setPreview(isPreview: boolean) { @@ -261,6 +266,18 @@ class ProjectConfig { this.port = PORT_DEFAULT; this.aceSoPath = `${this.projectTopDir}/entry/preview/cache/nativeDependencies.txt`; } + + private setDependentModuleMap() { + const arkTSEvolutionModuleInfo = { + language: '1.1', + pkgName: this.entryModuleName, + moduleName: this.entryModuleName, + modulePath: this.modulePath, + declgenV2OutPath: DECLGENV2OUTPATH, + declFilesPath: DECLFILESPATH + } + this.dependentModuleMap.set(this.entryModuleName, arkTSEvolutionModuleInfo) + } } export { ProjectConfig, IArkProjectConfig } diff --git a/compiler/test/ark_compiler_ut/module/ohmUrl/ohmUrl.test.ts b/compiler/test/ark_compiler_ut/module/ohmUrl/ohmUrl.test.ts index 4b0fe6851d49f6ce0b34c13cf70bc4017e1f43bb..53df1a2e785a50ce574680ef450074b6b3e69ba3 100644 --- a/compiler/test/ark_compiler_ut/module/ohmUrl/ohmUrl.test.ts +++ b/compiler/test/ark_compiler_ut/module/ohmUrl/ohmUrl.test.ts @@ -23,7 +23,8 @@ import { getOhmUrlBySystemApiOrLibRequest, getNormalizedOhmUrlByFilepath, getNormalizedOhmUrlByAliasName, - getNormalizedOhmUrlByModuleRequest + getNormalizedOhmUrlByModuleRequest, + pkgDeclFilesConfig } from '../../../../lib/ark_utils'; import { PACKAGES } from '../../../../lib/pre_define'; import projectConfig from '../../utils/processProjectConfig'; @@ -974,7 +975,6 @@ mocha.describe('generate ohmUrl', function () { 'json5': undefined }; const filePath: string = `${projectConfig.projectRootPath}/entry/oh_modules/json5/dist/index.js`; - const moduleName: string = 'entry'; const importerFile: string = 'importTest.ts'; const errInfo: LogData = LogDataFactory.newInstance( ErrorCode.ETS2BUNDLE_EXTERNAL_FAILED_TO_RESOLVE_OHM_URL, diff --git a/compiler/test/ark_compiler_ut/run_es2abc_standalone.test.ts b/compiler/test/ark_compiler_ut/run_es2abc_standalone.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..108aba9481f7943e2fa8af60c1fe08b88006c939 --- /dev/null +++ b/compiler/test/ark_compiler_ut/run_es2abc_standalone.test.ts @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use rollupObject file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import mocha from 'mocha'; +import path from 'path'; +import fs from 'fs'; +import { + expect +} from 'chai'; +import { + COMPILE_CONTEXT_INFO_JSON, + FILESINFO_TXT, + MODULES_CACHE, + NPMENTRIES_TXT, + RELEASE, + SOURCEMAPS, +} from '../../lib/fast_build/ark_compiler/common/ark_define'; +import { + mergeCacheData, + mergeCompileContextInfo, + mergeSourceMap, +} from '../../lib/fast_build/ark_compiler/run_es2abc_standalone'; +import RollUpPluginMock from './mock/rollup_mock/rollup_plugin_mock'; + +let MERGE_CACHE_PATH; +let targetCachePath; + +mocha.describe('test run_es2abc_standalone file api', function () { + mocha.before(function () { + this.rollup = new RollUpPluginMock(); + this.rollup.build(); + MERGE_CACHE_PATH=path.join(this.rollup.share.projectConfig.projectRootPath, '/mergeCacheData') + targetCachePath=path.join(MERGE_CACHE_PATH,'/targetCacheDir') + if (!fs.existsSync(targetCachePath)) { + fs.mkdirSync(targetCachePath, { recursive: true }); + } + }); + + mocha.after(function () { + if (fs.existsSync(targetCachePath)) { + fs.rmSync(targetCachePath, { recursive: true, force: true }); + } + }) + + mocha.it('1-1: test mergeCacheData', function () { + + const cachePathList = [ + path.resolve(MERGE_CACHE_PATH, './originCacheDir1'), + path.resolve(MERGE_CACHE_PATH, './originCacheDir2'), + ]; + const fileNameList = [ + FILESINFO_TXT, + NPMENTRIES_TXT + ] + fileNameList.forEach(fileName => { + mergeCacheData(cachePathList, targetCachePath, fileName); + }) + + fileNameList.forEach(fileName => { + + const targetFilePath = path.resolve(targetCachePath, fileName); + const targetLineCount = countLines(targetFilePath); + + let sumOriginLineCount = 0; + cachePathList.forEach(cacheDir => { + const originFilePath = path.resolve(cacheDir, fileName); + if (fs.existsSync(originFilePath)) { + sumOriginLineCount += countLines(originFilePath); + } + }); + expect(targetLineCount).to.equal(sumOriginLineCount); + }); + }); + + mocha.it('1-2: test mergeSourceMap', function () { + const cachePathList = [ + path.resolve(MERGE_CACHE_PATH, './originCacheDir1'), + path.resolve(MERGE_CACHE_PATH, './originCacheDir2'), + ]; + + mergeSourceMap(cachePathList, targetCachePath) + + const mergedSourceMap = JSON.parse(fs.readFileSync(path.resolve(targetCachePath, SOURCEMAPS), 'utf-8')); + const expectSourceMap = JSON.parse(fs.readFileSync(path.join(MERGE_CACHE_PATH, './expect', SOURCEMAPS), 'utf-8')); + + expect(mergedSourceMap).to.deep.equal(expectSourceMap); + }); + + mocha.it('1-3: test mergeCompileContextInfo', function () { + const cachePathList = [ + path.resolve(MERGE_CACHE_PATH, './originCacheDir1'), + path.resolve(MERGE_CACHE_PATH, './originCacheDir2'), + ]; + + mergeCompileContextInfo(cachePathList, targetCachePath); + + const mergedCompileContext = JSON.parse( + fs.readFileSync(path.resolve(targetCachePath, COMPILE_CONTEXT_INFO_JSON), 'utf-8') + ); + + const expectCompileContext = JSON.parse( + fs.readFileSync(path.join(MERGE_CACHE_PATH, './expect',COMPILE_CONTEXT_INFO_JSON), 'utf-8') + ); + + expect(mergedCompileContext).to.deep.equal(expectCompileContext); + }); +}); + +function countLines(filePath) { + const content = fs.readFileSync(filePath, 'utf-8'); + return content.split(/\r?\n/).filter(line => line !== '').length; +} \ No newline at end of file diff --git a/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/expect/compileContextInfo.json b/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/expect/compileContextInfo.json new file mode 100644 index 0000000000000000000000000000000000000000..07f011f3ca86b0f3c44b5dc05c4786d9e06c4f57 --- /dev/null +++ b/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/expect/compileContextInfo.json @@ -0,0 +1,14 @@ +{ + "hspPkgNames": [], + "compileEntries": [ + "&entry/src/main/ets/entryability/EntryAbility&", + "&entry/src/main/ets/entrybackupability/EntryBackupAbility&", + "&entry/src/main/ets/pages/Index&", + "&har/src/main/ets/components/a&1.0.0", + "&har/src/main/ets/components/aaa&1.0.0", + "&har/src/main/ets/components/MainPage&1.0.0", + "&har/build/default/generated/profile/default/ModuleInfo&1.0.0", + "&har/Index&1.0.0" + ], + "updateVersionInfo": {} +} \ No newline at end of file diff --git a/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/expect/sourceMaps.map b/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/expect/sourceMaps.map new file mode 100644 index 0000000000000000000000000000000000000000..f8a55a78b9952c3f37a35138d68a6172ae875a18 --- /dev/null +++ b/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/expect/sourceMaps.map @@ -0,0 +1,100 @@ +{ + "har|har|1.0.0|build/default/generated/profile/default/ModuleInfo.js": { + "version": 3, + "file": "ModuleInfo.ts", + "sources": [ + "har/build/default/generated/profile/default/ModuleInfo.ts" + ], + "names": [], + "mappings": "AACA,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAC,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAwB,EAAE,CAAA,CAAA;AACjE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAC,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAwB,EAAE,CAAA,CAAA;", + "entry-package-info": "har|1.0.0" + }, + "har|har|1.0.0|Index.ts": { + "version": 3, + "file": "Index.ets", + "sourceRoot": "", + "sources": [ + "har/Index.ets" + ], + "names": [], + "mappings": "OAAO,EAAE,QAAQ,EAAC,MAAM,EAAE;OACnB,EAAC,CAAC,EAAC", + "entry-package-info": "har|1.0.0" + }, + "har|har|1.0.0|src/main/ets/components/a.ts": { + "version": 3, + "file": "a.ts", + "sourceRoot": "", + "sources": [ + "har/src/main/ets/components/a.ts" + ], + "names": [], + "mappings": "AAEA,MAAM,CAAC,MAAM,IAAI,EAAC,MAAM,GAAC,OAAO,CAAA;AAGhC,MAAM,QAAQ,CAAC,CAAA;IACb,MAAM,CAAC,MAAM,EAAE,GAAC,KAAK,CAAC;IACtB,MAAM,CAAC,MAAM,EAAE,EAAC,MAAM,GAAC,CAAC,CAAC;CAC1B;AAED,MAAM,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC;AAC5B,MAAM,CAAC,IAAI,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC;AAG9B,SAAS,EAAE,CAAC,CAAC,EAAC,CAAC,EAAC,CAAC,IAAE,CAAC;AACpB,SAAS,EAAE,CAAC,CAAC,EAAC,CAAC,GAAC,CAAC,EAAC,GAAG,CAAC;AAEtB,CAAC;AACD,EAAE,CAAC,CAAC,CAAC,CAAA;AACL,EAAE,CAAC,CAAC,EAAC,CAAC,CAAC,CAAA;AACP,M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AAG,IAAI,CAAC;AAG3C,MAAM,CAAC,IAAI,KAAK,EAAC;IAAC,IAAI,EAAC,MAAM,CAAC;IAAA,GAAG,EAAC,MAAM,CAAA;CAAC,GAAC;IACxC,IAAI,EAAC,QAAQ;IACb,GAAG,EAAC,EAAE;CACP,CAAA;AAGD,MAAM,MAAM,UAAU,GAAG;IACvB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAAA", + "entry-package-info": "har|1.0.0" + }, + "har|har|1.0.0|src/main/ets/components/aaa.ts": { + "version": 3, + "file": "aaa.ts", + "sourceRoot": "", + "sources": [ + "har/src/main/ets/components/aaa.ts" + ], + "names": [], + "mappings": "", + "entry-package-info": "har|1.0.0" + }, + "har|har|1.0.0|src/main/ets/components/MainPage.ts": { + "version": 3, + "file": "MainPage.ets", + "sourceRoot": "", + "sources": [ + "har/src/main/ets/components/MainPage.ets" + ], + "names": [], + "mappings": ";;;;IAIS,OAAO,GAAE,MAAM;;OAJjB,EAAE,IAAI,EAAE;AAGf,MAAM,OAAQ,QAAQ;IADtB;;;;;sDAE2B,IAAI;;;KAJJ;;;;;;;;;;;;;;;;IAIzB,4CAAgB,MAAM,EAAQ;QAAvB,OAAO;;;QAAP,OAAO,WAAE,MAAM;;;IAEtB;;YACE,GAAG;YAAH,GAAG,CAQF,MAAM,CAAC,MAAM;;;YAPZ,MAAM;YAAN,MAAM,CAKL,KAAK,CAAC,MAAM;;;YAJX,IAAI,QAAC,IAAI,CAAC,OAAO;YAAjB,IAAI,CACD,QAAQ,CAAC,EAAE;YADd,IAAI,CAED,UAAU,CAAC,UAAU,CAAC,IAAI;;QAF7B,IAAI;QADN,MAAM;QADR,GAAG;KASJ;;;;;AAIH,MAAM,CAAC,MAAM,MAAM,EAAC,MAAM,GAAC,YAAY,CAAC", + "entry-package-info": "har|1.0.0" + }, + "entry|entry|1.0.0|src/main/ets/entryability/EntryAbility.ts": { + "version": 3, + "file": "EntryAbility.ets", + "sources": [ + "entry/src/main/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,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,8BAA8B,CAAC,CAAC;IAC9E,CAAC;IAED,YAAY,IAAI,IAAI;QAElB,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,sBAAsB,CAAC,CAAC;IACtE,CAAC;IAED,YAAY,IAAI,IAAI;QAElB,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,sBAAsB,CAAC,CAAC;IACtE,CAAC;CACF", + "sourceRoot": "", + "entry-package-info": "entry|1.0.0" + }, + "entry|entry|1.0.0|src/main/ets/entrybackupability/EntryBackupAbility.ts": { + "version": 3, + "file": "EntryBackupAbility.ets", + "sources": [ + "entry/src/main/ets/entrybackupability/EntryBackupAbility.ets" + ], + "names": [], + "mappings": "OAAS,KAAK,MAAA,aAAA,CAAA;OACL,sBAAsB,MAAA,0CAAA,CAAA;AAAE,OAAA,KAAA,EAAA,iBAAA,aAAa,EAAA,MAAA,0CAAA,CAAA;AAE9C,MAAM,CAAC,OAAO,iBAAkC,sBAAsB;IACpE,KAAK,CAAC,QAAQ;QACZ,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,aAAa,EAAE,aAAa;QAC1C,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,yBAAyB,EAAE,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC;IAC1F,CAAC;CACF", + "sourceRoot": "", + "entry-package-info": "entry|1.0.0" + }, + "entry|entry|1.0.0|src/main/ets/pages/Index.ts": { + "version": 3, + "file": "Index.ets", + "sources": [ + "entry/src/main/ets/pages/Index.ets" + ], + "names": [], + "mappings": ";;;;IAWS,OAAO,GAAE,MAAM,CAAA;;OAXjB,KAAK,EAAE,GAAG,EAAE,oDAAA;AAEnB,MAAM,aAAiB;IACrB,M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", + "sources": [ + "entry/src/main/ets/pages/test.ts" + ], + "names": [], + "mappings": "AAAA,MAAM,CAAE,MAAM,GAAG,EAAC,MAAM,GAAC,QAAQ,CAAA;AAEjC,QAAQ;IACN,QAAQ,MAAO;CAChB;AACD,UAAU,CAAC,CAAA;CAEV", + "sourceRoot": "", + "entry-package-info": "entry|1.0.0" + } +} \ No newline at end of file diff --git a/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/originCacheDir1/compileContextInfo.json b/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/originCacheDir1/compileContextInfo.json new file mode 100644 index 0000000000000000000000000000000000000000..1e66f2546addb7ee768cbb9efdc67c5cd6d14bb1 --- /dev/null +++ b/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/originCacheDir1/compileContextInfo.json @@ -0,0 +1,9 @@ +{ + "hspPkgNames": [], + "compileEntries": [ + "&entry/src/main/ets/entryability/EntryAbility&", + "&entry/src/main/ets/entrybackupability/EntryBackupAbility&", + "&entry/src/main/ets/pages/Index&" + ], + "updateVersionInfo": {} +} \ No newline at end of file diff --git a/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/originCacheDir1/filesInfo.txt b/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/originCacheDir1/filesInfo.txt new file mode 100644 index 0000000000000000000000000000000000000000..238c11ab48c8ad13c16d76efa91267378d414b32 --- /dev/null +++ b/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/originCacheDir1/filesInfo.txt @@ -0,0 +1,3 @@ +har22/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/har22/Index.ts;&har22/Index&1.0.0;esm;har22|har22|1.0.0|Index.ts;har22;false +har22/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/har22/src/main/ets/components/MainPage.ts;&har22/src/main/ets/components/MainPage&1.0.0;esm;har22|har22|1.0.0|src/main/ets/components/MainPage.ts;har22;false +har22/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/har22/build/default/generated/profile/default/ModuleInfo.js;&har22/build/default/generated/profile/default/ModuleInfo&1.0.0;esm;har22|har22|1.0.0|build/default/generated/profile/default/ModuleInfo.js;har22;false diff --git a/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/originCacheDir1/npmEntries.txt b/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/originCacheDir1/npmEntries.txt new file mode 100644 index 0000000000000000000000000000000000000000..40520cb9102134b38442df2d4bb2af79a52882cc --- /dev/null +++ b/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/originCacheDir1/npmEntries.txt @@ -0,0 +1,7 @@ +@system.app:@native.system.app1 +@ohos.app:@native.ohos.app1 +@system.router:@native.system.router1 +@system.curves:@native.system.curves1 +@ohos.curves:@native.ohos.curves1 +@system.matrix4:@native.system.matrix41 +@ohos.matrix4:@native.ohos.matrix41 diff --git a/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/originCacheDir1/sourceMaps.map b/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/originCacheDir1/sourceMaps.map new file mode 100644 index 0000000000000000000000000000000000000000..c54517a7f63a52d40f5ae1a55786fe84baf2e5ac --- /dev/null +++ b/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/originCacheDir1/sourceMaps.map @@ -0,0 +1,56 @@ +{ + "har|har|1.0.0|build/default/generated/profile/default/ModuleInfo.js": { + "version": 3, + "file": "ModuleInfo.ts", + "sources": [ + "har/build/default/generated/profile/default/ModuleInfo.ts" + ], + "names": [], + "mappings": "AACA,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAC,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAwB,EAAE,CAAA,CAAA;AACjE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAC,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAwB,EAAE,CAAA,CAAA;", + "entry-package-info": "har|1.0.0" + }, + "har|har|1.0.0|Index.ts": { + "version": 3, + "file": "Index.ets", + "sourceRoot": "", + "sources": [ + "har/Index.ets" + ], + "names": [], + "mappings": "OAAO,EAAE,QAAQ,EAAC,MAAM,EAAE;OACnB,EAAC,CAAC,EAAC", + "entry-package-info": "har|1.0.0" + }, + "har|har|1.0.0|src/main/ets/components/a.ts": { + "version": 3, + "file": "a.ts", + "sourceRoot": "", + "sources": [ + "har/src/main/ets/components/a.ts" + ], + "names": [], + "mappings": "AAEA,MAAM,CAAC,MAAM,IAAI,EAAC,MAAM,GAAC,OAAO,CAAA;AAGhC,MAAM,QAAQ,CAAC,CAAA;IACb,MAAM,CAAC,MAAM,EAAE,GAAC,KAAK,CAAC;IACtB,MAAM,CAAC,MAAM,EAAE,EAAC,MAAM,GAAC,CAAC,CAAC;CAC1B;AAED,MAAM,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC;AAC5B,MAAM,CAAC,IAAI,MAAM,EAAE,MAAM,GAAG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,GAAG,EACtD,EAAE,EAAE,EAAE,GACL,GAAG,CAAC;AAGP,SAAS,GAAG,CAAC,GAAG,IAAI;AAEpB,CAAC;AAGD,MAAM,QAAQ,CAAC,CAAC;IACd,MAAM,UAAU,CAAC,KAAI,CAAC;IACtB,SAAU,CAAC,KAAG,CAAC;CAChB;AAED,OAAO,CAAC,MAAM,EAAE,EAAE,KAAK,GAAG,SAAS,GAAG,IAAI,CAAC;AAG3C,MAAM,CAAC,IAAI,KAAK,EAAC;IAAC,IAAI,EAAC,MAAM,CAAC;IAAA,GAAG,EAAC,MAAM,CAAA;CAAC,GAAC;IACxC,IAAI,EAAC,QAAQ;IACb,GAAG,EAAC,EAAE;CACP,CAAA;AAGD,MAAM,MAAM,UAAU,GAAG;IACvB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAAA", + "entry-package-info": "har|1.0.0" + }, + "har|har|1.0.0|src/main/ets/components/aaa.ts": { + "version": 3, + "file": "aaa.ts", + "sourceRoot": "", + "sources": [ + "har/src/main/ets/components/aaa.ts" + ], + "names": [], + "mappings": "", + "entry-package-info": "har|1.0.0" + }, + "har|har|1.0.0|src/main/ets/components/MainPage.ts": { + "version": 3, + "file": "MainPage.ets", + "sourceRoot": "", + "sources": [ + "har/src/main/ets/components/MainPage.ets" + ], + "names": [], + "mappings": ";;;;IAIS,OAAO,GAAE,MAAM;;OAJjB,EAAE,IAAI,EAAE;AAGf,MAAM,OAAQ,QAAQ;IADtB;;;;;sDAE2B,IAAI;;;KAJJ;;;;;;;;;;;;;;;;IAIzB,4CAAgB,MAAM,EAAQ;QAAvB,OAAO;;;QAAP,OAAO,WAAE,MAAM;;;IAEtB;;YACE,GAAG;YAAH,GAAG,CAQF,MAAM,CAAC,MAAM;;;YAPZ,MAAM;YAAN,MAAM,CAKL,KAAK,CAAC,MAAM;;;YAJX,IAAI,QAAC,IAAI,CAAC,OAAO;YAAjB,IAAI,CACD,QAAQ,CAAC,EAAE;YADd,IAAI,CAED,UAAU,CAAC,UAAU,CAAC,IAAI;;QAF7B,IAAI;QADN,MAAM;QADR,GAAG;KASJ;;;;;AAIH,MAAM,CAAC,MAAM,MAAM,EAAC,MAAM,GAAC,YAAY,CAAC", + "entry-package-info": "har|1.0.0" + } +} \ No newline at end of file diff --git a/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/originCacheDir2/compileContextInfo.json b/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/originCacheDir2/compileContextInfo.json new file mode 100644 index 0000000000000000000000000000000000000000..c23a0a795a3cef52f189fd7a56c4c8b612741d78 --- /dev/null +++ b/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/originCacheDir2/compileContextInfo.json @@ -0,0 +1,11 @@ +{ + "hspPkgNames": [], + "compileEntries": [ + "&har/src/main/ets/components/a&1.0.0", + "&har/src/main/ets/components/aaa&1.0.0", + "&har/src/main/ets/components/MainPage&1.0.0", + "&har/build/default/generated/profile/default/ModuleInfo&1.0.0", + "&har/Index&1.0.0" + ], + "updateVersionInfo": {} +} \ No newline at end of file diff --git a/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/originCacheDir2/filesInfo.txt b/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/originCacheDir2/filesInfo.txt new file mode 100644 index 0000000000000000000000000000000000000000..da702d347faeaf0231829ac311d391e314c87564 --- /dev/null +++ b/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/originCacheDir2/filesInfo.txt @@ -0,0 +1,3 @@ +har33/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/har33/Index.ts;&har33/Index&1.0.0;esm;har33|har33|1.0.0|Index.ts;har33;false +har33/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/har33/src/main/ets/components/MainPage.ts;&har33/src/main/ets/components/MainPage&1.0.0;esm;har33|har33|1.0.0|src/main/ets/components/MainPage.ts;har33;false +har33/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/har33/build/default/generated/profile/default/ModuleInfo.js;&har33/build/default/generated/profile/default/ModuleInfo&1.0.0;esm;har33|har33|1.0.0|build/default/generated/profile/default/ModuleInfo.js;har33;false diff --git a/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/originCacheDir2/npmEntries.txt b/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/originCacheDir2/npmEntries.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c9e7b7c87dc3f4cb7f203ad5143af2c090ecc5f --- /dev/null +++ b/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/originCacheDir2/npmEntries.txt @@ -0,0 +1,7 @@ +@system.app:@native.system.app +@ohos.app:@native.ohos.app +@system.router:@native.system.router +@system.curves:@native.system.curves +@ohos.curves:@native.ohos.curves +@system.matrix4:@native.system.matrix4 +@ohos.matrix4:@native.ohos.matrix4 diff --git a/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/originCacheDir2/sourceMaps.json b/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/originCacheDir2/sourceMaps.json new file mode 100644 index 0000000000000000000000000000000000000000..492661a4695d7ab2f618ff8667e55c3b0db0faba --- /dev/null +++ b/compiler/test/ark_compiler_ut/testdata/testcase_def/mergeCacheData/originCacheDir2/sourceMaps.json @@ -0,0 +1,46 @@ +{ + "entry|entry|1.0.0|src/main/ets/entryability/EntryAbility.ts": { + "version": 3, + "file": "EntryAbility.ets", + "sources": [ + "entry/src/main/ets/entryability/EntryAbility.ets" + ], + "names": [], + "mappings": "YAAS,eAAe,MAAA,mCAAA,CAAA;OAAE,qBAAqB,MAAA,yCAAA,CAAA;OAAE,SAAS,MAAA,6BAAA,CAAA;YAAE,IAAI,MAAA,wBAAA,CAAA;OACvD,KAAK,MAAA,aAAA,CAAA;YACL,MAAM,MAAA,cAAA,CAAA;AAEf,MAAM,CAAC,OAAO,iBAA4B,SAAS;IACjD,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE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,CAAC;CACF", + "sourceRoot": "", + "entry-package-info": "entry|1.0.0" + }, + "entry|entry|1.0.0|src/main/ets/entrybackupability/EntryBackupAbility.ts": { + "version": 3, + "file": "EntryBackupAbility.ets", + "sources": [ + "entry/src/main/ets/entrybackupability/EntryBackupAbility.ets" + ], + "names": [], + "mappings": "OAAS,KAAK,MAAA,aAAA,CAAA;OACL,sBAAsB,MAAA,0CAAA,CAAA;AAAE,OAAA,KAAA,EAAA,iBAAA,aAAa,EAAA,MAAA,0CAAA,CAAA;AAE9C,MAAM,CAAC,OAAO,iBAAkC,sBAAsB;IACpE,KAAK,CAAC,QAAQ;QACZ,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,aAAa,EAAE,aAAa;QAC1C,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,yBAAyB,EAAE,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC;IAC1F,CAAC;CACF", + "sourceRoot": "", + "entry-package-info": "entry|1.0.0" + }, + "entry|entry|1.0.0|src/main/ets/pages/Index.ts": { + "version": 3, + "file": "Index.ets", + "sources": [ + "entry/src/main/ets/pages/Index.ets" + ], + "names": [], + "mappings": ";;;;IAWS,OAAO,GAAE,MAAM,CAAA;;OAXjB,KAAK,EAAE,GAAG,EAAE,oDAAA;AAEnB,MAAM,aAAiB;IACrB,MAAM,CAAC,MAAM,IAAO,MAAM,GAAC,QAAQ,CAAA;IACnC,MAAM,WAAS,MAAM,CAAA;CACtB;AACD,IAAI,KAAK,EAAC,IAAS,GAAC,IAAa,CAAA;OAIrB,SAAA,MAAA;IAFZ,YAAA,MAAA,EAAA,MAAA,EAAA,EAAA,EAAA,KAAA,CAAA,CAAA,EAAA,KAAA,SAAA,EAAA,SAAA;;;;;sDAG2B,GAAG,EAAA,IAAA,EAAA,SAAA,CAAA,CAAA;;;IALG,CAAA;;;;;;;;;;;;;;;;IAK/B,OAAA,CAAA,SAAA,EAAA,wBAAA,CAAgB,MAAM,CAAO,CAAA;QAAtB,OAAO;;;IAAP,IAAA,OAAO,WAAE,MAAM;;;IAEtB,aAAA;;YACE,iBAAiB,CAAA,MAAA,EAAA,CAAA;YAAjB,iBAAiB,CAUhB,MAAM,CAAC,MAAM,CAAA,CAAA;YAVd,iBAAiB,CAWhB,KAAK,CAAC,MAAM,CAAA,CAAA;;;YAVX,IAAI,CAAA,MAAA,CAAC,IAAI,CAAC,OAAO,CAAA,CAAA;YAAjB,IAAI,CACD,EAAE,CAAC,YAAY,CAAA,CAAA;YADlB,IAAI,CAED,QAAQ,CAAC,EAAE,CAAA,CAAA;YAFd,IAAI,CAGD,UAAU,CAAC,UAAU,CAAC,IAAI,CAAA,CAAA;YAH7B,IAAI,CAID,UAAU,CAAC;gBACV,MAAM,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,aAAa,CAAC,MAAM,EAAE;gBAChE,MAAM,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,CAAC,MAAM,EAAE;aACnE,CAAA,CAAA;;QAPH,IAAI,CAAA,GAAA,EAAA,CAAA;QADN,iBAAiB,CAAA,GAAA,EAAA,CAAA;IAYlB,CAAA;;;;;;;;", + "sourceRoot": "", + "entry-package-info": "entry|1.0.0" + }, + "entry|entry|1.0.0|src/main/ets/pages/a.ts": { + "version": 3, + "file": "test.ts", + "sources": [ + "entry/src/main/ets/pages/test.ts" + ], + "names": [], + "mappings": "AAAA,MAAM,CAAE,MAAM,GAAG,EAAC,MAAM,GAAC,QAAQ,CAAA;AAEjC,QAAQ;IACN,QAAQ,MAAO;CAChB;AACD,UAAU,CAAC,CAAA;CAEV", + "sourceRoot": "", + "entry-package-info": "entry|1.0.0" + } +} \ No newline at end of file diff --git a/compiler/test/ark_compiler_ut/utils/processProjectConfig.ts b/compiler/test/ark_compiler_ut/utils/processProjectConfig.ts index f98af7e8f0e1e13216d6cfa74e2288bc39c8fc2a..b7a643395e30157a405ee20b77a35cde58f4e15d 100644 --- a/compiler/test/ark_compiler_ut/utils/processProjectConfig.ts +++ b/compiler/test/ark_compiler_ut/utils/processProjectConfig.ts @@ -46,5 +46,6 @@ projectConfig.pkgContextInfo = { projectConfig.dependencyAliasMap = new Map([ ['library', '@bundle:UtTestApplication/sharedLibrary/ets/index'] ]); +projectConfig.dependentModuleMap = new Map(); export default projectConfig; \ No newline at end of file diff --git a/install_arkguard_tsc.py b/install_arkguard_tsc_declgen.py similarity index 96% rename from install_arkguard_tsc.py rename to install_arkguard_tsc_declgen.py index 61284e51e238b9680f46aa20aedd8a62681fb525..5fb5d0c1b304d1d4ad2fda777873999e1a791550 100755 --- a/install_arkguard_tsc.py +++ b/install_arkguard_tsc_declgen.py @@ -54,10 +54,11 @@ def run(args): arkguard_path = args[1] source_path = args[2] current_os = args[3] + declgen_path = args[4] node_modules_path = os.path.join(source_path, "node_modules") extract(tsc_path, node_modules_path, 'typescript', current_os) extract(arkguard_path, node_modules_path, 'arkguard', current_os) - + extract(declgen_path, node_modules_path, 'declgen', current_os) if __name__ == "__main__": run(sys.argv[1:]) \ No newline at end of file