diff --git a/ChangeLog.md b/ChangeLog.md index ff34464af2..486767d9f2 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -13,13 +13,13 @@ Behavior changes: * `stack init` now ignores symlinks when searching for cabal files. It also now ignores any directory that begins with `.` (as well as `dist` dirs) - before it would only ignore `.git`, `.stack-work`, and `dist`. -* The `stack path --ghc-paths` option is renamed to `--programs-path`. - `--compiler-path` is added, which points directly at the compiler used in - the current project. * The stack executable is no longer built with `-rtsopts`. Before, when `-rtsopts` was enabled, stack would process `+RTS` options even when intended for some other program, such as when used with `stack exec -- prog +RTS`. See [#2022](https://github.com/commercialhaskell/stack/issues/2022). +* The `stack path --ghc-paths` option is deprecated and renamed to `--programs`. + `--compiler` is added, which points directly at the compiler used in + the current project. `--compiler-bin` points to the compiler's bin dir. * For consistency with the `$STACK_ROOT` environment variable, the `stack path --global-stack-root` flag and the `global-stack-root` field in the output of `stack path` are being deprecated and replaced with the diff --git a/doc/GUIDE.md b/doc/GUIDE.md index 26bacce7ec..b4b17b11e2 100644 --- a/doc/GUIDE.md +++ b/doc/GUIDE.md @@ -1366,7 +1366,7 @@ modified version of a dependency that hasn't yet been released upstream. Please note that when adding upstream packages directly to your project it is important to distinguish _local packages_ from the upstream _dependency -packages_. Otherwise you may have trouble running `stack GHCi`. See +packages_. Otherwise you may have trouble running `stack GHCi`. See [stack.yaml documentation](yaml_configuration.md#packages) for more details. ## Flags and GHC options @@ -1474,8 +1474,9 @@ stack-root: /home/michael/.stack project-root: /home/michael/wai config-location: /home/michael/wai/stack.yaml bin-path: /home/michael/.stack/snapshots/x86_64-linux/lts-2.17/7.8.4/bin:/home/michael/.stack/programs/x86_64-linux/ghc-7.8.4/bin:/home/michael/.stack/programs/x86_64-linux/ghc-7.10.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -programs-path: /home/michael/.stack/programs/x86_64-linux -compiler-path: /home/michael/.stack/programs/x86_64-linux/ghc-7.8.4/bin/ghc +programs: /home/michael/.stack/programs/x86_64-linux +compiler: /home/michael/.stack/programs/x86_64-linux/ghc-7.8.4/bin/ghc +compiler-bin: /home/michael/.stack/programs/x86_64-linux/ghc-7.8.4/bin local-bin-path: /home/michael/.local/bin extra-include-dirs: extra-library-dirs: @@ -1496,7 +1497,7 @@ these keys you're interested in, which can be convenient for scripting. As a simple example, let's find out which versions of GHC are installed locally: ``` -michael@d30748af6d3d:~/wai$ ls $(stack path --programs-path)/*.installed +michael@d30748af6d3d:~/wai$ ls $(stack path --programs)/*.installed /home/michael/.stack/programs/x86_64-linux/ghc-7.10.2.installed /home/michael/.stack/programs/x86_64-linux/ghc-7.8.4.installed ``` @@ -1509,7 +1510,7 @@ what needs to be removed: 1. The stack executable itself 2. The stack root, e.g. `$HOME/.stack` on non-Windows systems. * See `stack path --stack-root` - * On Windows, you will also need to delete `stack path --programs-paths` + * On Windows, you will also need to delete `stack path --programs` 3. Any local `.stack-work` directories inside a project ## exec diff --git a/src/main/Main.hs b/src/main/Main.hs index 1e44027aef..ee116e5269 100644 --- a/src/main/Main.hs +++ b/src/main/Main.hs @@ -536,15 +536,14 @@ pathCmd keys go = localroot <- installationRootLocal distDir <- distRelativeDir hpcDir <- hpcReportDir - compilerPath <- getCompilerPath =<< getWhichCompiler - when (T.pack deprecatedStackRootOptionName `elem` keys) $ - liftIO $ forM_ - [ "" - , "'--" <> deprecatedStackRootOptionName <> "' will be removed in a future release." - , "Please use '--" <> stackRootOptionName <> "' instead." - , "" - ] - (hPutStrLn stderr) + compiler <- getCompilerPath =<< getWhichCompiler + let deprecated = filter ((`elem` keys) . fst) deprecatedPathKeys + liftIO $ forM_ deprecated $ \(oldOption, newOption) -> T.hPutStrLn stderr $ T.unlines + [ "" + , "'--" <> oldOption <> "' will be removed in a future release." + , "Please use '--" <> newOption <> "' instead." + , "" + ] forM_ -- filter the chosen paths in flags (keys), -- or show all of them if no specific paths chosen. @@ -571,7 +570,7 @@ pathCmd keys go = distDir hpcDir extra - compilerPath)))) + compiler)))) -- | Passed to all the path printers as a source of info. data PathInfo = PathInfo @@ -585,7 +584,7 @@ data PathInfo = PathInfo , piDistDir :: Path Rel Dir , piHpcDir :: Path Abs Dir , piExtraDbs :: [Path Abs Dir] - , piCompilerPath :: Path Abs File + , piCompiler :: Path Abs File } -- | The paths of interest to a user. The first tuple string is used @@ -612,11 +611,14 @@ paths = , "bin-path" , T.pack . intercalate [searchPathSeparator] . eoPath . piEnvOverride ) , ( "Install location for GHC and other core tools" - , "programs-path" + , "programs" , T.pack . toFilePathNoTrailingSep . configLocalPrograms . bcConfig . piBuildConfig ) - , ( "Compiler (e.g. ghc)" - , "compiler-path" - , T.pack . toFilePath . piCompilerPath ) + , ( "Compiler binary (e.g. ghc)" + , "compiler" + , T.pack . toFilePath . piCompiler ) + , ( "Directory containing the compiler binary (e.g. ghc)" + , "compiler-bin" + , T.pack . toFilePathNoTrailingSep . parent . piCompiler ) , ( "Local bin path where stack installs executables" , "local-bin-path" , T.pack . toFilePathNoTrailingSep . configLocalBin . bcConfig . piBuildConfig ) @@ -656,11 +658,20 @@ paths = , ( "Where HPC reports and tix files are stored" , "local-hpc-root" , T.pack . toFilePathNoTrailingSep . piHpcDir ) + , ( "DEPRECATED: Use '--programs' instead" + , "ghc-paths" + , T.pack . toFilePathNoTrailingSep . configLocalPrograms . bcConfig . piBuildConfig ) , ( "DEPRECATED: Use '--" <> stackRootOptionName <> "' instead" , T.pack deprecatedStackRootOptionName , T.pack . toFilePathNoTrailingSep . configStackRoot . bcConfig . piBuildConfig ) ] +deprecatedPathKeys :: [(Text, Text)] +deprecatedPathKeys = + [ (T.pack deprecatedStackRootOptionName, T.pack stackRootOptionName) + , ("ghc-paths", "programs") + ] + data SetupCmdOpts = SetupCmdOpts { scoCompilerVersion :: !(Maybe CompilerVersion) , scoForceReinstall :: !Bool