Skip to content

Commit

Permalink
Unified Travis scripts with installation script
Browse files Browse the repository at this point in the history
  • Loading branch information
mbudiu-vmw authored and ryzhyk committed Aug 23, 2019
1 parent e07635d commit e069414
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 48 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Expand Up @@ -59,8 +59,8 @@ before_install:
# Download and unpack the stack executable
- mkdir -p ~/.local/bin
- export PATH=$HOME/.local/bin:$PATH
- ./.travis/install-stack.sh
- ./.travis/install-flatbuf.sh
- ./tools/install-stack.sh
- ./tools/install-flatbuf.sh
- export CLASSPATH=$CLASSPATH:$HOME/flatbuffers/java
# Travis does not set JAVA_HOME on MacOS
- if [ `uname -s` = Darwin ]; then export JAVA_HOME=`/usr/libexec/java_home`; fi
Expand Down Expand Up @@ -99,7 +99,7 @@ before_deploy:
- if [ `uname -s` = Darwin ]; then ghead -n -1 config.tmp > config; else head -n -1 config.tmp > config; fi
- echo "directory = \"vendor\"" >> config
- cp -r vendor "../../$DIST_DIR/"
- mkdir "../../$DIST_DIR/.cargo"
- mkdir "../../$DIST_DIR/.cargo"
- cp config "../../$DIST_DIR/.cargo/"
- cp Cargo.lock "../../$DIST_DIR/"
- cd ../../
Expand Down
21 changes: 0 additions & 21 deletions .travis/install-ghr.sh

This file was deleted.

5 changes: 4 additions & 1 deletion README.md
Expand Up @@ -67,7 +67,10 @@ Datalog 2.0, Philadelphia, PA, June 4-5, 2019.

## Installing from sources

To install the required dependencies for buidling DDlog run `. ./install-dependencies.sh`
To install the required dependencies for buidling DDlog run
`. ./install-dependencies.sh` (If you want to use other versions of
the Rust or Haskell tools you can manually install the required
dependencies, as described below.)

### Prerequisites

Expand Down
14 changes: 4 additions & 10 deletions install-dependencies.sh
Expand Up @@ -6,26 +6,20 @@ echo "This script should be invoked with '. ./install-dependencies.sh' to set up

case "$OSTYPE" in
linux*) ;;
osx*) ;;
*) echo "Unhandled operating system $OSTYPE"; exit 1;;
esac


echo "Installing Haskell"
curl -sSL https://get.haskellstack.org/ | sh
./tools/install-stack.sh

echo "Installing Rust"
curl https://sh.rustup.rs -sSf | sh -s - -y
export PATH=$HOME/.cargo/bin:$PATH

echo "Installing Flatbuf"
if [ ! -d flatbuffers-1.11.0 ]; then
wget https://github.com/google/flatbuffers/archive/v1.11.0.tar.gz
tar xvfz v1.11.0.tar.gz
rm -rf v1.11.0.tar.gz
fi
pushd flatbuffers-1.11.0
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
make -j3
./tools/install-flatbuf.sh
pushd flatbuffers
export CLASSPATH=`pwd`"/java":$CLASSPATH
export PATH=`pwd`:$PATH
popd
2 changes: 1 addition & 1 deletion test/Spec.hs
Expand Up @@ -193,7 +193,7 @@ compilerTest progress java file cli_args crate_types = do
compile prog specname rs_code toml_code dir crate_types
-- compile generated Java code
classpath <- (maybe "" (":" ++ )) <$> lookupEnv "CLASSPATH"
path <- (maybe "" (":" ++ )) <$> lookupEnv "PATH"
path <- (maybe "" id) <$> lookupEnv "PATH"
let javac_proc = (shell $ "javac ddlog" </> specname </> "*.java") {
cwd = Just $ dir </> rustProjectDir specname </> "flatbuf" </> "java",
env = Just [("CLASSPATH", (dir </> "../../java") ++ classpath),
Expand Down
11 changes: 6 additions & 5 deletions .travis/install-flatbuf.sh → tools/install-flatbuf.sh
Expand Up @@ -2,25 +2,26 @@

set -ex

travis_retry() {
retry() {
cmd=$*
$cmd || (sleep 2 && $cmd) || (sleep 10 && $cmd)
}

fetch_flatbuf() {
rm -rf flatbuffers
mkdir flatbuffers
curl -L https://github.com/google/flatbuffers/archive/v1.11.0.tar.gz | tar -zx -C flatbuffers --strip-components 1;
#git clone https://github.com/google/flatbuffers.git
curl -L https://github.com/google/flatbuffers/archive/v1.11.0.tar.gz | tar -zx -C flatbuffers --strip-components 1
}

cd $HOME

if [ "x`flatbuffers/flatc --version`" != "xflatc version 1.11.0" ]; then
travis_retry fetch_flatbuf
echo "Installing Flatbuf"
retry fetch_flatbuf
cd flatbuffers
cmake -G "Unix Makefiles"
make
cd ..
fi

ln -f -s $HOME/flatbuffers/flatc ~/.local/bin/flatc
ln -f -s ./flatbuffers/flatc ~/.local/bin/flatc
14 changes: 7 additions & 7 deletions .travis/install-stack.sh → tools/install-stack.sh
Expand Up @@ -4,26 +4,26 @@

set -eux

travis_retry() {
retry() {
cmd=$*
$cmd || (sleep 2 && $cmd) || (sleep 10 && $cmd)
}

fetch_stack_osx() {
curl -skL https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin;
curl -skL https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin
}

fetch_stack_linux() {
curl -sL https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack';
curl -sL https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
}

# We need stack to generate cabal files with precise bounds, even for cabal
# builds.
mkdir -p ~/.local/bin;
mkdir -p ~/.local/bin
if [ "$(uname)" = "Darwin" ]; then
travis_retry fetch_stack_osx
retry fetch_stack_osx
else
travis_retry fetch_stack_linux
retry fetch_stack_linux
fi

travis_retry stack --no-terminal setup;
retry stack --no-terminal setup

0 comments on commit e069414

Please sign in to comment.