Skip to content

Commit

Permalink
Add symlink haddocks
Browse files Browse the repository at this point in the history
As requested in review
  • Loading branch information
philderbeast committed Dec 12, 2023
1 parent f2cf8d9 commit 9327025
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cabal-install/src/Distribution/Client/CmdInstall.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,8 @@ disableTestsBenchsByDefault configFlags =
, configBenchmarks = Flag False <> configBenchmarks configFlags
}

-- | Prepares a record containing the information needed to either symlink or
-- copy an executable.
symlink :: OverwritePolicy -> InstallExe -> UnitId -> UnqualComponentName -> Symlink
symlink
overwritePolicy
Expand Down
10 changes: 9 additions & 1 deletion cabal-install/src/Distribution/Client/InstallSymlink.hs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ symlinkBinaries
cinfo = compilerInfo comp
(CompilerId compilerFlavor _) = compilerInfoId cinfo

-- | A record needed to either check if a symlink is possible or to create a
-- symlink. Also used if copying instead of symlinking.
data Symlink = Symlink
{ overwritePolicy :: OverwritePolicy
-- ^ Whether to force overwrite an existing file.
Expand All @@ -265,7 +267,12 @@ data Symlink = Symlink
-- ^ The name of the executable to in the private bin dir, eg @foo-1.0@.
}

-- | How to handle symlinking a binary.
-- | After checking if a target is writeable given the overwrite policy,
-- dispatch to an appropriate action;
-- * @onMissing@ if the target doesn't exist
-- * @onOverwrite@ if the target exists and we are allowed to overwrite it
-- * @onNever@ if the target exists and we are never allowed to overwrite it
-- * @onPrompt@ if the target exists and we are allowed to overwrite after propmpting
onSymlinkBinary
:: IO a
-- ^ Missing action
Expand All @@ -274,6 +281,7 @@ onSymlinkBinary
-> IO a
-- ^ Never action
-> IO a
-- ^ Prompt action
-> Symlink
-> IO a
onSymlinkBinary
Expand Down

0 comments on commit 9327025

Please sign in to comment.