Skip to content

Commit 2b6c376

Browse files
committed
Revert "ordNub for extra stanzas"
This reverts commit a94b3f5.
1 parent a94b3f5 commit 2b6c376

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

Cabal/src/Distribution/Simple/Build.hs

+23-6
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ import Distribution.Version (thisVersion)
8989
import Distribution.Compat.Graph (IsNode(..))
9090

9191
import Control.Monad
92+
import qualified Data.Set as Set
9293
import qualified Data.ByteString.Lazy as LBS
9394
import System.FilePath ( (</>), (<.>), takeDirectory )
9495
import System.Directory ( getCurrentDirectory, removeFile, doesFileExist )
@@ -433,36 +434,52 @@ generateCode codeGens nm pdesc bi lbi clbi verbosity = do
433434
-- information.
434435
addExtraCSources :: BuildInfo -> [FilePath] -> BuildInfo
435436
addExtraCSources bi extras = bi { cSources = new }
436-
where new = ordNub (extras ++ cSources bi)
437+
where new = Set.toList $ old `Set.union` exs
438+
old = Set.fromList $ cSources bi
439+
exs = Set.fromList extras
440+
437441

438442
-- | Add extra C++ sources generated by preprocessing to build
439443
-- information.
440444
addExtraCxxSources :: BuildInfo -> [FilePath] -> BuildInfo
441445
addExtraCxxSources bi extras = bi { cxxSources = new }
442-
where new = ordNub (extras ++ cxxSources bi)
446+
where new = Set.toList $ old `Set.union` exs
447+
old = Set.fromList $ cxxSources bi
448+
exs = Set.fromList extras
449+
443450

444451
-- | Add extra C-- sources generated by preprocessing to build
445452
-- information.
446453
addExtraCmmSources :: BuildInfo -> [FilePath] -> BuildInfo
447454
addExtraCmmSources bi extras = bi { cmmSources = new }
448-
where new = ordNub (extras ++ cmmSources bi)
455+
where new = Set.toList $ old `Set.union` exs
456+
old = Set.fromList $ cmmSources bi
457+
exs = Set.fromList extras
458+
449459

450460
-- | Add extra ASM sources generated by preprocessing to build
451461
-- information.
452462
addExtraAsmSources :: BuildInfo -> [FilePath] -> BuildInfo
453463
addExtraAsmSources bi extras = bi { asmSources = new }
454-
where new = ordNub (extras ++ asmSources bi)
464+
where new = Set.toList $ old `Set.union` exs
465+
old = Set.fromList $ asmSources bi
466+
exs = Set.fromList extras
455467

456468
-- | Add extra HS modules generated by preprocessing to build
457469
-- information.
458470
addExtraOtherModules :: BuildInfo -> [ModuleName.ModuleName] -> BuildInfo
459471
addExtraOtherModules bi extras = bi { otherModules = new }
460-
where new = ordNub (extras ++ otherModules bi)
472+
where new = Set.toList $ old `Set.union` exs
473+
old = Set.fromList $ otherModules bi
474+
exs = Set.fromList extras
461475

462476
-- | Add extra source dir for generated modules.
463477
addSrcDir :: BuildInfo -> FilePath -> BuildInfo
464478
addSrcDir bi extra = bi { hsSourceDirs = new }
465-
where new = ordNub (unsafeMakeSymbolicPath extra : hsSourceDirs bi)
479+
where new = Set.toList $ old `Set.union` ex
480+
old = Set.fromList $ hsSourceDirs bi
481+
ex = Set.fromList [unsafeMakeSymbolicPath extra] -- TODO
482+
466483

467484
replComponent :: ReplOptions
468485
-> Verbosity

0 commit comments

Comments
 (0)