Hannes Siebenhandl pushed to branch wip/fendor/T27202 at Glasgow Haskell Compiler / GHC
Commits:
-
77d6c0a6
by fendor at 2026-05-12T15:51:35+02:00
24 changed files:
- changelog.d/T27202
- compiler/GHC/Driver/DynFlags.hs
- compiler/GHC/Unit/Home/Graph.hs
- compiler/GHC/Unit/State.hs
- ghc/GHCi/UI.hs
- + testsuite/tests/ghci/prog-mhu006/Makefile
- + testsuite/tests/ghci/prog-mhu006/a/A.hs
- + testsuite/tests/ghci/prog-mhu006/all.T
- + testsuite/tests/ghci/prog-mhu006/b/B.hs
- + testsuite/tests/ghci/prog-mhu006/prog-mhu006a.script
- + testsuite/tests/ghci/prog-mhu006/prog-mhu006a.stdout
- + testsuite/tests/ghci/prog-mhu006/unitA
- + testsuite/tests/ghci/prog-mhu006/unitB
- + testsuite/tests/ghci/prog025/Makefile
- + testsuite/tests/ghci/prog025/a/A.hs
- + testsuite/tests/ghci/prog025/all.T
- + testsuite/tests/ghci/prog025/prog025a.script
- + testsuite/tests/ghci/prog025/prog025a.stdout
- + testsuite/tests/ghci/prog025/prog025b.script
- + testsuite/tests/ghci/prog025/prog025b.stdout
- + testsuite/tests/ghci/prog025/testpkg/Test.hs
- + testsuite/tests/ghci/prog025/testpkg/testpkg-0.1.0.0.pkg
- + testsuite/tests/ghci/prog025/testpkg/testpkg-0.2.0.0.pkg
- + testsuite/tests/ghci/prog025/unitA
Changes:
| 1 | 1 | section: ghci
|
| 2 | -synopsis: Fix regression to allow loading modules into the GHCi after startup.
|
|
| 2 | +synopsis: Fix regression to honour module targets in nested directories into GHCi after startup.
|
|
| 3 | 3 | issues: #27202
|
| 4 | 4 | mrs: !15980
|
| 5 | 5 | |
| 6 | 6 | description: {
|
| 7 | 7 | Fix a regression that made it impossible to import modules using `:load <Mod>` and `:add <Mod>` after GHCi startup.
|
| 8 | 8 | GHCi wasn't honouring the `-i<directory>` argument if given via `ghci -i<directory>`.
|
| 9 | + |
|
| 10 | + Further, we fix a bug while setting up package database stacks for GHCi that was uncovered during this fix.
|
|
| 11 | + By underspecifying the version of dependencies, import modules from dependencies were ambiguous, even though
|
|
| 12 | + they shouldn't have been!
|
|
| 9 | 13 | } |
| ... | ... | @@ -37,6 +37,7 @@ module GHC.Driver.DynFlags ( |
| 37 | 37 | packageFlagsChanged,
|
| 38 | 38 | IgnorePackageFlag(..), TrustFlag(..),
|
| 39 | 39 | PackageDBFlag(..), PkgDbRef(..),
|
| 40 | + isPackageDbRef,
|
|
| 40 | 41 | Option(..), showOpt,
|
| 41 | 42 | DynLibLoader(..),
|
| 42 | 43 | positionIndependent,
|
| ... | ... | @@ -881,7 +882,7 @@ isNoLink _ = False |
| 881 | 882 | data PackageArg =
|
| 882 | 883 | PackageArg String -- ^ @-package@, by 'PackageName'
|
| 883 | 884 | | UnitIdArg Unit -- ^ @-package-id@, by 'Unit'
|
| 884 | - deriving (Eq, Show)
|
|
| 885 | + deriving (Eq, Ord, Show)
|
|
| 885 | 886 | |
| 886 | 887 | instance Outputable PackageArg where
|
| 887 | 888 | ppr (PackageArg pn) = text "package" <+> text pn
|
| ... | ... | @@ -902,7 +903,7 @@ data ModRenaming = ModRenaming { |
| 902 | 903 | modRenamingWithImplicit :: Bool, -- ^ Bring all exposed modules into scope?
|
| 903 | 904 | modRenamings :: [(ModuleName, ModuleName)] -- ^ Bring module @m@ into scope
|
| 904 | 905 | -- under name @n@.
|
| 905 | - } deriving (Eq)
|
|
| 906 | + } deriving (Eq, Ord)
|
|
| 906 | 907 | instance Outputable ModRenaming where
|
| 907 | 908 | ppr (ModRenaming b rns) = ppr b <+> parens (ppr rns)
|
| 908 | 909 | |
| ... | ... | @@ -920,14 +921,21 @@ data TrustFlag |
| 920 | 921 | data PackageFlag
|
| 921 | 922 | = ExposePackage String PackageArg ModRenaming -- ^ @-package@, @-package-id@
|
| 922 | 923 | | HidePackage String -- ^ @-hide-package@
|
| 923 | - deriving (Eq) -- NB: equality instance is used by packageFlagsChanged
|
|
| 924 | + deriving (Eq, Ord) -- NB: equality instance is used by packageFlagsChanged
|
|
| 924 | 925 | |
| 925 | 926 | data PackageDBFlag
|
| 926 | 927 | = PackageDB PkgDbRef
|
| 927 | 928 | | NoUserPackageDB
|
| 928 | 929 | | NoGlobalPackageDB
|
| 929 | 930 | | ClearPackageDBs
|
| 930 | - deriving (Eq)
|
|
| 931 | + deriving (Eq, Ord)
|
|
| 932 | + |
|
| 933 | +isPackageDbRef :: PackageDBFlag -> Maybe PkgDbRef
|
|
| 934 | +isPackageDbRef = \ case
|
|
| 935 | + PackageDB ref -> Just ref
|
|
| 936 | + NoUserPackageDB -> Nothing
|
|
| 937 | + NoGlobalPackageDB -> Nothing
|
|
| 938 | + ClearPackageDBs -> Nothing
|
|
| 931 | 939 | |
| 932 | 940 | packageFlagsChanged :: DynFlags -> DynFlags -> Bool
|
| 933 | 941 | packageFlagsChanged idflags1 idflags0 =
|
| ... | ... | @@ -1009,7 +1017,7 @@ data PkgDbRef |
| 1009 | 1017 | = GlobalPkgDb
|
| 1010 | 1018 | | UserPkgDb
|
| 1011 | 1019 | | PkgDbPath OsPath
|
| 1012 | - deriving Eq
|
|
| 1020 | + deriving (Eq, Ord)
|
|
| 1013 | 1021 | |
| 1014 | 1022 | |
| 1015 | 1023 |
| ... | ... | @@ -118,6 +118,10 @@ allAnns :: HomeUnitGraph -> IO AnnEnv |
| 118 | 118 | allAnns hug = foldr go (pure emptyAnnEnv) hug where
|
| 119 | 119 | go hue = liftA2 plusAnnEnv (hptAllAnnotations (homeUnitEnv_hpt hue))
|
| 120 | 120 | |
| 121 | +-- | Retrieve all 'UnitId's of units in the 'HomeUnitGraph'.
|
|
| 122 | +allUnits :: HomeUnitGraph -> Set.Set UnitId
|
|
| 123 | +allUnits = unitEnv_keys
|
|
| 124 | + |
|
| 121 | 125 | --------------------------------------------------------------------------------
|
| 122 | 126 | -- HomeUnitGraph (HUG)
|
| 123 | 127 | --------------------------------------------------------------------------------
|
| ... | ... | @@ -211,10 +215,6 @@ renameUnitId oldUnit newUnit hug = case unitEnv_lookup_maybe oldUnit hug of |
| 211 | 215 | unitEnv_insert newUnit oldHue $
|
| 212 | 216 | unitEnv_delete oldUnit hug
|
| 213 | 217 | |
| 214 | --- | Retrieve all 'UnitId's of units in the 'HomeUnitGraph'.
|
|
| 215 | -allUnits :: HomeUnitGraph -> Set.Set UnitId
|
|
| 216 | -allUnits = unitEnv_keys
|
|
| 217 | - |
|
| 218 | 218 | -- | Set the 'DynFlags' of the 'HomeUnitEnv' for unit in the 'HomeModuleGraph'
|
| 219 | 219 | updateUnitFlags :: UnitId -> (DynFlags -> DynFlags) -> HomeUnitGraph -> HomeUnitGraph
|
| 220 | 220 | updateUnitFlags uid f = unitEnv_adjust update uid
|
| ... | ... | @@ -68,7 +68,9 @@ module GHC.Unit.State ( |
| 68 | 68 | pprRawUnitIds,
|
| 69 | 69 | |
| 70 | 70 | -- * Utils
|
| 71 | - unwireUnit)
|
|
| 71 | + unwireUnit,
|
|
| 72 | + selectHptFlag,
|
|
| 73 | + )
|
|
| 72 | 74 | where
|
| 73 | 75 | |
| 74 | 76 | import GHC.Prelude
|
| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | {-# LANGUAGE TypeFamilies #-}
|
| 9 | 9 | |
| 10 | 10 | {-# OPTIONS -fno-warn-name-shadowing #-}
|
| 11 | +{-# OPTIONS -Wno-x-partial #-}
|
|
| 11 | 12 | -- This module does a lot of it
|
| 12 | 13 | |
| 13 | 14 | -----------------------------------------------------------------------------
|
| ... | ... | @@ -53,6 +54,7 @@ import GHC.Driver.Errors (printOrThrowDiagnostics) |
| 53 | 54 | import GHC.Driver.Errors.Types
|
| 54 | 55 | import GHC.Driver.Phases
|
| 55 | 56 | import GHC.Driver.Session as DynFlags
|
| 57 | +import GHC.Driver.DynFlags as DynFlags
|
|
| 56 | 58 | import GHC.Driver.Ppr hiding (printForUser)
|
| 57 | 59 | import GHC.Utils.Error hiding (traceCmd)
|
| 58 | 60 | import GHC.Driver.Monad ( modifySession, modifySessionM )
|
| ... | ... | @@ -131,6 +133,7 @@ import qualified Data.Foldable as Foldable |
| 131 | 133 | import Data.IORef ( IORef, modifyIORef, newIORef, readIORef, writeIORef )
|
| 132 | 134 | import Data.List ( find, intercalate, intersperse,
|
| 133 | 135 | isPrefixOf, isSuffixOf, nub, partition, sort, sortBy, (\\) )
|
| 136 | +import qualified Data.List as List
|
|
| 134 | 137 | import qualified Data.List.NonEmpty as NE
|
| 135 | 138 | import qualified Data.Set as S
|
| 136 | 139 | import Data.Maybe
|
| ... | ... | @@ -745,6 +748,48 @@ installInteractiveHomeUnits dflags = do |
| 745 | 748 | sessionUnitExposedFlag =
|
| 746 | 749 | homeUnitPkgFlag interactiveSessionUnitId
|
| 747 | 750 | |
| 751 | + -- Currently, we are in a somewhat awkward situation.
|
|
| 752 | + -- Users clearly want to control precisely which packages are available at the GHCi prompt,
|
|
| 753 | + -- but there is currently no way for the user to declaratively change the set of packages
|
|
| 754 | + -- available at the prompt. Thus, a bit of guessing is necessary to provide the reasonable
|
|
| 755 | + -- GHCi UX experience, but in the future, we might want to give the user more precise control.
|
|
| 756 | + --
|
|
| 757 | + -- The prompt and session home unit may not have any package db specified, but we still want to
|
|
| 758 | + -- to import modules from our home unit dependencies.
|
|
| 759 | + -- To make this possible, the prompt and session home unit need to have a package db, but which one?
|
|
| 760 | + -- We decide, if a package db is given at the top level, e.g. @ghci -package-db ...@,
|
|
| 761 | + -- then we honour what the user requests and only use this @-package-db@.
|
|
| 762 | + -- However, in the case of multiple home units, initialised via @ghci -unit ... -unit ...@, there
|
|
| 763 | + -- are not @-package-db@ arguments in the base 'DynFlags'...
|
|
| 764 | + -- To fix this, we look at the home units and merge their package dbs stacks.
|
|
| 765 | + -- We assume, that many package db stacks look almost identical, and only differ in view elements.
|
|
| 766 | + -- Thus, we try to extract a common package db stack (i.e., longest common prefix), and then concat
|
|
| 767 | + -- the rest of the package db stacks. At last, we add the two result package db stacks.
|
|
| 768 | + -- This should work reliably with cabal and stack, but it is hacky.
|
|
| 769 | + -- A proper solution would be to teach cabal and other tooling to specify the correct package db
|
|
| 770 | + -- stacks for the prompt and session home unit.
|
|
| 771 | + ghciPackageDbStacks =
|
|
| 772 | + if all (isNothing . DynFlags.isPackageDbRef) (packageDBFlags dflags0)
|
|
| 773 | + then
|
|
| 774 | + HUG.unitEnv_assocs (hsc_HUG hsc_env)
|
|
| 775 | + & concatPackageDbStacksUsingLongestCommonPrefix . map (packageDBFlags . HUG.homeUnitEnv_dflags . snd)
|
|
| 776 | + else
|
|
| 777 | + packageDBFlags dflags0
|
|
| 778 | + |
|
| 779 | + -- Make sure the prompt and session home unit use the correct dependencies.
|
|
| 780 | + ghciPackageFlags =
|
|
| 781 | + if null (packageFlags dflags0)
|
|
| 782 | + then
|
|
| 783 | + HUG.unitEnv_assocs (hsc_HUG hsc_env)
|
|
| 784 | + & concatMap (packageFlags . HUG.homeUnitEnv_dflags . snd)
|
|
| 785 | + -- We don't want to add `-package-id` flags for home units.
|
|
| 786 | + -- This is mostly for a clear separation of concerns,
|
|
| 787 | + -- to indicate we only care about unit dependencies from package dbs.
|
|
| 788 | + & filter (not . selectHptFlag (HUG.allUnits $ hsc_HUG hsc_env))
|
|
| 789 | + & ordNub
|
|
| 790 | + else
|
|
| 791 | + packageFlags dflags0
|
|
| 792 | + |
|
| 748 | 793 | -- Explicitly depends on all home units and 'sessionUnitExposedFlag'.
|
| 749 | 794 | -- Normalise the 'dflagsPrompt', as they will be used for 'ic_dflags'
|
| 750 | 795 | -- of the 'InteractiveContext'.
|
| ... | ... | @@ -759,8 +804,9 @@ installInteractiveHomeUnits dflags = do |
| 759 | 804 | , [ homeUnitPkgFlag uid
|
| 760 | 805 | | uid <- S.toList $ HUG.allUnits $ hsc_HUG hsc_env
|
| 761 | 806 | ]
|
| 762 | - , packageFlags dflags0
|
|
| 807 | + , ghciPackageFlags
|
|
| 763 | 808 | ]
|
| 809 | + , packageDBFlags = ghciPackageDbStacks
|
|
| 764 | 810 | , importPaths = []
|
| 765 | 811 | }
|
| 766 | 812 | |
| ... | ... | @@ -773,25 +819,19 @@ installInteractiveHomeUnits dflags = do |
| 773 | 819 | [ [ homeUnitPkgFlag uid
|
| 774 | 820 | | uid <- S.toList $ HUG.allUnits $ hsc_HUG hsc_env
|
| 775 | 821 | ]
|
| 776 | - , packageFlags dflags
|
|
| 822 | + , ghciPackageFlags
|
|
| 777 | 823 | ]
|
| 824 | + , packageDBFlags = ghciPackageDbStacks
|
|
| 778 | 825 | }
|
| 779 | 826 | |
| 780 | 827 | let
|
| 781 | - cached_unit_dbs =
|
|
| 782 | - concat
|
|
| 783 | - . catMaybes
|
|
| 784 | - . fmap homeUnitEnv_unit_dbs
|
|
| 785 | - $ Foldable.toList
|
|
| 786 | - $ hsc_HUG hsc_env
|
|
| 787 | - |
|
| 788 | 828 | all_unit_ids =
|
| 789 | 829 | S.insert interactiveGhciUnitId $
|
| 790 | 830 | S.insert interactiveSessionUnitId $
|
| 791 | 831 | hsc_all_home_unit_ids hsc_env
|
| 792 | 832 | |
| 793 | - ghciPromptUnit <- setupHomeUnitFor logger dflagsPrompt all_unit_ids cached_unit_dbs
|
|
| 794 | - ghciSessionUnit <- setupHomeUnitFor logger dflagsSession all_unit_ids cached_unit_dbs
|
|
| 833 | + ghciPromptUnit <- setupHomeUnitFor logger dflagsPrompt all_unit_ids
|
|
| 834 | + ghciSessionUnit <- setupHomeUnitFor logger dflagsSession all_unit_ids
|
|
| 795 | 835 | let
|
| 796 | 836 | -- Setup up the HUG, install the interactive home units
|
| 797 | 837 | withInteractiveUnits =
|
| ... | ... | @@ -813,13 +853,26 @@ installInteractiveHomeUnits dflags = do |
| 813 | 853 | |
| 814 | 854 | pure ()
|
| 815 | 855 | where
|
| 816 | - setupHomeUnitFor :: GHC.GhcMonad m => Logger -> DynFlags -> S.Set UnitId -> [UnitDatabase UnitId] -> m HomeUnitEnv
|
|
| 817 | - setupHomeUnitFor logger dflags all_home_units cached_unit_dbs = do
|
|
| 856 | + setupHomeUnitFor :: GHC.GhcMonad m => Logger -> DynFlags -> S.Set UnitId -> m HomeUnitEnv
|
|
| 857 | + setupHomeUnitFor logger dflags all_home_units = do
|
|
| 818 | 858 | (dbs,unit_state,home_unit,_mconstants) <-
|
| 819 | - liftIO $ initUnits logger dflags (Just cached_unit_dbs) all_home_units
|
|
| 859 | + liftIO $ initUnits logger dflags Nothing all_home_units
|
|
| 820 | 860 | hpt <- liftIO emptyHomePackageTable
|
| 821 | 861 | pure (HUG.mkHomeUnitEnv unit_state (Just dbs) dflags hpt (Just home_unit))
|
| 822 | 862 | |
| 863 | + concatPackageDbStacksUsingLongestCommonPrefix :: [[PackageDBFlag]] -> [PackageDBFlag]
|
|
| 864 | + concatPackageDbStacksUsingLongestCommonPrefix stacks =
|
|
| 865 | + let
|
|
| 866 | + -- O (m * n)
|
|
| 867 | + -- m ... Number of PackageDBFlag stacks
|
|
| 868 | + -- n ... Size of the stacks
|
|
| 869 | + longestCommonPrefix =
|
|
| 870 | + map List.head . List.takeWhile ((List.all . (==) . List.head) <*> List.tail) . List.transpose
|
|
| 871 | + prefix =
|
|
| 872 | + longestCommonPrefix stacks
|
|
| 873 | + in
|
|
| 874 | + prefix ++ ordNub (concatMap (List.drop (length prefix)) stacks)
|
|
| 875 | + |
|
| 823 | 876 | reportError :: GhciMonad m => GhciCommandMessage -> m ()
|
| 824 | 877 | reportError err = do
|
| 825 | 878 | printError err
|
| 1 | +TOP=../../..
|
|
| 2 | +include $(TOP)/mk/boilerplate.mk
|
|
| 3 | +include $(TOP)/mk/test.mk
|
|
| 4 | + |
|
| 5 | +.PHONY: prog-mhu006a
|
|
| 6 | +prog-mhu006a:
|
|
| 7 | + '$(TEST_HC)' $(TEST_HC_OPTS_INTERACTIVE) $(WAY_FLAGS) $(ghciWayFlags) \
|
|
| 8 | + -no-user-package-db \
|
|
| 9 | + -unit @unitA -unit @unitB < prog-mhu006a.script |
| 1 | +module A where |
| 1 | + |
|
| 2 | +proj_files = extra_files(['a/', 'b/', 'unitA', 'unitB'])
|
|
| 3 | + |
|
| 4 | +test('prog-mhu006a',
|
|
| 5 | + [proj_files,
|
|
| 6 | + cmd_prefix('ghciWayFlags=' + config.ghci_way_flags),
|
|
| 7 | + req_interp],
|
|
| 8 | + makefile_test, ['prog-mhu006a']) |
| 1 | +module B where |
| 1 | +"Can import modules from dependencies"
|
|
| 2 | +:m + Data.ByteString
|
|
| 3 | +:m + Data.Text
|
|
| 4 | +"Imported Data.ByteString and Data.Text" |
| 1 | +"Can import modules from dependencies"
|
|
| 2 | +"Imported Data.ByteString and Data.Text" |
| 1 | +-i
|
|
| 2 | +-ia/
|
|
| 3 | +A
|
|
| 4 | +-this-unit-id a-0.0.0
|
|
| 5 | +-this-package-name a
|
|
| 6 | +-global-package-db
|
|
| 7 | +-package base
|
|
| 8 | +-package-id b-0.0.0
|
|
| 9 | +-package containers |
| 1 | +-i
|
|
| 2 | +-ib/
|
|
| 3 | +B
|
|
| 4 | +-this-unit-id b-0.0.0
|
|
| 5 | +-this-package-name b
|
|
| 6 | +-global-package-db
|
|
| 7 | +-package base
|
|
| 8 | +-package bytestring |
| 1 | +TOP=../../..
|
|
| 2 | +include $(TOP)/mk/boilerplate.mk
|
|
| 3 | +include $(TOP)/mk/test.mk
|
|
| 4 | + |
|
| 5 | +PKGCONF01=local01.package.conf
|
|
| 6 | +LOCAL_GHC_PKG01 = '$(GHC_PKG)' --no-user-package-db -f $(PKGCONF01)
|
|
| 7 | + |
|
| 8 | +# When the user package databases are cleared, the GHCi prompt still needs to be able to find
|
|
| 9 | +# modules from home unit dependencies.
|
|
| 10 | +# Moreover, it needs to find the correct dependency unit, not just any.
|
|
| 11 | +.PHONY: prog025a
|
|
| 12 | +prog025a:
|
|
| 13 | + cd testpkg && \
|
|
| 14 | + '$(TEST_HC)' $(TEST_HC_OPTS) $(WAY_FLAGS) -hisuf=$(ghciWayExt) $(ghciWayFlags) \
|
|
| 15 | + -v0 -fno-code -fwrite-interface -hidir dist-testpkg-0.1.0.0 -this-unit-id testpkg-0.1.0.0-XXX \
|
|
| 16 | + -i. Test
|
|
| 17 | + cd testpkg && \
|
|
| 18 | + '$(TEST_HC)' $(TEST_HC_OPTS) $(WAY_FLAGS) -hisuf=$(ghciWayExt) $(ghciWayFlags) \
|
|
| 19 | + -v0 -fno-code -fwrite-interface -hidir dist-testpkg-0.2.0.0 -this-unit-id testpkg-0.2.0.0-XXX \
|
|
| 20 | + -i. Test
|
|
| 21 | + |
|
| 22 | + $(LOCAL_GHC_PKG01) init $(PKGCONF01) 2>/dev/null
|
|
| 23 | + $(LOCAL_GHC_PKG01) register --force testpkg/testpkg-0.1.0.0.pkg 2>/dev/null
|
|
| 24 | + $(LOCAL_GHC_PKG01) register --force testpkg/testpkg-0.2.0.0.pkg 2>/dev/null
|
|
| 25 | + $(LOCAL_GHC_PKG01) hide testpkg-0.1.0.0
|
|
| 26 | + $(LOCAL_GHC_PKG01) hide testpkg-0.2.0.0
|
|
| 27 | + $(LOCAL_GHC_PKG01) list
|
|
| 28 | + |
|
| 29 | + '$(TEST_HC)' $(TEST_HC_OPTS_INTERACTIVE) $(WAY_FLAGS) $(ghciWayFlags) \
|
|
| 30 | + -no-user-package-db -fno-code -unit @unitA < prog025a.script
|
|
| 31 | + |
|
| 32 | +# Same as prog025a, but the home unit arguments are not provided using a response file
|
|
| 33 | +.PHONY: prog025b
|
|
| 34 | +prog025b:
|
|
| 35 | + cd testpkg && \
|
|
| 36 | + '$(TEST_HC)' $(TEST_HC_OPTS) $(WAY_FLAGS) -hisuf=$(ghciWayExt) $(ghciWayFlags) \
|
|
| 37 | + -v0 -fno-code -fwrite-interface -hidir dist-testpkg-0.1.0.0 -this-unit-id testpkg-0.1.0.0-XXX \
|
|
| 38 | + -i. Test
|
|
| 39 | + cd testpkg && \
|
|
| 40 | + '$(TEST_HC)' $(TEST_HC_OPTS) $(WAY_FLAGS) -hisuf=$(ghciWayExt) $(ghciWayFlags) \
|
|
| 41 | + -v0 -fno-code -fwrite-interface -hidir dist-testpkg-0.2.0.0 -this-unit-id testpkg-0.2.0.0-XXX \
|
|
| 42 | + -i. Test
|
|
| 43 | + |
|
| 44 | + $(LOCAL_GHC_PKG01) init $(PKGCONF01) 2>/dev/null
|
|
| 45 | + $(LOCAL_GHC_PKG01) register --force testpkg/testpkg-0.1.0.0.pkg 2>/dev/null
|
|
| 46 | + $(LOCAL_GHC_PKG01) register --force testpkg/testpkg-0.2.0.0.pkg 2>/dev/null
|
|
| 47 | + $(LOCAL_GHC_PKG01) hide testpkg-0.1.0.0
|
|
| 48 | + $(LOCAL_GHC_PKG01) hide testpkg-0.2.0.0
|
|
| 49 | + $(LOCAL_GHC_PKG01) list
|
|
| 50 | + |
|
| 51 | + # Uses response file for argument, doesn't use it as a -unit argument
|
|
| 52 | + '$(TEST_HC)' $(TEST_HC_OPTS_INTERACTIVE) $(WAY_FLAGS) $(ghciWayFlags) \
|
|
| 53 | + -no-user-package-db -fno-code \
|
|
| 54 | + @unitA < prog025b.script |
| 1 | +module A where
|
|
| 2 | + |
|
| 3 | +import Test |
| 1 | + |
|
| 2 | +proj_files = extra_files(['a/', 'unitA', 'testpkg/'])
|
|
| 3 | + |
|
| 4 | +test('prog025a',
|
|
| 5 | + [proj_files,
|
|
| 6 | + cmd_prefix('ghciWayFlags=' + config.ghci_way_flags),
|
|
| 7 | + req_interp],
|
|
| 8 | + makefile_test, ['prog025a'])
|
|
| 9 | + |
|
| 10 | +test('prog025b',
|
|
| 11 | + [proj_files,
|
|
| 12 | + cmd_prefix('ghciWayFlags=' + config.ghci_way_flags),
|
|
| 13 | + req_interp],
|
|
| 14 | + makefile_test, ['prog025b']) |
| 1 | +:m + Test
|
|
| 2 | +"Imported package dependency module with multiple installed versions" |
| 1 | +Reading package info from "testpkg/testpkg-0.1.0.0.pkg" ... done.
|
|
| 2 | +Reading package info from "testpkg/testpkg-0.2.0.0.pkg" ... done.
|
|
| 3 | +local01.package.conf
|
|
| 4 | + (testpkg-0.1.0.0)
|
|
| 5 | + (testpkg-0.2.0.0)
|
|
| 6 | + |
|
| 7 | +"Imported package dependency module with multiple installed versions" |
| 1 | +:m + Test
|
|
| 2 | +"Imported package dependency module with multiple installed versions" |
| 1 | +Reading package info from "testpkg/testpkg-0.1.0.0.pkg" ... done.
|
|
| 2 | +Reading package info from "testpkg/testpkg-0.2.0.0.pkg" ... done.
|
|
| 3 | +local01.package.conf
|
|
| 4 | + (testpkg-0.1.0.0)
|
|
| 5 | + (testpkg-0.2.0.0)
|
|
| 6 | + |
|
| 7 | +"Imported package dependency module with multiple installed versions" |
| 1 | +module Test where |
| 1 | +name: testpkg
|
|
| 2 | +version: 0.1.0.0
|
|
| 3 | +id: testpkg-0.1.0.0-XXX
|
|
| 4 | +key: testpkg-0.1.0.0-XXX
|
|
| 5 | +exposed: True
|
|
| 6 | +exposed-modules: Test
|
|
| 7 | +hidden-modules:
|
|
| 8 | +import-dirs: ${pkgroot}/dist-testpkg-0.1.0.0
|
|
| 9 | +library-dirs:
|
|
| 10 | +include-dirs:
|
|
| 11 | +hs-libraries: |
| 1 | +name: testpkg
|
|
| 2 | +version: 0.2.0.0
|
|
| 3 | +id: testpkg-0.2.0.0-XXX
|
|
| 4 | +key: testpkg-0.2.0.0-XXX
|
|
| 5 | +exposed: True
|
|
| 6 | +exposed-modules: Test
|
|
| 7 | +hidden-modules:
|
|
| 8 | +import-dirs: ${pkgroot}/testpkg/dist-testpkg-0.2.0.0
|
|
| 9 | +library-dirs:
|
|
| 10 | +include-dirs:
|
|
| 11 | +hs-libraries: |
| 1 | +-i
|
|
| 2 | +-ia/
|
|
| 3 | +A
|
|
| 4 | +-this-unit-id a-0.0.0
|
|
| 5 | +-this-package-name a
|
|
| 6 | +-clear-package-db
|
|
| 7 | +-global-package-db
|
|
| 8 | +-no-user-package-db
|
|
| 9 | +-package-db local01.package.conf
|
|
| 10 | +-package base
|
|
| 11 | +-package-id testpkg-0.2.0.0-XXX |