Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Cabal
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Haskell
Cabal
Commits
d7994fde
Commit
d7994fde
authored
9 years ago
by
Mikhail Glushenkov
Browse files
Options
Downloads
Plain Diff
Merge pull request #3056 from 23Skidoo/backport-3012
Backport #3012 to the 1.22 branch
parents
bd526752
0bde9a36
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Cabal/Distribution/Simple/Haddock.hs
+18
-3
18 additions, 3 deletions
Cabal/Distribution/Simple/Haddock.hs
with
18 additions
and
3 deletions
Cabal/Distribution/Simple/Haddock.hs
+
18
−
3
View file @
d7994fde
...
...
@@ -84,14 +84,16 @@ import Language.Haskell.Extension
import
Control.Monad
(
when
,
forM_
)
import
Data.Char
(
isSpace
)
import
Data.Either
(
rights
)
import
Data.Monoid
import
Data.Foldable
(
foldl'
)
import
Data.Maybe
(
fromMaybe
,
listToMaybe
)
import
System.Directory
(
doesFileExist
)
import
System.FilePath
(
(
</>
),
(
<.>
)
,
normalise
,
splitPath
,
joinPath
,
isAbsolute
)
import
System.IO
(
hClose
,
hPutStrLn
,
hSetEncoding
,
utf8
)
import
System.IO
(
hClose
,
hPutStr
,
hPutStrLn
,
hSetEncoding
,
utf8
)
import
Distribution.Version
-- ------------------------------------------------------------------------------
...
...
@@ -467,7 +469,7 @@ renderArgs :: Verbosity
->
IO
a
renderArgs
verbosity
tmpFileOpts
version
comp
args
k
=
do
let
haddockSupportsUTF8
=
version
>=
Version
[
2
,
14
,
4
]
[]
haddockSupportsResponseFiles
=
version
>
Version
[
2
,
16
,
1
]
[]
haddockSupportsResponseFiles
=
version
>
Version
[
2
,
16
,
2
]
[]
createDirectoryIfMissingVerbose
verbosity
True
outputDir
withTempFileEx
tmpFileOpts
outputDir
"haddock-prologue.txt"
$
\
prologueFileName
h
->
do
...
...
@@ -482,7 +484,7 @@ renderArgs verbosity tmpFileOpts version comp args k = do
withTempFileEx
tmpFileOpts
outputDir
"haddock-response.txt"
$
\
responseFileName
hf
->
do
when
haddockSupportsUTF8
(
hSetEncoding
hf
utf8
)
mapM_
(
hPutStr
Ln
hf
)
renderedArgs
hPutStr
hf
$
unlines
$
map
escapeArg
renderedArgs
hClose
hf
let
respFile
=
"@"
++
responseFileName
k
([
respFile
],
result
)
...
...
@@ -500,6 +502,19 @@ renderArgs verbosity tmpFileOpts version comp args k = do
pkgstr
=
display
$
packageName
pkgid
pkgid
=
arg
argPackageName
arg
f
=
fromFlag
$
f
args
-- Support a gcc-like response file syntax. Each separate
-- argument and its possible parameter(s), will be separated in the
-- response file by an actual newline; all other whitespace,
-- single quotes, double quotes, and the character used for escaping
-- (backslash) are escaped. The called program will need to do a similar
-- inverse operation to de-escape and re-constitute the argument list.
escape
cs
c
|
isSpace
c
||
'
\\
'
==
c
||
'
\'
'
==
c
||
'"'
==
c
=
c
:
'
\\
'
:
cs
-- n.b., our caller must reverse the result
|
otherwise
=
c
:
cs
escapeArg
=
reverse
.
foldl'
escape
[]
renderPureArgs
::
Version
->
Compiler
->
HaddockArgs
->
[
String
]
renderPureArgs
version
comp
args
=
concat
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment