You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using code-generators to automatically generate my test suite. The Main.hs is also generated, I specify main-is: Main.hs, the auto-generated file is picked up by Cabal, and I have no problem running the tests. However, cabal sdist fails for the package, and depending on that package as a source-package via git also fails. Cabal reports (correctly) an error "Main.hs doesn't exist".
I believe the correct way to tell Cabal that Main.hs is auto-generated is to add Main to autogen-modules, but it does not work (as noted in the documentation):
Cabal does not really support main-is to also be listed in autogen-modules (it has no effect, to be precise), so we apply a workaround. Reported as haskell/cabal#10834, but we have to stick with this workaround in the meantime.
Oops! Thanks for the link. It seems main-is is not doing what I expected it to (in my case, I suspect the generated Main.hs is still chosen as the main module because its name is Main, but it works either way, so it doesn't really matter).
But I still think that is orthogonal to what I report here. The problem is that a test-suite with type exitcode-stdio-1.0 is required to have a main-is field (otherwise the cabal file is considered invalid), so I have to refer to some Main module in my cabal file, and that file cannot be specified as autogen-modules.
I am using
code-generators
to automatically generate my test suite. TheMain.hs
is also generated, I specifymain-is: Main.hs
, the auto-generated file is picked up by Cabal, and I have no problem running the tests. However,cabal sdist
fails for the package, and depending on that package as a source-package via git also fails. Cabal reports (correctly) an error "Main.hs doesn't exist".I believe the correct way to tell Cabal that
Main.hs
is auto-generated is to addMain
toautogen-modules
, but it does not work (as noted in the documentation):Is there any specific reasons that it is not supported?
Meanwhile, I figured out a workaround:
main-is: Main.hs
, I specify the following in the Cabal file:test/DocTests.hs
that forwards to the real auto-generatedMain
:However, this seems to be a really roundabout way to specify something trivial. Maybe there is a simpler workaround that I failed to figure out?
The text was updated successfully, but these errors were encountered: