Skip to content
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.5] Fix enum type conversion and support closure compiler to minify wasm glue code. #17767

Merged
merged 5 commits into from
Oct 23, 2024

Conversation

dumganhar
Copy link
Contributor

@dumganhar dumganhar commented Oct 23, 2024

Re: #17715

And add a script for generating compile commands which used for writing embind code in VS Code.

Changelog


Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

-s EXPORTED_FUNCTIONS=['_spineListenerCallBackFromJS','_spineTrackListenerCallback'] \
--js-library ../library_spine.js \
--closure=1 \
--closure-args=--externs=../library_spine_externs.js")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add closure compiler option

#include <math.h>
namespace spine {

Vector2::Vector2(): x(0), y(0) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy from ../spine-creator-support/Vector2.cpp to make spine-wasm project independent.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it conflict with spine?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vector2.h/.cpp was not the code in spine-runtime.
spine-creator-support directory is for JSB and spine-wasm is for WASM.
We should not include a file (Vector2.h/.cpp) in spine-creator-support directory since it is used for JSB.

@@ -14,6 +14,6 @@ mergeInto(LibraryManager.library, {
var eventType = wasmUtil.getCurrentEventType();
var trackEntry = wasmUtil.getCurrentTrackEntry();
var event = wasmUtil.getCurrentEvent();
globalThis.TrackEntryListeners.emitTrackEntryListener(listenerID, trackEntry, event, eventType.value);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eventType is number now, so doesn't need to add .value.

SpineWasmUtil.getCurrentListenerID = function() {};
SpineWasmUtil.getCurrentTrackEntry = function() {};
SpineWasmUtil.getCurrentEvent = function() {};
SpineWasmUtil.getCurrentEventType = function() {};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tell closure compiler that these methods should not be obfuscated.

Copy link

github-actions bot commented Oct 23, 2024

✅ Package size is not changed

Interface Check Report

This pull request does not change any public interfaces !

REGISTER_SPINE_ENUM(RotateMode);
REGISTER_SPINE_ENUM(TextureFilter);
REGISTER_SPINE_ENUM(TextureWrap);
REGISTER_SPINE_ENUM(AttachmentType);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handle enums like integers.

@dumganhar dumganhar merged commit 4b2399f into cocos:v3.8.5 Oct 23, 2024
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants