Skip to content

Commit 0d7d413

Browse files
authored
Merge pull request #69 from phadej/ghc-8.2
Support GHC-8.2
2 parents a3af57f + 81162ed commit 0d7d413

File tree

7 files changed

+85
-229
lines changed

7 files changed

+85
-229
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
.DS_Store
33
*.nix
44
dist/
5+
dist-newstyle/
6+
.ghc.environment.*
57
/foo.json
68
servant-client-0.4.4/
79
cabal-dev

.travis.yml

Lines changed: 24 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This Travis job script has been generated by a script via
22
#
3-
# make_travis_yml_2.hs 'servant-swagger.cabal'
3+
# make_travis_yml_2.hs '--branch' 'master' 'servant-swagger.cabal'
44
#
55
# For more information, see https://github.com/hvr/multi-ghc-travis
66
#
@@ -10,10 +10,15 @@ sudo: false
1010
git:
1111
submodules: false # whether to recursively clone submodules
1212

13+
branches:
14+
only:
15+
- master
16+
1317
cache:
1418
directories:
1519
- $HOME/.cabal/packages
1620
- $HOME/.cabal/store
21+
- $HOME/.local/bin
1722

1823
before_cache:
1924
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
@@ -27,19 +32,22 @@ before_cache:
2732
matrix:
2833
include:
2934
- compiler: "ghc-7.8.4"
30-
# env: TEST=--disable-tests BENCH=--disable-benchmarks
35+
# env: TEST=--disable-tests BENCH=--disable-benchmarks
3136
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.8.4], sources: [hvr-ghc]}}
3237
- compiler: "ghc-7.10.3"
33-
# env: TEST=--disable-tests BENCH=--disable-benchmarks
38+
# env: TEST=--disable-tests BENCH=--disable-benchmarks
3439
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.10.3], sources: [hvr-ghc]}}
3540
- compiler: "ghc-8.0.2"
36-
# env: TEST=--disable-tests BENCH=--disable-benchmarks
41+
# env: TEST=--disable-tests BENCH=--disable-benchmarks
3742
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.0.2], sources: [hvr-ghc]}}
43+
- compiler: "ghc-8.2.1"
44+
# env: TEST=--disable-tests BENCH=--disable-benchmarks
45+
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.2.1], sources: [hvr-ghc]}}
3846

3947
before_install:
4048
- HC=${CC}
4149
- unset CC
42-
- PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$PATH
50+
- PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/.local/bin:$PATH
4351
- PKGNAME='servant-swagger'
4452

4553
install:
@@ -49,23 +57,18 @@ install:
4957
- TEST=${TEST---enable-tests}
5058
- travis_retry cabal update -v
5159
- sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
52-
# Install hspec-discover manually, before hackage accepts build-tool-depends
53-
- mkdir -p $HOME/.local/bin
54-
- export PATH=$HOME/.local/bin/:$PATH
55-
- cabal get hspec-discover
56-
- "cd hspec-discover-*; cabal new-build hspec-discover:exe:hspec-discover; cp $(find dist-newstyle -type f -name hspec-discover) $HOME/.local/bin; cd .."
57-
60+
- sh install-hspec-discover.sh # TEMP: we should use build-tools-depends
5861
- rm -fv cabal.project.local
5962
- "echo 'packages: .' > cabal.project"
6063
- rm -f cabal.project.freeze
61-
- cabal new-build -w ${HC} ${TEST} ${BENCH} --dep -j2
62-
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks --dep -j2
64+
- cabal new-build -w ${HC} ${TEST} ${BENCH} --dep -j2 all
65+
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks --dep -j2 all
6366

6467
# Here starts the actual work to be performed for the package under test;
6568
# any command which exits with a non-zero exit code causes the build to fail.
6669
script:
6770
- if [ -f configure.ac ]; then autoreconf -i; fi
68-
- rm -rf dist/ .ghc.environment.*
71+
- rm -rf .ghc.environment.* dist/
6972
- cabal sdist # test that a source-distribution can be generated
7073
- cd dist/
7174
- SRCTAR=(${PKGNAME}-*.tar.gz)
@@ -77,27 +80,15 @@ script:
7780
- "echo 'packages: .' > cabal.project"
7881
# this builds all libraries and executables (without tests/benchmarks)
7982
- rm -f cabal.project.freeze
80-
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks
81-
82-
# Build with various constraints
83-
- if [ $HC = "ghc-8.0.2" ]; then UNLESSGHC802=true; fi
84-
- $UNLESSGHC802 cabal new-build -w ${HC} --disable-tests --disable-benchmarks "--constraint=servant==0.5.*"
85-
- $UNLESSGHC802 cabal new-build -w ${HC} --disable-tests --disable-benchmarks "--constraint=servant==0.6.*"
86-
- $UNLESSGHC802 cabal new-build -w ${HC} --disable-tests --disable-benchmarks "--constraint=servant==0.7.*"
87-
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks "--constraint=servant==0.8.*"
88-
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks "--constraint=servant==0.9.*"
89-
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks "--constraint=servant==0.10.*"
90-
83+
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
9184
# this builds all libraries and executables (including tests/benchmarks)
9285
# - rm -rf ./dist-newstyle
93-
- cabal new-build -w ${HC} ${TEST} ${BENCH}
9486

