Skip to content

Commit

Permalink
Move getDefaultPackageConfig to where it is used
Browse files Browse the repository at this point in the history
  • Loading branch information
snoyberg committed Aug 17, 2017
1 parent ea5646f commit f73b34a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
15 changes: 0 additions & 15 deletions src/Stack/Build/Source.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ module Stack.Build.Source
, getLocalFlags
, getGhcOptions
, addUnlistedToBuildCache
, getDefaultPackageConfig
) where

import Stack.Prelude
Expand Down Expand Up @@ -471,20 +470,6 @@ checkComponentsBuildable lps =
, c <- Set.toList (lpUnbuildable lp)
]

getDefaultPackageConfig :: (MonadIO m, MonadReader env m, HasEnvConfig env)
=> m PackageConfig
getDefaultPackageConfig = do
platform <- view platformL
compilerVersion <- view actualCompilerVersionL
return PackageConfig
{ packageConfigEnableTests = False
, packageConfigEnableBenchmarks = False
, packageConfigFlags = M.empty
, packageConfigGhcOptions = []
, packageConfigCompilerVersion = compilerVersion
, packageConfigPlatform = platform
}

-- | Get 'PackageConfig' for package given its name.
getPackageConfig :: (MonadIO m, MonadReader env m, HasEnvConfig env)
=> BuildOptsCLI
Expand Down
16 changes: 15 additions & 1 deletion src/Stack/SDist.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import Path.IO hiding (getModificationTime, getPermissions, withSystem
import Stack.Build (mkBaseConfigOpts, build)
import Stack.Build.Execute
import Stack.Build.Installed
import Stack.Build.Source (loadSourceMap, getDefaultPackageConfig)
import Stack.Build.Source (loadSourceMap)
import Stack.Build.Target hiding (PackageType (..))
import Stack.PackageLocation (resolveMultiPackageLocation)
import Stack.Constants
Expand Down Expand Up @@ -443,3 +443,17 @@ getModTime :: FilePath -> IO Tar.EpochTime
getModTime path = do
t <- getModificationTime path
return . floor . utcTimeToPOSIXSeconds $ t

getDefaultPackageConfig :: (MonadIO m, MonadReader env m, HasEnvConfig env)
=> m PackageConfig
getDefaultPackageConfig = do
platform <- view platformL
compilerVersion <- view actualCompilerVersionL
return PackageConfig
{ packageConfigEnableTests = False
, packageConfigEnableBenchmarks = False
, packageConfigFlags = mempty
, packageConfigGhcOptions = []
, packageConfigCompilerVersion = compilerVersion
, packageConfigPlatform = platform
}

0 comments on commit f73b34a

Please sign in to comment.