|
6 | 6 | {-# LANGUAGE MultiParamTypeClasses #-} |
7 | 7 | {-# LANGUAGE OverloadedStrings #-} |
8 | 8 | {-# LANGUAGE RecordWildCards #-} |
9 | | -{-# LANGUAGE TemplateHaskell #-} |
10 | 9 | {-# LANGUAGE LambdaCase #-} |
11 | 10 | {-# LANGUAGE TypeFamilies #-} |
12 | 11 | {-# LANGUAGE ScopedTypeVariables #-} |
@@ -43,7 +42,6 @@ import Data.Conduit.Process.Typed |
43 | 42 | createPipe, runProcess_, getStdout, |
44 | 43 | getStderr, createSource) |
45 | 44 | import qualified Data.Conduit.Text as CT |
46 | | -import Data.FileEmbed (embedFile, makeRelativeToProject) |
47 | 45 | import Data.IORef.RunOnce (runOnce) |
48 | 46 | import Data.List hiding (any) |
49 | 47 | import qualified Data.Map.Strict as M |
@@ -228,11 +226,6 @@ buildSetupArgs = |
228 | 226 | , "StackSetupShim.mainOverride" |
229 | 227 | ] |
230 | 228 |
|
231 | | -setupGhciShimCode :: S.ByteString |
232 | | -setupGhciShimCode = $(do |
233 | | - path <- makeRelativeToProject "src/setup-shim/StackSetupShim.hs" |
234 | | - embedFile path) |
235 | | - |
236 | 229 | simpleSetupCode :: S.ByteString |
237 | 230 | simpleSetupCode = "import Distribution.Simple\nmain = defaultMain" |
238 | 231 |
|
@@ -274,7 +267,7 @@ getSetupExe setupHs setupShimHs tmpdir = do |
274 | 267 | baseNameS ++ ".jsexe" |
275 | 268 | setupDir = |
276 | 269 | view stackRootL config </> |
277 | | - $(mkRelDir "setup-exe-cache") </> |
| 270 | + relDirSetupExeCache </> |
278 | 271 | platformDir |
279 | 272 |
|
280 | 273 | exePath <- (setupDir </>) <$> parseRelFile exeNameS |
@@ -333,7 +326,7 @@ withExecuteEnv bopts boptsCli baseConfigOpts locals globalPackages snapshotPacka |
333 | 326 | -- Create files for simple setup and setup shim, if necessary |
334 | 327 | let setupSrcDir = |
335 | 328 | view stackRootL config </> |
336 | | - $(mkRelDir "setup-exe-src") |
| 329 | + relDirSetupExeSrc |
337 | 330 | ensureDir setupSrcDir |
338 | 331 | setupFileName <- parseRelFile ("setup-" ++ simpleSetupHash ++ ".hs") |
339 | 332 | let setupHs = setupSrcDir </> setupFileName |
@@ -864,7 +857,7 @@ ensureConfig newConfigCache pkgDir ExecuteEnv {..} announce cabal cabalfp task = |
864 | 857 | -- with autoreconf -i. See: |
865 | 858 | -- https://github.com/commercialhaskell/stack/issues/3534 |
866 | 859 | ensureConfigureScript = do |
867 | | - let fp = pkgDir </> $(mkRelFile "configure") |
| 860 | + let fp = pkgDir </> relFileConfigure |
868 | 861 | exists <- doesFileExist fp |
869 | 862 | unless exists $ do |
870 | 863 | logInfo $ "Trying to generate configure with autoreconf in " <> fromString (toFilePath pkgDir) |
@@ -951,7 +944,7 @@ withSingleContext ActionContext {..} ExecuteEnv {..} task@Task {..} mdeps msuffi |
951 | 944 |
|
952 | 945 | -- See: https://github.com/fpco/stack/issues/157 |
953 | 946 | distDir <- distRelativeDir |
954 | | - let oldDist = dir </> $(mkRelDir "dist") |
| 947 | + let oldDist = dir </> relDirDist |
955 | 948 | newDist = dir </> distDir |
956 | 949 | exists <- doesDirExist oldDist |
957 | 950 | when exists $ do |
@@ -1086,7 +1079,7 @@ withSingleContext ActionContext {..} ExecuteEnv {..} task@Task {..} mdeps msuffi |
1086 | 1079 | let depsArgs = map fst matchedDeps |
1087 | 1080 | -- Generate setup_macros.h and provide it to ghc |
1088 | 1081 | let macroDeps = mapMaybe snd matchedDeps |
1089 | | - cppMacrosFile = toFilePath $ setupDir </> $(mkRelFile "setup_macros.h") |
| 1082 | + cppMacrosFile = toFilePath $ setupDir </> relFileSetupMacrosH |
1090 | 1083 | cppArgs = ["-optP-include", "-optP" ++ cppMacrosFile] |
1091 | 1084 | liftIO $ S.writeFile cppMacrosFile (encodeUtf8 (T.pack (C.generatePackageVersionMacros macroDeps))) |
1092 | 1085 | return (packageDBArgs ++ depsArgs ++ cppArgs) |
@@ -1193,8 +1186,8 @@ withSingleContext ActionContext {..} ExecuteEnv {..} task@Task {..} mdeps msuffi |
1193 | 1186 | Left setupExe -> return setupExe |
1194 | 1187 | Right setuphs -> do |
1195 | 1188 | distDir <- distDirFromDir pkgDir |
1196 | | - let setupDir = distDir </> $(mkRelDir "setup") |
1197 | | - outputFile = setupDir </> $(mkRelFile "setup") |
| 1189 | + let setupDir = distDir </> relDirSetup |
| 1190 | + outputFile = setupDir </> relFileSetupLower |
1198 | 1191 | customBuilt <- liftIO $ readIORef eeCustomBuilt |
1199 | 1192 | if Set.member (packageName package) customBuilt |
1200 | 1193 | then return outputFile |
@@ -1662,7 +1655,7 @@ checkExeStatus |
1662 | 1655 | -> RIO env (Text, ExecutableBuildStatus) |
1663 | 1656 | checkExeStatus compiler platform distDir name = do |
1664 | 1657 | exename <- parseRelDir (T.unpack name) |
1665 | | - exists <- checkPath (distDir </> $(mkRelDir "build") </> exename) |
| 1658 | + exists <- checkPath (distDir </> relDirBuild </> exename) |
1666 | 1659 | pure |
1667 | 1660 | ( name |
1668 | 1661 | , if exists |
@@ -1984,8 +1977,8 @@ getSetupHs dir = do |
1984 | 1977 | then return fp2 |
1985 | 1978 | else throwM $ NoSetupHsFound dir |
1986 | 1979 | where |
1987 | | - fp1 = dir </> $(mkRelFile "Setup.hs") |
1988 | | - fp2 = dir </> $(mkRelFile "Setup.lhs") |
| 1980 | + fp1 = dir </> relFileSetupHs |
| 1981 | + fp2 = dir </> relFileSetupLhs |
1989 | 1982 |
|
1990 | 1983 | -- Do not pass `-hpcdir` as GHC option if the coverage is not enabled. |
1991 | 1984 | -- This helps running stack-compiled programs with dynamic interpreters like `hint`. |
|
0 commit comments