-
Notifications
You must be signed in to change notification settings - Fork 698
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
Have the standard commands use the sandbox, if present. #1256
Conversation
Preparation for merging sandbox commands with their normal counterparts.
We use userInstallDirs in sandbox mode to prevent cabal-install from doing unnecessary things like invoking itself via 'sudo' (see commit 7b2e363 and 'rootCmd' in D.C.Install), but in this particular case we want userInstall to be False to prevent UserPackageDB from being added to the package DB stack (see haskell#1183 and interpretPackageDbFlags in D.S.Configure).
These allow us to work uniformly with @PackageEnvironment@ and @SavedConfig@, thus reducing boilerplate.
The commands that are implemented with 'wrapperAction' (haddock, hscolour, register, clean, copy) don't require 'withSandboxDirOnPath', so their code is not modified.
The only bigger concern I have with the implementation is all this when useSandbox $
createBlaBla instead of returning an opaque value from the |
Replace the confusing MaybePkgEnv type with a (UseSandbox, SavedConfig) tuple. Code in Main.hs is a bit uglier now.
@tibbe I refactored the code based on your suggestions. Should be less confusing now. |
It's clearer to me now at least. I think @dcoutts might have something to say, otherwise I'm happy with the changes (which are really important for the Haskell community!) |
Nice. I'll wait for @dcoutts's input then. |
Rationale: consistency with existing precedent ('isJust'/'isNothing').
Makes sense because they're basically doing 'cabal build' on each invocation.
@dcoutts I would like to get a cabal release out the door with this feature included. What do you think? |
@dcoutts Did you want to take a look? Otherwise I will get this merged this week. |
Merged! Merge commit: 9b77f56 |
Fixes #1104.
I decided not to add support for subcommands to
D.S.Command
for the time being (cost/benefit considerations).