From 7e495c9619d4b737cfb0ae03d2c06543225d1d42 Mon Sep 17 00:00:00 2001 From: lm Date: Tue, 15 Apr 2014 18:15:31 +0800 Subject: [PATCH] [Jenkins][ci skip] Create and save cpp-empty-test apk for autotest --- tools/jenkins-scripts/pull-request-builder.py | 14 ++++++++++++++ tools/jenkins-scripts/upload_apk.sh | 10 ++++++++++ 2 files changed, 24 insertions(+) create mode 100644 tools/jenkins-scripts/upload_apk.sh diff --git a/tools/jenkins-scripts/pull-request-builder.py b/tools/jenkins-scripts/pull-request-builder.py index 41dce4da3a..ea2e86c887 100755 --- a/tools/jenkins-scripts/pull-request-builder.py +++ b/tools/jenkins-scripts/pull-request-builder.py @@ -141,8 +141,22 @@ def main(): node_name = os.environ['NODE_NAME'] if(branch == 'develop'): if(node_name == 'android_mac') or (node_name == 'android_win7'): + #modify tests/cpp-empty-test/Classes/AppDelegate.cpp to support Console + modify_file = 'tests/cpp-empty-test/Classes/AppDelegate.cpp' + data = codecs.open(modify_file, encoding='UTF-8').read() + data = re.sub("director->setDisplayStats\(true\);", "director->setDisplayStats(true); director->getConsole()->listenOnTCP(5678);", data) + codecs.open(modify_file, 'wb', encoding='UTF-8').write(data) print "Start build android..." ret = os.system("python build/android-build.py -n -j10 all") + # create and save apk + if(ret == 0): + sample_dir = 'tests/cpp-empty-test/proj.android/' + os.system('android update project -p cocos/2d/platform/android/java/ -t android-13') + os.system('android update project -p ' + sample_dir + ' -t android-13') + os.system('ant debug -f ' + sample_dir + 'build.xml') + local_apk = sample_dir + 'bin/CppEmptyTest-debug.apk' + remote_apk = 'apks/cpp_empty_test/cpp_empty_test_' + str(pr_num) + '.apk' + os.system('tools/jenkins-scripts/upload_apk.sh ' + local_apk + ' ' + remote_apk) elif(node_name == 'win32_win7'): ret = subprocess.call('"%VS110COMNTOOLS%..\IDE\devenv.com" "build\cocos2d-win32.vc2012.sln" /Build "Debug|Win32"', shell=True) elif(node_name == 'ios_mac'): diff --git a/tools/jenkins-scripts/upload_apk.sh b/tools/jenkins-scripts/upload_apk.sh new file mode 100644 index 0000000000..8ede92b688 --- /dev/null +++ b/tools/jenkins-scripts/upload_apk.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +localfile=$1 +remotefile=$2 + +sftp redmine@10.10.11.15 << EOF +put $localfile $remotefile +bye +EOF +echo "upload finished" \ No newline at end of file