diff --git a/tools/JenkinsScript/androidtest-debug3.bat b/tools/JenkinsScript/androidtest-debug3.bat index f626f36f95..a1fda072c7 100644 --- a/tools/JenkinsScript/androidtest-debug3.bat +++ b/tools/JenkinsScript/androidtest-debug3.bat @@ -4,9 +4,11 @@ ::%ANT_HOME% %ANDROID_HOME% %JAVA_HOME% %CYGWIN% %GITBIN% %ANDROID_NDK% :: Don't change it until you know what you do. -::In order to prevent the problem of permission,make the current user group get the ownership of project. -::Set the current user name. -::set _USERNAME= +if not exist "%CYGWIN%" echo Couldn't find Cygwin at "%CYGWIN%" and you should set like this "C:\cygwin"& pause & exit 1 +if not exist "%GITBIN%" echo Couldn't find Gitbin at "%GITBIN%" and you should set like this "F:\Git\bin"& pause & exit 2 +if not exist "%ANDROID_HOME%" echo Couldn't find ANDROID_HOME at "%ANDROID_HOME%" and you should set like this "D:\Windows7\android-sdk-windows"& pause & exit 3 +if not exist "%ANDROID_NDK%" echo Couldn't find Cygwin at "%ANDROID_NDK%" and you should set like this "D:\Windows7\android-ndk-r8"& pause & exit 4 +if not exist "%JAVA_HOME%" echo Couldn't find Cygwin at "%JAVA_HOME%" and you should set like this "C:\Program Files\Java\jdk1.7.0_05"& pause & exit 5 set _PROJECTNAME=TestCpp cd ..\.. @@ -106,16 +108,16 @@ goto success :error echo Error. -git checkout -f|%GITBIN%\sh.exe --login -git clean -df -x|%GITBIN%\sh.exe --login +git checkout -f +git clean -df -x pause exit 1 goto end :success echo Success. -git checkout -f|%GITBIN%\sh.exe --login -git clean -df|%GITBIN%\sh.exe --login +git checkout -f +git clean -df -x pause exit 0 goto end diff --git a/tools/JenkinsScript/androidtest-debug3.sh b/tools/JenkinsScript/androidtest-debug3.sh new file mode 100644 index 0000000000..bf4c07a2e0 --- /dev/null +++ b/tools/JenkinsScript/androidtest-debug3.sh @@ -0,0 +1,103 @@ +##This script is used to finish a android automated compiler. +#You should make sure have finished the environment setting. +#Here are the environment variables you should set. +#$COCOS2DX_ROOT $ANDROID_SDK_ROOT $ANDROID_NDK_ROOT $NDK_ROOT + +antcompile() +{ + #Make sure the original target is android-8 + sed '/target=/s/=.*$/=android-8/' ant.properties > anttmp.properties + cp anttmp.properties ant.properties + rm anttmp.properties + + #Android ant build(debug ,API level:8) + ant debug + #If build failed,make sure the Jenkins could get the errorlevel. + compileresult=$[$compileresult+$?] + + #Change API level.(API level:10) + sed '/target=/s/=.*$/=android-10/' ant.properties > anttmp.properties + cp anttmp.properties ant.properties + rm anttmp.properties + ant debug + compileresult=$[$compileresult+$?] + + #Change API level.(API level:11) + sed '/target=/s/=.*$/=android-11/' ant.properties > anttmp.properties + cp anttmp.properties ant.properties + rm anttmp.properties + ant debug + compileresult=$[$compileresult+$?] + + #Change API level.(API level:12) + sed '/target=/s/=.*$/=android-12/' ant.properties > anttmp.properties + cp anttmp.properties ant.properties + rm anttmp.properties + ant debug + compileresult=$[$compileresult+$?] + + #Change API level.(API level:13) + sed '/target=/s/=.*$/=android-13/' ant.properties > anttmp.properties + cp anttmp.properties ant.properties + rm anttmp.properties + ant debug + compileresult=$[$compileresult+$?] + + #After all test versions completed,changed current API level to the original.(API level:8) + sed '/target=/s/=.*$/=android-8/' ant.properties > anttmp.properties + cp anttmp.properties ant.properties + rm anttmp.properties +} + +#record the relevant catalog +compileresult=0 +CUR=$(pwd) +cd ../.. +ROOT=$(pwd) + +#copy configuration files to target. +cp $CUR/ant.properties $ROOT/samples/TestCpp/proj.android +cp $CUR/build.xml $ROOT/samples/TestCpp/proj.android +cp $CUR/rootconfig-Mac.sh $ROOT/samples/TestCpp/proj.android +cd samples/TestCpp/proj.android +sh rootconfig-Mac.sh TestCpp +sh build_native.sh + +#update android project configuration files +cd .. +android update project -p proj.android +cd proj.android +antcompile + +cp $CUR/ant.properties $ROOT/samples/HelloCpp/proj.android +cp $CUR/build.xml $ROOT/samples/HelloCpp/proj.android +cp $CUR/rootconfig-Mac.sh $ROOT/samples/HelloCpp/proj.android +cd ../../HelloCpp/proj.android +sh rootconfig-Mac.sh HelloCpp +sh build_native.sh +cd .. +android update project -p proj.android +cd proj.android +antcompile + +cp $CUR/ant.properties $ROOT/samples/HelloLua/proj.android +cp $CUR/build.xml $ROOT/samples/HelloLua/proj.android +cp $CUR/rootconfig-Mac.sh $ROOT/samples/HelloLua/proj.android +cd ../../HelloLua/proj.android +sh rootconfig-Mac.sh HelloLua +sh build_native.sh +cd .. +android update project -p proj.android +cd proj.android +antcompile + +#return the compileresult. +cd ../../.. +if [ $compileresult != 0 ]; then + git checkout -f + git clean -df -x + exit 1 +else + git checkout -f + git clean -df -x +fi \ No newline at end of file diff --git a/tools/JenkinsScript/androidtest-debug4.bat b/tools/JenkinsScript/androidtest-debug4.bat index 4e07b7479b..1430effc93 100644 --- a/tools/JenkinsScript/androidtest-debug4.bat +++ b/tools/JenkinsScript/androidtest-debug4.bat @@ -4,9 +4,11 @@ ::%ANT_HOME% %ANDROID_HOME% %JAVA_HOME% %CYGWIN% %GITBIN% %ANDROID_NDK% :: Don't change it until you know what you do. -::In order to prevent the problem of permission,make the current user group get the ownership of project. -::Set the current user name. -::set _USERNAME= +if not exist "%CYGWIN%" echo Couldn't find Cygwin at "%CYGWIN%" and you should set like this "C:\cygwin"& pause & exit 1 +if not exist "%GITBIN%" echo Couldn't find Gitbin at "%GITBIN%" and you should set like this "F:\Git\bin"& pause & exit 2 +if not exist "%ANDROID_HOME%" echo Couldn't find ANDROID_HOME at "%ANDROID_HOME%" and you should set like this "D:\Windows7\android-sdk-windows"& pause & exit 3 +if not exist "%ANDROID_NDK%" echo Couldn't find Cygwin at "%ANDROID_NDK%" and you should set like this "D:\Windows7\android-ndk-r8"& pause & exit 4 +if not exist "%JAVA_HOME%" echo Couldn't find Cygwin at "%JAVA_HOME%" and you should set like this "C:\Program Files\Java\jdk1.7.0_05"& pause & exit 5 set _PROJECTNAME=TestCpp cd ..\.. @@ -81,16 +83,16 @@ goto success :error echo Error. -git checkout -f|%GITBIN%\sh.exe --login -git clean -df -x|%GITBIN%\sh.exe --login +git checkout -f +git clean -df -x pause exit 1 goto end :success echo Success. -git checkout -f|%GITBIN%\sh.exe --login -git clean -df|%GITBIN%\sh.exe --login +git checkout -f +git clean -df -x pause exit 0 goto end diff --git a/tools/JenkinsScript/androidtest-debug4.sh b/tools/JenkinsScript/androidtest-debug4.sh new file mode 100644 index 0000000000..5de378bb72 --- /dev/null +++ b/tools/JenkinsScript/androidtest-debug4.sh @@ -0,0 +1,79 @@ +##This script is used to finish a android automated compiler. +#You should make sure have finished the environment setting. +#Here are the environment variables you should set. +#$COCOS2DX_ROOT $ANDROID_SDK_ROOT $ANDROID_NDK_ROOT $NDK_ROOT + +antcompile() +{ + #Change API level.(API level:14) + sed '/target=/s/=.*$/=android-14/' ant.properties > anttmp.properties + cp anttmp.properties ant.properties + rm anttmp.properties + ant release + compileresult=$[$compileresult+$?] + + #Change API level.(API level:15) + sed '/target=/s/=.*$/=android-15/' ant.properties > anttmp.properties + cp anttmp.properties ant.properties + rm anttmp.properties + ant release + compileresult=$[$compileresult+$?] + + #After all test versions completed,changed current API level to the original.(API level:8) + sed '/target=/s/=.*$/=android-8/' ant.properties > anttmp.properties + cp anttmp.properties ant.properties + rm anttmp.properties +} + +#record the relevant catalog +compileresult=0 +CUR=$(pwd) +cd ../.. +ROOT=$(pwd) + +#copy configuration files to target. +cp $CUR/ant.properties $ROOT/samples/TestCpp/proj.android +cp $CUR/build.xml $ROOT/samples/TestCpp/proj.android +cp $CUR/rootconfig-Mac.sh $ROOT/samples/TestCpp/proj.android +cd samples/TestCpp/proj.android +sh rootconfig-Mac.sh TestCpp +sh build_native.sh + +#update android project configuration files +cd .. +android update project -p proj.android +cd proj.android +antcompile + +cp $CUR/ant.properties $ROOT/samples/HelloCpp/proj.android +cp $CUR/build.xml $ROOT/samples/HelloCpp/proj.android +cp $CUR/rootconfig-Mac.sh $ROOT/samples/HelloCpp/proj.android +cd ../../HelloCpp/proj.android +sh rootconfig-Mac.sh HelloCpp +sh build_native.sh +cd .. +android update project -p proj.android +cd proj.android +antcompile + +cp $CUR/ant.properties $ROOT/samples/HelloLua/proj.android +cp $CUR/build.xml $ROOT/samples/HelloLua/proj.android +cp $CUR/rootconfig-Mac.sh $ROOT/samples/HelloLua/proj.android +cd ../../HelloLua/proj.android +sh rootconfig-Mac.sh HelloLua +sh build_native.sh +cd .. +android update project -p proj.android +cd proj.android +antcompile + +#return the compileresult. +cd ../../.. +if [ $compileresult != 0 ]; then + git checkout -f + git clean -df -x + exit 1 +else + git checkout -f + git clean -df -x +fi \ No newline at end of file diff --git a/tools/JenkinsScript/androidtest-release3.bat b/tools/JenkinsScript/androidtest-release3.bat index f84cb65cf7..711a18ced6 100644 --- a/tools/JenkinsScript/androidtest-release3.bat +++ b/tools/JenkinsScript/androidtest-release3.bat @@ -4,9 +4,11 @@ ::%ANT_HOME% %ANDROID_HOME% %JAVA_HOME% %CYGWIN% %GITBIN% %ANDROID_NDK% :: Don't change it until you know what you do. -::In order to prevent the problem of permission,make the current user group get the ownership of project. -::Set the current user name. -::set _USERNAME= +if not exist "%CYGWIN%" echo Couldn't find Cygwin at "%CYGWIN%" and you should set like this "C:\cygwin"& pause & exit 1 +if not exist "%GITBIN%" echo Couldn't find Gitbin at "%GITBIN%" and you should set like this "F:\Git\bin"& pause & exit 2 +if not exist "%ANDROID_HOME%" echo Couldn't find ANDROID_HOME at "%ANDROID_HOME%" and you should set like this "D:\Windows7\android-sdk-windows"& pause & exit 3 +if not exist "%ANDROID_NDK%" echo Couldn't find Cygwin at "%ANDROID_NDK%" and you should set like this "D:\Windows7\android-ndk-r8"& pause & exit 4 +if not exist "%JAVA_HOME%" echo Couldn't find Cygwin at "%JAVA_HOME%" and you should set like this "C:\Program Files\Java\jdk1.7.0_05"& pause & exit 5 set _PROJECTNAME=TestCpp cd ..\.. @@ -130,16 +132,16 @@ goto :eof :error echo Error. -git checkout -f|%GITBIN%\sh.exe --login -git clean -df|%GITBIN%\sh.exe --login +git checkout -f +git clean -df -x pause exit 1 goto end :success echo Success. -git checkout -f|%GITBIN%\sh.exe --login -git clean -df|%GITBIN%\sh.exe --login +git checkout -f +git clean -df -x pause exit 0 goto end diff --git a/tools/JenkinsScript/androidtest-release3.sh b/tools/JenkinsScript/androidtest-release3.sh new file mode 100644 index 0000000000..d0ed76e256 --- /dev/null +++ b/tools/JenkinsScript/androidtest-release3.sh @@ -0,0 +1,107 @@ +##This script is used to finish a android automated compiler. +#You should make sure have finished the environment setting. +#Here are the environment variables you should set. +#$COCOS2DX_ROOT $ANDROID_SDK_ROOT $ANDROID_NDK_ROOT $NDK_ROOT + +antcompile() +{ + #Make sure the original target is android-8 + sed '/target=/s/=.*$/=android-8/' ant.properties > anttmp.properties + cp anttmp.properties ant.properties + rm anttmp.properties + + #Android ant build(debug ,API level:8) + ant release + #If build failed,make sure the Jenkins could get the errorlevel. + compileresult=$[$compileresult+$?] + + #Change API level.(API level:10) + sed '/target=/s/=.*$/=android-10/' ant.properties > anttmp.properties + cp anttmp.properties ant.properties + rm anttmp.properties + ant release + compileresult=$[$compileresult+$?] + + #Change API level.(API level:11) + sed '/target=/s/=.*$/=android-11/' ant.properties > anttmp.properties + cp anttmp.properties ant.properties + rm anttmp.properties + ant release + compileresult=$[$compileresult+$?] + + #Change API level.(API level:12) + sed '/target=/s/=.*$/=android-12/' ant.properties > anttmp.properties + cp anttmp.properties ant.properties + rm anttmp.properties + ant release + compileresult=$[$compileresult+$?] + + #Change API level.(API level:13) + sed '/target=/s/=.*$/=android-13/' ant.properties > anttmp.properties + cp anttmp.properties ant.properties + rm anttmp.properties + ant release + compileresult=$[$compileresult+$?] + + #After all test versions completed,changed current API level to the original.(API level:8) + sed '/target=/s/=.*$/=android-8/' ant.properties > anttmp.properties + cp anttmp.properties ant.properties + rm anttmp.properties +} + +#record the relevant catalog +compileresult=0 +CUR=$(pwd) +cd ../.. +ROOT=$(pwd) + +#copy configuration files to target. +sed -i '' '14d' $CUR/ant.properties +gsed -i "14 i\\key.store=$ANDROID_HOME/debug.keystore" $CUR/ant.properties +cp $CUR/debug.keystore $ANDROID_HOME + +cp $CUR/ant.properties $ROOT/samples/TestCpp/proj.android +cp $CUR/build.xml $ROOT/samples/TestCpp/proj.android +cp $CUR/rootconfig-Mac.sh $ROOT/samples/TestCpp/proj.android +cd samples/TestCpp/proj.android +sh rootconfig-Mac.sh TestCpp +sh build_native.sh + +#update android project configuration files +cd .. +android update project -p proj.android +cd proj.android +antcompile + +cp $CUR/ant.properties $ROOT/samples/HelloCpp/proj.android +cp $CUR/build.xml $ROOT/samples/HelloCpp/proj.android +cp $CUR/rootconfig-Mac.sh $ROOT/samples/HelloCpp/proj.android +cd ../../HelloCpp/proj.android +sh rootconfig-Mac.sh HelloCpp +sh build_native.sh +cd .. +android update project -p proj.android +cd proj.android +antcompile + +cp $CUR/ant.properties $ROOT/samples/HelloLua/proj.android +cp $CUR/build.xml $ROOT/samples/HelloLua/proj.android +cp $CUR/rootconfig-Mac.sh $ROOT/samples/HelloLua/proj.android +cd ../../HelloLua/proj.android +sh rootconfig-Mac.sh HelloLua +sh build_native.sh +cd .. +android update project -p proj.android +cd proj.android +antcompile + +#return the compileresult. +cd ../../.. +if [ $compileresult != 0 ]; then + git checkout -f + git clean -df -x + exit 1 +else + git checkout -f + git clean -df -x +fi \ No newline at end of file diff --git a/tools/JenkinsScript/androidtest-release4.bat b/tools/JenkinsScript/androidtest-release4.bat index b9f1f37ca8..ba71be43bd 100644 --- a/tools/JenkinsScript/androidtest-release4.bat +++ b/tools/JenkinsScript/androidtest-release4.bat @@ -4,17 +4,22 @@ ::%ANT_HOME% %ANDROID_HOME% %JAVA_HOME% %CYGWIN% %GITBIN% %ANDROID_NDK% :: Don't change it until you know what you do. -::In order to prevent the problem of permission,make the current user group get the ownership of project. -::Set the current user name. -::set _USERNAME= +if not exist "%CYGWIN%" echo Couldn't find Cygwin at "%CYGWIN%" and you should set like this "C:\cygwin"& pause & exit 1 +if not exist "%GITBIN%" echo Couldn't find Gitbin at "%GITBIN%" and you should set like this "F:\Git\bin"& pause & exit 2 +if not exist "%ANDROID_HOME%" echo Couldn't find ANDROID_HOME at "%ANDROID_HOME%" and you should set like this "D:\Windows7\android-sdk-windows"& pause & exit 3 +if not exist "%ANDROID_NDK%" echo Couldn't find Cygwin at "%ANDROID_NDK%" and you should set like this "D:\Windows7\android-ndk-r8"& pause & exit 4 +if not exist "%JAVA_HOME%" echo Couldn't find Cygwin at "%JAVA_HOME%" and you should set like this "C:\Program Files\Java\jdk1.7.0_05"& pause & exit 5 set _PROJECTNAME=TestCpp cd ..\.. :project +::Copy build Configuration files to target directory copy %cd%\tools\JenkinsScript\ant.properties %cd%\samples\%_PROJECTNAME%\proj.android copy %cd%\tools\JenkinsScript\build.xml %cd%\samples\%_PROJECTNAME%\proj.android copy %cd%\tools\JenkinsScript\rootconfig.sh %cd%\samples\%_PROJECTNAME%\proj.android + +::Modify the configuration files cd samples\%_PROJECTNAME%\proj.android rootconfig.sh %_PROJECTNAME% cd .. @@ -75,6 +80,7 @@ move ant1.properties ant.properties for /f "delims=" %%a in (ant.properties) do set num=%%a&call :lis move ant1.properties ant.properties +::Calculate the errorlevel and change build target. cd ..\..\.. IF "%_PROJECTNAME%"=="TestCpp" set /a testresult1=(result14+result15) && set _PROJECTNAME=HelloCpp&& goto project IF "%_PROJECTNAME%"=="HelloCpp" set /a testresult2=(result14+result15) && set _PROJECTNAME=HelloLua&& goto project @@ -92,16 +98,16 @@ goto :eof :error echo Error. -git checkout -f|%GITBIN%\sh.exe --login -git clean -df|%GITBIN%\sh.exe --login +git checkout -f +git clean -df -x pause exit 1 goto end :success echo Success. -git checkout -f|%GITBIN%\sh.exe --login -git clean -df|%GITBIN%\sh.exe --login +git checkout -f +git clean -df -x pause exit 0 goto end diff --git a/tools/JenkinsScript/androidtest-release4.sh b/tools/JenkinsScript/androidtest-release4.sh new file mode 100644 index 0000000000..0f76071fb7 --- /dev/null +++ b/tools/JenkinsScript/androidtest-release4.sh @@ -0,0 +1,83 @@ +##This script is used to finish a android automated compiler. +#You should make sure have finished the environment setting. +#Here are the environment variables you should set. +#$COCOS2DX_ROOT $ANDROID_SDK_ROOT $ANDROID_NDK_ROOT $NDK_ROOT + +antcompile() +{ + #Change API level.(API level:14) + sed '/target=/s/=.*$/=android-14/' ant.properties > anttmp.properties + cp anttmp.properties ant.properties + rm anttmp.properties + ant release + compileresult=$[$compileresult+$?] + + #Change API level.(API level:15) + sed '/target=/s/=.*$/=android-15/' ant.properties > anttmp.properties + cp anttmp.properties ant.properties + rm anttmp.properties + ant release + compileresult=$[$compileresult+$?] + + #After all test versions completed,changed current API level to the original.(API level:8) + sed '/target=/s/=.*$/=android-8/' ant.properties > anttmp.properties + cp anttmp.properties ant.properties + rm anttmp.properties +} + +#record the relevant catalog +compileresult=0 +CUR=$(pwd) +cd ../.. +ROOT=$(pwd) + +#copy configuration files to target. +sed -i '' '14d' $CUR/ant.properties +gsed -i "14 i\\key.store=$ANDROID_HOME/debug.keystore" $CUR/ant.properties +cp $CUR/debug.keystore $ANDROID_HOME + +cp $CUR/ant.properties $ROOT/samples/TestCpp/proj.android +cp $CUR/build.xml $ROOT/samples/TestCpp/proj.android +cp $CUR/rootconfig-Mac.sh $ROOT/samples/TestCpp/proj.android +cd samples/TestCpp/proj.android +sh rootconfig-Mac.sh TestCpp +sh build_native.sh + +#update android project configuration files +cd .. +android update project -p proj.android +cd proj.android +antcompile + +cp $CUR/ant.properties $ROOT/samples/HelloCpp/proj.android +cp $CUR/build.xml $ROOT/samples/HelloCpp/proj.android +cp $CUR/rootconfig-Mac.sh $ROOT/samples/HelloCpp/proj.android +cd ../../HelloCpp/proj.android +sh rootconfig-Mac.sh HelloCpp +sh build_native.sh +cd .. +android update project -p proj.android +cd proj.android +antcompile + +cp $CUR/ant.properties $ROOT/samples/HelloLua/proj.android +cp $CUR/build.xml $ROOT/samples/HelloLua/proj.android +cp $CUR/rootconfig-Mac.sh $ROOT/samples/HelloLua/proj.android +cd ../../HelloLua/proj.android +sh rootconfig-Mac.sh HelloLua +sh build_native.sh +cd .. +android update project -p proj.android +cd proj.android +antcompile + +#return the compileresult. +cd ../../.. +if [ $compileresult != 0 ]; then + git checkout -f + git clean -df -x + exit 1 +else + git checkout -f + git clean -df -x +fi \ No newline at end of file diff --git a/tools/JenkinsScript/debug.keystore b/tools/JenkinsScript/debug.keystore new file mode 100644 index 0000000000..cfc159027a Binary files /dev/null and b/tools/JenkinsScript/debug.keystore differ diff --git a/tools/JenkinsScript/rootconfig-Mac.sh b/tools/JenkinsScript/rootconfig-Mac.sh new file mode 100644 index 0000000000..8b3863ac8e --- /dev/null +++ b/tools/JenkinsScript/rootconfig-Mac.sh @@ -0,0 +1,31 @@ +#!bin/bash +#get params for build_native.sh +CUR=$(pwd) +cd ../../.. +COCOS2DX=$(pwd) + +var1=NDK_ROOT_LOCAL= +_NDK_ROOT=${var1}${ANDROID_NDK} + +var2=COCOS2DX_ROOT_LOCAL= +_COCOS2DX_ROOT=${var2}${COCOS2DX} +echo $_NDK_ROOT +echo $_COCOS2DX_ROOT + +#Modify the configuration files +sed -i '' '3,4d' $CUR/build_native.sh +sed -i '' '13d' $CUR/project.properties +gsed -i "3 i\\$_NDK_ROOT" $CUR/build_native.sh +gsed -i "4 i\\$_COCOS2DX_ROOT" $CUR/build_native.sh + +#Modify the xml file +if [ $1 = TestCpp ]; then + gsed -i '2d' $CUR/build.xml + gsed -i '2 i\' $CUR/build.xml +elif [ $1 = HelloCpp ]; then + gsed -i '2d' $CUR/build.xml + gsed -i '2 i\' $CUR/build.xml +else + gsed -i '2d' $CUR/build.xml + gsed -i '2 i\' $CUR/build.xml +fi