Revert "添加systemapi和atomicservice互斥校验",同步代码

This reverts commit eb9f0591ec.

Signed-off-by: wangcaoyu <wangcaoyu@huawei.com>
This commit is contained in:
wangcaoyu 2024-09-04 10:40:55 +08:00
parent b75c7fa092
commit 8fe58627c2
12 changed files with 24 additions and 74 deletions

View File

@ -121,7 +121,6 @@ buttonconfig
bypassed bypassed
bypassing bypassing
bytrace bytrace
backforward
callbackfn callbackfn
camped camped
canceling canceling
@ -165,6 +164,7 @@ compositing
compresses compresses
concatenates concatenates
cone cone
concatenates
conferencing conferencing
confpersist confpersist
connectable connectable
@ -786,7 +786,6 @@ pss
pssh pssh
puk puk
pvr pvr
qualities
quant quant
querier querier
queriers queriers
@ -809,13 +808,13 @@ recovered
recovering recovering
recovers recovers
recursions recursions
reclaimed
redefines redefines
redirections redirections
reenter reenter
refill refill
refresher refresher
refusing refusing
regarded
rehandshake rehandshake
rejects rejects
relocation relocation
@ -863,7 +862,6 @@ rtt
ruim ruim
ruleset ruleset
rwt rwt
resfile
s5 s5
sac sac
sae sae
@ -906,6 +904,7 @@ sha1
shadertype shadertype
sharedarraybuffer sharedarraybuffer
shenzhen shenzhen
shrinks
shortkey shortkey
showcounter showcounter
shrinks shrinks
@ -917,6 +916,11 @@ singly
skews skews
slidable slidable
sliderstyle sliderstyle
statvfs
stk
str
strokes
structurally
sm3 sm3
smil smil
smpte smpte
@ -982,8 +986,8 @@ suscriber
suscribes suscribes
suspending suspending
suspends suspends
suspending
swanctl swanctl
switchmode
switchvideomode switchvideomode
symantec symantec
symbolglyph symbolglyph
@ -999,7 +1003,6 @@ systemapp
systembar systembar
systemsize systemsize
systemui systemui
suspending
tabletype tabletype
tailoring tailoring
talkback talkback

View File

@ -636,7 +636,6 @@ const ruleArr = ['API_DOC_ATOMICSERVICE_01',
'API_CHANGE_INCOMPATIBLE_34', 'API_CHANGE_INCOMPATIBLE_34',
'API_CHANGE_INCOMPATIBLE_35', 'API_CHANGE_INCOMPATIBLE_35',
'API_CHANGE_INCOMPATIBLE_36', 'API_CHANGE_INCOMPATIBLE_36',
'API_DOC_JSDOC_04'
]; ];
exports.ruleArr = ruleArr; exports.ruleArr = ruleArr;

File diff suppressed because one or more lines are too long

View File

