[commit: ghc] wip/nfs-locking: Add GenApply builder, #22. (4b70d6e)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:21:29 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/4b70d6e8c474ba0a7789be0b3009e625c1a27820/ghc

>---------------------------------------------------------------

commit 4b70d6e8c474ba0a7789be0b3009e625c1a27820
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Sat Jan 2 02:09:27 2016 +0000

    Add GenApply builder, #22.


>---------------------------------------------------------------

4b70d6e8c474ba0a7789be0b3009e625c1a27820
 cfg/system.config.in              |  1 +
 shaking-up-ghc.cabal              |  4 +++-
 src/Builder.hs                    |  2 ++
 src/Rules/Actions.hs              | 16 ++++++++++------
 src/Settings/Args.hs              |  4 ++++
 src/Settings/Builders/GenApply.hs |  8 ++++++++
 6 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/cfg/system.config.in b/cfg/system.config.in
index a2cfef3..c5808c7 100644
--- a/cfg/system.config.in
+++ b/cfg/system.config.in
@@ -22,6 +22,7 @@ haddock          = inplace/bin/haddock
 hsc2hs           = inplace/bin/hsc2hs
 
 genprimopcode    = inplace/bin/genprimopcode
+genapply         = inplace/bin/genapply
 derive-constants = inplace/bin/deriveConstants
 
 hs-cpp           = @HaskellCPPCmd@
diff --git a/shaking-up-ghc.cabal b/shaking-up-ghc.cabal
index 2c75566..48dd0b8 100644
--- a/shaking-up-ghc.cabal
+++ b/shaking-up-ghc.cabal
@@ -38,6 +38,7 @@ executable ghc-shake
                        , Rules.Cabal
                        , Rules.Compile
                        , Rules.Config
+                       , Rules.Copy
                        , Rules.Data
                        , Rules.Dependencies
                        , Rules.Documentation
@@ -48,7 +49,6 @@ executable ghc-shake
                        , Rules.Generators.GhcPlatformH
                        , Rules.Generators.GhcVersionH
                        , Rules.Generators.VersionHs
-                       , Rules.Install
                        , Rules.Library
                        , Rules.Oracles
                        , Rules.Package
@@ -63,6 +63,7 @@ executable ghc-shake
                        , Settings.Builders.Common
                        , Settings.Builders.DeriveConstants
                        , Settings.Builders.Gcc
+                       , Settings.Builders.GenApply
                        , Settings.Builders.GenPrimopCode
                        , Settings.Builders.Ghc
                        , Settings.Builders.GhcCabal
@@ -82,6 +83,7 @@ executable ghc-shake
                        , Settings.Packages.Haddock
                        , Settings.Packages.Hp2ps
                        , Settings.Packages.IntegerGmp
+                       , Settings.Packages.Rts
                        , Settings.Packages.RunGhc
                        , Settings.TargetDirectory
                        , Settings.User
diff --git a/src/Builder.hs b/src/Builder.hs
index b4b01c3..c8e3f6e 100644
--- a/src/Builder.hs
+++ b/src/Builder.hs
@@ -25,6 +25,7 @@ data Builder = Alex
              | DeriveConstants
              | Gcc Stage
              | GccM Stage
+             | GenApply
              | GenPrimopCode
              | Ghc Stage
              | GhcCabal
@@ -60,6 +61,7 @@ builderKey builder = case builder of
     Gcc Stage0       -> "system-gcc"
     Gcc _            -> "gcc"
     GccM stage       -> builderKey $ Gcc stage -- synonym for 'Gcc -MM'
+    GenApply         -> "genapply"
     GenPrimopCode    -> "genprimopcode"
     Ghc Stage0       -> "system-ghc"
     Ghc Stage1       -> "ghc-stage1"
diff --git a/src/Rules/Actions.hs b/src/Rules/Actions.hs
index 8b243eb..e930b52 100644
--- a/src/Rules/Actions.hs
+++ b/src/Rules/Actions.hs
@@ -27,14 +27,12 @@ buildWithResources rs target = do
         quietlyUnlessVerbose $ case builder of
             Ar -> arCmd path argList
 
-            HsCpp -> do
-                let file = head $ Target.outputs target  -- TODO: ugly
-                Stdout output <- cmd [path] argList
-                writeFileChanged file output
+            HsCpp    -> captureStdout target path argList
+            GenApply -> captureStdout target path argList
 
             GenPrimopCode -> do
-                let src  = head $ Target.inputs target -- TODO: ugly
-                    file = head $ Target.outputs target
+                src  <- interpret target getInput
+                file <- interpret target getOutput
                 input <- readFile' src
                 Stdout output <- cmd (Stdin input) [path] argList
                 writeFileChanged file output
@@ -45,6 +43,12 @@ buildWithResources rs target = do
 build :: Target -> Action ()
 build = buildWithResources []
 
+captureStdout :: Target -> FilePath -> [String] -> Action ()
+captureStdout target path argList = do
+    file <- interpret target getOutput
+    Stdout output <- cmd [path] argList
+    writeFileChanged file output
+
 -- Print out key information about the command being executed
 putInfo :: Target.Target -> Action ()
 putInfo (Target.Target {..}) = putBuild $ renderBox $
diff --git a/src/Settings/Args.hs b/src/Settings/Args.hs
index 8066e81..c4c919c 100644
--- a/src/Settings/Args.hs
+++ b/src/Settings/Args.hs
@@ -7,6 +7,7 @@ import Settings.Builders.Alex
 import Settings.Builders.Ar
 import Settings.Builders.DeriveConstants
 import Settings.Builders.Gcc
+import Settings.Builders.GenApply
 import Settings.Builders.GenPrimopCode
 import Settings.Builders.Ghc
 import Settings.Builders.GhcCabal
@@ -25,6 +26,7 @@ import Settings.Packages.GhcPrim
 import Settings.Packages.Haddock
 import Settings.Packages.Hp2ps
 import Settings.Packages.IntegerGmp
+import Settings.Packages.Rts
 import Settings.Packages.RunGhc
 import Settings.User
 
@@ -44,6 +46,7 @@ defaultBuilderArgs = mconcat
     , deriveConstantsBuilderArgs
     , gccBuilderArgs
     , gccMBuilderArgs
+    , genApplyBuilderArgs
     , genPrimopCodeBuilderArgs
     , ghcBuilderArgs
     , ghcCabalBuilderArgs
@@ -67,4 +70,5 @@ defaultPackageArgs = mconcat
     , haddockPackageArgs
     , hp2psPackageArgs
     , integerGmpPackageArgs
+    , rtsPackageArgs
     , runGhcPackageArgs ]
diff --git a/src/Settings/Builders/GenApply.hs b/src/Settings/Builders/GenApply.hs
new file mode 100644
index 0000000..2d8140a
--- /dev/null
+++ b/src/Settings/Builders/GenApply.hs
@@ -0,0 +1,8 @@
+module Settings.Builders.GenApply (genApplyBuilderArgs) where
+
+import Expression
+
+-- Stdin/stdout are handled in a special way. See Rules/Actions.hs.
+-- TODO: Dead code? ifeq "$(GhcUnregisterised)" "YES" GENAPPLY_OPTS = -u
+genApplyBuilderArgs :: Args
+genApplyBuilderArgs = mempty



More information about the ghc-commits mailing list