Pull request didn't pass ci

Pull request didn't pass ci
0

It’s my first time to contribute to cocos2d-x, I’ve submitted a pull request, it didn’t pass the ci. The test fails on some error of lua library, but I didn’t modified any code of it, the diff proved that.
By the way, my own test case runs, but some of them are not since I cloned the repo.

Is there sth I need to do?

PR: https://github.com/cocos2d/cocos2d-x/pull/20315

It’s this PR: https://github.com/cocos2d/cocos2d-x/pull/20315

Yes, exactly this one.

Is it because of this commit updated lua binding?

https://github.com/cocos2d/cocos2d-x/commit/596da2df5bc8919382f6b166bf2db046cd4e42aa

@coulsonwang can you check this PR and check failure reason.

I found AppVeyor‘s result like this:

cmake test failed like this:
C:\projects\cocos2d-x\cocos\scripting\lua-bindings\auto\lua_cocos2dx_auto.cpp(101214): error C2770: invalid explicit template argument(s) for 'void object_to_luaval(lua_State *,const char *,T *)' [C:\projects\cocos2d-x\win32-build\engine\cocos\lua-bindings\luacocos2d.vcxproj]

sln test failed like this:
10>..\auto\jsb_cocos2dx_auto.cpp(65491): error C2672: 'js_get_or_create_jsobject': no matching overloaded function found [C:\projects\cocos2d-x\cocos\scripting\js-bindings\proj.win32\libjscocos2d.vcxproj]

and lua test failed like this:
C:/projects/cocos2d-x/cocos/scripting/lua-bindings/proj.android/../auto/lua_cocos2dx_auto.cpp:101214:9: error: no matching function for call to 'object_to_luaval'

and Travis-CI reports that kind of errors too:
/Users/travis/build/cocos2d/cocos2d-x/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp:101214:9: no matching function for call to ‘object_to_luaval’

1583

1584 object_to_luaval<std::map<unsigned int, std::vector<cocos2d::Vec2>>&>(tolua_S, "std::map<unsigned int, std::vector<cocos2d::Vec2>>",(std::map<unsigned int, std::vector<cocos2d::Vec2>>&)ret);

or:
/Users/travis/build/cocos2d/cocos2d-x/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp:65491:37: no matching function for call to ‘js_get_or_create_jsobject’
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<std::map<unsigned int, std::vectorcocos2d::Vec2>&>(cx, (std::map<unsigned int, std::vectorcocos2d::Vec2>&)ret));
^~~

All errors are about script bindings, especially lua. I didn’t modified any thing about it, only applied cpp code, the diff proved that. What I wondered is, is there anything I must do to lua and js bindings since I commited cpp codes?

And the last commit before the one of my pull request in my own branch is:

commit 596da2df5bc8919382f6b166bf2db046cd4e42aa (upstream/v3)
Author: CocosRobot <redmine@cocos2d-x.org>
Date:   Fri Nov 8 16:47:17 2019 +0800

    [ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json automatically (#20312)

Latest CI results of branch v3 is about commit:

21b008c6d8da79644111a9bac2d438c20c6957ee

It’s the second last commit on v3, with AppVeyor failed and Travis-CI passed.It’s two commits in the lead of my pull request.

Finally here’s the last problem for passing CI:
9>libluacocos2d.lib(lua_cocos2dx_auto.obj) : error LNK2019: unresolved external symbol "public: void __thiscall cocos2d::TMXTileAnimManager::stop(void)" (?stop@TMXTileAnimManager@cocos2d@@QAEXXZ) referenced in function "int __cdecl lua_cocos2dx_TMXTileAnimManager_stop(struct lua_State *)" (?lua_cocos2dx_TMXTileAnimManager_stop@@YAHPAUlua_State@@@Z) [C:\projects\cocos2d-x\tests\lua-empty-test\project\proj.win32\lua-empty-test.vcxproj]

It seems those API i applied can not be locate by lua or sth?

I’m sorry that I have no windows device to test that for now, I’ll try to find one

Should I regenerate lua and js bindings?

API changes like that do require the LUA and JS bindings to be re-generated. If you want to know how, check this post: https://discuss.cocos2d-x.org/t/cocos2d-x-jsb-auto-binding-tool-binding-generator-b-g-tips/10691

The instructions seem to be for Linux, but they’re pretty much the same for any other OS. The only thing to note is that you should use NDK 16 to do this (NDK20 causes errors). I’m not sure if any other newer NDK works, but it doesn’t matter, since NDK 16 does the job.

You’ll need Python 2.7 x86, not x64 (at least from my experience).

To generate the bindings, just go into cocosdir/tools/tojs/ and type:

py ./genbindings.py

Then do the same for LUA in cocosdir/tools/tolua/.

Fix any errors that appear, and once it generates them successfully, you should open the JS and LUA test projects in the test folder, and run them to make sure they work.

New APIs that I applied are just in those file that already exists, old APIs in these file can be link correctly, but new ones are not…

I’ve re-generated script bindings correctly, and tests runs well, but sln test on AppVeyor stil fails, it says:

5>libluacocos2d.lib(lua_cocos2dx_auto.obj) : error LNK2019: unresolved external symbol "public: void __thiscall cocos2d::TMXTileAnimManager::stopAll(void)" (?stopAll@TMXTileAnimManager@cocos2d@@QAEXXZ) referenced in function "int __cdecl lua_cocos2dx_TMXTileAnimManager_stopAll(struct lua_State *)" (?lua_cocos2dx_TMXTileAnimManager_stopAll@@YAHPAUlua_State@@@Z) [C:\projects\cocos2d-x\tests\lua-tests\project\proj.win32\lua-tests.win32.vcxproj]

Wired…

Thanks so much! I’ve been tried NDK 20 and it caused error exactly, I’ll try 16 now.
But what confused me is, the test on AppVeyor seems will re-generate bindings, but only cmake test passed and sln is not…

If it’s this that is failing, tests\lua-tests\project\proj.win32, then one thing you can try to do is generate a Visual Studio solution using CMake, and then do a file comparison of the new vcxproj file (which works) with this one that doesn’t work, tests\lua-tests\project\proj.win32\lua-tests.win32.vcxproj. You may be able to see what is missing in it.

I tried… but they quite different… I tested some settings but the original sln and vcxproject files still won’t work, those generated by cmake runs well… This is the last error in CIs but I think it’s too hard for me…

Is there any workflow about what to do after modified C++ API? I’ve already re-generated script bindings, but now lua-test project reports LNK2019 unresolved symbol about new functions that I added into TMXLayer.h and .cpp. But those functions it originally contains won’t cause that error.

vcxproj-2versions.zip (777.1 KB)

Here’s the the version of project files, since the error shows cannot resovle some simbo in libluacocos2d, I provided that too.

The issue isn’t related to the project files, and while the CMake Win32 generated project files worked, it was a bit misleading. The symbols we’re being exported for the TMXTileAnimManager and TMXTileAnimTask classes, so add CC_DLL to them and that should sort it all out.

class CC_DLL TMXTileAnimTask
{
...
}

class CC_DLL TMXTileAnimManager : public Ref
{
...
}

You may need to regenerate the JS and LUA bindings after you do this.

1 Like

It really works! Thank you!