Commit 6867dd5
committed
cabal-install: call Cabal in-library
This architectural change ensures that we build packages using Cabal
library functions (using a Haskell library interface) instead of going
via the command-line interface of Setup.hs, as much as possible.
The main changes are in SetupWrapper: the old InternalMethod becomes
LibraryMethod, which builds the package by calling Cabal library functions.
This is used to build all packages unless build-type: Custom or there is
a Cabal library version mismatch which requires us to fall back to
compiling Setup.hs and running that.
The SelfExec method as well as forceExternalSetupMethod are removed:
they no longer have any purpose, as builds can now be carried out
concurrently thanks to 7b90583 and edb808a.
This change required a bit of GADT trickery to accomodate the fact that
configure returns a LocalBuildInfo which must then be passed to
subsequent phases, while with the old Setup interface everything returns
`IO ()` and communication is done through the filesystem (the local
build info file).
The new Distribution.Client.InLibrary module contains all the necessary
framework for taking information that cabal-install has and invoking
Cabal library functions to perform the appropriate action
(configure, build, test, bench, ...).
Most of these are pretty simple; the main difficulty is with configure
as we need to jump to the part of the Cabal configure code that
continues after figuring out information about the system (e.g. compiler
information, dependency information determined by the solver), to avoid
wasting work with Cabal rediscovering things that cabal-install already
knows. This required a bit of refactoring in Distribution.Simple.Configure.
Packages with 'build-type: Hooks' are now compiled with the in-library
method (instead of going via Setup.hs). This is achieved as follows:
- The Cabal library provides 'Distribution.Simple.SetupHooks.HooksMain',
which exposes `hooksMain :: SetupHooks -> IO ()`. This allows us
to turn any definition of `SetupHooks` into an external hooks
executable.
- The new `hooks-exe` library, which `cabal-install` depends on,
provides the logic for communicating with the external hooks
executable (using the `CommunicationHandle` functionality from
haskell/process#308).
This change has been extensively tested by compiling clc-stackage and
diffing the differences in LocalBuildInfo (i.e. the output of the
configure step).1 parent e7cf0cb commit 6867dd5
69 files changed
Lines changed: 3267 additions & 1409 deletions
File tree
- Cabal
- src/Distribution
- Simple
- Program
- SetupHooks
- Test
- bootstrap
- cabal-install
- src/Distribution/Client
- ProjectBuilding
- ProjectPlanning
- tests
- cabal-testsuite
- PackageTests
- AutogenModules
- MainIsBench
- MainIsExe
- MainIsTest
- BuildAutogenPackageGuard
- LibraryBytecodeUnsupported
- NewBuild/CmdRun/ScriptLiterate
- NoOSSupport
- DynExe
- RelocatableExe
- Project/CoverageProject
- pkg-a
- Regression
- T5318
- T6440
- T7234/Success
- T9640
- SetupHooks/SetupHooksRecompilation
- src
- WithRepl/SimpleTests
- main
- changelog.d
- hooks-exe
- cli/Distribution/Client/SetupHooks
- CallHooksExe
- project-cabal/pkgs
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | | - | |
| 51 | + | |
53 | 52 | | |
54 | 53 | | |
55 | 54 | | |
| |||
165 | 164 | | |
166 | 165 | | |
167 | 166 | | |
| 167 | + | |
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
174 | 183 | | |
175 | 184 | | |
176 | 185 | | |
| |||
188 | 197 | | |
189 | 198 | | |
190 | 199 | | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
198 | 208 | | |
199 | 209 | | |
200 | 210 | | |
| |||
229 | 239 | | |
230 | 240 | | |
231 | 241 | | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
240 | 251 | | |
241 | 252 | | |
242 | 253 | | |
| |||
245 | 256 | | |
246 | 257 | | |
247 | 258 | | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
255 | 267 | | |
256 | 268 | | |
257 | 269 | | |
| |||
260 | 272 | | |
261 | 273 | | |
262 | 274 | | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
270 | 283 | | |
271 | 284 | | |
272 | 285 | | |
| |||
930 | 943 | | |
931 | 944 | | |
932 | 945 | | |
933 | | - | |
934 | | - | |
| 946 | + | |
| 947 | + | |
935 | 948 | | |
936 | 949 | | |
937 | 950 | | |
938 | 951 | | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
939 | 956 | | |
940 | 957 | | |
941 | 958 | | |
| |||
1155 | 1172 | | |
1156 | 1173 | | |
1157 | 1174 | | |
1158 | | - | |
1159 | | - | |
1160 | | - | |
1161 | | - | |
1162 | | - | |
1163 | | - | |
1164 | | - | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
1165 | 1183 | | |
1166 | 1184 | | |
1167 | 1185 | | |
| |||
1172 | 1190 | | |
1173 | 1191 | | |
1174 | 1192 | | |
1175 | | - | |
1176 | | - | |
1177 | | - | |
1178 | | - | |
1179 | | - | |
1180 | | - | |
1181 | | - | |
1182 | | - | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
1183 | 1202 | | |
1184 | 1203 | | |
1185 | 1204 | | |
| |||
0 commit comments