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

Allow empty set of input modules. #4891

Merged
merged 1 commit into from
Nov 16, 2017
Merged

Conversation

angerman
Copy link
Collaborator

Please include the following checklist in your PR:

  • Patches conform to the coding conventions.
  • Any changes that could be relevant to users have been recorded in the changelog.
  • The documentation has been updated, if necessary.
  • If the change is docs-only, [ci skip] is used to avoid triggering the build bots.

Please also shortly describe how you tested your change. Bonus points for added tests!

Do not try to call GHC on an empty set of inputModules.

Fixes #4890

@angerman angerman force-pushed the feature/c-only-main branch from 892a659 to 60f1f64 Compare November 15, 2017 02:55
Copy link
Collaborator

@BardurArantsson BardurArantsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@angerman angerman merged commit 97c66f2 into haskell:master Nov 16, 2017
Copy link
Member

@23Skidoo 23Skidoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments.

Configuring my-0.1...
# Setup build
Preprocessing executable 'foo' for my-0.1..
Building executable 'foo' for my-0.1..
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we also test that it correctly outputs "hello, world"?

-- Do not try to build anything if there are no input files.
-- This can happen if the cabal file ends up with only cSrcs
-- but no Haskell modules.
unless ((null inputFiles && null inputModules)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd maybe add an additional check, something along these lines:

let noHaskellSources  = null inputFiles && null inputModules
     noForeignSources = null cSrcs && null cxxSrcs && null asmSrcs && ...
when (noHaskellSources && noForeignSources) $
    die "Component has no source files to compile"

Though perhaps that should be part of cabal check.

BTW, do we allow a .cpp/.asm/.cmm main-is?

-- This can happen if the cabal file ends up with only cSrcs
-- but no Haskell modules.
unless ((null inputFiles && null inputModules)
|| gbuildIsRepl bm) $
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if you run repl on a component that only has C sources? Also, are C-only libraries allowed now?

@angerman
Copy link
Collaborator Author

@23Skidoo thanks. I'll have a look!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants