Commit c73d0b41 authored by simonmar's avatar simonmar

[project @ 2005-04-07 11:35:48 by simonmar]

Add the -hide-all-packages flag.
parent 9761a5ec
......@@ -60,7 +60,9 @@ import Util ( notNull, splitLongestPrefix, split, normalisePath )
import DATA_IOREF ( readIORef )
import EXCEPTION ( throwDyn )
import Monad ( when )
#ifdef mingw32_TARGET_OS
import Data.List ( isPrefixOf )
#endif
import Maybe ( fromJust )
import Char ( isDigit, isUpper )
......@@ -168,6 +170,7 @@ data DynFlag
| Opt_NoHsMain
| Opt_SplitObjs
| Opt_StgStats
| Opt_HideAllPackages
-- keeping stuff
| Opt_KeepHiDiffs
......@@ -819,6 +822,7 @@ dynamic_flags = [
, ( "package-name" , HasArg ignorePackage ) -- for compatibility
, ( "package" , HasArg exposePackage )
, ( "hide-package" , HasArg hidePackage )
, ( "hide-all-packages", NoArg (setDynFlag Opt_HideAllPackages) )
, ( "ignore-package" , HasArg ignorePackage )
, ( "syslib" , HasArg exposePackage ) -- for compatibility
......
......@@ -228,9 +228,16 @@ readPackageConfig dflags pkg_map conf_file = do
debugTraceMsg dflags 2 ("Using package config file: " ++ conf_file)
proto_pkg_configs <- loadPackageConfig conf_file
top_dir <- getTopDir
let pkg_configs = mungePackagePaths top_dir proto_pkg_configs
return (extendPackageConfigMap pkg_map pkg_configs)
let pkg_configs1 = mungePackagePaths top_dir proto_pkg_configs
pkg_configs2 = maybeHidePackages dflags pkg_configs1
return (extendPackageConfigMap pkg_map pkg_configs2)
maybeHidePackages :: DynFlags -> [PackageConfig] -> [PackageConfig]
maybeHidePackages dflags pkgs
| dopt Opt_HideAllPackages dflags = map hide pkgs
| otherwise = pkgs
where
hide pkg = pkg{ exposed = False }
mungePackagePaths :: String -> [PackageConfig] -> [PackageConfig]
-- Replace the string "$topdir" at the beginning of a path
......@@ -257,7 +264,7 @@ mkPackageState :: DynFlags -> PackageConfigMap -> IO PackageState
mkPackageState dflags pkg_db = do
--
-- Modify the package database according to the command-line flags
-- (-package, -hide-package, -ignore-package).
-- (-package, -hide-package, -ignore-package, -hide-all-packages).
--
-- Also, here we build up a set of the packages mentioned in -package
-- flags on the command line; these are called the "explicit" packages.
......
......@@ -480,6 +480,12 @@
<entry>static</entry>
<entry>-</entry>
</row>
<row>
<entry><option>-hide-all-packages</option></entry>
<entry>Hide all packages by default</entry>
<entry>static</entry>
<entry>-</entry>
</row>
<row>
<entry><option>-hide-package</option> <replaceable>name</replaceable></entry>
<entry>Hide package <replaceable>P</replaceable></entry>
......
......@@ -130,6 +130,23 @@ exposed-modules: Network.BSD,
</listitem>
</varlistentry>
<varlistentry>
<term><option>-hide-all-packages</option>
<indexterm><primary><option>-hide-package</option></primary>
</indexterm></term>
<listitem>
<para>Ignore the exposed flag on installed packages, and hide them
all by default. If you use
this flag, then any packages you require (including
<literal>base</literal>) need to be explicitly exposed using
<option>-package</option> options.</para>
<para>This is a good way to insulate your program from differences
in the globally exposed packages, and being explicit about package
dependencies is a Good Thing.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-hide-package</option> <replaceable>P</replaceable>
<indexterm><primary><option>-hide-package</option></primary>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment