From 130d691354a8f6e5f056f5a6ad9f5bad69422dc9 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Sat, 12 Jan 2019 00:43:25 -0500 Subject: [PATCH 1/3] fix compile on stackage lts-13.2 --- ble.cabal | 236 +++++++++++++++++------------------- examples/Auth.hs | 2 +- examples/HeartRate.hs | 3 +- examples/HeartRateClient.hs | 2 +- package.yaml | 19 ++- stack.yaml | 9 +- 6 files changed, 136 insertions(+), 135 deletions(-) diff --git a/ble.cabal b/ble.cabal index a4ef024..fa39542 100644 --- a/ble.cabal +++ b/ble.cabal @@ -1,6 +1,10 @@ --- This file has been generated from package.yaml by hpack version 0.17.1. +cabal-version: 1.12 + +-- This file has been generated from package.yaml by hpack version 0.31.1. -- -- see: https://github.com/sol/hpack +-- +-- hash: 2eaf7b48d485892509d025b3573af73d212bf5d4cf8b7188580eaf6e00ddd6a6 name: ble version: 0.4.2 @@ -16,14 +20,11 @@ license: BSD3 license-file: LICENSE tested-with: GHC == 7.10.3, GHC == 8.0.1 build-type: Simple -cabal-version: >= 1.10 - extra-source-files: - LICENSE - package.yaml README.md + package.yaml + LICENSE test/Mock/requirements.txt - data-files: test/Mock/start_mock.sh @@ -34,7 +35,7 @@ source-repository head flag bluez543 description: Bluez version 5.43 or greater manual: True - default: False + default: True flag hasBluez description: Whether to run tests that require Bluez @@ -47,26 +48,6 @@ flag hasDBus default: False library - hs-source-dirs: - src - default-extensions: AutoDeriveTypeable ConstraintKinds DataKinds DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs KindSignatures MultiParamTypeClasses OverloadedStrings RankNTypes ScopedTypeVariables TypeFamilies TypeOperators - ghc-options: -Wall - build-depends: - base >= 4.8 && < 4.10 - , bytestring >= 0.10 && < 0.11 - , text >= 1 && < 2 - , d-bus >= 0.1.5 && < 0.2 - , uuid >= 1 && < 2 - , mtl >= 2.2 && < 2.3 - , transformers >= 0.4 && < 0.6 - , containers >= 0.5 && < 0.6 - , random >= 1 && < 2 - , microlens >= 0.4 && < 0.5 - , microlens-ghc >= 0.4 && < 0.5 - , cereal >= 0.4 && < 0.6 - , data-default-class >= 0.0 && < 0.2 - if flag(hasDBus) - cpp-options: -DDBusMock exposed-modules: Bluetooth Bluetooth.Internal.DBus @@ -78,6 +59,26 @@ library Bluetooth.Internal.Serialize Bluetooth.Internal.Types Bluetooth.Internal.Utils + hs-source-dirs: + src + default-extensions: AutoDeriveTypeable ConstraintKinds DataKinds DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs KindSignatures MultiParamTypeClasses OverloadedStrings RankNTypes ScopedTypeVariables TypeFamilies TypeOperators + ghc-options: -Wall + build-depends: + base >=4.8 && <4.10 + , bytestring >=0.10 && <0.11 + , cereal >=0.4 && <0.6 + , containers >=0.5 && <0.6 + , d-bus >=0.1.5 && <0.2 + , data-default-class >=0.0 && <0.2 + , microlens >=0.4 && <0.5 + , microlens-ghc >=0.4 && <0.5 + , mtl >=2.2 && <2.3 + , random >=1 && <2 + , text >=1 && <2 + , transformers >=0.4 && <0.6 + , uuid >=1 && <2 + if flag(hasDBus) + cpp-options: -DDBusMock default-language: Haskell2010 executable auth @@ -85,28 +86,26 @@ executable auth hs-source-dirs: examples default-extensions: AutoDeriveTypeable ConstraintKinds DataKinds DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs KindSignatures MultiParamTypeClasses OverloadedStrings RankNTypes ScopedTypeVariables TypeFamilies TypeOperators - ghc-options: -Wall + ghc-options: -Wall -main-is Auth build-depends: - base >= 4.8 && < 4.10 - , bytestring >= 0.10 && < 0.11 - , text >= 1 && < 2 - , d-bus >= 0.1.5 && < 0.2 - , uuid >= 1 && < 2 - , mtl >= 2.2 && < 2.3 - , transformers >= 0.4 && < 0.6 - , containers >= 0.5 && < 0.6 - , random >= 1 && < 2 - , microlens >= 0.4 && < 0.5 - , microlens-ghc >= 0.4 && < 0.5 - , cereal >= 0.4 && < 0.6 - , data-default-class >= 0.0 && < 0.2 + base >=4.8 && <4.10 , ble + , bytestring >=0.10 && <0.11 + , cereal >=0.4 && <0.6 + , containers >=0.5 && <0.6 + , d-bus >=0.1.5 && <0.2 + , data-default-class >=0.0 && <0.2 + , hslogger + , microlens >=0.4 && <0.5 + , microlens-ghc >=0.4 && <0.5 + , mtl >=2.2 && <2.3 + , optparse-applicative + , random >=1 && <2 + , text >=1 && <2 + , transformers >=0.4 && <0.6 + , uuid >=1 && <2 if flag(hasDBus) cpp-options: -DDBusMock - other-modules: - HeartRate - HeartRateClient - README default-language: Haskell2010 executable hrs @@ -114,30 +113,26 @@ executable hrs hs-source-dirs: examples default-extensions: AutoDeriveTypeable ConstraintKinds DataKinds DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs KindSignatures MultiParamTypeClasses OverloadedStrings RankNTypes ScopedTypeVariables TypeFamilies TypeOperators - ghc-options: -Wall -threaded + ghc-options: -Wall -threaded -main-is HeartRate build-depends: - base >= 4.8 && < 4.10 - , bytestring >= 0.10 && < 0.11 - , text >= 1 && < 2 - , d-bus >= 0.1.5 && < 0.2 - , uuid >= 1 && < 2 - , mtl >= 2.2 && < 2.3 - , transformers >= 0.4 && < 0.6 - , containers >= 0.5 && < 0.6 - , random >= 1 && < 2 - , microlens >= 0.4 && < 0.5 - , microlens-ghc >= 0.4 && < 0.5 - , cereal >= 0.4 && < 0.6 - , data-default-class >= 0.0 && < 0.2 + base >=4.8 && <4.10 , ble + , bytestring >=0.10 && <0.11 + , cereal >=0.4 && <0.6 + , containers >=0.5 && <0.6 + , d-bus >=0.1.5 && <0.2 + , data-default-class >=0.0 && <0.2 , hslogger - , optparse-applicative >= 0.12 && < 0.14 + , microlens >=0.4 && <0.5 + , microlens-ghc >=0.4 && <0.5 + , mtl >=2.2 && <2.3 + , optparse-applicative + , random >=1 && <2 + , text >=1 && <2 + , transformers >=0.4 && <0.6 + , uuid >=1 && <2 if flag(hasDBus) cpp-options: -DDBusMock - other-modules: - Auth - HeartRateClient - README default-language: Haskell2010 executable hrs-client @@ -145,28 +140,26 @@ executable hrs-client hs-source-dirs: examples default-extensions: AutoDeriveTypeable ConstraintKinds DataKinds DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs KindSignatures MultiParamTypeClasses OverloadedStrings RankNTypes ScopedTypeVariables TypeFamilies TypeOperators - ghc-options: -Wall -threaded + ghc-options: -Wall -threaded -main-is HeartRateClient build-depends: - base >= 4.8 && < 4.10 - , bytestring >= 0.10 && < 0.11 - , text >= 1 && < 2 - , d-bus >= 0.1.5 && < 0.2 - , uuid >= 1 && < 2 - , mtl >= 2.2 && < 2.3 - , transformers >= 0.4 && < 0.6 - , containers >= 0.5 && < 0.6 - , random >= 1 && < 2 - , microlens >= 0.4 && < 0.5 - , microlens-ghc >= 0.4 && < 0.5 - , cereal >= 0.4 && < 0.6 - , data-default-class >= 0.0 && < 0.2 + base >=4.8 && <4.10 , ble + , bytestring >=0.10 && <0.11 + , cereal >=0.4 && <0.6 + , containers >=0.5 && <0.6 + , d-bus >=0.1.5 && <0.2 + , data-default-class >=0.0 && <0.2 + , hslogger + , microlens >=0.4 && <0.5 + , microlens-ghc >=0.4 && <0.5 + , mtl >=2.2 && <2.3 + , optparse-applicative + , random >=1 && <2 + , text >=1 && <2 + , transformers >=0.4 && <0.6 + , uuid >=1 && <2 if flag(hasDBus) cpp-options: -DDBusMock - other-modules: - Auth - HeartRate - README default-language: Haskell2010 executable readme @@ -176,63 +169,60 @@ executable readme default-extensions: AutoDeriveTypeable ConstraintKinds DataKinds DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs KindSignatures MultiParamTypeClasses OverloadedStrings RankNTypes ScopedTypeVariables TypeFamilies TypeOperators ghc-options: -Wall -pgmL markdown-unlit build-depends: - base >= 4.8 && < 4.10 - , bytestring >= 0.10 && < 0.11 - , text >= 1 && < 2 - , d-bus >= 0.1.5 && < 0.2 - , uuid >= 1 && < 2 - , mtl >= 2.2 && < 2.3 - , transformers >= 0.4 && < 0.6 - , containers >= 0.5 && < 0.6 - , random >= 1 && < 2 - , microlens >= 0.4 && < 0.5 - , microlens-ghc >= 0.4 && < 0.5 - , cereal >= 0.4 && < 0.6 - , data-default-class >= 0.0 && < 0.2 + base >=4.8 && <4.10 , ble - , stm + , bytestring >=0.10 && <0.11 + , cereal >=0.4 && <0.6 + , containers >=0.5 && <0.6 + , d-bus >=0.1.5 && <0.2 + , data-default-class >=0.0 && <0.2 , markdown-unlit + , microlens >=0.4 && <0.5 + , microlens-ghc >=0.4 && <0.5 + , mtl >=2.2 && <2.3 + , random >=1 && <2 + , stm + , text >=1 && <2 + , transformers >=0.4 && <0.6 + , uuid >=1 && <2 if flag(hasDBus) cpp-options: -DDBusMock - other-modules: - Auth - HeartRate - HeartRateClient default-language: Haskell2010 test-suite spec type: exitcode-stdio-1.0 main-is: Main.hs + other-modules: + Bluetooth.TypesSpec + BluetoothSpec + Doctest + Mock + Spec + Paths_ble hs-source-dirs: test default-extensions: AutoDeriveTypeable ConstraintKinds DataKinds DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs KindSignatures MultiParamTypeClasses OverloadedStrings RankNTypes ScopedTypeVariables TypeFamilies TypeOperators ghc-options: -Wall build-depends: - base >= 4.8 && < 4.10 - , bytestring >= 0.10 && < 0.11 - , text >= 1 && < 2 - , d-bus >= 0.1.5 && < 0.2 - , uuid >= 1 && < 2 - , mtl >= 2.2 && < 2.3 - , transformers >= 0.4 && < 0.6 - , containers >= 0.5 && < 0.6 - , random >= 1 && < 2 - , microlens >= 0.4 && < 0.5 - , microlens-ghc >= 0.4 && < 0.5 - , cereal >= 0.4 && < 0.6 - , data-default-class >= 0.0 && < 0.2 + QuickCheck >=2.8 && <2.10 + , base >=4.8 && <4.10 , ble - , hspec > 2 && < 3 - , QuickCheck >= 2.8 && < 2.10 - , quickcheck-instances >= 0.3 && < 0.4 - , process >= 1.2 && < 1.5 + , bytestring >=0.10 && <0.11 + , cereal >=0.4 && <0.6 + , containers >=0.5 && <0.6 + , d-bus >=0.1.5 && <0.2 + , data-default-class >=0.0 && <0.2 , hslogger + , hspec >2 && <3 + , microlens >=0.4 && <0.5 + , microlens-ghc >=0.4 && <0.5 + , mtl >=2.2 && <2.3 + , process >=1.2 && <1.5 + , quickcheck-instances >=0.3 && <0.4 + , random >=1 && <2 + , text >=1 && <2 + , transformers >=0.4 && <0.6 + , uuid >=1 && <2 if flag(hasDBus) cpp-options: -DDBusMock - other-modules: - Bluetooth.TypesSpec - BluetoothSpec - Doctest - Mock - Spec default-language: Haskell2010 diff --git a/examples/Auth.hs b/examples/Auth.hs index 9b7409c..484b936 100644 --- a/examples/Auth.hs +++ b/examples/Auth.hs @@ -1,4 +1,4 @@ -module Main (main) where +module Auth (main) where -- This examples contains a simple Characteristic which only allows encrypted -- authenticated reads. If the device pairing was not authenticated and diff --git a/examples/HeartRate.hs b/examples/HeartRate.hs index 357d393..b3e1c14 100644 --- a/examples/HeartRate.hs +++ b/examples/HeartRate.hs @@ -1,5 +1,5 @@ {-# OPTIONS_GHC -fno-warn-type-defaults #-} -module Main (main) where +module HeartRate (main) where -- This example contains a demonstration of the standard Heart Rate Service -- (HRS). It serves as an examples of using notifications. @@ -14,7 +14,6 @@ import Control.Concurrent import Control.Monad import Control.Monad.IO.Class import Data.IORef -import Data.Monoid import Data.String (fromString) import Data.Word (Word8) import System.Log.Logger diff --git a/examples/HeartRateClient.hs b/examples/HeartRateClient.hs index 7258566..cabee6d 100644 --- a/examples/HeartRateClient.hs +++ b/examples/HeartRateClient.hs @@ -1,4 +1,4 @@ -module Main (main) where +module HeartRateClient (main) where import Bluetooth import Control.Concurrent diff --git a/package.yaml b/package.yaml index a5cb005..dba955e 100644 --- a/package.yaml +++ b/package.yaml @@ -21,7 +21,7 @@ flags: bluez543: description: Bluez version 5.43 or greater manual: True - default: False + default: True hasBluez: description: Whether to run tests that require Bluez manual: True @@ -115,7 +115,8 @@ executables: readme: main: README.lhs source-dirs: examples - ghc-options: -pgmL markdown-unlit + ghc-options: -pgmL markdown-unlit + other-modules: [] dependencies: - ble - stm @@ -123,19 +124,27 @@ executables: hrs: main: HeartRate.hs source-dirs: examples - ghc-options: -threaded + ghc-options: -threaded -main-is HeartRate + other-modules: [] dependencies: - ble - hslogger - - optparse-applicative >= 0.12 && < 0.14 + - optparse-applicative auth: main: Auth.hs source-dirs: examples + ghc-options: -main-is Auth + other-modules: [] dependencies: - ble + - hslogger + - optparse-applicative hrs-client: main: HeartRateClient.hs source-dirs: examples - ghc-options: -threaded + ghc-options: -threaded -main-is HeartRateClient + other-modules: [] dependencies: - ble + - hslogger + - optparse-applicative diff --git a/stack.yaml b/stack.yaml index 51b2f67..3111a99 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,10 +1,13 @@ +resolver: lts-13.2 +allow-newer: true flags: ble: hasDBus: true extra-package-dbs: [] packages: - '.' +- location: + git: 'https://github.com/afcady/d-bus/' + commit: '2dd54818eca2a2af9a9688f648d00cc1325df838' + extra-dep: true extra-deps: -- d-bus-0.1.6 -- xml-picklers-0.3.6 -resolver: lts-8.13 From 745f40019d9c15f155e9fb1c470240e7f44aab1c Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Sat, 12 Jan 2019 13:08:09 -0500 Subject: [PATCH 2/3] fix build of the tests --- ble.cabal | 32 ++++++++++++++++++++++++++++++-- package.yaml | 23 ++++++++++++++++------- test/Doctest.hs | 2 +- 3 files changed, 47 insertions(+), 10 deletions(-) diff --git a/ble.cabal b/ble.cabal index fa39542..ae62736 100644 --- a/ble.cabal +++ b/ble.cabal @@ -4,7 +4,7 @@ cabal-version: 1.12 -- -- see: https://github.com/sol/hpack -- --- hash: 2eaf7b48d485892509d025b3573af73d212bf5d4cf8b7188580eaf6e00ddd6a6 +-- hash: e84816ecce58303c3c92194095e508043f72b435f98d5d844393572a38db85b6 name: ble version: 0.4.2 @@ -189,13 +189,41 @@ executable readme cpp-options: -DDBusMock default-language: Haskell2010 +test-suite doctest + type: exitcode-stdio-1.0 + main-is: Doctest.hs + hs-source-dirs: + test + default-extensions: AutoDeriveTypeable ConstraintKinds DataKinds DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs KindSignatures MultiParamTypeClasses OverloadedStrings RankNTypes ScopedTypeVariables TypeFamilies TypeOperators + ghc-options: -Wall -main-is Doctest + build-depends: + Glob >=0.7 && <0.8 + , base >=4.8 && <4.10 + , bytestring >=0.10 && <0.11 + , cereal >=0.4 && <0.6 + , containers >=0.5 && <0.6 + , d-bus >=0.1.5 && <0.2 + , data-default-class >=0.0 && <0.2 + , doctest >=0.9 && <0.12 + , filepath + , microlens >=0.4 && <0.5 + , microlens-ghc >=0.4 && <0.5 + , mtl >=2.2 && <2.3 + , random >=1 && <2 + , text >=1 && <2 + , transformers >=0.4 && <0.6 + , uuid >=1 && <2 + , yaml ==0.8.* + if flag(hasDBus) + cpp-options: -DDBusMock + default-language: Haskell2010 + test-suite spec type: exitcode-stdio-1.0 main-is: Main.hs other-modules: Bluetooth.TypesSpec BluetoothSpec - Doctest Mock Spec Paths_ble diff --git a/package.yaml b/package.yaml index dba955e..3e32d53 100644 --- a/package.yaml +++ b/package.yaml @@ -96,6 +96,12 @@ tests: spec: main: Main.hs source-dirs: test + other-modules: + - Bluetooth.TypesSpec + - BluetoothSpec + - Mock + - Spec + - Paths_ble dependencies: - ble - hspec > 2 && < 3 @@ -103,13 +109,16 @@ tests: - quickcheck-instances >= 0.3 && < 0.4 - process >= 1.2 && < 1.5 - hslogger -# doctest: -# main: Doctest.hs -# source-dirs: test -# dependencies: -# - doctest >= 0.9 && < 0.12 -# - Glob >= 0.7 && < 0.8 -# - yaml == 0.8.* + doctest: + main: Doctest.hs + source-dirs: test + ghc-options: -main-is Doctest + other-modules: [] + dependencies: + - doctest >= 0.9 && < 0.12 + - Glob >= 0.7 && < 0.8 + - yaml == 0.8.* + - filepath executables: readme: diff --git a/test/Doctest.hs b/test/Doctest.hs index 849dbbd..2d528be 100644 --- a/test/Doctest.hs +++ b/test/Doctest.hs @@ -1,4 +1,4 @@ -module Main (main) where +module Doctest (main) where -- Runs doctest on all files in "src" dir. Assumes: -- (a) You are using hpack From 6d5a180d1223739c77c339f652035bda92cd0301 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Sat, 12 Jan 2019 13:30:38 -0500 Subject: [PATCH 3/3] eliminate deprecation warning --- test/Doctest.hs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/Doctest.hs b/test/Doctest.hs index 2d528be..61be516 100644 --- a/test/Doctest.hs +++ b/test/Doctest.hs @@ -18,9 +18,6 @@ instance FromJSON Exts where main :: IO () main = do - hpack' <- decodeFile "package.yaml" - hpack <- case hpack' of - Nothing -> return $ Exts [] - Just v -> return v + hpack <- either (const $ Exts []) id <$> decodeFileEither "package.yaml" files <- glob "src/**/*.hs" doctest $ files ++ fmap ("-X" ++) (getExts hpack)