Remove jsb related (#19729)

* remove jsb related codes
* update 3rd party
This commit is contained in:
minggo 2019-05-24 00:00:51 -07:00 committed by GitHub
parent 254c57a347
commit 23a21ef298
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 16 additions and 509 deletions

View File

@ -41,9 +41,7 @@ AssureOutOfSourceBuilds()
# works before build libcocos2d # works before build libcocos2d
include(CocosBuildSet) include(CocosBuildSet)
# for metal-support alpha release, we only test cpp
set(BUILD_LUA_LIBS ON) set(BUILD_LUA_LIBS ON)
set(BUILD_JS_LIBS OFF)
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core)
@ -59,9 +57,5 @@ if(BUILD_LUA_LIBS)
add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/lua-tests/project ${ENGINE_BINARY_PATH}/tests/lua-test) add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/lua-tests/project ${ENGINE_BINARY_PATH}/tests/lua-test)
endif(BUILD_LUA_LIBS) endif(BUILD_LUA_LIBS)
if(BUILD_JS_LIBS)
add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/js-tests/project ${ENGINE_BINARY_PATH}/tests/js-tests)
endif()
# add cpp-template-default into project(Cocos2d-x) for tmp test # add cpp-template-default into project(Cocos2d-x) for tmp test
add_subdirectory(${COCOS2DX_ROOT_PATH}/templates/cpp-template-default ${ENGINE_BINARY_PATH}/tests/HelloCpp) add_subdirectory(${COCOS2DX_ROOT_PATH}/templates/cpp-template-default ${ENGINE_BINARY_PATH}/tests/HelloCpp)

View File

@ -25,7 +25,6 @@ message(STATUS "ENGINE_BINARY_PATH:" ${ENGINE_BINARY_PATH})
# the default behavior of build module # the default behavior of build module
option(DEBUG_MODE "Debug or Release?" ON) option(DEBUG_MODE "Debug or Release?" ON)
option(BUILD_LUA_LIBS "Build lua libraries" OFF) option(BUILD_LUA_LIBS "Build lua libraries" OFF)
option(BUILD_JS_LIBS "Build js libraries" OFF)
# include helper functions # include helper functions
include(CocosBuildHelpers) include(CocosBuildHelpers)

View File

@ -41,11 +41,6 @@ macro(cocos2dx_depend)
${METAL_LIBRARY} ${METAL_LIBRARY}
) )
if(BUILD_JS_LIBS)
find_library(SQLITE3_LIBRARY SQLite3)
list(APPEND COCOS_APPLE_LIBS ${SQLITE3_LIBRARY})
endif()
if(MACOSX) if(MACOSX)
list(APPEND PREBUILT_SPECIFIC_LIBS GLFW3) list(APPEND PREBUILT_SPECIFIC_LIBS GLFW3)

View File

@ -27,7 +27,6 @@
# this CMakeLists is to generate Cocos2d-x Engine Library # this CMakeLists is to generate Cocos2d-x Engine Library
# build libcocos2d # build libcocos2d
# build luacocos2d if BUILD_LUA_LIBS=ON # build luacocos2d if BUILD_LUA_LIBS=ON
# build jscocos2d if BUILD_JS_LIBS=ON
# The version number # The version number
set(COCOS2D_X_VERSION 3.18) set(COCOS2D_X_VERSION 3.18)
@ -46,7 +45,6 @@ include(base/CMakeLists.txt)
include(ui/CMakeLists.txt) include(ui/CMakeLists.txt)
include(network/CMakeLists.txt) include(network/CMakeLists.txt)
include(audio/CMakeLists.txt) include(audio/CMakeLists.txt)
include(storage/CMakeLists.txt)
# default value for cocos2dx extensions modules build # default value for cocos2dx extensions modules build
option(BUILD_EDITOR_COCOSTUDIO "Build editor support for cocostudio" ON) option(BUILD_EDITOR_COCOSTUDIO "Build editor support for cocostudio" ON)
@ -82,7 +80,6 @@ set(COCOS_HEADER cocos2d.h
${COCOS_NETWORK_HEADER} ${COCOS_NETWORK_HEADER}
${COCOS_EDITOR_SUPPORT_HEADER} ${COCOS_EDITOR_SUPPORT_HEADER}
${COCOS_EXTENSIONS_HEADER} ${COCOS_EXTENSIONS_HEADER}
${COCOS_STORAGE_HEADER}
) )
set(COCOS_SRC cocos2d.cpp set(COCOS_SRC cocos2d.cpp
@ -141,10 +138,6 @@ set_target_properties(cocos2d
if(BUILD_LUA_LIBS) if(BUILD_LUA_LIBS)
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/scripting/lua-bindings ${ENGINE_BINARY_PATH}/cocos/lua-bindings) add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/scripting/lua-bindings ${ENGINE_BINARY_PATH}/cocos/lua-bindings)
endif() endif()
## JS bindings lib
if(BUILD_JS_LIBS)
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/scripting/js-bindings ${ENGINE_BINARY_PATH}/cocos/js-bindings)
endif()
if(XCODE OR VS) if(XCODE OR VS)
cocos_mark_code_files("cocos2d") cocos_mark_code_files("cocos2d")

View File

@ -1,13 +0,0 @@
set(COCOS_STORAGE_HEADER
storage/local-storage/LocalStorage.h
)
if(ANDROID)
set(COCOS_STORAGE_SRC
storage/local-storage/LocalStorage-android.cpp
)
else()
set(COCOS_STORAGE_SRC
storage/local-storage/LocalStorage.cpp
)
endif()

View File

@ -1,134 +0,0 @@
/***************************************************************************
Copyright (c) 2012 Zynga Inc.
Copyright (c) 2013 cocos2d-x.org
Copyright (c) 2013-2017 Chukong Technologic Inc.
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
***************************************************************************/
/*
Local Storage support for the JS Bindings for iOS.
Works on cocos2d-iphone and cocos2d-x.
*/
#include "storage/local-storage/LocalStorage.h"
#include "platform/CCPlatformMacros.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "jni.h"
#include "platform/android/jni/JniHelper.h"
USING_NS_CC;
static int _initialized = 0;
static std::string className = "org.cocos2dx.lib.Cocos2dxLocalStorage";
static void splitFilename (std::string& str)
{
size_t found = 0;
found = str.find_last_of("/\\");
if (found != std::string::npos)
{
str = str.substr(found + 1);
}
}
void localStorageInit( const std::string& fullpath)
{
if (fullpath.empty())
return;
if (!_initialized)
{
std::string strDBFilename = fullpath;
splitFilename(strDBFilename);
if (JniHelper::callStaticBooleanMethod(className, "init", strDBFilename, "data")) {
_initialized = 1;
}
}
}
void localStorageFree()
{
if (_initialized) {
JniHelper::callStaticVoidMethod(className, "destroy");
_initialized = 0;
}
}
/** sets an item in the LS */
void localStorageSetItem( const std::string& key, const std::string& value)
{
assert( _initialized );
JniHelper::callStaticVoidMethod(className, "setItem", key, value);
}
/** gets an item from the LS */
bool localStorageGetItem( const std::string& key, std::string *outItem )
{
assert( _initialized );
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, className.c_str(), "getItem", "(Ljava/lang/String;)Ljava/lang/String;"))
{
jstring jkey = t.env->NewStringUTF(key.c_str());
jstring jret = (jstring)t.env->CallStaticObjectMethod(t.classID, t.methodID, jkey);
if (jret == nullptr)
{
t.env->DeleteLocalRef(jret);
t.env->DeleteLocalRef(jkey);
t.env->DeleteLocalRef(t.classID);
return false;
}
else
{
outItem->assign(JniHelper::jstring2string(jret));
t.env->DeleteLocalRef(jret);
t.env->DeleteLocalRef(jkey);
t.env->DeleteLocalRef(t.classID);
return true;
}
}
else
{
return false;
}
}
/** removes an item from the LS */
void localStorageRemoveItem( const std::string& key )
{
assert( _initialized );
JniHelper::callStaticVoidMethod(className, "removeItem", key);
}
/** removes all items from the LS */
void localStorageClear()
{
assert( _initialized );
JniHelper::callStaticVoidMethod(className, "clear");
}
#endif // #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)

View File

@ -1,181 +0,0 @@
/*
Copyright (c) 2012 - Zynga Inc.
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/*
Local Storage support for the JS Bindings for iOS.
Works on cocos2d-iphone and cocos2d-x.
*/
#include "storage/local-storage/LocalStorage.h"
#include "platform/CCPlatformMacros.h"
#if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID)
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <sqlite3.h>
static int _initialized = 0;
static sqlite3 *_db;
static sqlite3_stmt *_stmt_select;
static sqlite3_stmt *_stmt_remove;
static sqlite3_stmt *_stmt_update;
static sqlite3_stmt *_stmt_clear;
static void localStorageCreateTable()
{
const char *sql_createtable = "CREATE TABLE IF NOT EXISTS data(key TEXT PRIMARY KEY,value TEXT);";
sqlite3_stmt *stmt;
int ok = sqlite3_prepare_v2(_db, sql_createtable, -1, &stmt, nullptr);
ok |= sqlite3_step(stmt);
ok |= sqlite3_finalize(stmt);
if (ok != SQLITE_OK && ok != SQLITE_DONE)
printf("Error in CREATE TABLE\n");
}
void localStorageInit( const std::string& fullpath/* = "" */)
{
if (!_initialized) {
int ret = 0;
if (fullpath.empty())
ret = sqlite3_open(":memory:", &_db);
else
ret = sqlite3_open(fullpath.c_str(), &_db);
localStorageCreateTable();
// SELECT
const char *sql_select = "SELECT value FROM data WHERE key=?;";
ret |= sqlite3_prepare_v2(_db, sql_select, -1, &_stmt_select, nullptr);
// REPLACE
const char *sql_update = "REPLACE INTO data (key, value) VALUES (?,?);";
ret |= sqlite3_prepare_v2(_db, sql_update, -1, &_stmt_update, nullptr);
// DELETE
const char *sql_remove = "DELETE FROM data WHERE key=?;";
ret |= sqlite3_prepare_v2(_db, sql_remove, -1, &_stmt_remove, nullptr);
// Clear
const char *sql_clear = "DELETE FROM data;";
ret |= sqlite3_prepare_v2(_db, sql_clear, -1, &_stmt_clear, nullptr);
if (ret != SQLITE_OK) {
printf("Error initializing DB\n");
// report error
}
_initialized = 1;
}
}
void localStorageFree()
{
if (_initialized) {
sqlite3_finalize(_stmt_select);
sqlite3_finalize(_stmt_remove);
sqlite3_finalize(_stmt_update);
sqlite3_close(_db);
_initialized = 0;
}
}
/** sets an item in the LS */
void localStorageSetItem( const std::string& key, const std::string& value)
{
assert( _initialized );
int ok = sqlite3_bind_text(_stmt_update, 1, key.c_str(), -1, SQLITE_TRANSIENT);
ok |= sqlite3_bind_text(_stmt_update, 2, value.c_str(), -1, SQLITE_TRANSIENT);
ok |= sqlite3_step(_stmt_update);
ok |= sqlite3_reset(_stmt_update);
if (ok != SQLITE_OK && ok != SQLITE_DONE)
printf("Error in localStorage.setItem()\n");
}
/** gets an item from the LS */
bool localStorageGetItem( const std::string& key, std::string *outItem )
{
assert( _initialized );
int ok = sqlite3_reset(_stmt_select);
ok |= sqlite3_bind_text(_stmt_select, 1, key.c_str(), -1, SQLITE_TRANSIENT);
ok |= sqlite3_step(_stmt_select);
const unsigned char *text = sqlite3_column_text(_stmt_select, 0);
if (ok != SQLITE_OK && ok != SQLITE_DONE && ok != SQLITE_ROW)
{
printf("Error in localStorage.getItem()\n");
return false;
}
else if (!text)
{
return false;
}
else
{
outItem->assign((const char*)text);
return true;
}
}
/** removes an item from the LS */
void localStorageRemoveItem( const std::string& key )
{
assert( _initialized );
int ok = sqlite3_bind_text(_stmt_remove, 1, key.c_str(), -1, SQLITE_TRANSIENT);
ok |= sqlite3_step(_stmt_remove);
ok |= sqlite3_reset(_stmt_remove);
if (ok != SQLITE_OK && ok != SQLITE_DONE)
printf("Error in localStorage.removeItem()\n");
}
/** removes all items from the LS */
void localStorageClear()
{
assert( _initialized );
int ok = sqlite3_step(_stmt_clear);
if( ok != SQLITE_OK && ok != SQLITE_DONE)
printf("Error in localStorage.clear()\n");
}
#endif // #if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID)

