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
8e9fe8d6
Commit
8e9fe8d6
authored
Aug 01, 2015
by
Andrey Mokhov
Browse files
Cache computation of boot package constraints in a file.
parent
44ce5719
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/Base.hs
View file @
8e9fe8d6
module
Base
(
shakeFilesPath
,
configPath
,
shakeFilesPath
,
configPath
,
bootPackageConstraints
,
module
Development
.
Shake
,
module
Development
.
Shake
.
Util
,
module
Development
.
Shake
.
Config
,
...
...
@@ -18,3 +18,6 @@ shakeFilesPath = "_build/"
configPath
::
FilePath
configPath
=
"shake/cfg/"
bootPackageConstraints
::
FilePath
bootPackageConstraints
=
shakeFilesPath
++
"boot-package-constraints"
src/Main.hs
View file @
8e9fe8d6
...
...
@@ -3,6 +3,7 @@ import Rules
main
=
shakeArgs
shakeOptions
{
shakeFiles
=
shakeFilesPath
}
$
do
oracleRules
-- see module Rules.Oracles
cabalRules
-- see module Rules.Cabal
packageRules
-- see module Rules
configRules
-- see module Rules.Config
generateTargets
-- see module Rules
src/Rules.hs
View file @
8e9fe8d6
module
Rules
(
generateTargets
,
packageRules
,
oracleRules
,
module
Rules
.
Config
,
module
Rules
.
Package
,
oracleRules
,
cabalRules
,
configRules
,
packageRules
,
generateTargets
)
where
import
Base
import
Util
import
Stage
import
Expression
import
Rules.Cabal
import
Rules.Config
import
Rules.Package
import
Rules.Oracles
...
...
src/Rules/Cabal.hs
0 → 100644
View file @
8e9fe8d6
module
Rules.Cabal
(
cabalRules
)
where
import
Base
import
Util
import
Stage
import
Package
import
Expression
import
Settings.Packages
import
Data.List
import
Data.Version
import
qualified
Distribution.Package
as
D
import
qualified
Distribution.PackageDescription
as
D
import
qualified
Distribution.Verbosity
as
D
import
qualified
Distribution.PackageDescription.Parse
as
D
cabalRules
::
Rules
()
cabalRules
=
-- Cache boot package constraints (to be used in cabalArgs)
bootPackageConstraints
%>
\
file
->
do
pkgs
<-
interpret
(
stageTarget
Stage0
)
packages
constraints
<-
forM
(
sort
pkgs
)
$
\
pkg
->
do
let
cabal
=
pkgPath
pkg
-/-
pkgCabal
pkg
need
[
cabal
]
descr
<-
liftIO
$
D
.
readPackageDescription
D
.
silent
cabal
let
identifier
=
D
.
package
.
D
.
packageDescription
$
descr
version
=
showVersion
.
D
.
pkgVersion
$
identifier
D
.
PackageName
name
=
D
.
pkgName
$
identifier
return
$
name
++
" == "
++
version
writeFileChanged
file
.
unlines
$
constraints
src/Rules/Package.hs
View file @
8e9fe8d6
module
Rules.Package
(
buildPackage
)
where
module
Rules.Package
(
buildPackage
)
where
import
Base
import
Expression
...
...
src/Settings/Args.hs
View file @
8e9fe8d6
...
...
@@ -2,12 +2,12 @@ module Settings.Args (
args
)
where
import
Expression
import
Settings.User
import
Settings.GhcM
import
Settings.GccM
import
Settings.GhcPkg
import
Settings.GhcCabal
import
Expression
args
::
Args
args
=
defaultArgs
<>
userArgs
...
...
src/Settings/GhcCabal.hs
View file @
8e9fe8d6
...
...
@@ -15,12 +15,6 @@ import Oracles.Setting
import
Settings.User
import
Settings.Ways
import
Settings.Util
import
Settings.Packages
import
Data.Version
import
qualified
Distribution.Package
as
D
import
qualified
Distribution.PackageDescription
as
D
import
qualified
Distribution.Verbosity
as
D
import
qualified
Distribution.PackageDescription.Parse
as
D
cabalArgs
::
Args
cabalArgs
=
builder
GhcCabal
?
do
...
...
@@ -95,18 +89,9 @@ bootPackageDbArgs = do
dllArgs
::
Args
dllArgs
=
arg
""
-- TODO: speed up by caching the result in Shake database?
packageConstraints
::
Args
packageConstraints
=
stage0
?
do
pkgs
<-
getPackages
constraints
<-
lift
$
forM
pkgs
$
\
pkg
->
do
let
cabal
=
pkgPath
pkg
-/-
pkgCabal
pkg
need
[
cabal
]
description
<-
liftIO
$
D
.
readPackageDescription
D
.
silent
cabal
let
identifier
=
D
.
package
.
D
.
packageDescription
$
description
version
=
showVersion
.
D
.
pkgVersion
$
identifier
D
.
PackageName
name
=
D
.
pkgName
$
identifier
return
$
name
++
" == "
++
version
constraints
<-
lift
.
readFileLines
$
bootPackageConstraints
append
.
concatMap
(
\
c
->
[
"--constraint"
,
c
])
$
constraints
-- TODO: should be in a different file
...
...
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