aboutsummaryrefslogtreecommitdiff
path: root/cabal-helper.cabal
blob: 9cc721562a76981f48ac74fe5ee42648d94d2451 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
cabal-version:       2.2
name:                cabal-helper
version:             1.0.0.0
synopsis:
 Simple interface to some of Cabal's configuration state, mainly used by ghc-mod
description:
    Cabal's little helper provides access to build information gathered by
    @cabal@ when configuring a project. Specifically we're interested in
    retrieving enough information to bring up a compiler session, using the GHC
    API, which is similar to running @cabal repl@ in a project.
    .
    While simple in principle this is complicated by the fact that the
    information Cabal writes to disk is in an unstable format and only really
    accessible through the Cabal API itself.
    .
    Since we do not want to bind the user of a development tool which utilises
    this library to a specific version of Cabal we compile the code which
    interfaces with the Cabal library's API on the user's machine, at runtime,
    against whichever version of Cabal was used to write the on disk information
    for a given project.
    .
    If this version of Cabal is not available on the users machine anymore,
    which is fairly likely since cabal-install is usually linked statically, we
    have support for compiling the Cabal library also. In this case the library
    is installed into a private, isolated, package database in
    @$XDG_CACHE_HOME/cabal-helper@ so as to not interfere with the user's
    package database.
