Skip to content

Commit cf37614

Browse files
authored
Merge pull request #9997 from depressed-pho/suppress-warnings-on-empty-packages
Suppress ghc-pkg warnings emitted when an empty packages is being registered
2 parents ad40144 + 65218ce commit cf37614

File tree

6 files changed

+55
-2
lines changed

6 files changed

+55
-2
lines changed

Cabal/src/Distribution/Simple/Register.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,8 +549,8 @@ generalInstalledPackageInfo adjustRelIncDirs pkg abi_hash lib lbi clbi installDi
549549
, IPI.ldOptions = ldOptions bi
550550
, IPI.frameworks = map getSymbolicPath $ frameworks bi
551551
, IPI.frameworkDirs = map getSymbolicPath $ extraFrameworkDirs bi
552-
, IPI.haddockInterfaces = [haddockdir installDirs </> haddockLibraryPath pkg lib]
553-
, IPI.haddockHTMLs = [htmldir installDirs]
552+
, IPI.haddockInterfaces = [haddockdir installDirs </> haddockLibraryPath pkg lib | hasModules]
553+
, IPI.haddockHTMLs = [htmldir installDirs | hasModules]
554554
, IPI.pkgRoot = Nothing
555555
, IPI.libVisibility = libVisibility lib
556556
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
name: emptyLib
2+
Cabal-version: >= 1.2
3+
version: 1.0
4+
build-type: Simple
5+
6+
Library
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Setup configure
2+
Configuring emptyLib-1.0...
3+
# Setup build
4+
Preprocessing library for emptyLib-1.0...
5+
Building library for emptyLib-1.0...
6+
# Setup haddock
7+
Preprocessing library for emptyLib-1.0...
8+
Running Haddock on library for emptyLib-1.0...
9+
Warning: Haddocks are being requested, but there aren't any modules given to create documentation for.
10+
# Setup copy
11+
Installing library in <PATH>
12+
# Setup register
13+
Registering library for emptyLib-1.0...
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Setup configure
2+
Configuring emptyLib-1.0...
3+
# Setup build
4+
Preprocessing library for emptyLib-1.0...
5+
Building library for emptyLib-1.0...
6+
# Setup haddock
7+
Preprocessing library for emptyLib-1.0...
8+
Running Haddock on library for emptyLib-1.0...
9+
Warning: Haddocks are being requested, but there aren't any modules given to create documentation for.
10+
# Setup copy
11+
Installing library in <PATH>
12+
# Setup register
13+
Registering library for emptyLib-1.0...
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import Test.Cabal.Prelude
2+
-- Test install when the library is empty, for #9997
3+
main = setupAndCabalTest $
4+
withPackageDb $
5+
withDirectory "empty" $
6+
setup_install_with_docs []

changelog.d/pr-9997

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
synopsis: Suppress ghc-pkg warnings emitted when an empty packages is being registered
2+
packages: Cabal
3+
prs: #9997
4+
5+
description: {
6+
7+
When a package contains a library that has no modules, `./Setup register`
8+
tries to register the library with fields `haddock-interfaces:` and
9+
`haddock-html:` pointing at non-existent files or directories, and `ghc-pkg
10+
register` warns about them.
11+
12+
To suppress the warnings prevent these fields from being generated when
13+
there are no modules.
14+
15+
}

0 commit comments

Comments
 (0)