From 59086c18140a83be79beb6cad5af5d42350b9e6b Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Wed, 6 Mar 2019 12:37:48 +0200 Subject: [PATCH 1/2] Integration test: compiler override does not work Confirmed that this test passes with Stack 1.9.3 and fails with master. --- test/integration/tests/override-compiler/Main.hs | 7 +++++++ test/integration/tests/override-compiler/files/stack.yaml | 3 +++ 2 files changed, 10 insertions(+) create mode 100644 test/integration/tests/override-compiler/Main.hs create mode 100644 test/integration/tests/override-compiler/files/stack.yaml diff --git a/test/integration/tests/override-compiler/Main.hs b/test/integration/tests/override-compiler/Main.hs new file mode 100644 index 0000000000..77e75275a8 --- /dev/null +++ b/test/integration/tests/override-compiler/Main.hs @@ -0,0 +1,7 @@ +import StackTest +import Control.Monad (unless) + +main :: IO () +main = stackCheckStdout ["exec", "--", "ghc", "--numeric-version"] $ \ver -> + -- get rid of the newline character + unless (concat (lines ver) == "8.2.2") $ error $ "Invalid version: " ++ show ver diff --git a/test/integration/tests/override-compiler/files/stack.yaml b/test/integration/tests/override-compiler/files/stack.yaml new file mode 100644 index 0000000000..cbd151a11d --- /dev/null +++ b/test/integration/tests/override-compiler/files/stack.yaml @@ -0,0 +1,3 @@ +resolver: lts-13.10 +compiler: ghc-8.2.2 +packages: [] From ba50a70879f72e7185097a7885a6599fb02b7605 Mon Sep 17 00:00:00 2001 From: Kirill Zaborsky Date: Wed, 6 Mar 2019 16:56:21 +0300 Subject: [PATCH 2/2] Enable back compiler override in stack.yaml --- src/Stack/Config.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Stack/Config.hs b/src/Stack/Config.hs index 3c30adff7a..8bce95dd54 100644 --- a/src/Stack/Config.hs +++ b/src/Stack/Config.hs @@ -584,7 +584,8 @@ loadBuildConfig mproject maresolver mcompiler = do , "outside of a real project.\n" ] return (p, dest) let project = project' - { projectResolver = fromMaybe (projectResolver project') mresolver + { projectCompiler = mcompiler <|> projectCompiler project' + , projectResolver = fromMaybe (projectResolver project') mresolver } resolver <- completeSnapshotLocation $ projectResolver project @@ -642,7 +643,7 @@ loadBuildConfig mproject maresolver mcompiler = do throwM $ InvalidGhcOptionsSpecification (Map.keys unusedPkgGhcOptions) let wanted = SMWanted - { smwCompiler = fromMaybe (snapshotCompiler snapshot) mcompiler + { smwCompiler = fromMaybe (snapshotCompiler snapshot) (projectCompiler project) , smwProject = packages , smwDeps = deps , smwSnapshotLocation = projectResolver project