testing/taskcluster/scripts/builder/build-haz-linux.sh
author Steve Fink <sfink@mozilla.com>
Thu, 05 May 2016 16:47:08 -0700
changeset 296693 d55e3bc94309324a4d946b15a965c435b9bd051f
parent 296573 testing/taskcluster/scripts/builder/build-browser-haz-linux.sh@748b70bcdbc95a4f3e72ca53a23c8f766049d011
permissions -rwxr-xr-x
Bug 1267876 - Make usable on developer desktops, r=jorendorff MozReview-Commit-ID: K6kMX8WD15g

#!/bin/bash -ex

PROJECT=shell
if [[ "$1" == "--project" ]]; then
    shift
    PROJECT="$1"
    shift
fi

# Ensure all the scripts in this dir are on the path....
DIRNAME=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
PATH=$DIRNAME:$PATH

WORKSPACE=$( cd "$1" && pwd )
shift

SCRIPT_FLAGS="$*"

# Use GECKO_BASE_REPOSITORY as a signal for whether we are running in automation.
export AUTOMATION=${GECKO_BASE_REPOSITORY:+1}

: ${GECKO_DIR:=$WORKSPACE/gecko}
: ${TOOLTOOL_MANIFEST:=browser/config/tooltool-manifests/linux64/hazard.manifest}
: ${TOOLTOOL_CACHE:=$WORKSPACE/tt-cache}
: ${TOOLTOOL_REPO:=https://git.mozilla.org/build/tooltool.git}

if ! [ -d $GECKO_DIR ]; then
    echo "GECKO_DIR must be set to a directory containing a gecko source checkout" >&2
    exit 1
fi
GECKO_DIR=$( cd "$GECKO_DIR" && pwd )

# Directory to populate with tooltool-installed tools
export TOOLTOOL_DIR="$WORKSPACE"

# Directory to hold the (useless) object files generated by the analysis.
export MOZ_OBJDIR="$WORKSPACE/obj-analyzed"
mkdir -p "$MOZ_OBJDIR"

tc-vcs checkout --force-clone $WORKSPACE/tooltool $TOOLTOOL_REPO $TOOLTOOL_REPO $TOOLTOOL_REV
( cd $TOOLTOOL_DIR; python $WORKSPACE/tooltool/tooltool.py --url https://api.pub.build.mozilla.org/tooltool/ -m $GECKO_DIR/$TOOLTOOL_MANIFEST fetch -c $TOOLTOOL_CACHE )

if [[ "$PROJECT" = "browser" ]]; then (
    cd "$WORKSPACE"
    . setup-ccache.sh
    # Mozbuild config:
    export MOZBUILD_STATE_PATH=$WORKSPACE/mozbuild/
    # Create .mozbuild so mach doesn't complain about this
    mkdir -p $MOZBUILD_STATE_PATH
) fi
. hazard-analysis.sh

build_js_shell

# Artifacts folder is outside of the cache.
mkdir -p $HOME/artifacts/ || true

function onexit () {
    grab_artifacts "$WORKSPACE/analysis" "$HOME/artifacts"
}

trap onexit EXIT

configure_analysis "$WORKSPACE/analysis"
run_analysis "$WORKSPACE/analysis" "$PROJECT"

check_hazards "$WORKSPACE/analysis"

################################### script end ###################################