@ -122,8 +122,7 @@
"API_DOC_JSDOC_01": "Jsdoc needs to be added to the current API.", "API_DOC_JSDOC_01": "Jsdoc needs to be added to the current API.",
"API_DOC_JSDOC_02": "JSDoc tag validity verification failed. Please confirm if the [since] tag is missing.JSDoc tag validity verification failed. Please confirm if the [syscap] tag is missing.", "API_DOC_JSDOC_02": "JSDoc tag validity verification failed. Please confirm if the [since] tag is missing.JSDoc tag validity verification failed. Please confirm if the [syscap] tag is missing.",
"API_DOC_JSDOC_03": "Jsdoc has chinese.", "API_DOC_JSDOC_03": "Jsdoc has chinese.",
"API_DOC_UNKNOW_DECORATOR_01": "The [XXXX] tag does not exist. Please use a valid JSDoc tag.", "API_DOC_UNKNOW_DECORATOR_01": "The [XXXX] tag does not exist. Please use a valid JSDoc tag."
"API_DOC_JSDOC_04": "The [systemapi] and [atomicservice] cannot exist in the same doc."
}, },
"DEFINE": { "DEFINE": {
"API_DEFINE_UNALLOWABLE_01": "Illegal [any] keyword used in the API.", "API_DEFINE_UNALLOWABLE_01": "Illegal [any] keyword used in the API.",

View File

@ -48179,7 +48179,6 @@
"predominant", "predominant",
"predominate", "predominate",
"predomination", "predomination",
"preexisting",
"preemie", "preemie",
"preeminence", "preeminence",
"preeminent", "preeminent",
@ -48193,6 +48192,7 @@
"preexist", "preexist",
"preexistence", "preexistence",
"preexistent", "preexistent",
"preexisting",
"pref", "pref",
"prefab", "prefab",
"prefabbed", "prefabbed",

View File

@ -33,10 +33,6 @@ export class LegalityCheck {
*/ */
static apiLegalityCheck(singleApi: ApiInfo, apiJsdoc: Comment.JsDocInfo): ErrorTagFormat[] { static apiLegalityCheck(singleApi: ApiInfo, apiJsdoc: Comment.JsDocInfo): ErrorTagFormat[] {
const apiLegalityCheckResult: ErrorTagFormat[] = []; const apiLegalityCheckResult: ErrorTagFormat[] = [];
//check systemapi and atomicservice
LegalityCheck.checkSystemapiAtomicservice(apiJsdoc, apiLegalityCheckResult);
const nodeInfo: ts.Node = singleApi.getNode() as ts.Node; const nodeInfo: ts.Node = singleApi.getNode() as ts.Node;
const apiLegalityTagsArray: string[] = apiLegalityCheckTypeMap.get(nodeInfo.kind) as string[]; const apiLegalityTagsArray: string[] = apiLegalityCheckTypeMap.get(nodeInfo.kind) as string[];
const apiLegalityTagsSet: Set<string> = new Set(apiLegalityTagsArray); const apiLegalityTagsSet: Set<string> = new Set(apiLegalityTagsArray);
@ -251,25 +247,4 @@ export class LegalityCheck {
}); });
return illegalTagsArray; return illegalTagsArray;
} }
/**
* systemapi and atomicservice cannot exist at the same time
* @param apiJsdoc
*/
static checkSystemapiAtomicservice(apiJsdoc: Comment.JsDocInfo, apiLegalityCheckResult: ErrorTagFormat[]) {
const apiSystemapiAtomicservice: ErrorTagFormat = {
state: true,
errorInfo: '',
};
const tagsName: string[] = [];
apiJsdoc.tags?.forEach((tag: Comment.CommentTag) => {
tagsName.push(tag.tag);
})
const hasSystemapi: boolean = tagsName.includes('systemapi');
const hasAtomicservice: boolean = tagsName.includes('atomicservice');
if (hasSystemapi && hasAtomicservice) {
apiSystemapiAtomicservice.state=false;
apiSystemapiAtomicservice.errorInfo=ErrorMessage.ERROR_ERROR_SYSTEMAPI_ATOMICSERVICE;
}
apiLegalityCheckResult.push(apiSystemapiAtomicservice);
}
} }

View File

