Skip to content

Commit

Permalink
Add flags that control building the executables (#392)
Browse files Browse the repository at this point in the history
The `readme` and `play-tomland` have very limited usefulness for usual
package users. Therefore it is better to disable them by default in
order to conserve resources.

Additionally, because `build-tool-depends` as used in the `readme`
executable are currently unsupported by Hackage's docs builder,
automated docs builds didn't work for `tomland` and any packages that
depend on it.

Context:
haskell/hackage-server#988 (comment)
  • Loading branch information
sjakobi authored Nov 8, 2021
1 parent 097889f commit 253defa
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
4 changes: 4 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
packages: .

package tomland
flags: +build-readme +build-play-tomland
5 changes: 5 additions & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ resolver: lts-17.5

extra-deps:
- hashable-1.3.1.0

flags:
tomland:
build-readme: true
build-play-tomland: true
14 changes: 12 additions & 2 deletions tomland.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ source-repository head
type: git
location: https://github.com/kowainik/tomland.git

flag build-readme
description: Build README generator.
default: False
manual: True

flag build-play-tomland
description: Build play-tomland executable.
default: False
manual: True

common common-options
build-depends: base >= 4.11 && < 4.16

Expand Down Expand Up @@ -132,7 +142,7 @@ library
executable readme
import: common-options
-- doesn't work on windows for unknown reasons
if os(windows)
if !flag(build-readme) || os(windows)
buildable: False
main-is: README.lhs
build-depends: tomland
Expand All @@ -145,7 +155,7 @@ executable readme
executable play-tomland
import: common-options
-- We are using DerivingVia that works only with > 8.6
if impl(ghc < 8.6)
if !flag(build-play-tomland) || impl(ghc < 8.6)
buildable: False
main-is: Main.hs
build-depends: tomland
Expand Down

0 comments on commit 253defa

Please sign in to comment.