View File

@ -1,61 +0,0 @@
/****************************************************************************
Copyright (c) 2012 Zynga Inc.
Copyright (c) 2013-2016 Chukong Technologies Inc.
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __JSB_LOCALSTORAGE_H
#define __JSB_LOCALSTORAGE_H
#include <string>
#include "platform/CCPlatformMacros.h"
/**
* @addtogroup storage
* @{
*/
/** Local Storage support for the JS Bindings.*/
/** Initializes the database. If path is null, it will create an in-memory DB. */
void CC_DLL localStorageInit( const std::string& fullpath = "");
/** Frees the allocated resources. */
void CC_DLL localStorageFree();
/** Sets an item in the JS. */
void CC_DLL localStorageSetItem( const std::string& key, const std::string& value);
/** Gets an item from the JS. */
bool CC_DLL localStorageGetItem( const std::string& key, std::string *outItem );
/** Removes an item from the JS. */
void CC_DLL localStorageRemoveItem( const std::string& key );
/** Removes all items from the JS. */
void CC_DLL localStorageClear();
// end group
/// @}
#endif // __JSB_LOCALSTORAGE_H

View File

@ -1,5 +1,5 @@
{ {
"version": "metal-support-8", "version": "metal-support-9",
"zip_file_size": "146254799", "zip_file_size": "146254799",
"repo_name": "cocos2d-x-3rd-party-libs-bin", "repo_name": "cocos2d-x-3rd-party-libs-bin",
"repo_parent": "https://github.com/cocos2d/", "repo_parent": "https://github.com/cocos2d/",

View File

@ -1,14 +0,0 @@
SpiderMonkey is Mozilla's JavaScript engine written in C/C++. It is used in various Mozilla products, including Firefox, and is available under MPL/GPL/LGPL tri-license.
(from https://developer.mozilla.org/en/SpiderMonkey)
--------
Please see the file toolkit/content/license.html for the copyright licensing
conditions attached to this codebase, including copies of the licenses
concerned.
You are not granted rights or licenses to the trademarks of the
Mozilla Foundation or any party, including without limitation the
Firefox name or logo.
For more information, see: http://www.mozilla.org/foundation/licensing.html

View File

@ -91,13 +91,6 @@
"*.dll" "*.dll"
] ]
}, },
{
"from": "external/sqlite3/libraries/win32",
"to": "runtime/win32",
"include": [
"*.dll"
]
},
{ {
"from": "external/tiff/prebuilt/win32", "from": "external/tiff/prebuilt/win32",
"to": "runtime/win32", "to": "runtime/win32",

View File

@ -20,10 +20,6 @@ function Generate-Binding-Codes
Push-Location $env:APPVEYOR_BUILD_FOLDER\tools\tolua Push-Location $env:APPVEYOR_BUILD_FOLDER\tools\tolua
& $python $env:APPVEYOR_BUILD_FOLDER\tools\tolua\genbindings.py & $python $env:APPVEYOR_BUILD_FOLDER\tools\tolua\genbindings.py
Pop-Location Pop-Location
#Push-Location $env:APPVEYOR_BUILD_FOLDER\tools\tojs
#& $python $env:APPVEYOR_BUILD_FOLDER\tools\tojs\genbindings.py
#Pop-Location
} }
function Update-SubModule function Update-SubModule

View File

