Skip to content

Commit 4879ae1

Browse files
authored
Merge pull request #7827 from brandonchinn178/chinn/haddock
Fix haddock via Setup.hs with internal libraries
2 parents c976c0a + bd47cd7 commit 4879ae1

File tree

14 files changed

+135
-29
lines changed

14 files changed

+135
-29
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Here are some other useful variations on the commands:
2222

2323
~~~~
2424
cabal v2-build Cabal # build library only
25-
cabal v2-build Cabal:unit-tests # build Cabal's unit test suite
25+
cabal v2-build Cabal-tests:unit-tests # build Cabal's unit test suite
2626
cabal v2-build cabal-tests # etc...
2727
~~~~
2828

@@ -91,7 +91,7 @@ run without it).
9191

9292
There are also other test suites:
9393

94-
* `Cabal:unit-tests` are small, quick-running unit tests
94+
* `Cabal-tests:unit-tests` are small, quick-running unit tests
9595
on small pieces of functionality in Cabal. If you are working
9696
on some utility functions in the Cabal library you should run this
9797
test suite.

Cabal-syntax/src/Distribution/Compat/Lens.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ instance Functor (Pretext a b) where
238238
--
239239
-- First start a repl
240240
--
241-
-- > cabal new-repl Cabal:hackage-tests
241+
-- > cabal new-repl Cabal-tests:hackage-tests
242242
--
243243
-- Because @--extra-package@ isn't yet implemented, we use a test-suite
244244
-- with @generics-sop@ dependency.

Cabal-syntax/src/Distribution/Types/VersionInterval.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import Distribution.Types.VersionRange.Internal
4040

4141
-- To test this module, and to run version range normalisation benchmarks:
4242
--
43-
-- cabal run Cabal:unit-tests -- -p Distribution.Version
43+
-- cabal run Cabal-tests:unit-tests -- -p Distribution.Version
4444
-- cabal run cabal-benchmarks -- -o bench.html normaliseVersionRange
4545

4646
-------------------------------------------------------------------------------

Cabal/src/Distribution/Simple/Haddock.hs

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -279,27 +279,23 @@ haddock pkg_descr lbi suffixes flags' = do
279279
let libArgs' = commonArgs `mappend` libArgs
280280
runHaddock verbosity tmpFileOpts comp platform haddockProg libArgs'
281281

282-
case libName lib of
283-
LMainLibName ->
284-
pure index
285-
LSubLibName _ -> do
286-
pwd <- getCurrentDirectory
287-
288-
let
289-
ipi = inplaceInstalledPackageInfo
290-
pwd (flag haddockDistPref) pkg_descr
291-
(mkAbiHash "inplace") lib lbi' clbi
292-
293-
debug verbosity $ "Registering inplace:\n"
294-
++ (InstalledPackageInfo.showInstalledPackageInfo ipi)
295-
296-
registerPackage verbosity (compiler lbi') (withPrograms lbi')
297-
(withPackageDB lbi') ipi
298-
HcPkg.defaultRegisterOptions {
299-
HcPkg.registerMultiInstance = True
300-
}
301-
302-
return $ PackageIndex.insert ipi index
282+
pwd <- getCurrentDirectory
283+
284+
let
285+
ipi = inplaceInstalledPackageInfo
286+
pwd (flag haddockDistPref) pkg_descr
287+
(mkAbiHash "inplace") lib lbi' clbi
288+
289+
debug verbosity $ "Registering inplace:\n"
290+
++ (InstalledPackageInfo.showInstalledPackageInfo ipi)
291+
292+
registerPackage verbosity (compiler lbi') (withPrograms lbi')
293+
(withPackageDB lbi') ipi
294+
HcPkg.defaultRegisterOptions {
295+
HcPkg.registerMultiInstance = True
296+
}
297+
298+
return $ PackageIndex.insert ipi index
303299

304300
CFLib flib -> (when (flag haddockForeignLibs) $ do
305301
withTempDirectoryEx verbosity tmpFileOpts (buildDir lbi') "tmp" $
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Foo where
2+
3+
import InternalBefore
4+
5+
foo :: Int
6+
foo = internalBefore
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module InternalAfter where
2+
3+
import Foo
4+
5+
internalAfter :: Int
6+
internalAfter = foo
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module InternalBefore where
2+
3+
internalBefore :: Int
4+
internalBefore = 42
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: foo
2+
version: 0.1.0.0
3+
build-type: Simple
4+
cabal-version: 1.24
5+
6+
library foo-internal-before
7+
build-depends: base
8+
exposed-modules: InternalBefore
9+
default-language: Haskell2010
10+
11+
library
12+
build-depends: base, foo-internal-before
13+
exposed-modules: Foo
14+
default-language: Haskell2010
15+
16+
library foo-internal-after
17+
build-depends: base, foo
18+
exposed-modules: InternalAfter
19+
default-language: Haskell2010
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Setup configure
2+
Configuring foo-0.1.0.0...
3+
# Setup build
4+
Preprocessing library 'foo-internal-before' for foo-0.1.0.0..
5+
Building library 'foo-internal-before' for foo-0.1.0.0..
6+
Preprocessing library for foo-0.1.0.0..
7+
Building library for foo-0.1.0.0..
8+
Preprocessing library 'foo-internal-after' for foo-0.1.0.0..
9+
Building library 'foo-internal-after' for foo-0.1.0.0..
10+
# Setup copy
11+
Installing internal library foo-internal-before in <PATH>
12+
Installing library in <PATH>
13+
Installing internal library foo-internal-after in <PATH>
14+
# Setup register
15+
Registering library 'foo-internal-before' for foo-0.1.0.0..
16+
Registering library for foo-0.1.0.0..
17+
Registering library 'foo-internal-after' for foo-0.1.0.0..
18+
# Setup haddock
19+
Preprocessing library 'foo-internal-before' for foo-0.1.0.0..
20+
Running Haddock on library 'foo-internal-before' for foo-0.1.0.0..
21+
Documentation created: haddock.cabal.dist/work/dist/doc/html/foo/index.html
22+
Preprocessing library for foo-0.1.0.0..
23+
Running Haddock on library for foo-0.1.0.0..
24+
Documentation created: haddock.cabal.dist/work/dist/doc/html/foo/index.html
25+
Preprocessing library 'foo-internal-after' for foo-0.1.0.0..
26+
Running Haddock on library 'foo-internal-after' for foo-0.1.0.0..
27+
Documentation created: haddock.cabal.dist/work/dist/doc/html/foo/index.html
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Setup configure
2+
Configuring foo-0.1.0.0...
3+
# Setup build
4+
Preprocessing library 'foo-internal-before' for foo-0.1.0.0..
5+
Building library 'foo-internal-before' for foo-0.1.0.0..
6+
Preprocessing library for foo-0.1.0.0..
7+
Building library for foo-0.1.0.0..
8+
Preprocessing library 'foo-internal-after' for foo-0.1.0.0..
9+
Building library 'foo-internal-after' for foo-0.1.0.0..
10+
# Setup copy
11+
Installing internal library foo-internal-before in <PATH>
12+
Installing library in <PATH>
13+
Installing internal library foo-internal-after in <PATH>
14+
# Setup register
15+
Registering library 'foo-internal-before' for foo-0.1.0.0..
16+
Registering library for foo-0.1.0.0..
17+
Registering library 'foo-internal-after' for foo-0.1.0.0..
18+
# Setup haddock
19+
Preprocessing library 'foo-internal-before' for foo-0.1.0.0..
20+
Running Haddock on library 'foo-internal-before' for foo-0.1.0.0..
21+
Documentation created: haddock.dist/work/dist/doc/html/foo/index.html
22+
Preprocessing library for foo-0.1.0.0..
23+
Running Haddock on library for foo-0.1.0.0..
24+
Documentation created: haddock.dist/work/dist/doc/html/foo/index.html
25+
Preprocessing library 'foo-internal-after' for foo-0.1.0.0..
26+
Running Haddock on library 'foo-internal-after' for foo-0.1.0.0..
27+
Documentation created: haddock.dist/work/dist/doc/html/foo/index.html

0 commit comments

Comments
 (0)