<commit_before>#!/bin/bash
# exit this script if any commmand fails
set -e

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DRAGONBONES_ROOT="$DIR"/..
COCOS2DX_ROOT="$DRAGONBONES_ROOT"/engines/cocos2d-x-3.x

if [ -z "$NDK_ROOT" ]; then
    export NDK_ROOT=$HOME/bin/android-ndk
fi

if [ -z "$PYTHON_BIN" ]; then
    export PYTHON_BIN=/usr/bin/python
fi

if [ "$GEN_BINDING"x = "YES"x ]; then
    # Re-generation of the javascript bindings can perform push of the new
    # version back to github.  We don't do this for pull requests, or if
    # GH_USER/GH_EMAIL/GH_PASSWORD environment variables are not set correctly
    # by the encoded variables in the .travis.yml file.  (e.g. if cloned repo's
    # want to use travis).
    if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
        exit 0
    fi
    if [ -z "${GH_EMAIL}" ]; then
        echo "GH_EMAIL not set"
        exit 1
    fi
    if [ -z "${GH_USER}" ]; then
        echo "GH_USER not set"
        exit 1
    fi
    if [ -z "${GH_PASSWORD}" ]; then
        echo "GH_USER not set"
        exit 1
    fi

    cd $COCOS2DX_ROOT/tools/travis-scripts
    ./generate-bindings.sh
elif [ "$GEN_COCOS_FILES"x = "YES"x ]; then
    if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
        exit 0
    fi
    if [ -z "${GH_EMAIL}" ]; then
        echo "GH_EMAIL not set"
        exit 1
    fi
    if [ -z "${GH_USER}" ]; then
        echo "GH_USER not set"
        exit 1
    fi
    if [ -z "${GH_PASSWORD}" ]; then
        echo "GH_USER not set"
        exit 1
    fi

    cd $COCOS2DX_ROOT/tools/travis-scripts
    ./generate-cocosfiles.sh
elif [ "$PLATFORM"x = "android"x ]; then
    export NDK_ROOT=$HOME/bin/android-ndk

    cd $DRAGONBONES_ROOT/demos/cocos2d-x-$C2DX_VER/proj.android
    chmod +x build_native.py
    ./build_native.py -n "NDK_DEBUG=0 -j2"

    # Generate binding glue codes
    # echo "Generating bindings glue codes ..."
    # cd $COCOS2DX_ROOT/tools/travis-scripts
    # ./generate-bindings.sh
    # ./generate-cocosfiles.sh

    # cd $COCOS2DX_ROOT

    # # Create a directory for temporary objects
    # mkdir android_build_objs

    # PROJECTS=("cpp-empty-test" "cpp-tests" "lua-empty-test/project" "lua-tests/project")
    # for i in ${PROJECTS[*]}; do
    #     ln -s $COCOS2DX_ROOT/android_build_objs $COCOS2DX_ROOT/tests/$i/proj.android/obj
    # done

    # # Build all samples
    # echo "Building all samples ..."
    # cd $COCOS2DX_ROOT/build
    # ./android-build.py -n "NDK_BUG=0 -j10" all

elif [ "$PLATFORM"x = "nacl"x ]; then
    export NACL_SDK_ROOT=$HOME/bin/nacl_sdk/pepper_canary
    export PATH=$PATH:$NACL_SDK_ROOT/toolchain/linux_x86_newlib/bin
    export PATH=$PATH:$NACL_SDK_ROOT/toolchain/linux_arm_newlib/bin
    cd $COCOS2DX_ROOT/build
    make -j2
elif [ "$PLATFORM"x = "linux"x ]; then
    # Generate binding glue codes
    # echo "Generating bindings glue codes ..."
    # change cmakelists.txt
    # awk '{if(NR>=157&&NR<=159)printf "#"}1' $COCOS2DX_ROOT/CMakeLists.txt > CMakeLists1.txt
    # mv -f CMakeLists1.txt $COCOS2DX_ROOT/CMakeLists.txt

    if [[ -f "$DRAGONBONES_ROOT/demos/cocos2d-x-$C2DX_VER/FindGLEW.cmake" ]]; then
        mv "$DRAGONBONES_ROOT/demos/cocos2d-x-$C2DX_VER/FindGLEW.cmake" "$COCOS2DX_ROOT/cmake/Modules/FindGLEW.cmake"
    fi
    
    cd $COCOS2DX_ROOT/tools/travis-scripts
    # ./generate-bindings.sh
    # ./generate-cocosfiles.sh

    echo "Building cocos2d-x"
    cd $DRAGONBONES_ROOT/demos/cocos2d-x-$C2DX_VER
    # cd $COCOS2DX_ROOT/build
    mkdir -p linux-build
    cd linux-build
    cmake ..
    make -j10

elif [ "$PLATFORM"x = "emscripten"x ]; then
    # Generate binding glue codes
    echo "Generating bindings glue codes ..."
    cd $COCOS2DX_ROOT/tools/travis-scripts
    ./generate-bindings.sh
    ./generate-cocosfiles.sh<commit_msg>update job num for linux<commit_after>#!/bin/bash
# exit this script if any commmand fails
set -e

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DRAGONBONES_ROOT="$DIR"/..
COCOS2DX_ROOT="$DRAGONBONES_ROOT"/engines/cocos2d-x-3.x

if [ -z "$NDK_ROOT" ]; then
    export NDK_ROOT=$HOME/bin/android-ndk
fi

if [ -z "$PYTHON_BIN" ]; then
    export PYTHON_BIN=/usr/bin/python
fi

if [ "$GEN_BINDING"x = "YES"x ]; then
    # Re-generation of the javascript bindings can perform push of the new
    # version back to github.  We don't do this for pull requests, or if
    # GH_USER/GH_EMAIL/GH_PASSWORD environment variables are not set correctly
    # by the encoded variables in the .travis.yml file.  (e.g. if cloned repo's
    # want to use travis).
    if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
        exit 0
    fi
    if [ -z "${GH_EMAIL}" ]; then
        echo "GH_EMAIL not set"
        exit 1
    fi
    if [ -z "${GH_USER}" ]; then
        echo "GH_USER not set"
        exit 1
    fi
    if [ -z "${GH_PASSWORD}" ]; then
        echo "GH_USER not set"
        exit 1
    fi

    cd $COCOS2DX_ROOT/tools/travis-scripts
    ./generate-bindings.sh
elif [ "$GEN_COCOS_FILES"x = "YES"x ]; then
    if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
        exit 0
    fi
    if [ -z "${GH_EMAIL}" ]; then
        echo "GH_EMAIL not set"
        exit 1
    fi
    if [ -z "${GH_USER}" ]; then
        echo "GH_USER not set"
        exit 1
    fi
    if [ -z "${GH_PASSWORD}" ]; then
        echo "GH_USER not set"
        exit 1
    fi

    cd $COCOS2DX_ROOT/tools/travis-scripts
    ./generate-cocosfiles.sh
elif [ "$PLATFORM"x = "android"x ]; then
    export NDK_ROOT=$HOME/bin/android-ndk

    cd $DRAGONBONES_ROOT/demos/cocos2d-x-$C2DX_VER/proj.android
    chmod +x build_native.py
    ./build_native.py -n "NDK_DEBUG=0 -j2"

    # Generate binding glue codes
    # echo "Generating bindings glue codes ..."
    # cd $COCOS2DX_ROOT/tools/travis-scripts
    # ./generate-bindings.sh
    # ./generate-cocosfiles.sh

    # cd $COCOS2DX_ROOT

    # # Create a directory for temporary objects
    # mkdir android_build_objs

    # PROJECTS=("cpp-empty-test" "cpp-tests" "lua-empty-test/project" "lua-tests/project")
    # for i in ${PROJECTS[*]}; do
    #     ln -s $COCOS2DX_ROOT/android_build_objs $COCOS2DX_ROOT/tests/$i/proj.android/obj
    # done

    # # Build all samples
    # echo "Building all samples ..."
    # cd $COCOS2DX_ROOT/build
    # ./android-build.py -n "NDK_BUG=0 -j10" all

elif [ "$PLATFORM"x = "nacl"x ]; then
    export NACL_SDK_ROOT=$HOME/bin/nacl_sdk/pepper_canary
    export PATH=$PATH:$NACL_SDK_ROOT/toolchain/linux_x86_newlib/bin
    export PATH=$PATH:$NACL_SDK_ROOT/toolchain/linux_arm_newlib/bin
    cd $COCOS2DX_ROOT/build
    make -j2
elif [ "$PLATFORM"x = "linux"x ]; then
    # Generate binding glue codes
    # echo "Generating bindings glue codes ..."
    # change cmakelists.txt
    # awk '{if(NR>=157&&NR<=159)printf "#"}1' $COCOS2DX_ROOT/CMakeLists.txt > CMakeLists1.txt
    # mv -f CMakeLists1.txt $COCOS2DX_ROOT/CMakeLists.txt

    if [[ -f "$DRAGONBONES_ROOT/demos/cocos2d-x-$C2DX_VER/FindGLEW.cmake" ]]; then
        mv "$DRAGONBONES_ROOT/demos/cocos2d-x-$C2DX_VER/FindGLEW.cmake" "$COCOS2DX_ROOT/cmake/Modules/FindGLEW.cmake"
    fi
    
    cd $COCOS2DX_ROOT/tools/travis-scripts
    # ./generate-bindings.sh
    # ./generate-cocosfiles.sh

    echo "Building cocos2d-x"
    cd $DRAGONBONES_ROOT/demos/cocos2d-x-$C2DX_VER
    # cd $COCOS2DX_ROOT/build
    mkdir -p linux-build
    cd linux-build
    cmake ..
    make -j2

elif [ "$PLATFORM"x = "emscripten"x ]; then
    # Generate binding glue codes
    echo "Generating bindings glue codes ..."
    cd $COCOS2DX_ROOT/tools/travis-scripts
    ./generate-bindings.sh
    ./generate-cocosfiles.sh
{'fraction_non_alphanumeric': 0.13062944429813012, 'fraction_numerical': 0.014090071108770082, 'mean_word_length': 2.6922702965483714, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1854260', 'n_tokens_mistral': 3141, 'n_tokens_neox': 2890, 'n_words': 643}