license:             GPL-3.0-or-later
license-file:        LICENSE
author:              Daniel Gröber <cabal-helper@dxld.at>
maintainer:          cabal-helper@dxld.at
category:            Distribution
build-type:          Simple
extra-source-files:  README.md
                     src/CabalHelper/Runtime/*.hs

                     tests/*.hs
                     tests/stack-resolvers
                     tests/cabal-versions

                     tests/exelib/*.hs
                     tests/exelib/*.cabal
                     tests/exelib/packages.list
                     tests/exelib/stack.yaml
                     tests/exelib/lib/*.hs

                     tests/exeintlib/*.hs
                     tests/exeintlib/*.cabal
                     tests/exeintlib/packages.list
                     tests/exeintlib/stack.yaml
                     tests/exeintlib/lib/*.hs
                     tests/exeintlib/intlib/*.hs

                     tests/fliblib/*.hs
                     tests/fliblib/*.cabal
                     tests/fliblib/packages.list
                     tests/fliblib/stack.yaml
                     tests/fliblib/lib/*.hs

                     tests/bkpregex/*.hs
                     tests/bkpregex/*.cabal
                     tests/bkpregex/packages.list
                     tests/bkpregex/stack.yaml
                     tests/bkpregex/regex-example/*.hs
                     tests/bkpregex/regex-indef/*.hs
                     tests/bkpregex/regex-indef/*.hsig
                     tests/bkpregex/regex-types/Regex/*.hs
                     tests/bkpregex/str-impls/Str/*.hs

                     tests/multipkg/packages.list
                     tests/multipkg/pkg-oot/*.cabal
                     tests/multipkg/pkg-oot/*.hs
                     tests/multipkg/proj/*.cabal
                     tests/multipkg/proj/*.hs
                     tests/multipkg/proj/cabal.project
                     tests/multipkg/proj/pkg-a/*.cabal
                     tests/multipkg/proj/pkg-a/*.hs
                     tests/multipkg/proj/pkg-b/*.cabal
                     tests/multipkg/proj/pkg-b/*.hs
                     tests/multipkg/proj/stack.yaml


source-repository head
  type:     git
  location: https://github.com/DanielG/cabal-helper.git

flag dev
  description: Build development components
  default:     False
  manual:      True


common extensions
  default-language:    Haskell2010
  default-extensions:  NondecreasingIndentation
                       ImplicitParams
                       NamedFieldPuns RecordWildCards
                       FlexibleContexts
                       ConstraintKinds
  other-extensions:    TemplateHaskell

common build-deps
  build-depends:       base             < 5    && >= 4.8
                     , Cabal            < 2.5  && >= 2.0     || < 1.26 && >= 1.14
                     , cabal-plan       < 0.6  && >= 0.5.0.0
                     , clock            < 0.8  && >= 0.7.2
                     , containers       < 1    && >= 0.5.5.1
                     , bytestring       < 0.11 && >= 0.9.2.1
                     , directory        < 1.4  && >= 1.2.1.0
                     , filepath         < 1.5  && >= 1.3.0.0
                     , mtl              < 2.3  && >= 2.0
                     , process          < 1.7  && >= 1.2.3.0
                     , pretty-show      < 1.9  && >= 1.8.1
                     , semigroups       < 0.19 && >= 0.18
                     , semigroupoids    < 5.4  && >= 5.2
                     , SHA              < 1.7  && >= 1.6.4.4
                     , text             < 1.3  && >= 1.0.0.0
                     , template-haskell < 2.15 && >= 2.7.0.0
                     , temporary        < 1.3  && >= 1.2.1
                     , time             < 1.9  && >= 1.5.0.1
                     , transformers     < 0.6  && >= 0.3.0.0
  if !os(windows)
    build-depends:     unix             < 2.8  && >= 2.5.1.1
  build-depends:       unix-compat      < 0.6  && >= 0.4.3.1
                     , utf8-string      < 1.1  && >= 1.0.1.1
  if flag(dev)
    ghc-options:       -Wall


library c-h-internal
  import:             build-deps, extensions
  exposed-modules:
                       CabalHelper.Compiletime.Cabal
                       CabalHelper.Compiletime.Compat.Environment
                       CabalHelper.Compiletime.Compat.ProgramDb
                       CabalHelper.Compiletime.Compat.Version
                       CabalHelper.Compiletime.Compat.Parsec
                       CabalHelper.Compiletime.Compile
                       CabalHelper.Compiletime.Data
                       CabalHelper.Compiletime.Log
                       CabalHelper.Compiletime.Process
                       CabalHelper.Compiletime.Program.CabalInstall
                       CabalHelper.Compiletime.Program.Stack
                       CabalHelper.Compiletime.Program.GHC
                       CabalHelper.Compiletime.Sandbox
                       CabalHelper.Compiletime.Types
                       CabalHelper.Compiletime.Types.RelativePath
                       CabalHelper.Runtime.Compat
                       CabalHelper.Runtime.HelperMain
                       CabalHelper.Shared.Common
                       CabalHelper.Shared.InterfaceTypes
  other-modules:
                       Paths_cabal_helper
  autogen-modules:
                       Paths_cabal_helper
  hs-source-dirs:      src

library
  import:              build-deps, extensions
  exposed-modules:     Distribution.Helper
                       Distribution.Helper.Discover
  other-modules:
                       Paths_cabal_helper
  autogen-modules:
                       Paths_cabal_helper
  hs-source-dirs:      lib
  build-depends:       c-h-internal

test-suite compile-test
  import:              build-deps, extensions
  type:                exitcode-stdio-1.0
  main-is:             CompileTest.hs
  hs-source-dirs:      tests
  ghc-options:         -Wall
  build-depends:       c-h-internal



test-suite ghc-session
  import:              build-deps, extensions
  type:                exitcode-stdio-1.0
  main-is:             GhcSession.hs
  hs-source-dirs:      tests
  ghc-options:         -Wall
  build-depends:       ghc              < 8.7  && >= 7.10
                     , ghc-paths        < 0.2  && >= 0.1.0.9
                     , cabal-helper
                     , c-h-internal

test-suite examples
  import:              build-deps, extensions
  type:                exitcode-stdio-1.0
  main-is:             Examples.hs
  hs-source-dirs:      tests
  ghc-options:         -Wall
  build-depends:       cabal-helper

executable cabal-helper-main
  default-language:    Haskell2010
  default-extensions:  NondecreasingIndentation
  main-is:             CabalHelper/Runtime/Main.hs
  hs-source-dirs:      src
  other-modules:
                       CabalHelper.Runtime.HelperMain
                       CabalHelper.Runtime.Compat
                       CabalHelper.Shared.Common
                       CabalHelper.Shared.InterfaceTypes
                       CabalHelper.Shared.Common

  -- This component is usually built at runtime but during development it's
  -- convinient to build it via cabal
  if flag(dev)
    buildable:         True
  else
    buildable:         False

  ghc-options:         -Wall -fno-warn-unused-imports
  build-depends:       base             < 5    && >= 4.8
                     , Cabal
                     , containers
                     , bytestring
                     , filepath
                     , directory
                     , ghc-prim