[commit: ghc] wip/nfs-locking: Build Hadrian in _build. (1317c88)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:09:47 UTC 2017


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

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

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

commit 1317c886fe1293c3d21389e85ee154790a710cbd
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Sat Apr 30 02:40:55 2016 +0100

    Build Hadrian in _build.


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

1317c886fe1293c3d21389e85ee154790a710cbd
 build.bat          | 38 +++++++++++++++++++-------------------
 build.sh           | 32 ++++++++++++++++----------------
 src/Base.hs        |  1 +
 src/Rules/Clean.hs | 18 ++++++++++--------
 4 files changed, 46 insertions(+), 43 deletions(-)

diff --git a/build.bat b/build.bat
index 2f6d4cd..19a2a05 100644
--- a/build.bat
+++ b/build.bat
@@ -1,24 +1,24 @@
 @cd %~dp0
- at mkdir .shake 2> nul
+ at mkdir ../_build 2> nul
 
- at set ghcArgs=--make                   ^
-             -Wall                    ^
-             -fno-warn-name-shadowing ^
-             -XRecordWildCards        ^
-             src/Main.hs              ^
-             -threaded                ^
-             -isrc                    ^
-             -rtsopts                 ^
-             -with-rtsopts=-I0        ^
-             -outputdir=.shake        ^
-             -j                       ^
-             -O                       ^
-             -o .shake/build
+ at set ghcArgs=--make                       ^
+             -Wall                        ^
+             -fno-warn-name-shadowing     ^
+             -XRecordWildCards            ^
+             src/Main.hs                  ^
+             -threaded                    ^
+             -isrc                        ^
+             -rtsopts                     ^
+             -with-rtsopts=-I0            ^
+             -outputdir=../_build/hadrian ^
+             -j                           ^
+             -O                           ^
+             -o ../_build/hadrian
 
- at set shakeArgs=--lint      ^
-               --directory ^
-               ".."        ^
-               %*
+ at set hadrianArgs=--lint      ^
+                 --directory ^
+                 ".."        ^
+                 %*
 
 
 @ghc %ghcArgs%
@@ -27,4 +27,4 @@
 
 @rem Unset GHC_PACKAGE_PATH variable, as otherwise ghc-cabal complains
 @set GHC_PACKAGE_PATH=
- at .shake\build %shakeArgs%
+ at ..\_build\hadrian %hadrianArgs%
diff --git a/build.sh b/build.sh
index 95de2e6..8b53f81 100755
--- a/build.sh
+++ b/build.sh
@@ -30,22 +30,22 @@ function rl {
 
 root="$(dirname "$(rl "$0")")"
 
-mkdir -p "$root/.shake"
-
-ghc                           \
-    "$root/src/Main.hs"       \
-    -Wall                     \
-    -fno-warn-name-shadowing  \
-    -XRecordWildCards         \
-    -i"$root/src"             \
-    -rtsopts                  \
-    -with-rtsopts=-I0         \
-    -threaded                 \
-    -outputdir="$root/.shake" \
-    -j -O                     \
-    -o "$root/.shake/build"
-
-"$root/.shake/build"       \
+mkdir -p "$root/../_build"
+
+ghc                                      \
+    "$root/src/Main.hs"                  \
+    -Wall                                \
+    -fno-warn-name-shadowing             \
+    -XRecordWildCards                    \
+    -i"$root/src"                        \
+    -rtsopts                             \
+    -with-rtsopts=-I0                    \
+    -threaded                            \
+    -outputdir="$root/../_build/hadrian" \
+    -j -O                                \
+    -o "$root/../_build/hadrian"
+
+"$root/../_build/hadrian"  \
     --lint                 \
     --directory "$root/.." \
     --colour               \
diff --git a/src/Base.hs b/src/Base.hs
index b94648e..53bb197 100644
--- a/src/Base.hs
+++ b/src/Base.hs
@@ -50,6 +50,7 @@ import System.IO
 shakePath :: FilePath
 shakePath = "hadrian"
 
+-- TODO: Move to buildRootPath.
 shakeFilesPath :: FilePath
 shakeFilesPath = shakePath -/- ".db"
 
diff --git a/src/Rules/Clean.hs b/src/Rules/Clean.hs
index ea1cc37..357ac34 100644
--- a/src/Rules/Clean.hs
+++ b/src/Rules/Clean.hs
@@ -9,17 +9,19 @@ import Settings.Paths
 import Settings.User
 import Stage
 
+clean :: FilePath -> Action ()
+clean dir = do
+    putBuild $ "| Remove files in " ++ dir ++ "..."
+    removeDirectoryIfExists dir
+
 cleanRules :: Rules ()
 cleanRules = do
     "clean" ~> do
-        putBuild $ "| Remove files in " ++ buildRootPath ++ "..."
-        liftIO $ removeFiles buildRootPath ["//*"]
-        putBuild $ "| Remove files in " ++ programInplacePath ++ "..."
-        liftIO $ removeFiles programInplacePath ["//*"]
-        putBuild $ "| Remove files in inplace/lib..."
-        liftIO $ removeFiles "inplace/lib" ["//*"]
-        putBuild $ "| Remove files in " ++ derivedConstantsPath ++ "..."
-        liftIO $ removeFiles derivedConstantsPath ["//*"]
+        forM_ [Stage0 ..] $ \stage -> clean (buildRootPath -/- stageString stage)
+        clean (buildRootPath -/- "hadrian")
+        clean programInplacePath
+        clean "inplace/lib"
+        clean derivedConstantsPath
         forM_ includesDependencies $ \file -> do
             putBuild $ "| Remove " ++ file
             removeFileIfExists file



More information about the ghc-commits mailing list