git.iko.soy/typeable/hjsonpointer
on master help sign in
1.3.0. Enable GHC 8.2.1.

Also: + Drop GHC 7.8. + Regenerate .travis.yml using make-travis-yml-2.

commite2be2c75a32a0d3ea076e59223ce9f9f5972c4b5 authorIan Grant Jeffries <ian@housejeffries.com> dateMon 18 Sep 2017, 10:46 (9 years ago) parentf7a0cfb
7 files changed+82−81
.travis.yml+67−56 changelog.md+4 hjsonpointer.cabal+4−6 shell.nix+1 src/JSONPointer.hs+1−6 stack.yaml+1−6 test/Unit.hs+4−7
.travis.yml+67−56
@@ -1,84 +1,95 @@
1−# This file has been generated -- see https://github.com/hvr/multi-ghc-travis
1+# This Travis job script has been generated by a script via
2+#
3+# make_travis_yml_2.hs 'hjsonpointer.cabal'
4+#
5+# For more information, see https://github.com/hvr/multi-ghc-travis
26#
3−# Manually modified to remove cabal check. I don't want a description field.
4−
57language: c
68sudo: false
79
10+git:
11+ submodules: false # whether to recursively clone submodules
12+
813cache:
914 directories:
10− - $HOME/.cabsnap
1115 - $HOME/.cabal/packages
16+ - $HOME/.cabal/store
1217
1318before_cache:
1419 - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
15− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar
20+ # remove files that are regenerated by 'cabal update'
21+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.*
22+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json
23+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache
24+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar
25+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx
1626
1727matrix:
1828 include:
19− - env: CABALVER=1.18 GHCVER=7.8.4
20− compiler: ": #GHC 7.8.4"
21− addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}}
22− - env: CABALVER=1.22 GHCVER=7.10.2
23− compiler: ": #GHC 7.10.2"
24− addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2], sources: [hvr-ghc]}}
25− - env: CABALVER=1.24 GHCVER=8.0.1
26− compiler: ": #GHC 8.0.1"
27− addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1], sources: [hvr-ghc]}}
29+ - compiler: "ghc-7.10.3"
30+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
31+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.10.3], sources: [hvr-ghc]}}
32+ - compiler: "ghc-8.0.1"
33+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
34+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.0.1], sources: [hvr-ghc]}}
35+ - compiler: "ghc-8.2.1"
36+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
37+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.2.1], sources: [hvr-ghc]}}
2838
2939before_install:
40+ - HC=${CC}
41+ - HCPKG=${HC/ghc/ghc-pkg}
3042 - unset CC
31− - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
43+ - PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$PATH
44+ - PKGNAME='hjsonpointer'
3245
3346install:
3447 - cabal --version
35− - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
36− - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];
37− then
38− zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >
39− $HOME/.cabal/packages/hackage.haskell.org/00-index.tar;
40− fi
48+ - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
49+ - BENCH=${BENCH---enable-benchmarks}
50+ - TEST=${TEST---enable-tests}
51+ - HADDOCK=${HADDOCK-true}
52+ - INSTALLED=${INSTALLED-true}
4153 - travis_retry cabal update -v
42− - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
43− - cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt
44− - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt
45−
46−# check whether current requested install-plan matches cached package-db snapshot
47− - if diff -u installplan.txt $HOME/.cabsnap/installplan.txt;
48− then
49− echo "cabal build-cache HIT";
50− rm -rfv .ghc;
51− cp -a $HOME/.cabsnap/ghc $HOME/.ghc;
52− cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;
53− else
54− echo "cabal build-cache MISS";
55− rm -rf $HOME/.cabsnap;
56− mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;
57− cabal install --only-dependencies --enable-tests --enable-benchmarks;
58− fi
59−
60−# snapshot package-db on cache miss
61− - if [ ! -d $HOME/.cabsnap ];
62− then
63− echo "snapshotting package-db to build-cache";
64− mkdir $HOME/.cabsnap;
65− cp -a $HOME/.ghc $HOME/.cabsnap/ghc;
66− cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;
67− fi
54+ - sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
55+ - rm -fv cabal.project.local
56+ - "echo 'packages: .' > cabal.project"
57+ - rm -f cabal.project.freeze
58+ - cabal new-build -w ${HC} ${TEST} ${BENCH} --dep -j2 all
59+ - cabal new-build -w ${HC} --disable-tests --disable-benchmarks --dep -j2 all
6860
6961# Here starts the actual work to be performed for the package under test;
7062# any command which exits with a non-zero exit code causes the build to fail.
7163script:
7264 - if [ -f configure.ac ]; then autoreconf -i; fi
73− - cabal configure --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging
74− - cabal build # this builds all libraries and executables (including tests/benchmarks)
75− - cabal test
76− - cabal sdist # tests that a source-distribution can be generated
65+ - rm -rf .ghc.environment.* dist/
66+ - cabal sdist # test that a source-distribution can be generated
67+ - cd dist/
68+ - SRCTAR=(${PKGNAME}-*.tar.gz)
69+ - SRC_BASENAME="${SRCTAR/%.tar.gz}"
70+ - tar -xvf "./$SRC_BASENAME.tar.gz"
71+ - cd "$SRC_BASENAME/"
72+## from here on, CWD is inside the extracted source-tarball
73+ - rm -fv cabal.project.local
74+ - "echo 'packages: .' > cabal.project"
75+ # this builds all libraries and executables (without tests/benchmarks)
76+ - rm -f cabal.project.freeze
77+ - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
78+ # this builds all libraries and executables (including tests/benchmarks)
79+ # - rm -rf ./dist-newstyle
80+
81+ # Build with installed constraints for packages in global-db
82+ - if $INSTALLED; then
83+ 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;
84+ else echo "Not building with installed constraints"; fi
85+
86+ # build & run tests, build benchmarks
87+ - cabal new-build -w ${HC} ${TEST} ${BENCH} all
88+ - if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} all; fi
7789
78−# Check that the resulting source distribution can be built & installed.
79−# If there are no other `.tar.gz` files in `dist`, this can be even simpler:
80−# `cabal install --force-reinstalls dist/*-*.tar.gz`
81− - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&
82− (cd dist && cabal install --force-reinstalls "$SRC_TGZ")
90+ # haddock
91+ - rm -rf ./dist-newstyle
92+ - if $HADDOCK; then cabal new-haddock -w ${HC} --disable-tests --disable-benchmarks all; else echo "Skipping haddock generation";fi
8393
94+# REGENDATA ["hjsonpointer.cabal"]
8495# EOF
changelog.md+4
@@ -1,3 +1,7 @@
1+# 1.3.0
2+
3++ Test with GHC 8.2. Drop GHC 7.8.
4+
15# 1.2.0
26
37+ Track upper bounds in a Hackage revision instead of source code.
hjsonpointer.cabal+4−6
@@ -1,5 +1,5 @@
11name: hjsonpointer
2−version: 1.2.0
2+version: 1.3.0
33synopsis: JSON Pointer library
44homepage: https://github.com/seagreen/hjsonpointer
55license: MIT
@@ -9,6 +9,8 @@ maintainer: ian@housejeffries.com
99category: Data
1010build-type: Simple
1111cabal-version: >=1.10
12+-- Rerun multi-ghc-travis (executable make-travis-yml-2) after changing:
13+Tested-With: GHC == 7.10.3, GHC == 8.0.1, GHC == 8.2.1
1214extra-source-files:
1315 changelog.md
1416 README.md
@@ -22,7 +24,7 @@ library
2224 exposed-modules:
2325 JSONPointer
2426 build-depends:
25− base >= 4.6 && < 4.10
27+ base >= 4.6 && < 4.11
2628 , aeson >= 0.7
2729 , hashable >= 1.2
2830 , QuickCheck >= 2.8
@@ -54,7 +56,3 @@ test-suite unit
5456 , unordered-containers
5557 , text
5658 , vector
57−
58−source-repository head
59− type: git
60− location: git://github.com/seagreen/hjsonpointer.git
shell.nix+1
@@ -1,3 +1,4 @@
1+{ghc}:
12with (import <nixpkgs> {});
23
34haskell.lib.buildStackProject {
src/JSONPointer.hs+1−6
@@ -16,11 +16,6 @@ import GHC.Generics (Generic)
1616import Test.QuickCheck
1717import Text.Read (readMaybe)
1818
19−-- For GHCs before 7.10:
20−import Control.Applicative
21−import Data.Monoid
22−import Data.Traversable
23−
2419--------------------------------------------------
2520-- * Resolution
2621--------------------------------------------------
@@ -112,7 +107,7 @@ unescape txt =
112107--------------------------------------------------
113108-- * Wrapper Types
114109--
115−-- These aren't used by the rest of the library
110+-- $ These aren't used by the rest of the library
116111-- (as explained in the docs for 'Token').
117112--
118113-- However, they might be useful if you need to distinguish JSON Pointer
stack.yaml+1−6
@@ -1,7 +1,2 @@
1−resolver: lts-8.20
2−extra-deps:
3− - QuickCheck-2.10.0.1
1+resolver: nightly-2017-09-18
42pvp-bounds: upper-revision
5−nix:
6− enable: true
7− shell-file: shell.nix
test/Unit.hs+4−7
@@ -1,11 +1,13 @@
11
22module Main where
33
4−import Control.Arrow
54import Data.Aeson
5+import Data.Bifunctor (first)
6+import Data.Foldable
7+import Data.Monoid
68import Data.Text (Text)
79import qualified Data.Text as T
8−import Data.Text.Encoding
10+import Data.Text.Encoding (decodeUtf8, encodeUtf8)
911import qualified Data.Vector as V
1012import qualified JSONPointer as JP
1113import Network.HTTP.Types.URI (urlDecode)
@@ -13,11 +15,6 @@ import Network.HTTP.Types.URI (urlDecode)
1315import Test.Hspec
1416import Test.QuickCheck (property)
1517
16−-- For GHCs before 7.10:
17−import Control.Applicative
18−import Data.Foldable
19−import Data.Monoid
20−
2118import qualified Example
2219
2320main :: IO ()