Skip to content

Add .doc derivation to test components #1982

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion builder/comp-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ let
});
profiled = self (drvArgs // { enableLibraryProfiling = true; });
dwarf = self (drvArgs // { enableDWARF = true; });
} // lib.optionalAttrs (haskellLib.isLibrary componentId) ({
} // lib.optionalAttrs (haskellLib.isLibrary componentId || haskellLib.isTest componentId) ({
inherit haddock;
inherit (haddock) haddockDir; # This is null if `doHaddock = false`
} // lib.optionalAttrs (haddock ? doc) {
Expand Down
9 changes: 5 additions & 4 deletions builder/haddock-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@

let
doHaddock' = doHaddock
&& (haskellLib.isLibrary componentId)
&& (haskellLib.isLibrary componentId || haskellLib.isTest componentId)
&& !haskellLib.isCrossHost;

# the target dir for haddock documentation
docdir = docoutput: docoutput + "/share/doc/" + componentId.cname;
# The target dir for haddock documentation
docdir = docoutput: docoutput + "/share/doc/" + package.identifier.name;

packageCfgDir = configFiles.packageCfgDir;

Expand Down Expand Up @@ -111,6 +111,7 @@ let
[[ -n $(find . -name "*.hs" -o -name "*.lhs") ]] && {
$SETUP_HS haddock \
"--html" \
${lib.optionalString (haskellLib.isTest componentId) "--tests"} \
${lib.optionalString doHoogle "--hoogle"} \
${lib.optionalString hyperlinkSource "--hyperlink-source"} \
${lib.optionalString quickjump "--quickjump"} \
Expand All @@ -129,7 +130,7 @@ let
# Ensure that libraries are not pulled into the docs closure.
# As an example, the prettified source code of a
# Paths_package module will contain store paths of the library package.
for x in "$html/src/"*.html; do
for x in $(find "$html" -name "*.html"); do
remove-references-to -t $out $x
remove-references-to -t ${componentDrv} $x
done
Expand Down
4 changes: 2 additions & 2 deletions test/sublib-docs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ in recurseIntoAttrs {
otool -L $exe |grep .dylib
'') + ''

# Check that it looks like we have docs
printf "check that it looks like we have docs..." >& 2
test -f "${packages.sublib-docs.components.library.doc}/share/doc/sublib-docs/html/Lib.html"
test -f "${packages.sublib-docs.components.sublibs.slib.doc}/share/doc/slib/html/Slib.html"
test -f "${packages.sublib-docs.components.sublibs.slib.doc}/share/doc/sublib-docs/html/Slib.html"

touch $out
'';
Expand Down