-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v3.8.6] Mark some properties as @dontmangle
.
#18160
base: v3.8.6
Are you sure you want to change the base?
[v3.8.6] Mark some properties as @dontmangle
.
#18160
Conversation
|
@dontmangle
.
…86-test-mangle-protected-properties
…86-test-mangle-protected-properties # Conflicts: # package-lock.json
protected _times: number[] = []; | ||
|
||
/** @dontmangle */ | ||
protected _values: TKeyframeValue[] = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
protected member variable will be mangled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file engine-mangle-config.json
supports to control whether to mangle protected
properties globally, its default value is false
which means protected
properties will not be mangled. But if developers set it to true
, then all protected properties will be mangled too. The file format is :
{
"common": {
"mangleProtected": false, // <------- here
"mangleList": [
"MyClass2",
"MyClass.foo",
"MyClass.getBar"
],
"dontMangleList": [
"BaseFactory",
"Slot",
"MyClass.hello"
]
},
"web-mobile": {
"extends": "common",
"mangleList": [
"MyClass3",
"MyClass4.haha",
"MyClass4.w111uwu"
],
"dontMangleList": [
"MyClass5.skldjfl"
]
}
}
So if developer set mangleProtected
to true, some properties are set by cc.fastDefine
to mark them as serializable, so they should not be mangled. In this case, we should make sure some properties in engine should not be mangled by jsdoc tag @dontmangle
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example:
CCClass.fastDefine('cc.AnimationCurve', AnimationCurve, {
_curve: null, // <---- the protected property _curve should not be mangled.
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. If so, then how to determine if a protected variable can be mangled or not? What i mean is how to know if need to add @@dontmangle
for protected variables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to review the code to decide. So the mangleProtected
is disabled (false) by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to review the code to decide.
Is there a simple rule to determine it? If not, then it will be hard to maintain the codes. And how to make sure it work or not, is there a CI to check it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, we haven't enable CI to run the feature of mangleProperties
. I will discuss with QA team after editor is updated.
@dontmangle
.@dontmangle
.
Because the private property |
…ganhar/cocos-engine into 386-test-mangle-protected-properties
@minggo I added some comment for the API being marked as |
Re: #
Changelog
Continuous Integration
This pull request:
Compatibility Check
This pull request: