restore error msgs for validateModuleName, NotSupportResrcType, ExceededPreview, ExceededEntry, OneEntry

Signed-off-by: s00912778 <shijiakai2@huawei.com>
Change-Id: I621cd7205c747bfede09a418e8e29f764631ab39
This commit is contained in:
s00912778 2024-10-24 19:17:12 +08:00
parent e8a39b5a3d
commit 6d531814ef
11 changed files with 76 additions and 38 deletions

View File

@ -179,11 +179,20 @@
"message": "Property 'message' cannot initialize using '$' to create a reference to a variable.",
"type": "ERROR"
},
"validateModuleName": [],
"notComponent": {
"message": "Decorator '@Component', '@ComponentV2', or '@CustomDialog' is missing for struct 'EntryComponent'.",
"validateModuleName": {
"message": "The module name 'Button' can not be the same as the inner component name.",
"type": "ERROR"
},
"notComponent": [
{
"message": "Decorator '@Component', '@ComponentV2', or '@CustomDialog' is missing for struct 'EntryComponent'.",
"type": "ERROR"
},
{
"message": "A page configured in 'main_pages.json or build-profile.json5' must have one and only one '@Entry' decorator.Solutions:>Please make sure that the splash page has one and only one '@Entry' decorator.",
"type": "ERROR"
}
],
"notConcurrent": {
"message": "The struct 'NotConcurrentIndexDecorator' use invalid decorator.",
"type": "WARN"
@ -256,16 +265,10 @@
"message": "Unknown resource name 'tari'.",
"type": "ERROR"
},
"NotSupportResrcType": [
{
"message": "Unknown resource type 'string'.",
"type": "ERROR"
},
{
"message": "The input parameter is not supported.",
"type": "ERROR"
}
],
"NotSupportResrcType": {
"message": "The resource type font is not supported.",
"type": "ERROR"
},
"NoSrc": {
"message": "No such 'test.png' resource in current module.",
"type": "ERROR"
@ -278,9 +281,24 @@
"message": "@Styles can't have parameters.",
"type": "ERROR"
},
"ExceededPreview": [],
"ExceededEntry": [],
"OneEntry": [],
"ExceededPreview": {
"message": "A page can contain at most 10 '@Preview' decorators.",
"type": "ERROR"
},
"ExceededEntry": [
{
"message": "A page can't contain more than one '@Entry' decorator",
"type": "ERROR"
},
{
"message": "A page configured in 'main_pages.json or build-profile.json5' must have one and only one '@Entry' decorator.Solutions:>Please make sure that the splash page has one and only one '@Entry' decorator.",
"type": "ERROR"
}
],
"OneEntry": {
"message": "A page configured in 'main_pages.json or build-profile.json5' must have one and only one '@Entry' decorator.Solutions:>Please make sure that the splash page has one and only one '@Entry' decorator.",
"type": "ERROR"
},
"notMethodDeco": {
"message": "'@State' can not decorate the method.",
"type": "ERROR"

View File

@ -0,0 +1,12 @@
string EntryAbility_desc 0x01000002
string EntryAbility_label 0x01000003
string app_name 0x01000000
string module_desc 0x01000004
color start_window_background 0x01000005
media app_icon 0x01000001
media background 0x01000006
media foreground 0x01000007
media layered_image 0x01000008
media startIcon 0x01000009
profile backup_config 0x0100000a
profile main_pages 0x0100000b

View File

@ -4,8 +4,7 @@ struct NotSupportResrcTypePaworks {
build(){
Column(){
Image($r('app.string.module_desc'))
Image($r('app.font'))
Image($r('app.font.song'))
}
}
}

View File

@ -27,10 +27,15 @@ class ModuleInfo {
id: string;
importedIdMaps: object = {};
importCache = [];
isEntry: boolean = false;
constructor(id: string, entryModuleName: string, modulePath: string) {
this.meta = new Meta(entryModuleName, modulePath);
this.id = id;
if (entryModuleName === 'entry') {
this.isEntry = true;
}
}
setIsLocalDependency(value: boolean) {

View File

@ -156,6 +156,8 @@ export const UT_PARTIAL_UPFATE_PAGES: string[] = [
'v2_component_decorator/staticComponentMember'
];
export const UT_VALIDATE_PAGES_PREVIEW: string[] = [];
export const UT_VALIDATE_PAGES: string[] = [
'Decorators/process_component_build/@BuilderParam',
'Decorators/process_component_build/arkUIComponent',
@ -202,8 +204,6 @@ export const UT_VALIDATE_PAGES: string[] = [
'Decorators/process_custom_component/validateNonLinkWithDollar',
'Decorators/process_custom_component/validateParamTwoWayBind',
'Decorators/process_import/validateModuleName',
'Decorators/process_struct_componentV2/param_require_once_check',
'Decorators/process_struct_componentV2/v2Component_member_type_check',
@ -257,11 +257,9 @@ export const UT_VALIDATE_PAGES: string[] = [
'Decorators/vaildate_ui_syntax/validateDuplicateMethod'
]
export const MAIN_PAGES: string[] = [
...UT_PAGES.map((p) => `pages/ut/${p}`),
...UT_PARTIAL_UPFATE_PAGES.map((p) => `pages/utForPartialUpdate/${p}`),
...UT_VALIDATE_PAGES.map((p) => `pages/utForValidate/${p}`),
];
export const UT_VALIDATE_PAGES_JSBUNDLE: string[] = [
'Decorators/process_import/validateModuleName',
]
export const CACHE_PATH: string = 'default/cache/default/default@CompileArkTS/esmodule/debug';
export const AN_BUILD_OUTPUT_PATH: string = 'default/intermediates/loader_out/default/an/arm64-v8a';

View File

@ -262,11 +262,6 @@ class ProjectConfig {
Object.assign(this, Object.fromEntries(filteredEntries));
// for (let key in other) {
// if (other.hasOwnProperty(key) && (this[key] === undefined || other[key] !== undefined)) {
// this[key] = other[key];
// }
// }
}
private initPath(projectPath: string, pagePaths: string[] = []) {
@ -321,13 +316,11 @@ class ProjectConfig {
this.entryObj = {
'entryAbility/EntryAbility': `${projectRoot}/entry/src/main/ets/entryability/EntryAbility.ets`,
'entryformability/EntryFormAbility': `${projectRoot}/entry/src/main/ets/entryformability/EntryFormAbility.ets`,
// 'pages/Intex': `${projectRoot}/entry/src/main/ets/pages/Index.ets`
};
this.entryArrayForObf = [
"./entryability/EntryAbility",
"./entryformability/EntryFormAbility",
// "pages/Index"
];
pagePaths.forEach((mainPage: string) => {

View File

@ -70,7 +70,7 @@ mocha.describe('test UT for partial update testcases [non-preview mode]', functi
this.globalProjectConfig.setIgnoreWarning(true);
this.globalProjectConfig.scan(PROJECT_ROOT, DEFAULT_PROJECT, MAIN_PAGES);
this.globalProjectConfig.mockCompileContextInfo(`${PROJECT_ROOT}/${DEFAULT_PROJECT}`, MAIN_PAGES);
this.globalProjectConfig.concat(RollUpPluginMock.mockArkProjectConfig(PROJECT_ROOT, DEFAULT_PROJECT, true));
this.globalProjectConfig.concat(RollUpPluginMock.mockArkProjectConfig(PROJECT_ROOT, DEFAULT_PROJECT, false));
this.rollup.share.projectConfig.concat(this.globalProjectConfig);
Object.assign(projectConfig, this.globalProjectConfig);

View File

@ -6,6 +6,7 @@ import { expect } from 'chai';
import {
BUILD_ON,
JSBUNDLE,
} from '../../lib/pre_define';
import {
resetComponentCollection,
@ -22,6 +23,7 @@ import {
import main, {
partialUpdateConfig,
projectConfig,
readAppResource,
resetGlobalProgram,
resetMain,
resources,
@ -43,7 +45,9 @@ import {
ProjectConfig
} from './helpers/projectConfig';
import {
UT_VALIDATE_PAGES
UT_VALIDATE_PAGES,
UT_VALIDATE_PAGES_JSBUNDLE,
UT_VALIDATE_PAGES_PREVIEW
} from './helpers/pathConfig';
import {
parseFileNameFromPath,
@ -60,7 +64,11 @@ const DEFAULT_PROJECT: string = 'application';
const TEST_CASES_PATH: string = path.resolve(PROJECT_ROOT, DEFAULT_PROJECT, 'entry/src/main/ets/pages');
const SYS_CONFIG_PATH: string = path.resolve(PROJECT_ROOT, DEFAULT_PROJECT, 'entry/src/main/ets/test/common');
const ERROR_COLLECTION_PATH: string = path.resolve(__dirname, '../../test/error.json');
const MAIN_PAGES: string[] = UT_VALIDATE_PAGES.map((p) => `pages/utForValidate/${p}`);
const MAIN_PAGES: string[] = [
...UT_VALIDATE_PAGES,
...UT_VALIDATE_PAGES_PREVIEW,
...UT_VALIDATE_PAGES_JSBUNDLE
].map((p) => `pages/utForValidate/${p}`);
const systemModuleSet: Set<string> = new Set();
scanFileNames(SYS_CONFIG_PATH, systemModuleSet);
@ -85,10 +93,11 @@ mocha.describe('test UT for validate testcases [non-preview mode]', function ()
this.globalProjectConfig.setIgnoreWarning(true);
this.globalProjectConfig.scan(PROJECT_ROOT, DEFAULT_PROJECT, MAIN_PAGES);
this.globalProjectConfig.mockCompileContextInfo(`${PROJECT_ROOT}/${DEFAULT_PROJECT}`, MAIN_PAGES);
this.globalProjectConfig.mockCompileContextInfo(`${PROJECT_ROOT}/${DEFAULT_PROJECT}`, MAIN_PAGES);
this.globalProjectConfig.concat(RollUpPluginMock.mockArkProjectConfig(PROJECT_ROOT, DEFAULT_PROJECT, false));
this.rollup.share.projectConfig.concat(this.globalProjectConfig);
Object.assign(projectConfig, this.globalProjectConfig);
readAppResource(projectConfig.appResource);
this.globalPartialUpdateConfig = new PartialUpdateConfig();
this.globalPartialUpdateConfig.setPartialUpdateMode(true);
@ -157,8 +166,12 @@ mocha.describe('test UT for validate testcases [non-preview mode]', function ()
processStructComponentV2.resetStructMapInEts();
});
UT_VALIDATE_PAGES.forEach((utPage, index) => {
[...UT_VALIDATE_PAGES, ...UT_VALIDATE_PAGES_JSBUNDLE].forEach((utPage, index) => {
mocha.it(`1-${index + 1}: test ${utPage}`, function (done) {
if (UT_VALIDATE_PAGES_JSBUNDLE.includes(utPage)) {
Object.assign(projectConfig, { compileMode: JSBUNDLE });
}
const sourceFilePath: string = path.resolve(TEST_CASES_PATH, `utForValidate/${utPage}.ets`);
const sourceCode: string = fs.readFileSync(sourceFilePath, 'utf-8');
@ -220,4 +233,4 @@ mocha.describe('test UT for validate testcases [non-preview mode]', function ()
.catch(err => done(err));
});
});
});
});