Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
5db0017b
Commit
5db0017b
authored
Jul 14, 2015
by
Andrey Mokhov
Browse files
Factor out build :: Target -> Action () into Rules/Util.hs.
parent
196430d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Rules/Data.hs
View file @
5db0017b
...
...
@@ -9,11 +9,10 @@ import Package
import
Expression
hiding
(
when
,
liftIO
)
import
Oracles.Flag
(
when
)
import
Oracles.Builder
import
Oracles.ArgsHash
import
Settings
import
Settings.GhcPkg
import
Settings.GhcCabal
import
Settings.TargetDirectory
import
Rules.Util
import
Util
import
Ways
...
...
@@ -35,27 +34,17 @@ buildPackageData target =
]
&%>
\
_
->
do
let
configure
=
pkgPath
pkg
</>
"configure"
-- TODO: 1) how to automate this? 2) handle multiple files?
newTarget
=
target
{
getFile
=
path
</>
"package-data.mk"
}
newTarget
=
target
{
getFile
=
path
</>
"package-data.mk"
,
getWay
=
vanilla
}
-- TODO: think
-- GhcCabal will run the configure script, so we depend on it
need
[
pkgPath
pkg
</>
pkgCabal
pkg
]
-- We still don't know who built the configure script from configure.ac
when
(
doesFileExist
$
configure
<.>
"ac"
)
$
need
[
configure
]
run'
newTarget
GhcCabal
build
$
newTarget
{
getBuilder
=
GhcCabal
}
-- TODO: when (registerPackage settings) $
run'
newTarget
(
GhcPkg
stage
)
build
$
newTarget
{
getBuilder
=
GhcPkg
stage
}
postProcessPackageData
$
path
</>
"package-data.mk"
-- TODO: This should probably go to Oracles.Builder
run'
::
Target
->
Builder
->
Action
()
run'
target
builder
=
do
let
finalTarget
=
target
{
getBuilder
=
builder
,
getWay
=
vanilla
}
args
<-
interpret
finalTarget
settings
putColoured
Green
(
show
args
)
-- The line below forces the rule to be rerun if the hash has changed
argsHash
<-
askArgsHash
finalTarget
putColoured
Yellow
(
show
argsHash
)
run
builder
args
-- Prepare a given 'packaga-data.mk' file for parsing by readConfigFile:
-- 1) Drop lines containing '$'
-- For example, get rid of
...
...
src/Rules/Util.hs
0 → 100644
View file @
5db0017b
module
Rules.Util
(
build
)
where
import
Base
import
Util
import
Settings
import
Expression
import
Oracles.Builder
import
Oracles.ArgsHash
build
::
Target
->
Action
()
build
target
=
do
args
<-
interpret
target
settings
putColoured
Green
(
show
target
)
putColoured
Green
(
show
args
)
-- The line below forces the rule to be rerun if the args hash has changed
argsHash
<-
askArgsHash
target
run
(
getBuilder
target
)
args
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment