Skip to content

Commit

Permalink
refactor cabal file to support multi home units.
Browse files Browse the repository at this point in the history
  • Loading branch information
hughjfchen committed Jan 17, 2023
1 parent c0662ee commit 6d4a6d1
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
--command="cabal new-repl {{name}}:exe:{{name}}" --test=":!cabal new-test {{name}}:test:{{name}}-test"
--command="cabal new-repl lib:{{name}} -f ghcidlibwithtest" --test="TestMain.main" --setup=":load test/Spec.hs"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.4
cabal-version: 3.0
name: {{name}}
version: 0.0.0.0
version: 0.1.0.0
synopsis: {{description}}.
description: {{description}}.
homepage: https://github.com/hughjfchen/{{name}}
Expand All @@ -9,7 +9,7 @@ license: MIT
license-file: LICENSE
author: Hugh JF Chen
maintainer: Hugh JF Chen <hugh.jf.chen@gmail.com>
copyright: 2021 Hugh JF Chen
copyright: 2023 Hugh JF Chen
category: Network
build-type: Simple
extra-doc-files: README.md
Expand All @@ -20,20 +20,82 @@ source-repository head
type: git
location: https://github.com/hughjfchen/{{name}}.git

common common-options
build-depends: base >= 4.11.1.0 && < 4.15
, relude
, text
, bytestring
, mtl
, transformers
, containers
, unordered-containers
flag ghcidlibwithtest
description: provide test support with the lib for ghcid
default: False

mixins: base hiding (Prelude)
, relude (Relude as Prelude)
, relude
flag ghcidappwithtest
description: provide test support with the app for ghcid
default: False

common c-base
build-depends: base >= 4.11.1.0 && < 4.15

common c-relude
build-depends: relude
mixins: base hiding (Prelude)
, relude (Relude as Prelude)
, relude

common c-basic-pkgs
build-depends: text
, bytestring
, mtl
, transformers
, containers
, unordered-containers
, exceptions

common c-json
build-depends: aeson
, aeson-pretty

common c-io
build-depends: filepath
, path
, path-io

common c-test
build-depends: hspec
, hedgehog
, hspec-hedgehog

common c-bench
build-depends: gauge

common c-app
build-depends: optparse-applicative ^>= 0.16.1.0
, unix-compat
, time
, Glob

common c-lens
build-depends: lens

common c-parse
build-depends: parsec
, megaparsec

common c-xml
import: c-lens
build-depends: xml-conduit
, xml-lens

common c-propellor
build-depends: propellor

common c-conf-parse
build-depends: language-conf

common c-ghcidlibwithtest
if flag(ghcidlibwithtest)
import: c-test

common c-ghcidappwithtest
if flag(ghcidappwithtest)
import: c-test

common c-options
ghc-options: -Wall
-Wcompat
-Widentities
Expand All @@ -51,15 +113,20 @@ common common-options
if impl(ghc >= 8.10)
ghc-options: -Wunused-packages

common c-language
default-language: Haskell2010

common c-extensions
default-extensions: ConstraintKinds
DeriveAnyClass
DeriveFunctor
DeriveDataTypeable
DeriveGeneric
DerivingStrategies
FlexibleContexts
FlexibleInstances
GeneralizedNewtypeDeriving
TemplateHaskell
InstanceSigs
KindSignatures
LambdaCase
Expand All @@ -74,55 +141,81 @@ common common-options
PatternSynonyms

library
import: common-options
import: c-base
, c-basic-pkgs
, c-json
, c-parse
, c-conf-parse
, c-ghcidlibwithtest
, c-relude
, c-options
, c-language
, c-extensions
hs-source-dirs: src
exposed-modules: Core.Types
, Core.MyError
, Core.{{ name | toPascal }}
, Core.MyError
, Core.OrphanInstances
, Has
, As
, Error
, MonadStack
, Capability.{{ name | toPascal }}

executable {{name}}
import: common-options
import: c-base
, c-basic-pkgs
, c-json
, c-parse
, c-io
, c-propellor
, c-lens
, c-xml
, c-app
, c-ghcidappwithtest
, c-relude
, c-options
, c-language
, c-extensions
hs-source-dirs: app
main-is: Main.hs
other-modules: Paths_{{ name | toSnake }}
, CmdLine
other-modules: Paths_{{name | toSnake }}
, AppM
, AppEnv
, AppError
, Utils
, CmdLine
, AppCapability.{{ name | toPascal }}
, FromConfig.PostgresqlSimple
, FromConfig.ResourcePool
, FromConfig.{{ name | toPascal }}
build-depends: {{name}}
, optparse-applicative
, conferer
, postgresql-simple
, resource-pool
, time
ghc-options: -threaded
-rtsopts
-with-rtsopts=-N

test-suite {{name}}-test
import: common-options
import: c-base
, c-parse
, c-conf-parse
, c-test
, c-relude
, c-options
, c-language
, c-extensions
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Spec.hs
build-depends: {{name}}
, hspec
, hedgehog
, hspec-hedgehog
ghc-options: -threaded
-rtsopts
-with-rtsopts=-N
other-modules: Paths_{{name | toSnake}}

benchmark {{name}}-benchmark
import: common-options
import: c-base
, c-bench
, c-relude
, c-options
, c-language
, c-extensions
type: exitcode-stdio-1.0
hs-source-dirs: benchmark
main-is: Main.hs
Expand Down

0 comments on commit 6d4a6d1

Please sign in to comment.