diff --git a/.travis.yml b/.travis.yml index dd91246..76b09c8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,84 +1,95 @@ -# This file has been generated -- see https://github.com/hvr/multi-ghc-travis +# This Travis job script has been generated by a script via +# +# make_travis_yml_2.hs 'hjsonpointer.cabal' +# +# For more information, see https://github.com/hvr/multi-ghc-travis # -# Manually modified to remove cabal check. I don't want a description field. - language: c sudo: false +git: + submodules: false # whether to recursively clone submodules + cache: directories: - - $HOME/.cabsnap - $HOME/.cabal/packages + - $HOME/.cabal/store before_cache: - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log - - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar + # remove files that are regenerated by 'cabal update' + - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.* + - rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json + - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache + - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar + - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx matrix: include: - - env: CABALVER=1.18 GHCVER=7.8.4 - compiler: ": #GHC 7.8.4" - addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}} - - env: CABALVER=1.22 GHCVER=7.10.2 - compiler: ": #GHC 7.10.2" - addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2], sources: [hvr-ghc]}} - - env: CABALVER=1.24 GHCVER=8.0.1 - compiler: ": #GHC 8.0.1" - addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1], sources: [hvr-ghc]}} + - compiler: "ghc-7.10.3" + # env: TEST=--disable-tests BENCH=--disable-benchmarks + addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.10.3], sources: [hvr-ghc]}} + - compiler: "ghc-8.0.1" + # env: TEST=--disable-tests BENCH=--disable-benchmarks + addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.0.1], sources: [hvr-ghc]}} + - compiler: "ghc-8.2.1" + # env: TEST=--disable-tests BENCH=--disable-benchmarks + addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.2.1], sources: [hvr-ghc]}} before_install: + - HC=${CC} + - HCPKG=${HC/ghc/ghc-pkg} - unset CC - - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH + - PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$PATH + - PKGNAME='hjsonpointer' install: - cabal --version - - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]" - - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ]; - then - zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz > - $HOME/.cabal/packages/hackage.haskell.org/00-index.tar; - fi + - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]" + - BENCH=${BENCH---enable-benchmarks} + - TEST=${TEST---enable-tests} + - HADDOCK=${HADDOCK-true} + - INSTALLED=${INSTALLED-true} - travis_retry cabal update -v - - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config - - cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt - - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt - -# check whether current requested install-plan matches cached package-db snapshot - - if diff -u installplan.txt $HOME/.cabsnap/installplan.txt; - then - echo "cabal build-cache HIT"; - rm -rfv .ghc; - cp -a $HOME/.cabsnap/ghc $HOME/.ghc; - cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/; - else - echo "cabal build-cache MISS"; - rm -rf $HOME/.cabsnap; - mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin; - cabal install --only-dependencies --enable-tests --enable-benchmarks; - fi - -# snapshot package-db on cache miss - - if [ ! -d $HOME/.cabsnap ]; - then - echo "snapshotting package-db to build-cache"; - mkdir $HOME/.cabsnap; - cp -a $HOME/.ghc $HOME/.cabsnap/ghc; - cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/; - fi + - sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config + - rm -fv cabal.project.local + - "echo 'packages: .' > cabal.project" + - rm -f cabal.project.freeze + - cabal new-build -w ${HC} ${TEST} ${BENCH} --dep -j2 all + - cabal new-build -w ${HC} --disable-tests --disable-benchmarks --dep -j2 all # Here starts the actual work to be performed for the package under test; # any command which exits with a non-zero exit code causes the build to fail. script: - if [ -f configure.ac ]; then autoreconf -i; fi - - cabal configure --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging - - cabal build # this builds all libraries and executables (including tests/benchmarks) - - cabal test - - cabal sdist # tests that a source-distribution can be generated + - rm -rf .ghc.environment.* dist/ + - cabal sdist # test that a source-distribution can be generated + - cd dist/ + - SRCTAR=(${PKGNAME}-*.tar.gz) + - SRC_BASENAME="${SRCTAR/%.tar.gz}" + - tar -xvf "./$SRC_BASENAME.tar.gz" + - cd "$SRC_BASENAME/" +## from here on, CWD is inside the extracted source-tarball + - rm -fv cabal.project.local + - "echo 'packages: .' > cabal.project" + # this builds all libraries and executables (without tests/benchmarks) + - rm -f cabal.project.freeze + - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all + # this builds all libraries and executables (including tests/benchmarks) + # - rm -rf ./dist-newstyle -# Check that the resulting source distribution can be built & installed. -# If there are no other `.tar.gz` files in `dist`, this can be even simpler: -# `cabal install --force-reinstalls dist/*-*.tar.gz` - - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz && - (cd dist && cabal install --force-reinstalls "$SRC_TGZ") + # Build with installed constraints for packages in global-db + - if $INSTALLED; then + echo cabal new-build -w ${HC} --disable-tests --disable-benchmarks $(${HCPKG} list --global --simple-output --names-only | sed 's/\([a-zA-Z0-9-]\{1,\}\) */--constraint="\1 installed" /g') all | sh; + else echo "Not building with installed constraints"; fi + # build & run tests, build benchmarks + - cabal new-build -w ${HC} ${TEST} ${BENCH} all + - if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} all; fi + + # haddock + - rm -rf ./dist-newstyle + - if $HADDOCK; then cabal new-haddock -w ${HC} --disable-tests --disable-benchmarks all; else echo "Skipping haddock generation";fi + +# REGENDATA ["hjsonpointer.cabal"] # EOF diff --git a/changelog.md b/changelog.md index e5953be..ea29957 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,7 @@ +# 1.3.0 + ++ Test with GHC 8.2. Drop GHC 7.8. + # 1.2.0 + Track upper bounds in a Hackage revision instead of source code. diff --git a/hjsonpointer.cabal b/hjsonpointer.cabal index 4258849..9de190e 100644 --- a/hjsonpointer.cabal +++ b/hjsonpointer.cabal @@ -1,5 +1,5 @@ name: hjsonpointer -version: 1.2.0 +version: 1.3.0 synopsis: JSON Pointer library homepage: https://github.com/seagreen/hjsonpointer license: MIT @@ -9,6 +9,8 @@ maintainer: ian@housejeffries.com category: Data build-type: Simple cabal-version: >=1.10 +-- Rerun multi-ghc-travis (executable make-travis-yml-2) after changing: +Tested-With: GHC == 7.10.3, GHC == 8.0.1, GHC == 8.2.1 extra-source-files: changelog.md README.md @@ -22,7 +24,7 @@ library exposed-modules: JSONPointer build-depends: - base >= 4.6 && < 4.10 + base >= 4.6 && < 4.11 , aeson >= 0.7 , hashable >= 1.2 , QuickCheck >= 2.8 @@ -54,7 +56,3 @@ test-suite unit , unordered-containers , text , vector - -source-repository head - type: git - location: git://github.com/seagreen/hjsonpointer.git diff --git a/shell.nix b/shell.nix index 1a8c29c..d91528a 100644 --- a/shell.nix +++ b/shell.nix @@ -1,3 +1,4 @@ +{ghc}: with (import {}); haskell.lib.buildStackProject { diff --git a/src/JSONPointer.hs b/src/JSONPointer.hs index c03f46f..6b374f2 100644 --- a/src/JSONPointer.hs +++ b/src/JSONPointer.hs @@ -16,11 +16,6 @@ import GHC.Generics (Generic) import Test.QuickCheck import Text.Read (readMaybe) --- For GHCs before 7.10: -import Control.Applicative -import Data.Monoid -import Data.Traversable - -------------------------------------------------- -- * Resolution -------------------------------------------------- @@ -112,7 +107,7 @@ unescape txt = -------------------------------------------------- -- * Wrapper Types -- --- These aren't used by the rest of the library +-- $ These aren't used by the rest of the library -- (as explained in the docs for 'Token'). -- -- However, they might be useful if you need to distinguish JSON Pointer diff --git a/stack.yaml b/stack.yaml index a8b55b3..a16bc89 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,7 +1,2 @@ -resolver: lts-8.20 -extra-deps: - - QuickCheck-2.10.0.1 +resolver: nightly-2017-09-18 pvp-bounds: upper-revision -nix: - enable: true - shell-file: shell.nix diff --git a/test/Unit.hs b/test/Unit.hs index 48bd6fd..d392685 100644 --- a/test/Unit.hs +++ b/test/Unit.hs @@ -1,11 +1,13 @@ module Main where -import Control.Arrow import Data.Aeson +import Data.Bifunctor (first) +import Data.Foldable +import Data.Monoid import Data.Text (Text) import qualified Data.Text as T -import Data.Text.Encoding +import Data.Text.Encoding (decodeUtf8, encodeUtf8) import qualified Data.Vector as V import qualified JSONPointer as JP import Network.HTTP.Types.URI (urlDecode) @@ -13,11 +15,6 @@ import Network.HTTP.Types.URI (urlDecode) import Test.Hspec import Test.QuickCheck (property) --- For GHCs before 7.10: -import Control.Applicative -import Data.Foldable -import Data.Monoid - import qualified Example main :: IO ()