mirror of
https://github.com/input-output-hk/foliage.git
synced 2024-12-02 07:54:45 +03:00
9a4d097cde
The function preparePackageVersion is now responsible for doing everything we need to do to be able to include the package in the index. The function also returns a denormalised view of the package information which can be taken as a proof that everything is consistent.
40 lines
1.1 KiB
Haskell
40 lines
1.1 KiB
Haskell
module Foliage.Shake
|
|
( computeFileInfoSimple',
|
|
readKeysAt,
|
|
readPackageVersionSpec',
|
|
readGenericPackageDescription',
|
|
)
|
|
where
|
|
|
|
import Data.Traversable (for)
|
|
import Development.Shake
|
|
import Development.Shake.FilePath
|
|
import Distribution.Simple.PackageDescription
|
|
import Distribution.Types.GenericPackageDescription
|
|
import Distribution.Verbosity qualified as Verbosity
|
|
import Foliage.HackageSecurity
|
|
import Foliage.Meta
|
|
|
|
computeFileInfoSimple' :: FilePath -> Action FileInfo
|
|
computeFileInfoSimple' fp = do
|
|
need [fp]
|
|
liftIO $ computeFileInfoSimple fp
|
|
|
|
readKeysAt :: FilePath -> Action [Some Key]
|
|
readKeysAt base = do
|
|
paths <- getDirectoryFiles base ["*.json"]
|
|
need $ map (base </>) paths
|
|
for paths $ \path -> do
|
|
Right key <- liftIO $ readJSONSimple (base </> path)
|
|
pure key
|
|
|
|
readPackageVersionSpec' :: FilePath -> Action PackageVersionSpec
|
|
readPackageVersionSpec' fp = do
|
|
need [fp]
|
|
liftIO $ readPackageVersionSpec fp
|
|
|
|
readGenericPackageDescription' :: FilePath -> Action GenericPackageDescription
|
|
readGenericPackageDescription' fp = do
|
|
need [fp]
|
|
liftIO $ readGenericPackageDescription Verbosity.silent fp
|