Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

haskell-cabal-sandboxing #1698

Merged
merged 36 commits into from
Jan 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
e74cc62
haskell-cabal-sandboxing: use cabal sandboxes to avoid breaking the g…
e1528532 Nov 6, 2017
a2efb19
haskell-cabal-sandboxing: enable caching, reenable tests in travis
e1528532 Nov 11, 2017
f757e3a
haskell-cabal-sandboxing: fix travis file to not use $?
e1528532 Nov 11, 2017
a016f69
haskell-cabal-sandboxing: fix build due to caching change
e1528532 Nov 11, 2017
e97ef12
haskell-cabal-sandboxing: fix travis build
e1528532 Nov 11, 2017
0aad377
haskell-cabal-sandboxing: manage hspec and QuickCheck via sandbox bui…
e1528532 Nov 11, 2017
2e3c863
haskell-cabal-sandboxing: adjust cabal options for faster dependency …
e1528532 Nov 22, 2017
bb5f251
haskell-cabal-sandboxing: disable test parallelization again, seems t…
e1528532 Nov 22, 2017
5ced30d
haskell-cabal-sandboxing: reverse travis changes, add keyGetRelativeN…
e1528532 Nov 29, 2017
a445dad
haskell-cabal-sandboxing: the usual travis fix attempts
e1528532 Nov 29, 2017
2100651
haskell-cabal-sandboxing: add array function bindings for haskell to …
e1528532 Dec 12, 2017
aedfe1e
haskell-cabal-sandboxing: workaround the ghc ffi issue
e1528532 Dec 12, 2017
dd1692e
haskell-cabal-sandboxing: reformat, adjust travis plugins for haskell…
e1528532 Dec 14, 2017
5914663
haskell-cabal-sandboxing: format c file, add shared sandbox support t…
e1528532 Dec 14, 2017
360e5f8
haskell-cabal-sandboxing: fix linking issues by installing haskell dy…
e1528532 Dec 28, 2017
ff60bb7
haskell-cabal-sandboxing: unify and fix indendation in haskell files,…
e1528532 Dec 28, 2017
ffc8b86
haskell-cabal-sandboxing: fix another rpath issue, adjust travis config
e1528532 Dec 28, 2017
3386077
haskell-cabal-sandboxing: adjust travis file for after the rebase
e1528532 Dec 28, 2017
3268d6a
haskell-cabal-sandboxing: fix detection and installation issues on build
e1528532 Dec 29, 2017
5d71bae
haskell-cabal-sandboxing: fix minimum build, fix missing placements m…
e1528532 Dec 29, 2017
2d715e6
haskell-cabal-sandboxing: fix copy mistake
e1528532 Dec 29, 2017
5d876e2
haskell-cabal-sandboxing: improve travis build config
e1528532 Dec 29, 2017
9283729
haskell-cabal-sandboxing: rollback cmakelists ordering
e1528532 Dec 30, 2017
088cbee
haskell-cabal-sandboxing: add fileheaders for haskell files
e1528532 Dec 30, 2017
7e8d739
haskell-cabal-sandboxing: fix concurrency issues with sandboxes, fix …
e1528532 Jan 3, 2018
76986e4
haskell-cabal-sandboxing: add dini to the travis configuration
e1528532 Jan 11, 2018
e350192
haskell-cabal-sandboxing: adjust remove_binding which is now called d…
e1528532 Jan 11, 2018
bf9894d
haskell-cabal-sandboxing: revert travis change
e1528532 Jan 12, 2018
67ab46a
haskell-cabal-sandboxing: don't let the haskell plugin write to stdout
e1528532 Jan 12, 2018
1259c4d
haskell-cabal-sandboxing: supress cabal output by default
e1528532 Jan 12, 2018
a0cdac5
haskell-cabal-sandboxing: add release note
e1528532 Jan 12, 2018
0ff004f
haskell-cabal-sandboxing: add hosts plugin to minimal config
e1528532 Jan 15, 2018
c6a256d
haskell-cabal-sandboxing: fix potential build issue with glib
e1528532 Jan 16, 2018
5d2b8db
haskell-cabal-sandboxing: revert travis bindings change
e1528532 Jan 16, 2018
5bdb8d7
haskell-cabal-sandboxing: cleanup the realworld test traces to fix kd…
e1528532 Jan 18, 2018
c3f731e
haskell-cabal-sandboxing: exclude cpp bindings from haskell build (no…
e1528532 Jan 18, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 24 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
language: cpp

cache:
directories:
$HOME/.m2
$HOME/.cabal
$HOME/Library/Haskell
$TRAVIS_BUILD_DIR/../build/.cabal-sandbox

#
# Define the build matrix
#
Expand Down Expand Up @@ -30,20 +37,20 @@ matrix:
compiler: gcc
env: [ FULL=ON ]

# HASKELL: Only build Haskell binding and plugin

- os: osx
osx_image: xcode9.1
compiler: clang
env: [ HASKELL=ON ]
compiler: gcc

- os: osx
osx_image: xcode9.1
compiler: gcc
compiler: clang

# HASKELL: Only build Haskell binding and plugin

- os: osx
osx_image: xcode9.1
compiler: clang
env: [ HASKELL=ON ]

- os: linux
compiler: gcc
Expand Down Expand Up @@ -96,9 +103,12 @@ before_install:
if [[ "$TRAVIS_OS_NAME" == "osx" && "$HASKELL" == "ON" ]] ; then
brew install cabal-install
cabal update
cabal install happy alex
# avoid reinstalls if we already have them cached
# disable everything that slows down compilation times of the dependencies to have reasonable travis build times
PATH=$PATH:"$HOME/.cabal/bin"
cabal install QuickCheck hspec c2hs
which happy || cabal install happy
which alex || cabal install alex
which c2hs || cabal install c2hs
fi
- |
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
Expand All @@ -119,15 +129,19 @@ before_script:
- >
[[ "$TRAVIS_OS_NAME" == "linux" ]] && INSTALL_DIR="$PWD/install" || INSTALL_DIR="/usr/local"
- SYSTEM_DIR="$PWD/kdbsystem"
- mkdir build && cd build
# gets created due to sandbox caching automatically
- cd build
- >
[[ $ASAN == ON ]] && CMAKE_OPT=(-DENABLE_ASAN=ON) || CMAKE_OPT=()
- if [[ $FULL == ON ]]; then CMAKE_OPT+=(-DBUILD_FULL=ON); fi
- |
if [[ "$TRAVIS_OS_NAME" == "linux" && "$CC" == "clang" || "$TRAVIS_OS_NAME" == "osx" && "${CC:0:3}" == "gcc" ]]; then
CMAKE_OPT+=("-DCOMMON_FLAGS=-Werror")
fi
# use a minimal configuration for the haskell bindings to give it enough time to compile dependencies
- if [[ $HASKELL == ON ]]; then bindings="haskell"; fi
- if [[ $HASKELL == ON ]]; then plugins="resolver_fm_hpu_b;dump;ini;dini;sync;error;hosts;list;glob;profile;spec;network;tracer;timeofday;base64;haskell"; fi
- if [[ $HASKELL == ON ]]; then tools="kdb"; fi
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
python2_ver=$(python2 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))') && \
Expand All @@ -145,7 +159,7 @@ before_script:
-DPLUGINS="${plugins:-ALL;-jni}"
-DBINDINGS="${bindings}"
-DENABLE_DEBUG=ON
-DTOOLS=ALL
-DTOOLS="${tools:-ALL;}"
-DINSTALL_SYSTEM_FILES=OFF
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR"
Expand All @@ -162,9 +176,5 @@ script:
ninja run_all
else
ninja install
# Unfortunately the Haskell tests do not work currently:
# https://github.com/ElektraInitiative/libelektra/issues/1631
if [[ "$HASKELL" != "ON" ]]; then
ninja run_all && kdb run_all
fi
ninja run_all && kdb run_all
fi
54 changes: 43 additions & 11 deletions cmake/Modules/FindHaskell.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
# GHC-PKG_EXECUTABLE - Path to the ghc-pkg executable
# GHC_HSPEC_FOUND - True if the hspec library is available
# GHC_QUICKCHECK_FOUND - True if the QuickCheck library is available
# GHC_VERSION - The numeric version of the ghc executable
# CABAL_DYNLIB_PATH - The default path where cabal installs dynamic libraries
# CABAL_CUSTOM_TARGET - The default dependencies of the custom Setup.hs for plugins
# HASKELL_FOUND - True if the whole required haskell environment exists
# This variable is set to true if CABAL_EXECUTABLE, C2HS_EXECUTABLE, GHC_EXECUTABLE
# and GHC-PKG_EXECUTABLE are all available. If BUILD_TESTING is enabled, it also
Expand All @@ -25,7 +28,7 @@ if (CABAL_EXECUTABLE)
if (C2HS_EXECUTABLE)
if (GHC_EXECUTABLE)
if (GHC-PKG_EXECUTABLE)