@ -133,11 +133,11 @@ export class TagValueCheck {
state: true, state: true,
errorInfo: '', errorInfo: '',
}; };
let extendsTagValue: string = tag.name + tag.description; let extendsTagValue: string = tag.name;
if (singleApi.getApiType() === ApiType.CLASS || singleApi.getApiType() === ApiType.INTERFACE) { if (singleApi.getApiType() === ApiType.CLASS || singleApi.getApiType() === ApiType.INTERFACE) {
const extendsApiValue: string = CommonFunctions.getExtendsApiValue(singleApi); const extendsApiValue: string = CommonFunctions.getExtendsApiValue(singleApi);
const ImplementsApiValue: string = CommonFunctions.getImplementsApiValue(singleApi); const ImplementsApiValue: string = CommonFunctions.getImplementsApiValue(singleApi);
if (tag.tag === 'extends' && extendsTagValue.replace(/\s/g, '') !== extendsApiValue) { if (tag.tag === 'extends' && extendsTagValue !== extendsApiValue) {
extendsValueCheckResult.state = false; extendsValueCheckResult.state = false;
extendsValueCheckResult.errorInfo = ErrorMessage.ERROR_INFO_VALUE_EXTENDS; extendsValueCheckResult.errorInfo = ErrorMessage.ERROR_INFO_VALUE_EXTENDS;
} }

View File

@ -105,12 +105,12 @@ export class DiffHelper {
oldSourceFileInfo?.setSyscap(DiffHelper.getSyscapField(oldSourceFileInfo)); oldSourceFileInfo?.setSyscap(DiffHelper.getSyscapField(oldSourceFileInfo));
const oldKitInfo: string | undefined = oldSourceFileInfo?.getLastJsDocInfo()?.getKit(); const oldKitInfo: string | undefined = oldSourceFileInfo?.getLastJsDocInfo()?.getKit();
//文件在新版本中被删除 //文件在新版本中被删除
if (!clonedNewSDKApiMap.get(key) && oldKitInfo !== 'NA') { if (!clonedNewSDKApiMap.get(key) && oldKitInfo) {
diffInfos.push( diffInfos.push(
DiffProcessorHelper.wrapDiffInfo( DiffProcessorHelper.wrapDiffInfo(
oldSourceFileInfo, oldSourceFileInfo,
undefined, undefined,
new DiffTypeInfo(ApiStatusCode.KIT_CHANGE, ApiDiffType.KIT_HAVE_TO_NA, oldKitInfo, 'NA') new DiffTypeInfo(ApiStatusCode.KIT_CHANGE, ApiDiffType.KIT_CHANGE, oldKitInfo, 'NA')
) )
); );
} else if (clonedNewSDKApiMap.get(key)) { } else if (clonedNewSDKApiMap.get(key)) {
@ -121,7 +121,7 @@ export class DiffHelper {
DiffProcessorHelper.wrapDiffInfo( DiffProcessorHelper.wrapDiffInfo(
oldSourceFileInfo, oldSourceFileInfo,
newSourceFileInfo, newSourceFileInfo,
new DiffTypeInfo(ApiStatusCode.KIT_CHANGE, DiffHelper.getKitDiffType(oldKitInfo, newKitInfo), oldKitInfo, newKitInfo) new DiffTypeInfo(ApiStatusCode.KIT_CHANGE, ApiDiffType.KIT_CHANGE, oldKitInfo, newKitInfo)
) )
); );
} }
@ -131,31 +131,18 @@ export class DiffHelper {
for (const key of clonedNewSDKApiMap.keys()) { for (const key of clonedNewSDKApiMap.keys()) {
const newSourceFileInfo: ApiInfo | undefined = DiffHelper.getSourceFileInfo(clonedNewSDKApiMap.get(key)); const newSourceFileInfo: ApiInfo | undefined = DiffHelper.getSourceFileInfo(clonedNewSDKApiMap.get(key));
const newKitInfo: string | undefined = newSourceFileInfo?.getLastJsDocInfo()?.getKit(); const newKitInfo: string | undefined = newSourceFileInfo?.getLastJsDocInfo()?.getKit();
if (!clonedOldSDKApiMap.get(key) && newKitInfo !== 'NA') { if (!clonedOldSDKApiMap.get(key) && newKitInfo) {
diffInfos.push( diffInfos.push(
DiffProcessorHelper.wrapDiffInfo( DiffProcessorHelper.wrapDiffInfo(
undefined, undefined,
newSourceFileInfo, newSourceFileInfo,
new DiffTypeInfo(ApiStatusCode.KIT_CHANGE, ApiDiffType.KIT_NA_TO_HAVE, 'NA', newKitInfo) new DiffTypeInfo(ApiStatusCode.KIT_CHANGE, ApiDiffType.KIT_CHANGE, 'NA', newKitInfo)
) )
); );
} }
} }
} }
static getKitDiffType(oldKitInfo: string | undefined, newKitInfo: string | undefined): ApiDiffType {
if (oldKitInfo === 'NA' && newKitInfo === '') {
return ApiDiffType.KIT_NA_TO_HAVE;
} else if (oldKitInfo === '' && newKitInfo === 'NA') {
return ApiDiffType.KIT_HAVE_TO_NA;
} else if (oldKitInfo === 'NA' || oldKitInfo === '') {
return ApiDiffType.KIT_NA_TO_HAVE;
} else if (newKitInfo === 'NA' || newKitInfo === '') {
return ApiDiffType.KIT_HAVE_TO_NA;
}
return ApiDiffType.KIT_CHANGE;
}
static getSourceFileInfo(fileMap: FileInfoMap | undefined): ApiInfo | undefined { static getSourceFileInfo(fileMap: FileInfoMap | undefined): ApiInfo | undefined {
if (!fileMap) { if (!fileMap) {
return undefined; return undefined;

View File

@ -148,7 +148,6 @@ export enum ErrorMessage {
ERROR_NO_JSDOC_TAG = 'add tags to the Jsdoc.', ERROR_NO_JSDOC_TAG = 'add tags to the Jsdoc.',
ERROR_HAS_CHINESE = 'Jsdoc has chinese.', ERROR_HAS_CHINESE = 'Jsdoc has chinese.',
ERROR_ERROR_CODE = 'The generic error code does not contain the current error code.', ERROR_ERROR_CODE = 'The generic error code does not contain the current error code.',
ERROR_ERROR_SYSTEMAPI_ATOMICSERVICE = 'The [systemapi] and [atomicservice] cannot exist in the same doc.',
ERROR_CHANGES_JSDOC_LEVEL = 'Forbid changes: Cannot change from public API to system API.', ERROR_CHANGES_JSDOC_LEVEL = 'Forbid changes: Cannot change from public API to system API.',
ERROR_CHANGES_JSDOC_PERMISSION_RANGE = 'Forbid changes: Cannot reduce or permission or increase and permission.', ERROR_CHANGES_JSDOC_PERMISSION_RANGE = 'Forbid changes: Cannot reduce or permission or increase and permission.',
ERROR_CHANGES_JSDOC_PERMISSION_VALUE = 'Forbid changes: Cannot change permission value,cannot judge the range change.', ERROR_CHANGES_JSDOC_PERMISSION_VALUE = 'Forbid changes: Cannot change permission value,cannot judge the range change.',

View File

@ -682,8 +682,6 @@ export enum ApiDiffType {
ATOMIC_SERVICE_NA_TO_HAVE, ATOMIC_SERVICE_NA_TO_HAVE,
ATOMIC_SERVICE_HAVE_TO_NA, ATOMIC_SERVICE_HAVE_TO_NA,
PROPERTY_TYPE_SIGN_CHANGE, PROPERTY_TYPE_SIGN_CHANGE,
KIT_HAVE_TO_NA,
KIT_NA_TO_HAVE,
} }
export const diffTypeMap: Map<ApiDiffType, string> = new Map([ export const diffTypeMap: Map<ApiDiffType, string> = new Map([
@ -770,8 +768,6 @@ export const diffTypeMap: Map<ApiDiffType, string> = new Map([
[ApiDiffType.SINCE_VERSION_HAVE_TO_NA, '起始版本有变化'], [ApiDiffType.SINCE_VERSION_HAVE_TO_NA, '起始版本有变化'],
[ApiDiffType.SINCE_VERSION_NA_TO_HAVE, '起始版本有变化'], [ApiDiffType.SINCE_VERSION_NA_TO_HAVE, '起始版本有变化'],
[ApiDiffType.KIT_CHANGE, 'kit变更'], [ApiDiffType.KIT_CHANGE, 'kit变更'],
[ApiDiffType.KIT_HAVE_TO_NA, '删除kit'],
[ApiDiffType.KIT_NA_TO_HAVE, '新增kit'],
[ApiDiffType.ATOMIC_SERVICE_HAVE_TO_NA, 'API从支持元服务到不支持元服务'], [ApiDiffType.ATOMIC_SERVICE_HAVE_TO_NA, 'API从支持元服务到不支持元服务'],
[ApiDiffType.ATOMIC_SERVICE_NA_TO_HAVE, 'API从不支持元服务到支持元服务'], [ApiDiffType.ATOMIC_SERVICE_NA_TO_HAVE, 'API从不支持元服务到支持元服务'],
]); ]);
@ -862,8 +858,6 @@ export const diffMap: Map<ApiDiffType, string> = new Map([
[ApiDiffType.HISTORICAL_JSDOC_CHANGE, '历史版本jsdoc变更'], [ApiDiffType.HISTORICAL_JSDOC_CHANGE, '历史版本jsdoc变更'],
[ApiDiffType.HISTORICAL_API_CHANGE, '历史版本API变更'], [ApiDiffType.HISTORICAL_API_CHANGE, '历史版本API变更'],
[ApiDiffType.KIT_CHANGE, 'kit变更'], [ApiDiffType.KIT_CHANGE, 'kit变更'],
[ApiDiffType.KIT_HAVE_TO_NA, 'kit信息从有到无'],
[ApiDiffType.KIT_NA_TO_HAVE, 'kit信息从无到有'],
[ApiDiffType.ATOMIC_SERVICE_HAVE_TO_NA, 'API从支持元服务到不支持元服务'], [ApiDiffType.ATOMIC_SERVICE_HAVE_TO_NA, 'API从支持元服务到不支持元服务'],
[ApiDiffType.ATOMIC_SERVICE_NA_TO_HAVE, 'API从不支持元服务到支持元服务'], [ApiDiffType.ATOMIC_SERVICE_NA_TO_HAVE, 'API从不支持元服务到支持元服务'],
]); ]);
@ -939,8 +933,6 @@ export const apiChangeMap: Map<ApiDiffType, string> = new Map([
[ApiDiffType.SINCE_VERSION_HAVE_TO_NA, 'API修改约束变化'], [ApiDiffType.SINCE_VERSION_HAVE_TO_NA, 'API修改约束变化'],
[ApiDiffType.SINCE_VERSION_NA_TO_HAVE, 'API修改约束变化'], [ApiDiffType.SINCE_VERSION_NA_TO_HAVE, 'API修改约束变化'],
[ApiDiffType.KIT_CHANGE, '非API变更'], [ApiDiffType.KIT_CHANGE, '非API变更'],
[ApiDiffType.KIT_HAVE_TO_NA, '非API变更'],
[ApiDiffType.KIT_NA_TO_HAVE, '非API变更'],
[ApiDiffType.ATOMIC_SERVICE_HAVE_TO_NA, 'API修改约束变化'], [ApiDiffType.ATOMIC_SERVICE_HAVE_TO_NA, 'API修改约束变化'],
[ApiDiffType.ATOMIC_SERVICE_NA_TO_HAVE, 'API修改约束变化'], [ApiDiffType.ATOMIC_SERVICE_NA_TO_HAVE, 'API修改约束变化'],
[ApiDiffType.TYPE_ALIAS_FUNCTION_RETURN_TYPE_ADD, 'API修改原型修改'], [ApiDiffType.TYPE_ALIAS_FUNCTION_RETURN_TYPE_ADD, 'API修改原型修改'],
@ -1011,8 +1003,6 @@ export const incompatibleApiDiffTypes: Set<ApiDiffType> = new Set([
ApiDiffType.SYSCAP_A_TO_B, ApiDiffType.SYSCAP_A_TO_B,
ApiDiffType.SYSCAP_HAVE_TO_NA, ApiDiffType.SYSCAP_HAVE_TO_NA,
ApiDiffType.SYSCAP_NA_TO_HAVE, ApiDiffType.SYSCAP_NA_TO_HAVE,
ApiDiffType.KIT_CHANGE,
ApiDiffType.KIT_HAVE_TO_NA,
]); ]);
export const isNotApiSet: Set<string> = new Set([ export const isNotApiSet: Set<string> = new Set([

View File

@ -319,7 +319,7 @@ export class ApiInfo extends BasicApiInfo {
constructor(apiType: string = '', node: ts.Node, parentApi: BasicApiInfo | undefined) { constructor(apiType: string = '', node: ts.Node, parentApi: BasicApiInfo | undefined) {
super(apiType, node, parentApi); super(apiType, node, parentApi);
let parentKitInfo: string = 'NA'; let parentKitInfo: string = '';
let parentIsFile: boolean = false; let parentIsFile: boolean = false;
if (parentApi) { if (parentApi) {
parentKitInfo = this.getKitInfoFromParent(parentApi).kitInfo; parentKitInfo = this.getKitInfoFromParent(parentApi).kitInfo;
@ -342,7 +342,7 @@ export class ApiInfo extends BasicApiInfo {
getKitInfoFromParent(parentApi: BasicApiInfo): FileTag { getKitInfoFromParent(parentApi: BasicApiInfo): FileTag {
const parentApiInfo = parentApi as ApiInfo; const parentApiInfo = parentApi as ApiInfo;
const jsDocInfos: Comment.JsDocInfo[] = parentApiInfo.getJsDocInfos(); const jsDocInfos: Comment.JsDocInfo[] = parentApiInfo.getJsDocInfos();
let kitInfo: string | undefined = ''; let kitInfo: string = '';
let isFile: boolean = false; let isFile: boolean = false;
jsDocInfos.forEach((jsDocInfo: Comment.JsDocInfo) => { jsDocInfos.forEach((jsDocInfo: Comment.JsDocInfo) => {
kitInfo = jsDocInfo.getKit(); kitInfo = jsDocInfo.getKit();

View File

@ -231,17 +231,15 @@ export class CommonFunctions {
} }
static getExtendsApiValue(singleApi: ApiInfo): string { static getExtendsApiValue(singleApi: ApiInfo): string {
let extendsApiValue: string = ''; let extendsApiValue: string = '';
const extendsApiValueArr: string[] = [];
const extendsApiArr: ParentClass[] = (singleApi as ClassInfo).getParentClasses(); const extendsApiArr: ParentClass[] = (singleApi as ClassInfo).getParentClasses();
if (extendsApiArr.length === 0) { if (extendsApiArr.length === 0) {
return extendsApiValue; return extendsApiValue;
} }
extendsApiArr.forEach(extendsApi => { extendsApiArr.forEach(extendsApi => {
if (extendsApi.getExtendClass().length !== 0) { if (extendsApi.getExtendClass().length !== 0) {
extendsApiValueArr.push(extendsApi.getExtendClass()); extendsApiValue = extendsApi.getExtendClass();
} }
}); });
extendsApiValue = extendsApiValueArr.join(',');
return extendsApiValue; return extendsApiValue;
} }