Commit 7d01c2e6 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Export a few more BuildTarget utils

parent 89fd3e09
...@@ -14,10 +14,14 @@ module Distribution.Simple.BuildTarget ( ...@@ -14,10 +14,14 @@ module Distribution.Simple.BuildTarget (
-- * Build targets -- * Build targets
BuildTarget(..), BuildTarget(..),
readBuildTargets, readBuildTargets,
showBuildTarget,
QualLevel(..),
buildTargetComponentName,
-- * Parsing user build targets -- * Parsing user build targets
UserBuildTarget, UserBuildTarget,
readUserBuildTargets, readUserBuildTargets,
showUserBuildTarget,
UserBuildTargetProblem(..), UserBuildTargetProblem(..),
reportUserBuildTargetProblems, reportUserBuildTargetProblems,
...@@ -130,6 +134,11 @@ data BuildTarget = ...@@ -130,6 +134,11 @@ data BuildTarget =
instance Binary BuildTarget instance Binary BuildTarget
buildTargetComponentName :: BuildTarget -> ComponentName
buildTargetComponentName (BuildTargetComponent cn) = cn
buildTargetComponentName (BuildTargetModule cn _) = cn
buildTargetComponentName (BuildTargetFile cn _) = cn
-- | Read a list of user-supplied build target strings and resolve them to -- | Read a list of user-supplied build target strings and resolve them to
-- 'BuildTarget's according to a 'PackageDescription'. If there are problems -- 'BuildTarget's according to a 'PackageDescription'. If there are problems
-- with any of the targets e.g. they don't exist or are misformatted, throw an -- with any of the targets e.g. they don't exist or are misformatted, throw an
...@@ -232,6 +241,10 @@ showUserBuildTarget = intercalate ":" . components ...@@ -232,6 +241,10 @@ showUserBuildTarget = intercalate ":" . components
components (UserBuildTargetDouble s1 s2) = [s1,s2] components (UserBuildTargetDouble s1 s2) = [s1,s2]
components (UserBuildTargetTriple s1 s2 s3) = [s1,s2,s3] components (UserBuildTargetTriple s1 s2 s3) = [s1,s2,s3]
showBuildTarget :: QualLevel -> PackageId -> BuildTarget -> String
showBuildTarget ql pkgid bt =
showUserBuildTarget (renderBuildTarget ql bt pkgid)
-- ------------------------------------------------------------ -- ------------------------------------------------------------
-- * Resolving user targets to build targets -- * Resolving user targets to build targets
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment