Skip to content
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

Bring back sandboxes #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions Cabal-syntax/src/Distribution/Utils/Path.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module Distribution.Utils.Path
, Tix
, Tmp
, Response
, Sandbox

-- * Symbolic paths
, RelativePath
Expand Down Expand Up @@ -499,3 +500,9 @@ data Tmp
--
-- See Note [Symbolic paths] in Distribution.Utils.Path.
data Response

-- | Abstract directory: directory for response files.
--
-- See Note [Symbolic paths] in Distribution.Utils.Path.
data Sandbox

1 change: 1 addition & 0 deletions cabal-install/cabal-install.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ library
Distribution.Client.CmdOutdated
Distribution.Client.CmdRepl
Distribution.Client.CmdRun
Distribution.Client.CmdSandbox
Distribution.Client.CmdSdist
Distribution.Client.CmdTest
Distribution.Client.CmdUpdate
Expand Down
10 changes: 9 additions & 1 deletion cabal-install/src/Distribution/Client/CmdInstall.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module Distribution.Client.CmdInstall
, establishDummyProjectBaseContext
) where

import qualified Distribution.Client.CmdSandbox as Sandbox
import Distribution.Client.Compat.Prelude
import Distribution.Compat.Directory
( doesPathExist
Expand Down Expand Up @@ -238,6 +239,7 @@ import System.Directory
, makeAbsolute
, removeDirectory
, removeFile
, getCurrentDirectory
)
import System.FilePath
( takeBaseName
Expand Down Expand Up @@ -742,7 +744,13 @@ getClientInstallFlags :: Verbosity -> GlobalFlags -> ClientInstallFlags -> IO Cl
getClientInstallFlags verbosity globalFlags existingClientInstallFlags = do
let configFileFlag = globalConfigFile globalFlags
savedConfig <- loadConfig verbosity configFileFlag
pure $ savedClientInstallFlags savedConfig `mappend` existingClientInstallFlags
isSandbox <- Sandbox.isSandbox Nothing
let merged = savedClientInstallFlags savedConfig `mappend` existingClientInstallFlags
if isSandbox
then do
cwd <- getCurrentDirectory
pure $ merged { cinstEnvironmentPath = Flag cwd }
else pure $ merged
Comment on lines +747 to +753
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we check during cabal install whether we're in a sanbdox and if so pass the --package-env=. flag, creating a ghc environment file.

It seems the env file already acts as a "world file"... it will (except for base) only contain the targets we specified via cabal install --lib. So I'm not sure it's necessary to play tricks with recreation of the env file to allow new resolutions.

Instead, I think it is reasonable to have users specify multiple targets to avoid resolution issues, such as cabal install --lib text attoparsec.


getSpecsAndTargetSelectors
:: Verbosity
Expand Down
Loading
Loading