-
Notifications
You must be signed in to change notification settings - Fork 711
Allow empty set of input modules. #4891
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1268,7 +1268,11 @@ gbuild verbosity numJobs pkg_descr lbi bm clbi = do | |
runGhcProg compileTHOpts { ghcOptNoLink = toFlag True | ||
, ghcOptNumJobs = numJobs } | ||
|
||
unless (gbuildIsRepl bm) $ | ||
-- 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) | ||
|| gbuildIsRepl bm) $ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if you run |
||
runGhcProg compileOpts { ghcOptNoLink = toFlag True | ||
, ghcOptNumJobs = numJobs } | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include <stdio.h> | ||
|
||
int main(int argc, char **argv) { | ||
printf("Hello world!"); | ||
return 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: my | ||
version: 0.1 | ||
license: BSD3 | ||
cabal-version: >= 2.1 | ||
build-type: Simple | ||
|
||
executable foo | ||
-- default-language is required by cabal-version >= 1.10 | ||
default-language: Haskell2010 | ||
main-is: foo.c |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Setup configure | ||
Resolving dependencies... | ||
Configuring my-0.1... | ||
# Setup build | ||
Preprocessing executable 'foo' for my-0.1.. | ||
Building executable 'foo' for my-0.1.. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Setup configure | ||
Configuring my-0.1... | ||
# Setup build | ||
Preprocessing executable 'foo' for my-0.1.. | ||
Building executable 'foo' for my-0.1.. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't we also test that it correctly outputs "hello, world"? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import Test.Cabal.Prelude | ||
-- Test building an executable whose main() function is defined in a C | ||
-- file | ||
main = setupAndCabalTest $ setup_build [] |
There was a problem hiding this comment.
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:
Though perhaps that should be part of
cabal check
.BTW, do we allow a
.cpp/.asm/.cmm
main-is
?