aboutsummaryrefslogtreecommitdiffstats
path: root/build.sh
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2018-03-07 12:09:56 +0000
committerYann Herklotz <ymherklotz@gmail.com>2018-03-07 12:09:56 +0000
commit8d4cceac61bcce8722dbd144ecda32ea19057e5b (patch)
treea0afa85d41ffc3fce18997bb9b15a66431b4615d /build.sh
parentf9d4f3b8dee743cfc106565b9da05b2d031fdb02 (diff)
downloadFMark-8d4cceac61bcce8722dbd144ecda32ea19057e5b.tar.gz
FMark-8d4cceac61bcce8722dbd144ecda32ea19057e5b.zip
Added better build
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh68
1 files changed, 49 insertions, 19 deletions
diff --git a/build.sh b/build.sh
index 6cb97b3..efa4fd2 100755
--- a/build.sh
+++ b/build.sh
@@ -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