git.iko.soy/typeable/hjsonpointer
on master help sign in
.travis.yml+79−59
since splitsnapshots
unifiedsplit
@@ -1,84 +1,104 @@
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#
2#
3+# runghc make_travis_yml_2.hs 'hjsonpointer.cabal'
4+#
5+# For more information, see https://github.com/hvr/multi-ghc-travis
6+
3−# Manually modified to remove cabal check. I don't want a description field.
7+# NOTE: After generating comment out `cabal check`, it requires a description field.
4
8
5language: c
9language: c
6sudo: false
10sudo: false
7
11
12+git:
13+ submodules: false # whether to recursively clone submodules
14+
8cache:
15cache:
9 directories:
16 directories:
10− - $HOME/.cabsnap
11 - $HOME/.cabal/packages
17 - $HOME/.cabal/packages
18+ - $HOME/.cabal/store
12
19
13before_cache:
20before_cache:
14 - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
21 - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
22+ # remove files that are regenerated by 'cabal update'
15− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar
23+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.*
24+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json
25+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache
26+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar
27+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx
28+
29+ - rm -rfv $HOME/.cabal/packages/head.hackage
16
30
17matrix:
31matrix:
18 include:
32 include:
19− - env: CABALVER=1.18 GHCVER=7.8.4
33+ - compiler: "ghc-8.0.2"
20− compiler: ": #GHC 7.8.4"
34+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
21− addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}}
35+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.0.2], sources: [hvr-ghc]}}
22− - env: CABALVER=1.22 GHCVER=7.10.2
36+ - compiler: "ghc-8.2.2"
23− compiler: ": #GHC 7.10.2"
37+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
24− addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2], sources: [hvr-ghc]}}
38+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.2.2], sources: [hvr-ghc]}}
25− - env: CABALVER=1.24 GHCVER=8.0.1
39+ - compiler: "ghc-8.4.1"
26− compiler: ": #GHC 8.0.1"
40+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
27− addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1], sources: [hvr-ghc]}}
41+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.4.1], sources: [hvr-ghc]}}
28
42
29before_install:
43before_install:
44+ - HC=${CC}
45+ - HCPKG=${HC/ghc/ghc-pkg}
30− - unset CC
46+ - unset CC
47+ - ROOTDIR=$(pwd)
48+ - mkdir -p $HOME/.local/bin
31− - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
49+ - "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH"
50+ - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
51+ - echo $HCNUMVER
32
52
33install:
53install:
34− - cabal --version
54+ - cabal --version
35− - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
55+ - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
36− - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];
56+ - BENCH=${BENCH---enable-benchmarks}
37− then
57+ - TEST=${TEST---enable-tests}
38− zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >
58+ - HADDOCK=${HADDOCK-true}
39− $HOME/.cabal/packages/hackage.haskell.org/00-index.tar;
59+ - INSTALLED=${INSTALLED-true}
40− fi
60+ - GHCHEAD=${GHCHEAD-false}
41− - travis_retry cabal update -v
61+ - travis_retry cabal update -v
42− - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
62+ - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
43− - cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt
63+ - rm -fv cabal.project cabal.project.local
44− - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt
64+ - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
45−
65+ - "printf 'packages: \".\"\\n' > cabal.project"
46−# check whether current requested install-plan matches cached package-db snapshot
66+ - cat cabal.project
47− - if diff -u installplan.txt $HOME/.cabsnap/installplan.txt;
67+ - if [ -f "./configure.ac" ]; then
48− then
68+ (cd "." && autoreconf -i);
49− echo "cabal build-cache HIT";
69+ fi
50− rm -rfv .ghc;
70+ - rm -f cabal.project.freeze
51− cp -a $HOME/.cabsnap/ghc $HOME/.ghc;
71+ - cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
52− cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;
72+ - cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
53− else
73+ - rm -rf .ghc.environment.* "."/dist
54− echo "cabal build-cache MISS";
74+ - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
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
68
75
69# Here starts the actual work to be performed for the package under test;
76# Here starts the actual work to be performed for the package under test;
70# any command which exits with a non-zero exit code causes the build to fail.
77# any command which exits with a non-zero exit code causes the build to fail.
71script:
78script:
72− - if [ -f configure.ac ]; then autoreconf -i; fi
79+ # test that source-distributions can be generated
73− - cabal configure --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging
80+ - (cd "." && cabal sdist)
81+ - mv "."/dist/hjsonpointer-*.tar.gz ${DISTDIR}/
82+ - cd ${DISTDIR} || false
83+ - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
84+ - "printf 'packages: hjsonpointer-*/*.cabal\\n' > cabal.project"
85+ - cat cabal.project
74− - cabal build # this builds all libraries and executables (including tests/benchmarks)
86+ # this builds all libraries and executables (without tests/benchmarks)
75− - cabal test
87+ - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
76− - cabal sdist # tests that a source-distribution can be generated
88+
89+ # Build with installed constraints for packages in global-db
90+ - 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
91+
92+ # build & run tests, build benchmarks
93+ - cabal new-build -w ${HC} ${TEST} ${BENCH} all
94+ - if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} ${BENCH} all; fi
95+
96+ # cabal check
97+ # - (cd hjsonpointer-* && cabal check)
77
98
78−# Check that the resulting source distribution can be built & installed.
99+ # haddock
79−# If there are no other `.tar.gz` files in `dist`, this can be even simpler:
100+ - rm -rf ./dist-newstyle
80−# `cabal install --force-reinstalls dist/*-*.tar.gz`
101+ - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi
81− - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&
82− (cd dist && cabal install --force-reinstalls "$SRC_TGZ")
83
102
103+# REGENDATA ["hjsonpointer.cabal"]
84# EOF
104# EOF
changelog.md+17
@@ -1,3 +1,20 @@
1+# 1.5.0
2+
3++ Drop QuickCheck dependency (thanks @mmhat !).
4+
5+# 1.4.0
6+
7++ Enable GHC 8.4 (thanks @4e6 !).
8++ Drop GHC 7.10.
9+
10+# 1.3.0
11+
12++ Test with GHC 8.2. Drop GHC 7.8.
13+
14+# 1.2.0
15+
16++ Track upper bounds in a Hackage revision instead of source code.
17+
1# 1.1.1
18# 1.1.1
2
19
3+ Bump aeson.
20+ Bump aeson.
hjsonpointer.cabal+12−16
@@ -1,5 +1,5 @@
1name: hjsonpointer
1name: hjsonpointer
2−version: 1.1.1
2+version: 1.5.0
3synopsis: JSON Pointer library
3synopsis: JSON Pointer library
4homepage: https://github.com/seagreen/hjsonpointer
4homepage: https://github.com/seagreen/hjsonpointer
5license: MIT
5license: MIT
@@ -9,6 +9,8 @@ maintainer: ian@housejeffries.com
9category: Data
9category: Data
10build-type: Simple
10build-type: Simple
11cabal-version: >=1.10
11cabal-version: >=1.10
12+-- Rerun multi-ghc-travis (executable make-travis-yml-2) after changing:
13+Tested-With: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.1
12extra-source-files:
14extra-source-files:
13 changelog.md
15 changelog.md
14 README.md
16 README.md
@@ -22,15 +24,12 @@ library
22 exposed-modules:
24 exposed-modules:
23 JSONPointer
25 JSONPointer
24 build-depends:
26 build-depends:
25− base >= 4.6 && < 4.10
27+ base >= 4.9 && < 5
26− , aeson >= 0.7 && < 1.3
28+ , aeson >= 0.7
27− , hashable >= 1.2 && < 1.3
29+ , hashable >= 1.2
28− , QuickCheck >= 2.8 && < 2.10
29− , unordered-containers >= 0.2 && < 0.3
30+ , unordered-containers >= 0.2
30− , semigroups >= 0.18 && < 1.0
31− -- ^ for GHCs < 8
32− , text >= 1.2 && < 1.3
31+ , text >= 1.2
33− , vector >= 0.10 && < 1.0
32+ , vector >= 0.10
34
33
35test-suite unit
34test-suite unit
36 hs-source-dirs:
35 hs-source-dirs:
@@ -43,18 +42,15 @@ test-suite unit
43 OverloadedStrings
42 OverloadedStrings
44 ghc-options:
43 ghc-options:
45 -Wall
44 -Wall
45+ -fno-warn-orphans
46 other-modules: Example
46 other-modules: Example
47 build-depends:
47 build-depends:
48 aeson
48 aeson
49 , base
49 , base
50 , hjsonpointer
50 , hjsonpointer
51− , hspec >= 2.2 && < 3.0
51+ , hspec >= 2.2
52− , http-types >= 0.8 && < 1.0
52+ , http-types >= 0.8
53 , QuickCheck
53 , QuickCheck
54 , unordered-containers
54 , unordered-containers
55 , text
55 , text
56 , vector
56 , vector
57−
58−source-repository head
59− type: git
60− location: git://github.com/seagreen/hjsonpointer.git
shell.nixnew file+9
@@ -0,0 +1,9 @@
1+{ghc}:
2+with (import <nixpkgs> {});
3+
4+haskell.lib.buildStackProject {
5+ name = "none";
6+ inherit ghc;
7+ buildInputs = [
8+ ];
9+}
src/JSONPointer.hs+2−11
@@ -13,14 +13,8 @@ import Data.Text (Text)
13import qualified Data.Text as T
13import qualified Data.Text as T
14import qualified Data.Vector as V
14import qualified Data.Vector as V
15import GHC.Generics (Generic)
15import GHC.Generics (Generic)
16−import Test.QuickCheck
17import Text.Read (readMaybe)
16import Text.Read (readMaybe)
18
17
19−-- For GHCs before 7.10:
20−import Control.Applicative
21−import Data.Monoid
22−import Data.Traversable
23−
24--------------------------------------------------
18--------------------------------------------------
25-- * Resolution
19-- * Resolution
26--------------------------------------------------
20--------------------------------------------------
@@ -42,7 +36,7 @@ resolve (Pointer (t:ts)) v = resolveToken t v >>= resolve (Pointer ts)
42
36
43newtype Pointer
37newtype Pointer
44 = Pointer { _unPointer :: [Token] }
38 = Pointer { _unPointer :: [Token] }
45− deriving (Eq, Show, Semigroup, Monoid, Generic, Arbitrary)
39+ deriving (Eq, Show, Semigroup, Monoid, Generic)
46
40
47instance HA.Hashable Pointer
41instance HA.Hashable Pointer
48
42
@@ -68,9 +62,6 @@ newtype Token
68
62
69instance HA.Hashable Token
63instance HA.Hashable Token
70
64
71−instance Arbitrary Token where
72− arbitrary = Token . T.pack <$> arbitrary
73−
74-- | This escapes @"/"@ (because it's the token separator character).
65-- | This escapes @"/"@ (because it's the token separator character).
75--
66--
76-- It also escapes @"~"@ (because it's the escape character).
67-- It also escapes @"~"@ (because it's the escape character).
@@ -112,7 +103,7 @@ unescape txt =
112--------------------------------------------------
103--------------------------------------------------
113-- * Wrapper Types
104-- * Wrapper Types
114--
105--
115−-- These aren't used by the rest of the library
106+-- $ These aren't used by the rest of the library
116-- (as explained in the docs for 'Token').
107-- (as explained in the docs for 'Token').
117--
108--
118-- However, they might be useful if you need to distinguish JSON Pointer
109-- However, they might be useful if you need to distinguish JSON Pointer
stack.yamlnew file+2
@@ -0,0 +1,2 @@
1+resolver: lts-12.10
2+pvp-bounds: upper-revision
test/Unit.hs+12−8
@@ -1,25 +1,29 @@
1+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
2+{-# LANGUAGE StandaloneDeriving #-}
1
3
2module Main where
4module Main where
3
5
4−import Control.Arrow
5import Data.Aeson
6import Data.Aeson
7+import Data.Bifunctor (first)
8+import Data.Foldable
9+import Data.Monoid
6import Data.Text (Text)
10import Data.Text (Text)
7import qualified Data.Text as T
11import qualified Data.Text as T
8−import Data.Text.Encoding
12+import Data.Text.Encoding (decodeUtf8, encodeUtf8)
9import qualified Data.Vector as V
13import qualified Data.Vector as V
10import qualified JSONPointer as JP
14import qualified JSONPointer as JP
11import Network.HTTP.Types.URI (urlDecode)
15import Network.HTTP.Types.URI (urlDecode)
12
16
13import Test.Hspec
17import Test.Hspec
14−import Test.QuickCheck (property)
18+import Test.QuickCheck (Arbitrary(..), property)
15−
16−-- For GHCs before 7.10:
17−import Control.Applicative
18−import Data.Foldable
19−import Data.Monoid
20
19
21import qualified Example
20import qualified Example
22
21
22+deriving instance Arbitrary JP.Pointer
23+
24+instance Arbitrary JP.Token where
25+ arbitrary = JP.Token . T.pack <$> arbitrary
26+
23main :: IO ()
27main :: IO ()
24main = hspec $ do
28main = hspec $ do
25 describe "example" $ do
29 describe "example" $ do