Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make spago verify-set fail if there are duplicate module names. #438

Merged
merged 4 commits into from
Oct 5, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ New features:
- Add `--open` flag to `spago docs` which opens generated docs in browser (#379)
- Support building for alternate backends (#355). E.g: Use `backend = "psgo"` entry in `spago.dhall` to compile with `psgo`
- Add `--no-comments` flag to `spago init` which strips comments from the generated `spago.dhall` and `packages.dhall` configs (#417)
- Make `spago verify-set` compile everything, to detect duplicate module names.

Bugfixes:
- Warn (but don't error) when trying to watch missing directories (#406)
Expand Down
13 changes: 12 additions & 1 deletion src/Spago/Packages.hs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,9 @@ verify cacheFlag maybePackage = do
Config{ packageSet = packageSet@PackageSet{..}, ..} <- Config.ensureConfig
case maybePackage of
-- If no package is specified, verify all of them
Nothing -> verifyPackages packageSet (Map.toList packagesDB)
Nothing -> do
verifyPackages packageSet (Map.toList packagesDB)
compileEverything packageSet
-- In case we have a package, search in the package set for it
Just packageName -> do
case Map.lookup packageName packagesDB of
Expand Down Expand Up @@ -340,3 +342,12 @@ verify cacheFlag maybePackage = do
echo $ "Verifying package " <> quotedName
Purs.compile globs []
echo $ "Successfully verified " <> quotedName

compileEverything :: Spago m => PackageSet -> m ()
compileEverything PackageSet{..} = do
let deps = Map.toList packagesDB
globs = getGlobs deps DepsOnly []
Fetch.fetchPackages cacheFlag deps packagesMinPursVersion
echo "Compiling everything (will fail if module names conflict)"
Purs.compile globs []
echo "Successfully compiled everything"