Repository: realm/realm-swift
File: build.sh (Shell)

Code before:
	sed -i '' -e "s/TDB_VERSION_PATCH .*$/TDB_VERSION_PATCH $realm_ver_patch/" $version_file || exit 1
	exit 0
	;;

    "clean")
        auto_configure || exit 1
        $MAKE clean || exit 1
        if [ "$OS" = "Darwin" ]; then
            for x in $IPHONE_PLATFORMS; do
                $MAKE BASE_DENOM="$x" clean || exit 1
            done
            $MAKE BASE_DENOM="ios" clean || exit 1
            if [ -e "$IPHONE_DIR" ]; then
                echo "Removing '$IPHONE_DIR'"
                rm -fr "$IPHONE_DIR/include" || exit 1
                rm -f "$IPHONE_DIR/librealm-objc-ios.a" "$IPHONE_DIR/librealm-objc-ios-dbg.a" || exit 1
                rmdir "$IPHONE_DIR" || exit 1
            fi
        fi
        echo "Done cleaning"
        exit 0
        ;;

    "ci-clean")
        git reset --hard HEAD
        git clean -xfd
        (
            cd ../tightdb
            git reset --hard HEAD
            git clean -xfd
        )
        exit 0
        ;;

    "ci-test")
        mkdir -p test-reports
        (
            cd ../tightdb
            mkdir -p install
            sh build.sh config $(pwd)/install
            sh build.sh build-iphone
            sh build.sh build
            sh build.sh install
        )
        export REALM_CONFIG=../tightdb/install/bin/tightdb-config
        sh build.sh config
        sh build.sh build
        sh build.sh build-iphone
        sh build.sh ios-framework
        sh build.sh test-debug
        (

Review comment (suggestion):
Checked out? what do you mean? There always is a checked out branch.

Anyway ci-test is only meant to be done by Jenkins because the changes it makes are irreversible. I will make sure this feature is not documented and if somebody finds out about it in by reading the code it should state in clear letters what it does.


Code after:
	sed -i '' -e "s/TDB_VERSION_PATCH .*$/TDB_VERSION_PATCH $realm_ver_patch/" $version_file || exit 1
	exit 0
	;;

    "clean")
        auto_configure || exit 1
        $MAKE clean || exit 1
        if [ "$OS" = "Darwin" ]; then
            for x in $IPHONE_PLATFORMS; do
                $MAKE BASE_DENOM="$x" clean || exit 1
            done
            $MAKE BASE_DENOM="ios" clean || exit 1
            if [ -e "$IPHONE_DIR" ]; then
                echo "Removing '$IPHONE_DIR'"
                rm -fr "$IPHONE_DIR/include" || exit 1
                rm -f "$IPHONE_DIR/librealm-objc-ios.a" "$IPHONE_DIR/librealm-objc-ios-dbg.a" || exit 1
                rmdir "$IPHONE_DIR" || exit 1
            fi
        fi
        echo "Done cleaning"
        exit 0
        ;;

    "ci-clean")
        # DO NOT USE THIS TARGET! IT WILL RESET YOUR WORKAREA IN A NON REVERSIBLE WAY!
        git reset --hard HEAD
        git clean -xfd
        (
            cd ../tightdb
            git reset --hard HEAD
            git clean -xfd
        )
        exit 0
        ;;

    "ci-test")
        if [ "$(id -u)" != "0" ]; then
           echo "This target must be run as root or with sudo" 1>&2
           exit 1
        fi
        mkdir -p test-reports || exit 1
        (
            cd ../tightdb
            mkdir -p install
            sh build.sh config $(pwd)/install
            sh build.sh build-iphone
            sh build.sh build
            sh build.sh install
        ) || exit 1
        (
            export REALM_CONFIG=../tightdb/install/bin/tightdb-config