diff --git a/CMakeLists.txt b/CMakeLists.txt index d1c40c3b19..dad20ba10b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,8 +58,8 @@ endif() set(BUILD_CPP_TESTS_DEFAULT ON) set(BUILD_LUA_LIBS_DEFAULT ON) set(BUILD_LUA_TESTS_DEFAULT ON) -set(BUILD_JS_LIBS_DEFAULT OFF) -set(BUILD_JS_TESTS_DEFAULT OFF) +set(BUILD_JS_LIBS_DEFAULT ON) +set(BUILD_JS_TESTS_DEFAULT ON) # TODO: fix test samples for MSVC if(MSVC) set(BUILD_CPP_TESTS_DEFAULT OFF) diff --git a/build/android-build.py b/build/android-build.py index 47ffe5930e..bca7221447 100755 --- a/build/android-build.py +++ b/build/android-build.py @@ -4,12 +4,12 @@ import sys import os, os.path -import shutil from optparse import OptionParser CPP_SAMPLES = ['cpp-empty-test', 'cpp-tests', 'game-controller-test'] LUA_SAMPLES = ['lua-empty-test', 'lua-tests', 'lua-game-controller-test'] -ALL_SAMPLES = CPP_SAMPLES + LUA_SAMPLES +JS_SAMPLES = ['js-tests'] +ALL_SAMPLES = CPP_SAMPLES + LUA_SAMPLES + JS_SAMPLES def caculate_built_samples(args): ''' Compute the sampels to be built @@ -27,6 +27,9 @@ def caculate_built_samples(args): if 'lua' in args: targets += LUA_SAMPLES args.remove('lua') + if 'js' in args: + targets += JS_SAMPLES + args.remove('js') targets += args @@ -36,8 +39,8 @@ def caculate_built_samples(args): return list(targets) def do_build(app_android_root, build_mode): - - command = 'cocos compile -p android -s %s --ndk-mode %s' % (app_android_root, build_mode) + + command = 'cocos compile -p android -s %s --ndk-mode %s' % (app_android_root, build_mode) print command if os.system(command) != 0: @@ -49,7 +52,7 @@ def build_samples(target, build_mode): build_mode = 'debug' elif build_mode != 'release': build_mode = 'debug' - + build_targets = caculate_built_samples(target) app_android_root = '' @@ -60,7 +63,8 @@ def build_samples(target, build_mode): "cpp-tests": "tests/cpp-tests", "lua-empty-test": "tests/lua-empty-test", "lua-tests": "tests/lua-tests", - "lua-game-controller-test": "tests/lua-game-controller-test" + "lua-game-controller-test": "tests/lua-game-controller-test", + "js-tests": "tests/js-tests" } cocos_root = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..") @@ -81,7 +85,7 @@ if __name__ == '__main__': usage = """ This script is mainy used for building tests built-in with cocos2d-x. - Usage: %prog [options] [cpp-empty-test|cpp-tests|lua-empty-test|lua-tests|cpp|lua|all] + Usage: %prog [options] [cpp-empty-test|cpp-tests|lua-empty-test|lua-tests|js-tests|cpp|lua|all] If you are new to cocos2d-x, I recommend you start with cpp-empty-test, lua-empty-test. @@ -93,13 +97,15 @@ if __name__ == '__main__': parser = OptionParser(usage=usage) parser.add_option("-n", "--ndk", dest="ndk_build_param", - help='It is not used anymore, because cocos console does not support it.') + help='It is not used anymore, because cocos console does not support it.') parser.add_option("-p", "--platform", dest="android_platform", - help='This parameter is not used any more, just keep compatible.') + help='This parameter is not used any more, just keep compatible.') parser.add_option("-b", "--build", dest="build_mode", - help='The build mode for java project,debug[default] or release. Get more information,please refer to http://developer.android.com/tools/building/building-cmdline.html') + help='The build mode for java project,debug[default] or release. \ + Get more information, \ + please refer to http://developer.android.com/tools/building/building-cmdline.html') (opts, args) = parser.parse_args() - + if len(args) == 0: parser.print_help() sys.exit(1) diff --git a/tools/jenkins-scripts/do-pull-request-builder.py b/tools/jenkins-scripts/do-pull-request-builder.py index d4dba509dd..06a8c56a9b 100755 --- a/tools/jenkins-scripts/do-pull-request-builder.py +++ b/tools/jenkins-scripts/do-pull-request-builder.py @@ -48,10 +48,13 @@ def do_build_slaves(): js_tests_build_scripts = jenkins_script_path + "win32-js-build.bat" elif(node_name == 'windows-universal' or node_name == 'windows-universal_bak'): slave_build_scripts = jenkins_script_path + "windows-universal.bat" + js_tests_build_scripts = jenkins_script_path + "windows-js-universal.bat" elif(node_name == 'ios_mac' or node_name == 'ios' or node_name == 'ios_bak'): slave_build_scripts = jenkins_script_path + "ios-build.sh" + js_tests_build_scripts = jenkins_script_path + "ios-js-build.sh" elif(node_name == 'mac' or node_name == 'mac_bak'): slave_build_scripts = jenkins_script_path + "mac-build.sh" + js_tests_build_scripts = jenkins_script_path + "mac-js-build.sh" elif(node_name == 'linux_centos' or node_name == 'linux' or node_name == 'linux_bak'): slave_build_scripts = jenkins_script_path + "linux-build.sh" elif(node_name == 'wp8'): diff --git a/tools/jenkins-scripts/slave-scripts/android-build.sh b/tools/jenkins-scripts/slave-scripts/android-build.sh index 5c86082518..bfad2d3a49 100755 --- a/tools/jenkins-scripts/slave-scripts/android-build.sh +++ b/tools/jenkins-scripts/slave-scripts/android-build.sh @@ -2,4 +2,4 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" COCOS2DX_ROOT="$DIR"/../../.. cd ${COCOS2DX_ROOT} -python build/android-build.py -p 10 cpp-tests lua-tests +python build/android-build.py -p 10 cpp-tests lua-tests js-tests diff --git a/tools/jenkins-scripts/slave-scripts/gen_jsb.py b/tools/jenkins-scripts/slave-scripts/gen_jsb.py index 1403b49400..4f69233e0c 100755 --- a/tools/jenkins-scripts/slave-scripts/gen_jsb.py +++ b/tools/jenkins-scripts/slave-scripts/gen_jsb.py @@ -4,7 +4,7 @@ import os import sys ret = 0 -genbindings_dirs = ['tolua'] +genbindings_dirs = ['tolua', 'tojs'] for item in genbindings_dirs: os.chdir("tools/" + item) ret = os.system('python genbindings.py') @@ -12,5 +12,5 @@ for item in genbindings_dirs: if(ret != 0): ret = 1 break - + sys.exit(ret) diff --git a/tools/jenkins-scripts/slave-scripts/ios-js-build.sh b/tools/jenkins-scripts/slave-scripts/ios-js-build.sh new file mode 100755 index 0000000000..1c3ca79613 --- /dev/null +++ b/tools/jenkins-scripts/slave-scripts/ios-js-build.sh @@ -0,0 +1,7 @@ +#put xctool.sh into your PATH +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +COCOS2DX_ROOT="$DIR"/../../.. +xcodebuild -project "$COCOS2DX_ROOT"/build/cocos2d_js_tests.xcodeproj -scheme "js-tests iOS" -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" clean | xcpretty +xcodebuild -project "$COCOS2DX_ROOT"/build/cocos2d_js_tests.xcodeproj -scheme "js-tests iOS" -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" build | xcpretty +#the following commands must not be removed +xcodebuild -project "$COCOS2DX_ROOT"/build/cocos2d_js_tests.xcodeproj -scheme "js-tests iOS" -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" build diff --git a/tools/jenkins-scripts/slave-scripts/mac-js-build.sh b/tools/jenkins-scripts/slave-scripts/mac-js-build.sh new file mode 100755 index 0000000000..5a686724d0 --- /dev/null +++ b/tools/jenkins-scripts/slave-scripts/mac-js-build.sh @@ -0,0 +1,22 @@ +#put xctool.sh into your PATH + +####### +# Cmake build +####### +# DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +# COCOS2DX_ROOT="$DIR"/../../.. +# cd ${COCOS2DX_ROOT} +# mkdir mac-build +# cd mac-build +# cmake .. +# make -j4 + +####### +# xcode build +####### +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +COCOS2DX_ROOT="$DIR"/../../.. +xcodebuild -project "$COCOS2DX_ROOT"/build/cocos2d_js_tests.xcodeproj -scheme "js-tests Mac" clean | xcpretty +xcodebuild -project "$COCOS2DX_ROOT"/build/cocos2d_js_tests.xcodeproj -scheme "js-tests Mac" build | xcpretty +#xcpretty has a bug, some xcodebuid fails return value would be treated as 0. +xcodebuild -project "$COCOS2DX_ROOT"/build/cocos2d_js_tests.xcodeproj -scheme "js-tests Mac" build diff --git a/tools/jenkins-scripts/slave-scripts/windows-js-universal.bat b/tools/jenkins-scripts/slave-scripts/windows-js-universal.bat new file mode 100755 index 0000000000..efb44a152f --- /dev/null +++ b/tools/jenkins-scripts/slave-scripts/windows-js-universal.bat @@ -0,0 +1,2 @@ +call "%VS120COMNTOOLS%vsvars32.bat" +msbuild build\cocos2d-js-win8.1-universal.sln /t:Build /p:Platform="Win32" /p:Configuration="Release" /m