Skip to content
This repository was archived by the owner on Feb 3, 2022. It is now read-only.

Commit 3812aa1

Browse files
committed
Un-overload the "targetDir" target
If a FilePath matches a so-called "phony" target, Shake will count this as satisfying the phony target and skip its steps. Currently, the target called targetDir is overloaded, being used in a "~>" rule (for defining a "phony" target) but it is also used for contructing file paths, and it appears as a dependency in some rules (e.g., "need [targetDir]"). When it is a dependency, it actually should be upon a phony target, not the actual directory. Due to how dependencies are constructed for the Windows HP build, this problem has plagued it. This change needs to be tested for the other build environments. * hptool/src/Main.hs * hptool/src/OS/Internal.hs * hptool/src/OS/Mac.hs * hptool/src/OS/Posix.hs * hptool/src/OS/Win.hs * hptool/src/OS/Win/WinNsis.hs * change the dependency upon targetDir to phonyTargetDir * hptool/src/Paths.hs * define and export phonyTargetDir * hptool/src/Target.hs * Change rule from targetDir to phonyTargetDir
1 parent b4c5f05 commit 3812aa1

File tree

8 files changed

+13
-10
lines changed

8 files changed

+13
-10
lines changed

hptool/src/Main.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ whatIsIncluded rel = ("-- Minimal Platform:":minimalIncludes) ++ ("-- Full Platf
110110
buildRules :: Release -> FilePath -> BuildConfig -> Rules()
111111
buildRules hpRelease srcTarFile bc = do
112112
"build-source" ~> need [srcTarFile]
113-
"build-target" ~> need [targetDir]
113+
"build-target" ~> need [phonyTargetDir]
114114
"build-product" ~> need [osProduct]
115115
"build-local" ~> need [dir ghcLocalDir]
116116
"build-website" ~> need [dir websiteDir]

hptool/src/OS/Internal.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ genericOS BuildConfig{..} = OS{..}
124124
osProduct = productDir </> "generic.tar.gz"
125125
osRules _hpRelease _bc =
126126
osProduct %> \out -> do
127-
need [targetDir, vdir ghcVirtualTarget]
127+
need [phonyTargetDir, vdir ghcVirtualTarget]
128128
command_ [Cwd buildRoot]
129129
"tar" ["czf", out `relativeToDir` buildRoot, targetDir `relativeToDir` buildRoot]
130130

hptool/src/OS/Mac.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ macOsFromConfig BuildConfig{..} = OS{..}
139139
]
140140

141141
hpPkgFile %> \out -> do
142-
need [targetDir, dir extrasDir] -- FIXME(mzero): could be more specific
142+
need [phonyTargetDir, dir extrasDir] -- FIXME(mzero): could be more specific
143143
command_ []
144144
"pkgbuild"
145145
[ "--identifier", "org.haskell.HaskellPlatform.Libraries."

hptool/src/OS/Posix.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ posixOS BuildConfig{..} = OS{..}
9797
]
9898

9999
usrLocalTar %> \out -> do
100-
need [targetDir, vdir ghcVirtualTarget]
100+
need [phonyTargetDir, vdir ghcVirtualTarget]
101101
command_ [Cwd targetDir]
102102
"tar" ["czf", out `relativeToDir` targetDir, hpTargetDir `relativeToDir` targetDir]
103103

hptool/src/OS/Win.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ winOsFromConfig BuildConfig{..} = os
137137
winRules
138138

139139
osProduct %> \_ -> do
140-
need $ [dir ghcLocalDir, targetDir, vdir ghcVirtualTarget]
140+
need $ [dir ghcLocalDir, phonyTargetDir, vdir ghcVirtualTarget]
141141
++ winNeeds
142142

143143
copyWinTargetExtras bc

hptool/src/OS/Win/WinNsis.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Text.Hastache.Context (mkStrContext)
1313
import Config
1414
import OS.Win.WinPaths
1515
import OS.Win.WinUtils
16-
import Paths ( installerPartsDir, targetDir )
16+
import Paths ( installerPartsDir, phonyTargetDir )
1717
import Templates
1818
import Types
1919
import Utils
@@ -22,11 +22,11 @@ import Utils
2222
genNsisData :: Rules ()
2323
genNsisData = do
2424
nsisInstDat %> \dFile -> do
25-
need [targetDir]
25+
need [phonyTargetDir]
2626
dirs <- getDirsFiles filterEmptyDirs
2727
genData nsisInstDatTmpl dFile dirs
2828
nsisUninstDat %> \uFile -> do
29-
need [targetDir]
29+
need [phonyTargetDir]
3030
dirs <- getDirsFiles sortByDirRev
3131
genData nsisUninstDatTmpl uFile dirs
3232
where

hptool/src/Paths.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module Paths
1818
, listBuild, listCore, listSource
1919
, hpCabalFile
2020

21-
, targetDir
21+
, targetDir, phonyTargetDir
2222
, ghcVirtualTarget, hpVirtualTarget
2323

2424
, installerPartsDir, extrasDir
@@ -111,6 +111,9 @@ hpCabalFile = buildRoot </> "haskell-platform.cabal"
111111
targetDir :: FilePath
112112
targetDir = buildRoot </> "target"
113113

114+
phonyTargetDir :: FilePath
115+
phonyTargetDir = "PHONYtargetdir"
116+
114117
ghcVirtualTarget :: String
115118
ghcVirtualTarget = "target-ghc"
116119

hptool/src/Target.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ targetRules :: BuildConfig -> Rules ()
2525
targetRules bc = do
2626
buildRules
2727
installRules bc
28-
targetDir ~> do
28+
phonyTargetDir ~> do
2929
hpRel <- askHpRelease
3030
bc' <- askBuildConfig
3131
let OS{..} = osFromConfig bc'

0 commit comments

Comments
 (0)