diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2018-03-07 12:09:56 +0000 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2018-03-07 12:09:56 +0000 |
commit | 8d4cceac61bcce8722dbd144ecda32ea19057e5b (patch) | |
tree | a0afa85d41ffc3fce18997bb9b15a66431b4615d /build.sh | |
parent | f9d4f3b8dee743cfc106565b9da05b2d031fdb02 (diff) | |
download | FMark-8d4cceac61bcce8722dbd144ecda32ea19057e5b.tar.gz FMark-8d4cceac61bcce8722dbd144ecda32ea19057e5b.zip |
Added better build
Diffstat (limited to 'build.sh')
-rwxr-xr-x | build.sh | 68 |
1 files changed, 49 insertions, 19 deletions
@@ -1,11 +1,50 @@ #!/usr/bin/env bash +# Exit with error when any error occurs set -e -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +function print_help { + echo "This is a build script for FMark" + echo "" + echo "USAGE:" + echo " ./build.sh [OPTIONS]" + echo "" + echo "OPTIONS:" + echo " -b/--build Build a specific project, can be set to" + echo " fsharp, js, all" + exit 1 +} + +POSITIONAL=() +while [[ $# -gt 0 ]] +do +key="$1" + +case $key in + -b|--build) + BUILD="$2" + shift # past argument + shift # past value + ;; + *) + print_help + ;; +esac +done + +if [[ -z $BUILD ]]; then + BUILD=fsharp +fi + +if [[ $BUILD != "fsharp" ]] && [[ $BUILD != "js" ]] && [[ $BUILD != "all" ]]; then + print_help +fi -PREFIX=$DIR -PATH=$PREFIX/bin:$PATH +echo "build set to: $BUILD" +echo "" + +# get the current directory of the script, which is at the base of the project +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" if [[ -z $TRAVIS_BUILD_DIR ]]; then echo "Travis not detected" @@ -13,25 +52,16 @@ if [[ -z $TRAVIS_BUILD_DIR ]]; then else echo "Running on travis-ci" BASE_DIR=$TRAVIS_BUILD_DIR - # echo "Compiling mono from source" - # git clone -b mono-5.13.0.308 https://github.com/mono/mono.git - # cd mono - # ./autogen.sh --prefix=$PREFIX >/dev/null - # make >/dev/null - # make install >/dev/null - # mono --version fi -# echo "Downloading paket.exe directly" -# curl https://github.com/fsprojects/Paket/releases/download/5.148.0/paket.exe -o $BASE_DIR/FMark/.paket/paket.exe - -echo "Running F# tests" -cd $BASE_DIR/FMark/src/FMarkCLI - -dotnet build -dotnet run --no-build -- --test +if [[ $BUILD = "all" ]] || [[ $BUILD = "fsharp" ]]; then + echo "Running F# tests" + cd $BASE_DIR/FMark/src/FMarkCLI + dotnet build + dotnet run --no-build -- --test +fi -if [[ -z $TRAVIS_BUILD_DIR ]]; then +if [[ $BUILD = "all" ]] || [[ $BUILD = "js" ]]; then echo "Running javascript build" cd $BASE_DIR/FMark/src/FMarkFable dotnet restore |