[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.
protected member variable will be mangled?
There was a problem hiding this comment.
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.
For example:
CCClass.fastDefine('cc.AnimationCurve', AnimationCurve, {
_curve: null, // <---- the protected property _curve should not be mangled.
});There was a problem hiding this comment.
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.
Need to review the code to decide. So the mangleProtected is disabled (false) by default.
There was a problem hiding this comment.
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.
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: