diff --git a/compiler/src/ets_checker.ts b/compiler/src/ets_checker.ts index 716d75244c5fed4ebfac63401cfc2f77aa6daec1..8aaec8d56e08e702b1025cce295d2dd77803a2bd 100644 --- a/compiler/src/ets_checker.ts +++ b/compiler/src/ets_checker.ts @@ -177,7 +177,8 @@ function setCompilerOptions(resolveModulePaths: string[]): void { allPath.push('../*'); } } - const suffix: string = projectConfig.hotReload ? HOT_RELOAD_BUILD_INFO_SUFFIX : TS_BUILD_INFO_SUFFIX; + const suffix: string = projectConfig?.hotReload ? HOT_RELOAD_BUILD_INFO_SUFFIX : + `${TS_BUILD_INFO_SUFFIX}${projectConfig?.widgetCompile === 'true' ? '_widget' : ''}`; const buildInfoPath: string = path.resolve(projectConfig.cachePath, '..', suffix); checkArkTSVersion(); Object.assign(compilerOptions, { @@ -568,7 +569,8 @@ export function serviceChecker(rootFileNames: string[], newLogger: Object = null MemoryMonitor.stopRecordStage(recordInfo); props = languageService.getProps(); } else { - cacheFile = path.resolve(projectConfig.cachePath, '../.ts_checker_cache'); + cacheFile = rollupShareObject?.projectConfig?.widgetCompile === 'true' ? path.resolve(projectConfig.cachePath, '../.ts_checker_cache_widget') : + path.resolve(projectConfig.cachePath, '../.ts_checker_cache'); const [isJsonObject, cacheJsonObject]: [boolean, WholeCache | undefined] = isJsonString(cacheFile); const wholeCache: WholeCache = isJsonObject ? cacheJsonObject : { 'runtimeOS': projectConfig.runtimeOS, 'sdkInfo': projectConfig.sdkInfo, 'fileList': {} }; if (wholeCache.runtimeOS === projectConfig.runtimeOS && wholeCache.sdkInfo === projectConfig.sdkInfo) { diff --git a/compiler/src/interop/src/ets_checker.ts b/compiler/src/interop/src/ets_checker.ts index e1d5381b33b6c10d13b7e985ec997e2fda472c1a..92393f8db799ed782880117b66c112f988c5210d 100644 --- a/compiler/src/interop/src/ets_checker.ts +++ b/compiler/src/interop/src/ets_checker.ts @@ -193,7 +193,8 @@ function setCompilerOptions(resolveModulePaths: string[]): void { if (isMixCompile()) { compilerOptions.preserveValueImports = true; } - const suffix: string = projectConfig.hotReload ? HOT_RELOAD_BUILD_INFO_SUFFIX : TS_BUILD_INFO_SUFFIX; + const suffix: string = projectConfig?.hotReload ? HOT_RELOAD_BUILD_INFO_SUFFIX : + `${TS_BUILD_INFO_SUFFIX}${projectConfig?.widgetCompile === 'true' ? '_widget' : ''}`; const buildInfoPath: string = path.resolve(projectConfig.cachePath, '..', suffix); checkArkTSVersion(); Object.assign(compilerOptions, { @@ -588,7 +589,8 @@ export function serviceChecker(rootFileNames: string[], newLogger: Object = null MemoryMonitor.stopRecordStage(recordInfo); props = languageService.getProps(); } else { - cacheFile = path.resolve(projectConfig.cachePath, '../.ts_checker_cache'); + cacheFile = rollupShareObject?.projectConfig?.widgetCompile === 'true' ? path.resolve(projectConfig.cachePath, '../.ts_checker_cache_widget') : + path.resolve(projectConfig.cachePath, '../.ts_checker_cache'); const [isJsonObject, cacheJsonObject]: [boolean, WholeCache | undefined] = isJsonString(cacheFile); const wholeCache: WholeCache = isJsonObject ? cacheJsonObject : { 'runtimeOS': projectConfig.runtimeOS, 'sdkInfo': projectConfig.sdkInfo, 'fileList': {} }; if (wholeCache.runtimeOS === projectConfig.runtimeOS && wholeCache.sdkInfo === projectConfig.sdkInfo) { diff --git a/compiler/test/ark_compiler_ut/ets_checker.test.ts b/compiler/test/ark_compiler_ut/ets_checker.test.ts index 17d258b70485ffcc9f1e1c2eb791f18ad9280467..b0dceb320531ba84cd2c508a7c9ecd40d2a968c2 100644 --- a/compiler/test/ark_compiler_ut/ets_checker.test.ts +++ b/compiler/test/ark_compiler_ut/ets_checker.test.ts @@ -60,17 +60,29 @@ mocha.describe('test ets_checker file api', function () { mocha.after(() => { delete this.rollup; const cacheFile: string = path.resolve(projectConfig.cachePath, '../.ts_checker_cache'); + const cacheFileWidget: string = path.resolve(projectConfig.cachePath, '../.ts_checker_cache_widget'); if (fs.existsSync(cacheFile)) { fs.unlinkSync(cacheFile); } + if (fs.existsSync(cacheFileWidget)) { + fs.unlinkSync(cacheFileWidget); + } const tsBuildInfoFilePath: string = path.resolve(projectConfig.cachePath, '..', TS_BUILD_INFO_SUFFIX); + const tsBuildInfoWidgetFilePath: string = path.resolve(projectConfig.cachePath, '..', TS_BUILD_INFO_SUFFIX + '_widget'); if (fs.existsSync(tsBuildInfoFilePath)) { fs.unlinkSync(tsBuildInfoFilePath); } + if (fs.existsSync(tsBuildInfoWidgetFilePath)) { + fs.unlinkSync(tsBuildInfoWidgetFilePath); + } const tsBuildInfoLinterFilePath: string = tsBuildInfoFilePath + '.linter'; + const tsBuildInfoWidgetLinterFilePath: string = tsBuildInfoWidgetFilePath + '.linter'; if (fs.existsSync(tsBuildInfoLinterFilePath)) { fs.unlinkSync(tsBuildInfoLinterFilePath); } + if (fs.existsSync(tsBuildInfoWidgetLinterFilePath)) { + fs.unlinkSync(tsBuildInfoWidgetLinterFilePath); + } }); mocha.it('1-1: test addLocalPackageSet for original ohmurl', function () {