Skip to content

Commit 911aec5

Browse files
convert file path back to native in fileMatcher
1 parent 6ce0844 commit 911aec5

File tree

1 file changed

+35
-36
lines changed

1 file changed

+35
-36
lines changed

bootstrap/src/Build.hs

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import Development.Shake ( FilePattern
3838
, (&?>)
3939
)
4040
import Development.Shake.FilePath ( exe
41+
, splitDirectories
4142
, (</>)
4243
, (<.>)
4344
)
@@ -81,24 +82,23 @@ buildProgram programDirectory libraryDirectories sourceExtensions buildDirectory
8182
, shakeProgress = progressSimple
8283
}
8384
$ do
84-
let
85-
infoToRule cti =
86-
let
87-
obj = compileTimeInfoObjectFileProduced cti
88-
other = compileTimeInfoOtherFilesProduced cti
89-
directDependencies = compileTimeInfoDirectDependencies cti
90-
sourceFile = compileTimeInfoSourceFileName cti
91-
fileMatcher f = if f == obj || f `elem` other
92-
then Just (obj : other)
93-
else Nothing
94-
in
95-
fileMatcher &?> \(objectFile : _) -> do
96-
need (sourceFile : directDependencies)
97-
cmd compiler
98-
["-c", "-J" ++ buildDirectory]
99-
includeFlags
100-
flags
101-
["-o", objectFile, sourceFile]
85+
let infoToRule cti =
86+
let obj = compileTimeInfoObjectFileProduced cti
87+
other = compileTimeInfoOtherFilesProduced cti
88+
directDependencies = compileTimeInfoDirectDependencies cti
89+
sourceFile = compileTimeInfoSourceFileName cti
90+
fileMatcher f =
91+
let realf = foldl1 (</>) (splitDirectories f)
92+
in if realf == obj || realf `elem` other
93+
then Just (obj : other)
94+
else Nothing
95+
in fileMatcher &?> \(objectFile : _) -> do
96+
need (sourceFile : directDependencies)
97+
cmd compiler
98+
["-c", "-J" ++ buildDirectory]
99+
includeFlags
100+
flags
101+
["-o", objectFile, sourceFile]
102102
want [buildDirectory </> programName <.> exe]
103103
buildDirectory </> programName <.> exe %> \executable -> do
104104
liftIO $ print objectFiles
@@ -134,24 +134,23 @@ buildLibrary libraryDirectory sourceExtensions buildDirectory compiler flags lib
134134
, shakeProgress = progressSimple
135135
}
136136
$ do
137-
let
138-
infoToRule cti =
139-
let
140-
obj = compileTimeInfoObjectFileProduced cti
141-
other = compileTimeInfoOtherFilesProduced cti
142-
directDependencies = compileTimeInfoDirectDependencies cti
143-
sourceFile = compileTimeInfoSourceFileName cti
144-
fileMatcher f = if f == obj || f `elem` other
145-
then Just (obj : other)
146-
else Nothing
147-
in
148-
fileMatcher &?> \(objectFile : _) -> do
149-
need (sourceFile : directDependencies)
150-
cmd compiler
151-
["-c", "-J" ++ buildDirectory]
152-
includeFlags
153-
flags
154-
["-o", objectFile, sourceFile]
137+
let infoToRule cti =
138+
let obj = compileTimeInfoObjectFileProduced cti
139+
other = compileTimeInfoOtherFilesProduced cti
140+
directDependencies = compileTimeInfoDirectDependencies cti
141+
sourceFile = compileTimeInfoSourceFileName cti
142+
fileMatcher f =
143+
let realf = foldl1 (</>) (splitDirectories f)
144+
in if realf == obj || realf `elem` other
145+
then Just (obj : other)
146+
else Nothing
147+
in fileMatcher &?> \(objectFile : _) -> do
148+
need (sourceFile : directDependencies)
149+
cmd compiler
150+
["-c", "-J" ++ buildDirectory]
151+
includeFlags
152+
flags
153+
["-o", objectFile, sourceFile]
155154
want [archiveFile]
156155
archiveFile %> \a -> do
157156
need objectFiles

0 commit comments

Comments
 (0)