Skip to content

Commit

Permalink
feat: support hledger-ui on windows
Browse files Browse the repository at this point in the history
Introduced or bumped dependencies:

- brick-2.1.1
- vty-6.1
- vty-crossplatform-0.4.0.0
- vty-windows-0.2.0.1 conditionally on windows (current version of
  vty-crossplatform has 0.2.0.0 as a lower bound, need to put a newer version explcitly;
  once we get a newer vty-crossplatform, we will be able to drop this conditional)
- vty-unix (indirectly via vty-crossplatform)
  • Loading branch information
ShrykeWindgrace committed Dec 8, 2023
1 parent 63341cd commit 5e6f125
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 22 deletions.
3 changes: 2 additions & 1 deletion hledger-ui/Hledger/UI/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import Data.List (find)
import Data.List.Extra (nubSort)
import Data.Maybe (fromMaybe)
import qualified Data.Text as T
import Graphics.Vty (mkVty, Mode (Mouse), Vty (outputIface), Output (setMode))
import Graphics.Vty (Mode (Mouse), Vty (outputIface), Output (setMode))
import Graphics.Vty.CrossPlatform (mkVty)
import Lens.Micro ((^.))
import System.Directory (canonicalizePath)
import System.Environment (withProgName)
Expand Down
15 changes: 5 additions & 10 deletions hledger-ui/hledger-ui.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ library
ansi-terminal >=0.9
, async
, base >=4.14 && <4.19
, brick >=1.5 && <2
, brick >=2.1.1 && <3
, cmdargs >=0.8
, containers >=0.5.9
, data-default
Expand All @@ -95,14 +95,13 @@ library
, text-zipper >=0.4
, time >=1.5
, transformers
, unix
, vector
, vty >=5.15 && <6
, vty >=6.1 && <7
, vty-crossplatform >=0.4.0.0 && <0.5.0.0
default-language: Haskell2010
if os(windows)
buildable: False
else
buildable: True
build-depends:
vty-windows >=0.2.0.1 && <0.3

executable hledger-ui
main-is: hledger-ui.hs
Expand All @@ -116,9 +115,5 @@ executable hledger-ui
base >=4.14 && <4.19
, hledger-ui
default-language: Haskell2010
if os(windows)
buildable: False
else
buildable: True
if flag(threaded)
ghc-options: -threaded
22 changes: 11 additions & 11 deletions hledger-ui/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ ghc-options:
dependencies:
- base >=4.14 && <4.19

when:
# curses is required to build terminfo for vty for hledger-ui.
# On POSIX systems it might be not present.
# On windows it's very likely not present, but possibly it could be.
Expand All @@ -61,12 +60,10 @@ when:
# curses
# default: True
# description:
# For now, just don't build hledger-ui on windows
- condition: os(windows)
then:
buildable: false
else:
buildable: true
#
# note on windows: the vty-windows (and hence hledger-ui) will reliably work only on the newer backends
# like Windows Terminal.
# mintty-based backends (default for cygwin/gitbash/msys2) are not supported (yet)

library:
source-dirs: .
Expand Down Expand Up @@ -101,10 +98,13 @@ library:
- time >=1.5
- transformers
- vector
# not installable on windows, cf buildable flag below
- brick >=1.5 && <2
- vty >=5.15 && <6
- unix
- brick >=2.1.1 && <3
- vty >=6.1 && <7
- vty-crossplatform >= 0.4.0.0 && < 0.5.0.0
when:
- condition: os(windows)
dependencies: vty-windows >= 0.2.0.1 && < 0.3


executables:
hledger-ui:
Expand Down
5 changes: 5 additions & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,8 @@ nix:
# # "$targets": -Werror
# # "$everything": -O2
# # some-package: -DSOME_CPP_FLAG
extra-deps:
- vty-windows-0.2.0.1
- vty-crossplatform-0.4.0.0
- brick-2.1.1
- vty-6.1

0 comments on commit 5e6f125

Please sign in to comment.