Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidy up import lists after refactor #6419

Merged
merged 1 commit into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ library:
- Stack.Build.Cache
- Stack.Build.ConstructPlan
- Stack.Build.Execute
- Stack.Build.ExecuteEnv
- Stack.Build.ExecutePackage
- Stack.Build.Haddock
- Stack.Build.Installed
- Stack.Build.Source
Expand Down
95 changes: 28 additions & 67 deletions src/Stack/Build/Execute.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,15 @@ module Stack.Build.Execute
import Control.Concurrent.Companion ( Companion, withCompanion )
import Control.Concurrent.Execute
( Action (..), ActionContext (..), ActionId (..)
, ActionType (..)
, Concurrency (..), runActions
, ActionType (..), Concurrency (..), runActions
)
import Control.Concurrent.STM ( check )
import Data.Attoparsec.Text ( char, choice, digit, parseOnly )
import qualified Data.Attoparsec.Text as P ( string )
import qualified Data.ByteString as S
import Data.Char ( isSpace )
import Conduit
( ConduitT, awaitForever, sinkHandle
, withSourceFile, yield
)
( ConduitT, awaitForever, sinkHandle, withSourceFile, yield )
import qualified Data.Conduit.Binary as CB
import qualified Data.Conduit.List as CL
import qualified Data.Conduit.Text as CT
Expand All @@ -43,90 +40,68 @@ import qualified Data.Set as Set
import qualified Data.Text as T
import Data.Tuple ( swap )
import Data.Time
( ZonedTime, getZonedTime, formatTime, defaultTimeLocale )
( ZonedTime, defaultTimeLocale, formatTime, getZonedTime )
import qualified Data.ByteString.Char8 as S8
import qualified Distribution.PackageDescription as C
import qualified Distribution.Simple.Build.Macros as C
import Distribution.System ( OS (Windows), Platform (Platform) )
import Distribution.System ( OS (..), Platform (..) )
import Distribution.Types.PackageName ( mkPackageName )
import Distribution.Verbosity ( showForCabal )
import Distribution.Version ( mkVersion )
import Path
( PathException, (</>)
, parent, parseRelDir, parseRelFile

)
( PathException, (</>), parent, parseRelDir, parseRelFile )
import Path.CheckInstall ( warnInstallSearchPathIssues )
import Path.Extra
( forgivingResolveFile, rejectMissingFile
, toFilePathNoTrailingSep
)
import Path.IO
( doesDirExist, doesFileExist, ensureDir
, renameDir

)
import Path.IO ( doesDirExist, doesFileExist, ensureDir, renameDir )
import RIO.NonEmpty ( nonEmpty )
import qualified RIO.NonEmpty as NE
import RIO.Process
( HasProcessContext, eceExitCode

, proc, runProcess_

( HasProcessContext, eceExitCode, proc, runProcess_
, withWorkingDir
)
import Stack.Build.ExecuteEnv
( ExecuteEnv (..), withExecuteEnv )
import Stack.Build.ExecutePackage
( singleBench, singleBuild, singleTest )
import Stack.Build.Haddock
( generateDepsHaddockIndex
, generateLocalHaddockForHackageArchives
, generateLocalHaddockIndex, generateSnapHaddockIndex
, openHaddocksInBrowser
)
import Stack.Build.Installed ( )
import Stack.Build.Target ( )
import Stack.Config ( checkOwnership )
import Stack.Constants
( bindirSuffix, cabalPackageName
, relDirDist, relDirSetup
, relFileBuildLock, relFileSetupHs
, relFileSetupLhs, relFileSetupLower, relFileSetupMacrosH

)
import Stack.Constants.Config
( distDirFromDir, distRelativeDir

( bindirSuffix, cabalPackageName, relDirDist, relDirSetup
, relFileBuildLock, relFileSetupHs, relFileSetupLhs
, relFileSetupLower, relFileSetupMacrosH
)
import Stack.Constants.Config ( distDirFromDir, distRelativeDir )
import Stack.Coverage
( deleteHpcReports, generateHpcMarkupIndex
, generateHpcUnifiedReport
)
import Stack.GhcPkg ( unregisterGhcPkgIds )
import Stack.Package
( buildLogPath
)
import Stack.Package ( buildLogPath )
import Stack.Prelude
import Stack.Types.ApplyGhcOptions ( ApplyGhcOptions (..) )
import Stack.Types.Build
( Plan (..)
, Task (..), TaskConfigOpts (..), TaskType (..)
, ExcludeTHLoading (..), ConvertPathsToAbsolute (..), KeepOutputOpen (..)
, taskLocation, taskProvides, taskTypeLocation
, taskTypePackageIdentifier
( ConvertPathsToAbsolute (..), ExcludeTHLoading (..)
, KeepOutputOpen (..), Plan (..), Task (..)
, TaskConfigOpts (..), TaskType (..), taskLocation
, taskProvides, taskTypeLocation, taskTypePackageIdentifier
)
import Stack.Types.Build.Exception
( BuildException (..), BuildPrettyException (..) )
import Stack.Types.BuildOpts
( BuildOpts (..), BuildOptsCLI (..)
, CabalVerbosity (..)
( BuildOpts (..), BuildOptsCLI (..), CabalVerbosity (..)
, ProgressBarFormat (..), TestOpts (..)
)
import Stack.Types.Compiler
( ActualCompiler (..)
, getGhcVersion
)
import Stack.Types.Compiler ( ActualCompiler (..), getGhcVersion )
import Stack.Types.CompilerPaths
( CompilerPaths (..), HasCompiler (..)
, getGhcPkgExe
)
( CompilerPaths (..), HasCompiler (..), getGhcPkgExe )
import Stack.Types.Config
( Config (..), HasConfig (..), buildOptsL )
import Stack.Types.ConfigureOpts
Expand All @@ -135,10 +110,8 @@ import Stack.Types.Dependency (DepValue(dvVersionRange))
import Stack.Types.DumpPackage ( DumpPackage (..) )
import Stack.Types.EnvConfig
( HasEnvConfig (..), actualCompilerVersionL
, bindirCompilerTools
, installationRootDeps, installationRootLocal
, packageDatabaseLocal

, bindirCompilerTools, installationRootDeps
, installationRootLocal, packageDatabaseLocal
)
import Stack.Types.EnvSettings ( EnvSettings (..) )
import Stack.Types.GhcPkgId ( GhcPkgId, ghcPkgIdString )
Expand All @@ -147,29 +120,18 @@ import Stack.Types.Installed
, installedPackageIdentifier
)
import Stack.Types.NamedComponent
( NamedComponent, benchComponents
, testComponents
)
( NamedComponent, benchComponents, testComponents )
import Stack.Types.Package
( LocalPackage (..), Package (..)
, packageIdentifier

)
( LocalPackage (..), Package (..), packageIdentifier )
import Stack.Types.Platform ( HasPlatform (..) )
import Stack.Types.Runner ( HasRunner, terminalL )
import Stack.Types.SourceMap ( Target )
import Stack.Types.Version ( withinRange )
import qualified System.Directory as D
import System.Environment ( getExecutablePath )
import System.FileLock
( SharedExclusive (Exclusive), withFileLock, withTryFileLock
)
( SharedExclusive (..), withFileLock, withTryFileLock )
import qualified System.FilePath as FP
import Stack.Build.ExecutePackage
( singleBuild, singleTest, singleBench )
import Stack.Build.ExecuteEnv
(ExecuteEnv (..), withExecuteEnv
)

-- | Fetch the packages necessary for a build, for example in combination with
-- a dry run.
Expand Down Expand Up @@ -404,7 +366,6 @@ copyExecutables exes = do
(map (fromString . T.unpack . textDisplay) installed :: [StyleDoc])
unless compilerSpecific $ warnInstallSearchPathIssues destDir' installed


-- | Windows can't write over the current executable. Instead, we rename the
-- current executable to something else and then do the copy.
windowsRenameCopy :: FilePath -> FilePath -> IO ()
Expand Down
85 changes: 30 additions & 55 deletions src/Stack/Build/ExecuteEnv.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,19 @@ module Stack.Build.ExecuteEnv

import Control.Concurrent.Companion ( Companion, withCompanion )
import Control.Concurrent.Execute
( ActionContext (..), ActionId (..)
, Concurrency (..)
)
( ActionContext (..), ActionId (..), Concurrency (..) )
import Crypto.Hash ( SHA256 (..), hashWith )
import Data.Attoparsec.Text ( char, choice, digit, parseOnly )
import qualified Data.Attoparsec.Text as P ( string )
import qualified Data.ByteArray as Mem ( convert )
import qualified Data.ByteString as S
import qualified Data.ByteString.Builder ( toLazyByteString )
import qualified Data.ByteString.Base64.URL as B64URL
import qualified Data.ByteString.Builder ( toLazyByteString )
import qualified Data.ByteString.Char8 as S8
import Data.Char ( isSpace )
import Conduit
( ConduitT, awaitForever, sinkHandle
, withSinkFile, withSourceFile, yield
( ConduitT, awaitForever, sinkHandle, withSinkFile
, withSourceFile, yield
)
import qualified Data.Conduit.Binary as CB
import qualified Data.Conduit.List as CL
Expand All @@ -43,97 +42,73 @@ import qualified Data.Set as Set
import qualified Data.Text as T
import Data.Text.Encoding ( decodeUtf8 )
import Data.Time
( ZonedTime, getZonedTime, formatTime, defaultTimeLocale )
import qualified Data.ByteString.Char8 as S8
( ZonedTime, defaultTimeLocale, formatTime, getZonedTime )
import qualified Distribution.PackageDescription as C
import qualified Distribution.Simple.Build.Macros as C
import Distribution.System ( OS (Windows), Platform (Platform) )
import Distribution.System ( OS (..), Platform (..) )
import Distribution.Types.PackageName ( mkPackageName )
import Distribution.Verbosity ( showForCabal )
import Distribution.Version ( mkVersion )
import Path
( PathException, (</>)
, parent, parseRelDir, parseRelFile

)
import Path.Extra
( forgivingResolveFile
, toFilePathNoTrailingSep
)
( PathException, (</>), parent, parseRelDir, parseRelFile )
import Path.Extra ( forgivingResolveFile, toFilePathNoTrailingSep )
import Path.IO
( doesDirExist, doesFileExist, ensureDir
, ignoringAbsence, removeFile, renameDir
, renameFile
( doesDirExist, doesFileExist, ensureDir, ignoringAbsence
, removeFile, renameDir, renameFile
)
import RIO.Process
( eceExitCode, proc, runProcess_
, setStdout, useHandleOpen
( eceExitCode, proc, runProcess_, setStdout, useHandleOpen
, withWorkingDir
)
import Stack.Config ( checkOwnership )
import Stack.Constants
( cabalPackageName
, relDirDist, relDirSetup, relDirSetupExeCache
, relDirSetupExeSrc, relFileBuildLock, relFileSetupHs
, relFileSetupLhs, relFileSetupLower, relFileSetupMacrosH
, setupGhciShimCode, stackProgName
)
import Stack.Constants.Config
( distDirFromDir, distRelativeDir

)
import Stack.Package
( buildLogPath
( cabalPackageName, relDirDist, relDirSetup
, relDirSetupExeCache, relDirSetupExeSrc, relFileBuildLock
, relFileSetupHs, relFileSetupLhs, relFileSetupLower
, relFileSetupMacrosH, setupGhciShimCode, stackProgName
)
import Stack.Constants.Config ( distDirFromDir, distRelativeDir )
import Stack.Package ( buildLogPath )
import Stack.Prelude
import Stack.Types.ApplyGhcOptions ( ApplyGhcOptions (..) )
import Stack.Types.Build
( TaskType (..), ExcludeTHLoading (..)
, ConvertPathsToAbsolute (..), KeepOutputOpen (..)
, taskTypeLocation, taskTypePackageIdentifier
( ConvertPathsToAbsolute (..), ExcludeTHLoading (..)
, KeepOutputOpen (..), TaskType (..), taskTypeLocation
, taskTypePackageIdentifier
)
import Stack.Types.Build.Exception
( BuildException (..), BuildPrettyException (..) )
import Stack.Types.BuildOpts
( BuildOpts (..), BuildOptsCLI (..)
, CabalVerbosity (..)
)
( BuildOpts (..), BuildOptsCLI (..), CabalVerbosity (..) )
import Stack.Types.Compiler
( ActualCompiler (..), WhichCompiler (..)
, compilerVersionString, getGhcVersion, whichCompilerL
)
import Stack.Types.CompilerPaths
( CompilerPaths (..), HasCompiler (..)
, cabalVersionL, getCompilerPath
( CompilerPaths (..), HasCompiler (..), cabalVersionL
, getCompilerPath
)
import Stack.Types.Config
( Config (..), HasConfig (..), stackRootL )
import Stack.Types.ConfigureOpts
( BaseConfigOpts (..) )
import Stack.Types.Dependency (DepValue(dvVersionRange))
import Stack.Types.ConfigureOpts ( BaseConfigOpts (..) )
import Stack.Types.Dependency ( DepValue(..) )
import Stack.Types.DumpLogs ( DumpLogs (..) )
import Stack.Types.DumpPackage ( DumpPackage (..) )
import Stack.Types.EnvConfig
( HasEnvConfig (..), actualCompilerVersionL
, platformGhcRelDir
, shouldForceGhcColorFlag
, platformGhcRelDir, shouldForceGhcColorFlag
)
import Stack.Types.EnvSettings ( EnvSettings (..) )
import Stack.Types.GhcPkgId ( GhcPkgId, ghcPkgIdString )
import Stack.Types.Installed
( InstallLocation (..), Installed (..)
)
import Stack.Types.Installed ( InstallLocation (..), Installed (..) )
import Stack.Types.Package
( LocalPackage (..), Package (..)
, packageIdentifier
)
( LocalPackage (..), Package (..), packageIdentifier )
import Stack.Types.Platform ( HasPlatform (..) )
import Stack.Types.Version ( withinRange )
import qualified System.Directory as D
import System.Environment ( lookupEnv )
import System.FileLock
( SharedExclusive (Exclusive), withFileLock, withTryFileLock
)
( SharedExclusive (..), withFileLock, withTryFileLock )

-- | Has an executable been built or not?
data ExecutableBuildStatus
Expand Down
Loading
Loading