diff --git a/.travis.yml b/.travis.yml index a4f3cb5c..9bb9b67f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,6 +27,8 @@ matrix: addons: {apt: {packages: [libgmp-dev]}} - env: BUILD=stack STACK='stack' # Use the resolver in stack.yaml addons: {apt: {packages: [libgmp-dev]}} + - env: BUILD=stack STACK='stack --stack-yaml=stack-ghc-8.6.yaml' + addons: {apt: {packages: [libgmp-dev]}} before_install: - mkdir -p $HOME/.local/bin diff --git a/discrimination-ieee754/package.yaml b/discrimination-ieee754/package.yaml index 488c7570..2bb66bc2 100644 --- a/discrimination-ieee754/package.yaml +++ b/discrimination-ieee754/package.yaml @@ -12,7 +12,7 @@ license: BSD3 github: google/proto-lens/discrimination-ieee754 dependencies: - - base >= 4.9 && < 4.12 + - base >= 4.9 && < 4.13 - data-binary-ieee754 >= 0.4 && < 0.5 - contravariant >= 1.3 && < 1.5 - discrimination >= 0.3 && < 0.4 diff --git a/lens-labels/package.yaml b/lens-labels/package.yaml index e35bc217..28b85efc 100644 --- a/lens-labels/package.yaml +++ b/lens-labels/package.yaml @@ -20,7 +20,7 @@ library: - Lens.Labels.Unwrapped - Lens.Labels.Prism dependencies: - - base >= 4.9 && < 4.12 + - base >= 4.9 && < 4.13 - ghc-prim >= 0.4 && < 0.6 - profunctors >= 5.2 - tagged >= 0.8 diff --git a/proto-lens-arbitrary/package.yaml b/proto-lens-arbitrary/package.yaml index 859014c1..481c3e43 100644 --- a/proto-lens-arbitrary/package.yaml +++ b/proto-lens-arbitrary/package.yaml @@ -15,9 +15,9 @@ extra-source-files: dependencies: - proto-lens == 0.4.* - - base >= 4.9 && < 4.12 + - base >= 4.9 && < 4.13 - bytestring == 0.10.* - - containers == 0.5.* + - containers >= 0.5 && < 0.7 - text == 1.2.* - lens-family == 1.2.* - QuickCheck >= 2.8 && < 2.12 diff --git a/proto-lens-combinators/package.yaml b/proto-lens-combinators/package.yaml index 3139798f..98b8d35c 100644 --- a/proto-lens-combinators/package.yaml +++ b/proto-lens-combinators/package.yaml @@ -14,12 +14,12 @@ extra-source-files: custom-setup: dependencies: - - base >= 4.9 && < 4.12 + - base >= 4.9 && < 4.13 - Cabal - proto-lens-setup == 0.4.* dependencies: - - base >= 4.9 && < 4.12 + - base >= 4.9 && < 4.13 - lens-family == 1.2.* library: diff --git a/proto-lens-discrimination/package.yaml b/proto-lens-discrimination/package.yaml index e3ec48f2..e6d73618 100644 --- a/proto-lens-discrimination/package.yaml +++ b/proto-lens-discrimination/package.yaml @@ -15,12 +15,12 @@ extra-source-files: custom-setup: dependencies: - - base >= 4.9 && < 4.12 + - base >= 4.9 && < 4.13 - Cabal - proto-lens-setup >= 0.4 && < 0.5 dependencies: - - base >= 4.9 && < 4.12 + - base >= 4.9 && < 4.13 - bytestring == 0.10.* - contravariant >= 1.3 && < 1.5 - containers >= 0.5 && < 0.6 diff --git a/proto-lens-optparse/package.yaml b/proto-lens-optparse/package.yaml index c39db795..eb54c234 100644 --- a/proto-lens-optparse/package.yaml +++ b/proto-lens-optparse/package.yaml @@ -16,7 +16,7 @@ extra-source-files: dependencies: - proto-lens >= 0.1 && < 0.5 - - base >= 4.9 && < 4.12 + - base >= 4.9 && < 4.13 - optparse-applicative >= 0.12 && < 0.15 - text == 1.2.* diff --git a/proto-lens-protobuf-types/package.yaml b/proto-lens-protobuf-types/package.yaml index f6d9f54f..69881f1f 100644 --- a/proto-lens-protobuf-types/package.yaml +++ b/proto-lens-protobuf-types/package.yaml @@ -20,12 +20,12 @@ extra-source-files: custom-setup: dependencies: - - base >= 4.9 && < 4.12 + - base >= 4.9 && < 4.13 - Cabal - proto-lens-setup == 0.4.* dependencies: - - base >= 4.9 && < 4.12 + - base >= 4.9 && < 4.13 - lens-labels == 0.3.* - proto-lens == 0.4.* - proto-lens-runtime == 0.4.* diff --git a/proto-lens-protoc/package.yaml b/proto-lens-protoc/package.yaml index 3238d161..0818322f 100644 --- a/proto-lens-protoc/package.yaml +++ b/proto-lens-protoc/package.yaml @@ -17,8 +17,8 @@ extra-source-files: - Changelog.md dependencies: - - base >= 4.9 && < 4.12 - - containers == 0.5.* + - base >= 4.9 && < 4.13 + - containers >= 0.5 && < 0.7 - lens-family == 1.2.* - proto-lens == 0.4.* - text == 1.2.* diff --git a/proto-lens-runtime/package.yaml b/proto-lens-runtime/package.yaml index 065e0453..49df08e8 100644 --- a/proto-lens-runtime/package.yaml +++ b/proto-lens-runtime/package.yaml @@ -16,9 +16,9 @@ extra-source-files: library: dependencies: - - base >= 4.9 && < 4.12 + - base >= 4.9 && < 4.13 - bytestring == 0.10.* - - containers == 0.5.* + - containers >= 0.5 && < 0.7 - deepseq == 1.4.* - filepath >= 1.4 && < 1.6 - lens-family == 1.2.* diff --git a/proto-lens-setup/package.yaml b/proto-lens-setup/package.yaml index ca4af4eb..383348a5 100644 --- a/proto-lens-setup/package.yaml +++ b/proto-lens-setup/package.yaml @@ -50,10 +50,10 @@ extra-source-files: library: source-dirs: src dependencies: - - base >= 4.9 && < 4.12 + - base >= 4.9 && < 4.13 - bytestring == 0.10.* - - containers == 0.5.* - - Cabal >= 1.22 && < 2.3 + - containers >= 0.5 && < 0.7 + - Cabal >= 1.22 && < 2.5 - deepseq == 1.4.* - directory >= 1.2 && < 1.4 - filepath >= 1.4 && < 1.6 diff --git a/proto-lens-setup/src/Data/ProtoLens/Setup.hs b/proto-lens-setup/src/Data/ProtoLens/Setup.hs index e29f397f..e68f32b8 100644 --- a/proto-lens-setup/src/Data/ProtoLens/Setup.hs +++ b/proto-lens-setup/src/Data/ProtoLens/Setup.hs @@ -43,6 +43,9 @@ import Distribution.PackageDescription , extraSrcFiles #if !MIN_VERSION_Cabal(2,0,0) , hsSourceDirs +#endif +#if MIN_VERSION_Cabal(2,4,0) + , specVersion #endif , libBuildInfo , otherModules @@ -68,14 +71,25 @@ import Distribution.Simple.Setup (fromFlag, copyDest, copyVerbosity) import Distribution.Simple.Utils ( createDirectoryIfMissingVerbose , installOrdinaryFile +#if MIN_VERSION_Cabal(2,4,0) +#else , matchFileGlob +#endif ) +#if MIN_VERSION_Cabal(2,4,0) +import Distribution.Simple.Glob (matchDirFileGlob) +#endif import Distribution.Simple ( defaultMainWithHooks , simpleUserHooks , UserHooks(..) ) -import Distribution.Verbosity (Verbosity) +import Distribution.Verbosity + ( Verbosity +#if MIN_VERSION_Cabal(2,4,0) + , normal +#endif + ) import System.FilePath ( () , equalFilePath @@ -158,13 +172,20 @@ generatingProtos root = generatingSpecificProtos root getProtos where getProtos l = do -- Replicate Cabal's own logic for parsing file globs. - files <- concat <$> mapM matchFileGlob (extraSrcFiles $ localPkgDescr l) + files <- concat <$> mapM (match $ localPkgDescr l) + (extraSrcFiles $ localPkgDescr l) pure . filter (\f -> takeExtension f == ".proto") . map (makeRelative root) . filter (isSubdirectoryOf root) $ files +match :: PackageDescription -> FilePath -> IO [FilePath] +#if MIN_VERSION_Cabal(2,4,0) +match desc f = matchDirFileGlob normal (specVersion desc) "." f +#else +match _ f = matchFileGlob f +#endif -- | Augment the given 'UserHooks' to auto-generate Haskell files from the -- .proto files returned by a function @getProtos@. diff --git a/proto-lens-tests/package.yaml b/proto-lens-tests/package.yaml index 2465e6b7..122d4c63 100644 --- a/proto-lens-tests/package.yaml +++ b/proto-lens-tests/package.yaml @@ -7,8 +7,11 @@ author: Judah Jacobson maintainer: proto-lens@googlegroups.com copyright: Google Inc. license: BSD3 -extra-source-files: - - tests/*.proto +# Use extra-source-files verbatim since hpack otherwise expands the glob +# to an explicit list in the Cabal file. +# We want to test that globs within Cabal files are supported. +verbatim: + extra-source-files: tests/*.proto custom-setup: dependencies: diff --git a/proto-lens-tutorial/stack-ghc-8.6.yaml b/proto-lens-tutorial/stack-ghc-8.6.yaml new file mode 120000 index 00000000..2df91e0c --- /dev/null +++ b/proto-lens-tutorial/stack-ghc-8.6.yaml @@ -0,0 +1 @@ +stack.yaml \ No newline at end of file diff --git a/proto-lens/package.yaml b/proto-lens/package.yaml index f71c1677..f4778821 100644 --- a/proto-lens/package.yaml +++ b/proto-lens/package.yaml @@ -47,9 +47,9 @@ library: - Data.ProtoLens.TextFormat.Parser dependencies: - attoparsec == 0.13.* - - base >= 4.9 && < 4.12 + - base >= 4.9 && < 4.13 - bytestring == 0.10.* - - containers == 0.5.* + - containers >= 0.5 && < 0.7 - deepseq == 1.4.* - lens-family == 1.2.* - lens-labels == 0.3.* diff --git a/stack-ghc-8.6.yaml b/stack-ghc-8.6.yaml new file mode 100644 index 00000000..ad0b5200 --- /dev/null +++ b/stack-ghc-8.6.yaml @@ -0,0 +1,21 @@ +resolver: nightly-2018-09-29 +packages: +# - discrimination-ieee754 +- lens-labels +- proto-lens +- proto-lens-arbitrary +# Criterion doesn't build with nightly yet: +# - proto-lens-benchmarks +- proto-lens-combinators +# - proto-lens-discrimination +- proto-lens-optparse +- proto-lens-protobuf-types +- proto-lens-protoc +- proto-lens-runtime +- proto-lens-setup +- proto-lens-tests +- proto-lens-tests-dep +extra-deps: +# These don't build with nightly yet: +# - discrimination-0.3 +# - promises-0.3