95-
# there's no 'cabal new-test' yet, so let's emulate for now
96-
- TESTS=( $(awk 'tolower($0) ~ /^test-suite / { print $2 }' *.cabal) )
97-
- if [ "$TEST" != "--enable-tests" ]; then TESTS=(); fi
98-
- shopt -s globstar;
99-
RC=true; for T in ${TESTS[@]}; do echo "== $T ==";
100-
if dist-newstyle/build/**/$SRC_BASENAME/**/build/$T/$T; then echo "= $T OK =";
101-
else echo "= $T FAILED ="; RC=false; fi; done; $RC
87+
# build & run tests, build benchmarks
88+
- cabal new-build -w ${HC} ${TEST} ${BENCH} all
89+
- if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} all; fi
90+
91+
# haddock
92+
- cabal new-haddock -w ${HC} --disable-tests --disable-benchmarks all
10293

10394
# EOF

Setup.hs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{-# LANGUAGE CPP #-}
2+
{-# OPTIONS_GHC -Wall #-}
3+
module Main (main) where
4+
5+
#ifndef MIN_VERSION_cabal_doctest
6+
#define MIN_VERSION_cabal_doctest(x,y,z) 0
7+
#endif
8+
9+
#if MIN_VERSION_cabal_doctest(1,0,0)
10+
11+
import Distribution.Extra.Doctest ( defaultMainWithDoctests )
12+
main :: IO ()
13+
main = defaultMainWithDoctests "doctests"
14+
15+
#else
16+
17+
#ifdef MIN_VERSION_Cabal
18+
-- If the macro is defined, we have new cabal-install,
19+
-- but for some reason we don't have cabal-doctest in package-db
20+
--
21+
-- Probably we are running cabal sdist, when otherwise using new-build
22+
-- workflow
23+
#warning You are configuring this package without cabal-doctest installed. \
24+
The doctests test-suite will not work as a result. \
25+
To fix this, install cabal-doctest before configuring.
26+
#endif
27+
28+
import Distribution.Simple
29+
30+
main :: IO ()
31+
main = defaultMain
32+
33+
#endif

Setup.lhs

Lines changed: 0 additions & 178 deletions
This file was deleted.

install-hspec-discover.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
3+
set -ex
4+
5+
if [ ! -e $HOME/.local/bin/hspec-discover ]; then
6+
# Fetch the source
7+
cabal get hspec-discover-2.4.4
8+
cd hspec-discover-2.4.4
9+
10+
# Set-up project
11+
echo 'packages: .' > cabal.project
12+
13+
# build exe
14+
cabal new-build hspec-discover:exe:hspec-discover
15+
16+
# copy executable to $HOME/.local/bin
17+
mkdir -p $HOME/.local/bin
18+
cp $(find dist-newstyle -name hspec-discover -type f) $HOME/.local/bin
19+
fi

servant-swagger.cabal

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: servant-swagger
22
version: 1.1.3
3+
x-revision: 1
34
synopsis: Generate Swagger specification for your servant API.
45
description: Please see README.md
56
homepage: https://github.com/haskell-servant/servant-swagger
@@ -15,7 +16,8 @@ cabal-version: >=1.10
1516
tested-with:
1617
GHC==7.8.4,
1718
GHC==7.10.3,
18-
GHC==8.0.2
19+
GHC==8.0.2,
20+
GHC==8.2.1
1921
extra-source-files:
2022
README.md
2123
, CHANGELOG.md
@@ -35,9 +37,9 @@ source-repository head
3537

3638
custom-setup
3739
setup-depends:
38-
base >=4.7 && <4.10,
39-
Cabal >= 1.18 && <2.0,
40-
cabal-doctest >=1 && <1.1
40+
base >=4.7 && <4.11,
41+
Cabal >= 1.18 && <2.1,
42+
cabal-doctest >=1.0.2 && <1.1
4143

4244
library
4345
ghc-options: -Wall
@@ -55,7 +57,7 @@ library
5557
Servant.Swagger.Internal.TypeLevel.TMap
5658
hs-source-dirs: src
5759
build-depends: aeson >=0.11.2.0 && <1.3
58-
, base >=4.7.0.0 && <4.10
60+
, base >=4.7.0.0 && <4.11
5961
, bytestring >=0.10.4.0 && <0.11
6062
, http-media >=0.6.3 && <0.8
6163
, insert-ordered-containers >=0.1.0.0 && <0.3

0 commit comments

Comments
 (0)