Skip to content
Snippets Groups Projects
Unverified Commit 6cf9e139 authored by gershomb's avatar gershomb Committed by GitHub
Browse files

ordNub for extra stanzas (#8499)


* ordNub for extra stanzas

* changelong

* Update pr-8499

Co-authored-by: default avatarGershom Bazerman <gershom@arista.com>
Co-authored-by: default avatarmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent 2acce8d3
No related branches found
No related tags found
No related merge requests found
......@@ -89,7 +89,6 @@ import Distribution.Version (thisVersion)
import Distribution.Compat.Graph (IsNode(..))
import Control.Monad
import qualified Data.Set as Set
import qualified Data.ByteString.Lazy as LBS
import System.FilePath ( (</>), (<.>), takeDirectory )
import System.Directory ( getCurrentDirectory, removeFile, doesFileExist )
......@@ -434,52 +433,36 @@ generateCode codeGens nm pdesc bi lbi clbi verbosity = do
-- information.
addExtraCSources :: BuildInfo -> [FilePath] -> BuildInfo
addExtraCSources bi extras = bi { cSources = new }
where new = Set.toList $ old `Set.union` exs
old = Set.fromList $ cSources bi
exs = Set.fromList extras
where new = ordNub (extras ++ cSources bi)
-- | Add extra C++ sources generated by preprocessing to build
-- information.
addExtraCxxSources :: BuildInfo -> [FilePath] -> BuildInfo
addExtraCxxSources bi extras = bi { cxxSources = new }
where new = Set.toList $ old `Set.union` exs
old = Set.fromList $ cxxSources bi
exs = Set.fromList extras
where new = ordNub (extras ++ cxxSources bi)
-- | Add extra C-- sources generated by preprocessing to build
-- information.
addExtraCmmSources :: BuildInfo -> [FilePath] -> BuildInfo
addExtraCmmSources bi extras = bi { cmmSources = new }
where new = Set.toList $ old `Set.union` exs
old = Set.fromList $ cmmSources bi
exs = Set.fromList extras
where new = ordNub (extras ++ cmmSources bi)
-- | Add extra ASM sources generated by preprocessing to build
-- information.
addExtraAsmSources :: BuildInfo -> [FilePath] -> BuildInfo
addExtraAsmSources bi extras = bi { asmSources = new }
where new = Set.toList $ old `Set.union` exs
old = Set.fromList $ asmSources bi
exs = Set.fromList extras
where new = ordNub (extras ++ asmSources bi)
-- | Add extra HS modules generated by preprocessing to build
-- information.
addExtraOtherModules :: BuildInfo -> [ModuleName.ModuleName] -> BuildInfo
addExtraOtherModules bi extras = bi { otherModules = new }
where new = Set.toList $ old `Set.union` exs
old = Set.fromList $ otherModules bi
exs = Set.fromList extras
where new = ordNub (extras ++ otherModules bi)
-- | Add extra source dir for generated modules.
addSrcDir :: BuildInfo -> FilePath -> BuildInfo
addSrcDir bi extra = bi { hsSourceDirs = new }
where new = Set.toList $ old `Set.union` ex
old = Set.fromList $ hsSourceDirs bi
ex = Set.fromList [unsafeMakeSymbolicPath extra] -- TODO
where new = ordNub (unsafeMakeSymbolicPath extra : hsSourceDirs bi)
replComponent :: ReplOptions
-> Verbosity
......
synopsis: orders extra stanzas
packages: Cabal
prs: #8499
issues: #8458
description: {
Ensure thatt extra-src-dirs, extra sources, and extra other modules all are added using ordNub rather than incidentally alphabetized.
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment