From 0620ec984097ed082d559924a02fecd2cf9c113a Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sun, 19 Oct 2014 09:37:18 -0700 Subject: [PATCH] fix redundant compilation in the hledger packages, at last This seems to work well now with my haddock and GHC 7.8. Not tested with GHC 7.6 though. --- hledger-lib/hledger-lib.cabal | 13 ++++++---- hledger-web/hledger-web.cabal | 32 +++++------------------ hledger/hledger.cabal | 49 ++++++++++++----------------------- 3 files changed, 31 insertions(+), 63 deletions(-) diff --git a/hledger-lib/hledger-lib.cabal b/hledger-lib/hledger-lib.cabal index 3cd8aad30..ba6a119a0 100644 --- a/hledger-lib/hledger-lib.cabal +++ b/hledger-lib/hledger-lib.cabal @@ -30,13 +30,18 @@ extra-source-files: -- sample.ledger -- sample.timelog +source-repository head + type: git + location: https://github.com/simonmichael/hledger + flag double Description: Use old Double number representation (instead of Decimal), for testing/benchmarking. Default: False + library -- should set patchlevel here as in Makefile - cpp-options: -DPATCHLEVEL=0 + cpp-options: -DPATCHLEVEL=0 ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures ghc-options: -fno-warn-type-defaults -fno-warn-orphans if flag(double) @@ -100,13 +105,11 @@ library if impl(ghc >= 7.4) build-depends: pretty-show >= 1.6.4 -source-repository head - type: git - location: https://github.com/simonmichael/hledger test-suite tests type: exitcode-stdio-1.0 - main-is: tests/suite.hs + main-is: suite.hs + hs-source-dirs: tests ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures ghc-options: -fno-warn-type-defaults -fno-warn-orphans default-language: Haskell2010 diff --git a/hledger-web/hledger-web.cabal b/hledger-web/hledger-web.cabal index 3d277198b..fc5fafe7c 100644 --- a/hledger-web/hledger-web.cabal +++ b/hledger-web/hledger-web.cabal @@ -77,6 +77,7 @@ flag library-only Description: Build for use with "yesod devel" Default: False + library cpp-options: -DVERSION="0.23.98" if flag(dev) || flag(library-only) @@ -101,8 +102,7 @@ library -- EmptyDataDecls -- NoMonomorphismRestriction - hs-source-dirs: . app - exposed-modules: Application + exposed-modules: Application Foundation Import Settings @@ -117,7 +117,7 @@ library Handler.RootR Handler.SidebarR Handler.Utils - other-modules: + -- other-modules: Hledger.Web Hledger.Web.Main Hledger.Web.Options @@ -206,31 +206,13 @@ executable hledger-web TemplateHaskell TypeFamilies - hs-source-dirs: . app + hs-source-dirs: app main-is: main.hs - other-modules: - Application - Foundation - Import - Settings - Settings.StaticFiles - Settings.Development - Handler.Common - Handler.JournalEditR - Handler.JournalEntriesR - Handler.JournalR - Handler.Post - Handler.RegisterR - Handler.RootR - Handler.SidebarR - Handler.Utils - Hledger.Web - Hledger.Web.Main - Hledger.Web.Options build-depends: - hledger == 0.23.98 - , hledger-lib == 0.23.98 + hledger-lib == 0.23.98 + , hledger == 0.23.98 + , hledger-web == 0.23.98 , base >= 4 && < 5 , bytestring , clientsession diff --git a/hledger/hledger.cabal b/hledger/hledger.cabal index 0c91aab2b..a14dc6918 100644 --- a/hledger/hledger.cabal +++ b/hledger/hledger.cabal @@ -41,12 +41,12 @@ flag threaded Description: Build with support for multithreaded execution Default: True + library cpp-options: -DVERSION="0.23.98" ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures ghc-options: -fno-warn-type-defaults -fno-warn-orphans default-language: Haskell2010 - -- should be the same as below exposed-modules: Hledger.Cli Hledger.Cli.Main @@ -64,7 +64,6 @@ library Hledger.Cli.Print Hledger.Cli.Register Hledger.Cli.Stats - -- should be the same as below build-depends: hledger-lib == 0.23.98 ,base >= 4.3 && < 5 @@ -103,42 +102,20 @@ library if impl(ghc >= 7.4) build-depends: pretty-show >= 1.6.4 --- should depend on the above to avoid double compilation but this is --- still too complicated as of 2011/6/1 because: --- - breaks haddock, http://hackage.haskell.org/trac/hackage/ticket/656 --- - library and executable must have different hs-source-dirs --- - the exe may need to list all the lib's dependencies --- - how it works seems ghc version dependent --- leksah is reported to have this working, http://hackage.haskell.org/packages/archive/leksah/0.10.0.4/leksah.cabal + executable hledger main-is: hledger-cli.hs - -- should be the same as above - other-modules: - Hledger.Cli - Hledger.Cli.Main - Hledger.Cli.Options - Hledger.Cli.Tests - Hledger.Cli.Utils - Hledger.Cli.Version - Hledger.Cli.Add - Hledger.Cli.Accounts - Hledger.Cli.Balance - Hledger.Cli.Balancesheet - Hledger.Cli.Cashflow - Hledger.Cli.Histogram - Hledger.Cli.Incomestatement - Hledger.Cli.Print - Hledger.Cli.Register - Hledger.Cli.Stats + hs-source-dirs: app + default-language: Haskell2010 cpp-options: -DVERSION="0.23.98" ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures ghc-options: -fno-warn-type-defaults -fno-warn-orphans if flag(threaded) ghc-options: -threaded - -- should be the same as above - default-language: Haskell2010 + -- same as above: build-depends: hledger-lib == 0.23.98 + ,hledger == 0.23.98 ,base >= 4.3 && < 5 ,containers ,cmdargs >= 0.10 && < 0.11 @@ -166,12 +143,15 @@ executable hledger if impl(ghc >= 7.4) build-depends: pretty-show >= 1.6.4 + test-suite tests type: exitcode-stdio-1.0 - main-is: tests/suite.hs + main-is: suite.hs + hs-source-dirs: tests + default-language: Haskell2010 ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures ghc-options: -fno-warn-type-defaults -fno-warn-orphans - default-language: Haskell2010 + -- same as above: build-depends: hledger-lib , hledger , base >= 4.3 && < 5 @@ -204,11 +184,14 @@ test-suite tests if impl(ghc >= 7.4) build-depends: pretty-show >= 1.6.4 + +-- not a standard cabal bench test, I think benchmark bench type: exitcode-stdio-1.0 --- hs-source-dirs: src + -- hs-source-dirs: main-is: ../tools/simplebench.hs - ghc-options: -Wall + ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures + ghc-options: -fno-warn-type-defaults -fno-warn-orphans default-language: Haskell2010 build-depends: hledger-lib, hledger,