@ -12,7 +12,6 @@ function install_android_ndk()
{ {
sudo python -m pip install retry sudo python -m pip install retry
if [ "$BUILD_TARGET" == "android_cmake" ]\ if [ "$BUILD_TARGET" == "android_cmake" ]\
|| [ "$BUILD_TARGET" == "android_js_cmake" ]\
|| [ "$BUILD_TARGET" == "android_lua_cmake" ] ; then || [ "$BUILD_TARGET" == "android_lua_cmake" ] ; then
python $COCOS2DX_ROOT/tools/appveyor-scripts/setup_android.py python $COCOS2DX_ROOT/tools/appveyor-scripts/setup_android.py
else else

View File

@ -42,10 +42,8 @@ class CocosFileList:
self.rootDir = "" self.rootDir = ""
self.fileList_com=[] self.fileList_com=[]
self.fileList_lua=[] self.fileList_lua=[]
self.fileList_js=[]
self.luaPath = ["cocos/scripting/lua-bindings", "external/lua", "tools/bindings-generator", "tools/tolua"] self.luaPath = ["cocos/scripting/lua-bindings", "external/lua", "tools/bindings-generator", "tools/tolua"]
self.jsPath = ["cocos/scripting/js-bindings", "external/spidermonkey", "tools/bindings-generator", "tools/tojs" ]
def readIngoreFile(self, fileName): def readIngoreFile(self, fileName):
""" """
@ -96,16 +94,8 @@ class CocosFileList:
foundLuaModule = True foundLuaModule = True
break break
foundJSModule = False
for jsPath in self.jsPath:
if relativePath.upper().find(jsPath.upper()) == 0:
foundJSModule = True
break
if foundLuaModule: if foundLuaModule:
self.fileList_lua.append("%s/" %relativePath) self.fileList_lua.append("%s/" %relativePath)
elif foundJSModule:
self.fileList_js.append("%s/" %relativePath)
else: else:
self.fileList_com.append("%s/" %relativePath) self.fileList_com.append("%s/" %relativePath)
self.__parseFileList(path) self.__parseFileList(path)
@ -135,16 +125,8 @@ class CocosFileList:
foundLuaModule = True foundLuaModule = True
break break
foundJSModule = False
for jsPath in self.jsPath:
if relativePath.upper().find(jsPath.upper()) == 0:
foundJSModule = True
break
if foundLuaModule: if foundLuaModule:
self.fileList_lua.append(relativePath) self.fileList_lua.append(relativePath)
elif foundJSModule:
self.fileList_js.append(relativePath)
else: else:
self.fileList_com.append(relativePath) self.fileList_com.append(relativePath)
@ -171,8 +153,7 @@ class CocosFileList:
f = open(fileName,"w") f = open(fileName,"w")
self.fileList_com.sort() self.fileList_com.sort()
self.fileList_lua.sort() self.fileList_lua.sort()
self.fileList_js.sort() content ={'common':self.fileList_com,'lua':self.fileList_lua}
content ={'common':self.fileList_com,'lua':self.fileList_lua,'js':self.fileList_js}
json.dump(content,f,sort_keys=True,indent=4) json.dump(content,f,sort_keys=True,indent=4)
f.close() f.close()
return True return True

View File

@ -101,19 +101,6 @@ function build_android_lua_cmake()
} }
function build_android_js_cmake()
{
# Build all samples
echo "Building Android samples js ..."
source ../environment.sh
# build lua-tests
pushd $COCOS2DX_ROOT/tests/js-tests/project/proj.android
do_retry ./gradlew assembleDebug -PPROP_BUILD_TYPE=cmake --parallel --info
popd
}
function genernate_binding_codes() function genernate_binding_codes()
{ {
if [ $TRAVIS_OS_NAME == "linux" ]; then if [ $TRAVIS_OS_NAME == "linux" ]; then
@ -137,16 +124,6 @@ function genernate_binding_codes()
pushd "$COCOS2DX_ROOT/tools/tolua" pushd "$COCOS2DX_ROOT/tools/tolua"
python ./genbindings.py python ./genbindings.py
popd popd
# We don't support building js projects for linux platform,
# therefore, don't generate js-binding code for it.
# comment it, currently doesn't support JSB
# if [ $TRAVIS_OS_NAME != "linux" ] || [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
# echo "Create auto-generated jsbinding glue codes."
# pushd "$COCOS2DX_ROOT/tools/tojs"
# python ./genbindings.py
# popd
# fi
} }
# generate cocos_files.json and check diff # generate cocos_files.json and check diff
@ -160,18 +137,7 @@ function update_cocos_files()
$COCOS2DX_ROOT/tools/travis-scripts/generate-template-files.py $COCOS2DX_ROOT/tools/travis-scripts/generate-template-files.py
git diff FETCH_HEAD --stat --exit-code "$COCOSFILE_PATH" git diff FETCH_HEAD --stat --exit-code "$COCOSFILE_PATH"
COCOSFILE_DIFF_RETVAL=$? COCOSFILE_DIFF_RETVAL=$?
echo $COCOSFILE_DIFF_RETVAL
if [ $LUA_DIFF_RETVAL -eq 0 ] && [ $JS_DIFF_RETVAL -eq 0 ] && [ $COCOSFILE_DIFF_RETVAL -eq 0 ]; then
echo
echo "No differences in generated files"
echo "Exiting with success."
echo
exit 0
else
echo
echo "Generated files differ from HEAD. Continuing."
echo
fi
# Exit on error # Exit on error
set -e set -e
@ -179,13 +145,12 @@ function update_cocos_files()
function generate_pull_request_for_binding_codes_and_cocosfiles() function generate_pull_request_for_binding_codes_and_cocosfiles()
{ {
COCOS_ROBOT_REMOTE="https://${GH_USER}:${GH_PASSWORD}@github.com/${GH_USER}/cocos2d-x.git" local COCOS_ROBOT_REMOTE="https://${GH_USER}:${GH_PASSWORD}@github.com/${GH_USER}/cocos2d-x.git"
LUA_AUTO_GENERATE_SCRIPT_PATH="$COCOS2DX_ROOT/cocos/scripting/lua-bindings/auto" local LUA_AUTO_GENERATE_SCRIPT_PATH="$COCOS2DX_ROOT/cocos/scripting/lua-bindings/auto"
JS_AUTO_GENERATE_SCRIPT_PATH="$COCOS2DX_ROOT/cocos/scripting/js-bindings/auto" local ELAPSEDSECS=`date +%s`
ELAPSEDSECS=`date +%s` local COCOS_BRANCH="update_lua_bindings_$ELAPSEDSECS"
COCOS_BRANCH="update_lua_bindings_$ELAPSEDSECS" local COMMITTAG="[ci skip][AUTO]: updating luabinding & cocos_file.json automatically"
COMMITTAG="[ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json automatically" local PULL_REQUEST_REPO="https://api.github.com/repos/cocos2d/cocos2d-x/pulls"
PULL_REQUEST_REPO="https://api.github.com/repos/cocos2d/cocos2d-x/pulls"
pushd "$COCOS2DX_ROOT" pushd "$COCOS2DX_ROOT"
#Set git user for cocos2d-lua repo #Set git user for cocos2d-lua repo
@ -204,19 +169,20 @@ function generate_pull_request_for_binding_codes_and_cocosfiles()
# Don't exit on non-zero return value # Don't exit on non-zero return value
set +e set +e
git diff FETCH_HEAD --stat --exit-code "$LUA_AUTO_GENERATE_SCRIPT_PATH" git diff FETCH_HEAD --stat --exit-code "$LUA_AUTO_GENERATE_SCRIPT_PATH"
LUA_DIFF_RETVAL=$? local lua_binding_codes_diff=$?
git diff FETCH_HEAD --stat --exit-code "$JS_AUTO_GENERATE_SCRIPT_PATH"
JS_DIFF_RETVAL=$?
# generate cocos_files.json and check diff # generate cocos_files.json and check diff
update_cocos_files local cocos_file_diff=$(update_cocos_files)
if [ $lua_binding_codes_diff -eq 0 ] && [ $cocos_file_diff -eq 0 ]; then
echo "lua binding codes and cocos file are not differences"
exit 0
fi
# Exit on error # Exit on error
set -e set -e
git add -f --all "$LUA_AUTO_GENERATE_SCRIPT_PATH" git add -f --all "$LUA_AUTO_GENERATE_SCRIPT_PATH"
git add -f --all "$JS_AUTO_GENERATE_SCRIPT_PATH"
git add -f --all "$COCOSFILE_PATH" git add -f --all "$COCOSFILE_PATH"
git checkout -b "$COCOS_BRANCH" git checkout -b "$COCOS_BRANCH"
git commit -m "$COMMITTAG" git commit -m "$COMMITTAG"
@ -290,12 +256,6 @@ function run_pull_request()
genernate_binding_codes genernate_binding_codes
build_android_lua_cmake build_android_lua_cmake
fi fi
# android_js
if [ $BUILD_TARGET == 'android_js_cmake' ]; then
genernate_binding_codes
build_android_js_cmake
fi
} }
function run_after_merge() function run_after_merge()