@@ -32,7 +32,7 @@ performs the actual building, while the last both copies the build
3232results to some permanent place and registers the package with GHC.
3333
3434.. note ::
35-
35+
3636 Global installing of packages is not recommended.
3737 The :ref:`nix-style-builds` is the preferred way of building and installing
3838 packages.
@@ -1034,6 +1034,61 @@ Miscellaneous options
10341034 Specify a soft constraint on versions of a package. The solver will
10351035 attempt to satisfy these preferences on a "best-effort" basis.
10361036
1037+ .. option :: --enable-build-info
1038+
1039+ Generate accurate build information for build components.
1040+
1041+ Information contains meta information, such as component type, compiler type, and
1042+ Cabal library version used during the build, but also fine grained information,
1043+ such as dependencies, what modules are part of the component, etc...
1044+
1045+ On build, a file ``build-info.json `` (in the ``json `` format) will be written to
1046+ the root of the build directory.
1047+
1048+ .. note ::
1049+ The format and fields of the generated build information is currently
1050+ experimental. In the future we might add or remove fields, depending
1051+ on the needs of other tooling.
1052+
1053+ :: example
1054+ {
1055+ "cabal-lib-version": "<cabal version>",
1056+ "compiler": {
1057+ "flavour": "<compiler name>",
1058+ "compiler-id": "<compiler id>",
1059+ "path": "<absolute path of the compiler>"
1060+ },
1061+ "components": [
1062+ {
1063+ "type": "<component type, e.g. lib | bench | exe | flib | test>",
1064+ "name": "<component name>",
1065+ "unit-id": "<unitid>",
1066+ "compiler-args": [
1067+ "<compiler args necessary for compilation>"
1068+ ],
1069+ "modules": [
1070+ "<modules in this component>"
1071+ ],
1072+ "src-files": [
1073+ "<source files relative to hs-src-dirs>"
1074+ ],
1075+ "hs-src-dirs": [
1076+ "<source directories of this component>"
1077+ ],
1078+ "src-dir": "<root directory of this component>",
1079+ "cabal-file": "<cabal file location>"
1080+ }
1081+ ]
1082+ }
1083+
1084+ .. jsonschema :: ./json-schemas/build-info.schema.json
1085+
1086+ .. option :: --disable-build-info
1087+
1088+ (default) Do not generate detailed build information for built components.
1089+
1090+ Already generated `build-info.json ` files will be removed since they would be stale otherwise.
1091+
10371092.. option :: --disable-response-files
10381093
10391094 Enable workaround for older versions of programs such as ``ar `` or
@@ -1132,7 +1187,7 @@ This command takes the following options:
11321187.. option :: --hscolour-css=path
11331188
11341189 The argument *path * denotes a CSS file, which is passed to HsColour _ as in
1135-
1190+
11361191 ::
11371192
11381193 $ runhaskell Setup.hs hscolour --css=*path*
@@ -1358,7 +1413,7 @@ the package.
13581413 results in real time).
13591414
13601415.. option :: --test-options=options
1361-
1416+
13621417 Give extra options to the test executables.
13631418
13641419.. option :: --test-option=option
0 commit comments