-
-
Notifications
You must be signed in to change notification settings - Fork 369
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for the multi unit argument syntax introduced in GHC 9.4: h…
…ttps://downloads.haskell.org/ghc/9.4.4/docs/users_guide/using.html#multiple-home-units We now support arguments of the form ``` -unit @unitA -unit @unitb ``` where the response files `unitA` and `unitB` contain the actual list of arguments for that unit: ``` -this-unit-id a-0.1.0.0 -i -isrc A1 A2 ``` Also refactor the session loader and simplify it. Also adds error messages on GHC 9.4 if the units are not closed (#3422).
- Loading branch information
Showing
14 changed files
with
324 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{-# LANGUAGE CPP #-} | ||
{-# LANGUAGE RankNTypes #-} | ||
|
||
-- | Compat module Interface file relevant code. | ||
module Development.IDE.GHC.Compat.CmdLine ( | ||
processCmdLineP | ||
, CmdLineP (..) | ||
, getCmdLineState | ||
, putCmdLineState | ||
, Flag(..) | ||
, OptKind(..) | ||
, EwM | ||
, defFlag | ||
, liftEwM | ||
) where | ||
|
||
#if MIN_VERSION_ghc(9,3,0) | ||
import GHC.Driver.Session (processCmdLineP, CmdLineP (..), getCmdLineState, putCmdLineState) | ||
import GHC.Driver.CmdLine | ||
#else | ||
|
||
#if MIN_VERSION_ghc(9,0,0) | ||
import GHC.Driver.CmdLine | ||
#else | ||
import CmdLineParser | ||
#endif | ||
|
||
import Control.Monad.IO.Class | ||
import Control.Monad.Trans.State | ||
import GHC (Located, mkGeneralLocated) | ||
import GHC.ResponseFile | ||
import Control.Exception | ||
#endif | ||
|
||
#if !MIN_VERSION_ghc(9,3,0) | ||
-- | A helper to parse a set of flags from a list of command-line arguments, handling | ||
-- response files. | ||
processCmdLineP | ||
:: forall s m. MonadIO m | ||
=> [Flag (CmdLineP s)] -- ^ valid flags to match against | ||
-> s -- ^ current state | ||
-> [Located String] -- ^ arguments to parse | ||
-> m (([Located String], [Err], [Warn]), s) | ||
-- ^ (leftovers, errors, warnings) | ||
processCmdLineP activeFlags s0 args = | ||
pure $ runCmdLine (processArgs activeFlags args) s0 | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
-this-package-name | ||
a | ||
-working-dir | ||
a | ||
-fbuilding-cabal-package | ||
-O0 | ||
-i. | ||
-this-unit-id | ||
a-1.0.0-inplace | ||
-hide-all-packages | ||
-Wmissing-home-modules | ||
-no-user-package-db | ||
-package | ||
base | ||
-package | ||
text | ||
-XHaskell98 | ||
A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module A(foo) where | ||
import Data.Text | ||
foo = () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
-this-package-name | ||
b | ||
-working-dir | ||
b | ||
-fbuilding-cabal-package | ||
-O0 | ||
-i | ||
-i. | ||
-this-unit-id | ||
b-1.0.0-inplace | ||
-hide-all-packages | ||
-Wmissing-home-modules | ||
-no-user-package-db | ||
-package-id | ||
a-1.0.0-inplace | ||
-package | ||
base | ||
-XHaskell98 | ||
B |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module B(module B) where | ||
import A | ||
qux = foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
-this-package-name | ||
c | ||
-working-dir | ||
c | ||
-fbuilding-cabal-package | ||
-O0 | ||
-i | ||
-i. | ||
-this-unit-id | ||
c-1.0.0-inplace | ||
-hide-all-packages | ||
-Wmissing-home-modules | ||
-no-user-package-db | ||
-package-id | ||
a-1.0.0-inplace | ||
-package | ||
base | ||
-XHaskell98 | ||
C |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module C(module C) where | ||
import A | ||
cux = foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
packages: a b c | ||
multi-repl: True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
cradle: | ||
direct: | ||
arguments: ["-unit" ,"@a-1.0.0-inplace" | ||
,"-unit" ,"@b-1.0.0-inplace" | ||
,"-unit" ,"@c-1.0.0-inplace" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters