| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | #Helper script to be called from build_both_dylib_and_dylib.sh |
| 4 | # |
| 5 | #checkout and clone a new copy of gatk in a tmpdir |
| 6 | #build the .so file and return its location |
| 7 | #this can only be run on broad machines |
| 8 | # |
| 9 | # usage build_native_lib_in_clean_repo.sh <commit hash> <git-project> <library name> <path to lib> |
| 10 | |
| 11 | set -v |
| 12 | |
| 13 | COMMIT=$1 |
| 14 | PROJECT=$2 |
| 15 | LIB_NAME=$3 |
| 16 | LIB_PATH=$4 |
| 17 | |
| 18 | |
| 19 | source /broad/tools/scripts/useuse |
| 20 | reuse Git-2.11 |
| 21 | |
| 22 | set -e |
| 23 | |
| 24 | export TMPDIR="/broad/hptmp" |
| 25 | |
| 26 | echoerr() { echo "$@" 1>&2; } |
| 27 | |
| 28 | PROJECT_TMP_DIR=`mktemp --tmpdir -d 2>/dev/null || mktemp -d -t 'mytmpdir'` |
| 29 | |
| 30 | echoerr "Moving to $PROJECT_TMP_DIR" |
| 31 | cd "$PROJECT_TMP_DIR" |
| 32 | |
| 33 | echoerr "cloning broadinstitute/${PROJECT}" |
| 34 | GIT_LFS_SKIP_SMUDGE=1 git clone [email protected]:broadinstitute/${PROJECT}.git 1>2 |
| 35 | |
| 36 | echoerr "Moving to $PROJECT" |
| 37 | cd $PROJECT |
| 38 | |
| 39 | echoerr "Checking out ${commit}" |
| 40 | GIT_LFS_SKIP_SMUDGE=1 git checkout -f "$COMMIT" 1>2 |
| 41 | |
| 42 | echoerr "performing gradle build" |
| 43 | ./gradlew build 1>2 --no-daemon |
| 44 | |
| 45 | LIB=$(pwd)/$(find $LIB_PATH -name "${LIB_NAME}*" ! -name "*.a" ) |
| 46 | echoerr "created $LIB" |
| 47 | |
| 48 | echo $LIB |
| 49 | exit 0 |