Skip to content

Commit b0fd93a

Browse files
committed
Adapt naming to fit to plan.json
1 parent 64c59ff commit b0fd93a

File tree

1 file changed

+27
-26
lines changed

1 file changed

+27
-26
lines changed

Cabal/Distribution/Simple/ShowBuildInfo.hs

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
-- |
22
-- This module defines a simple JSON-based format for exporting basic
33
-- information about a Cabal package and the compiler configuration Cabal
4-
-- would use to build it. This can be produced with the @cabal show-build-info@
5-
-- command.
4+
-- would use to build it. This can be produced with the
5+
-- @cabal new-show-build-info@ command.
6+
--
67
--
78
-- This format is intended for consumption by external tooling and should
89
-- therefore be rather stable. Moreover, this allows tooling users to avoid
@@ -13,42 +14,42 @@
1314
-- Below is an example of the output this module produces,
1415
--
1516
-- @
16-
-- { "cabal_version": "1.23.0.0",
17+
-- { "cabal-version": "1.23.0.0",
1718
-- "compiler": {
1819
-- "flavor": "GHC",
19-
-- "compiler_id": "ghc-7.10.2",
20+
-- "compiler-id": "ghc-7.10.2",
2021
-- "path": "/usr/bin/ghc",
2122
-- },
2223
-- "components": [
23-
-- { "type": "library",
24-
-- "name": "CLibName",
25-
-- "compiler_args":
24+
-- { "type": "lib",
25+
-- "name": "lib:Cabal",
26+
-- "compiler-args":
2627
-- ["-O", "-XHaskell98", "-Wall",
2728
-- "-package-id", "parallel-3.2.0.6-b79c38c5c25fff77f3ea7271851879eb"]
2829
-- "modules": ["Project.ModA", "Project.ModB", "Paths_project"],
29-
-- "source_files": [],
30-
-- "source_dirs": ["src"]
30+
-- "src-files": [],
31+
-- "src-dirs": ["src"]
3132
-- }
3233
-- ]
3334
-- }
3435
-- @
3536
--
36-
-- The @cabal_version@ property provides the version of the Cabal library
37+
-- The @cabal-version@ property provides the version of the Cabal library
3738
-- which generated the output. The @compiler@ property gives some basic
3839
-- information about the compiler Cabal would use to compile the package.
3940
--
4041
-- The @components@ property gives a list of the Cabal 'Component's defined by
4142
-- the package. Each has,
4243
--
43-
-- * @type@: the type of the component (one of @library@, @executable@,
44-
-- @test-suite@, or @benchmark@)
44+
-- * @type@: the type of the component (one of @lib@, @exe@,
45+
-- @test@, @bench@, or @flib@)
4546
-- * @name@: a string serving to uniquely identify the component within the
4647
-- package.
47-
-- * @compiler_args@: the command-line arguments Cabal would pass to the
48+
-- * @compiler-args@: the command-line arguments Cabal would pass to the
4849
-- compiler to compile the component
4950
-- * @modules@: the modules belonging to the component
50-
-- * @source_dirs@: a list of directories where the modules might be found
51-
-- * @source_files@: any other Haskell sources needed by the component
51+
-- * @src-dirs@: a list of directories where the modules might be found
52+
-- * @src-files@: any other Haskell sources needed by the component
5253
--
5354
-- Note: At the moment this is only supported when using the GHC compiler.
5455
--
@@ -84,14 +85,14 @@ mkBuildInfo pkg_descr lbi _flags targetsToBuild = info
8485
k .= v = (k, v)
8586

8687
info = JsonObject
87-
[ "cabal_version" .= JsonString (display cabalVersion)
88+
[ "cabal-version" .= JsonString (display cabalVersion)
8889
, "compiler" .= mkCompilerInfo
8990
, "components" .= JsonArray (map mkComponentInfo componentsToBuild)
9091
]
9192

9293
mkCompilerInfo = JsonObject
9394
[ "flavour" .= JsonString (prettyShow $ compilerFlavor $ compiler lbi)
94-
, "compiler_id" .= JsonString (showCompilerId $ compiler lbi)
95+
, "compiler-id" .= JsonString (showCompilerId $ compiler lbi)
9596
, "path" .= path
9697
]
9798
where
@@ -101,25 +102,25 @@ mkBuildInfo pkg_descr lbi _flags targetsToBuild = info
101102
mkComponentInfo (name, clbi) = JsonObject
102103
[ "type" .= JsonString compType
103104
, "name" .= JsonString (prettyShow name)
104-
, "compiler_args" .= JsonArray (map JsonString $ getCompilerArgs bi lbi clbi)
105+
, "compiler-args" .= JsonArray (map JsonString $ getCompilerArgs bi lbi clbi)
105106
, "modules" .= JsonArray (map (JsonString . display) modules)
106-
, "source_files" .= JsonArray (map JsonString source_files)
107-
, "source_dirs" .= JsonArray (map JsonString $ hsSourceDirs bi)
107+
, "src-files" .= JsonArray (map JsonString sourceFiles)
108+
, "src-dirs" .= JsonArray (map JsonString $ hsSourceDirs bi)
108109
]
109110
where
110111
bi = componentBuildInfo comp
111112
Just comp = lookupComponent pkg_descr name
112113
compType = case comp of
113-
CLib _ -> "library"
114-
CExe _ -> "executable"
115-
CTest _ -> "test-suite"
116-
CBench _ -> "benchmark"
117-
CFLib _ -> "foreign-library"
114+
CLib _ -> "lib"
115+
CExe _ -> "exe"
116+
CTest _ -> "test"
117+
CBench _ -> "bench"
118+
CFLib _ -> "flib"
118119
modules = case comp of
119120
CLib lib -> explicitLibModules lib
120121
CExe exe -> exeModules exe
121122
_ -> []
122-
source_files = case comp of
123+
sourceFiles = case comp of
123124
CLib _ -> []
124125
CExe exe -> [modulePath exe]
125126
_ -> []

0 commit comments

Comments
 (0)