# check for hspec and QuickCheck
# ghc-pkg return code is 0 on success, 1 otherwise
execute_process (
Expand Down Expand Up @@ -53,17 +56,43 @@ if (GHC-PKG_EXECUTABLE)
set (GHC_QUICKCHECK_FOUND 0)
endif (GHC_QUICKCHECK_FOUND EQUAL 0)

if (GHC_HSPEC_FOUND OR NOT BUILD_TESTING)
if (GHC_QUICKCHECK_FOUND OR NOT BUILD_TESTING)
# all set, have fun with haskell!
set (HASKELL_FOUND 1)
else (GHC_QUICKCHECK_FOUND OR NOT BUILD_TESTING)
set (HASKELL_NOTFOUND_INFO "QuickCheck library not found")
endif (GHC_QUICKCHECK_FOUND OR NOT BUILD_TESTING)
else (GHC_HSPEC_FOUND OR NOT BUILD_TESTING)
set (HASKELL_NOTFOUND_INFO "hspec library not found")
endif (GHC_HSPEC_FOUND OR NOT BUILD_TESTING)
execute_process (
COMMAND ${GHC_EXECUTABLE} --numeric-version
OUTPUT_VARIABLE GHC_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE
)

# find the default cabal installation path
# sort of hacky but i haven't found a uniform way of doing this
# first find the global cabal directory
execute_process (
COMMAND ${CABAL_EXECUTABLE} --ignore-sandbox help
COMMAND tail -n1
COMMAND xargs dirname
OUTPUT_VARIABLE CABAL_LOCATION OUTPUT_STRIP_TRAILING_WHITESPACE
)
# filter the library path matching our ghc version, ignoring architectures for now
execute_process (
COMMAND ls -F "${CABAL_LOCATION}/lib"
COMMAND grep ghc-${GHC_VERSION}
OUTPUT_VARIABLE GHC_DYNAMIC_LIBRARY_DIR OUTPUT_STRIP_TRAILING_WHITESPACE
)
set (CABAL_DYNLIB_PATH "${CABAL_LOCATION}/lib/${GHC_DYNAMIC_LIBRARY_DIR}")

# dependencies for the default cmake Setup.hs
set (CABAL_CUSTOM_SETUP
"custom-setup
setup-depends:
Cabal >= 1.24 && < 2.1,
containers >= 0.4 && < 0.6,
base >= 4.7 && < 5 ,
directory >= 1.1 && < 1.4,
process >= 1.2 && < 1.7,
filepath >= 1.3 && < 1.5")

# By using cabal sandboxes we can install hspec and QuickCheck to the sandbox without
# any concerns as they are independent from the global environment. So they are not required.
# All set, have fun with haskell!
set (HASKELL_FOUND 1)
else (GHC-PKG_EXECUTABLE)
set (HASKELL_NOTFOUND_INFO "ghc-pkg not found")
endif (GHC-PKG_EXECUTABLE)
Expand All @@ -84,6 +113,9 @@ mark_as_advanced (
GHC-PKG_EXECUTABLE
C2HS_EXECUTABLE
CABAL_EXECUTABLE
CABAL_DYNLIB_PATH
CABAL_CUSTOM_TARGET
GHC_VERSION
GHC_HSPEC_FOUND
GHC_QUICKCHECK_FOUND
)
Loading