Iain Nicol | 26 Aug 21:40 2012
Picon

Cabal Test-suites + custom preprocessors

Hi café,

I am successfully using a custom preprocessor to build my main
executable.  In particular, I am using UUAGC to preprocess .ag files
into .hs files.  My Setup.hs file uses 'uuagcLibUserHook' from the
package uuagc-cabal to do this, which in particular overrides Cabal's
'buildHook' for me.

Now I am trying to add a test-suite (of type exitcode-stdio-1.0).  I
want the test suite to be able to import the modules which implement
the main program.  Unfortunately, building the test suite fails,
because the .ag files don't seem to be built into .hs files.

Does anybody know if Cabal actually supports using custom
preprocessors for building a test-suite?  If so, is 'buildHook' still
the right hook to override?

Thanks,
--

-- 
Iain
Johan Tibell | 26 Aug 21:49 2012
Picon

Re: Cabal Test-suites + custom preprocessors

On Sun, Aug 26, 2012 at 12:40 PM, Iain Nicol <iain <at> thenicols.net> wrote:
> Hi café,
>
> I am successfully using a custom preprocessor to build my main
> executable.  In particular, I am using UUAGC to preprocess .ag files
> into .hs files.  My Setup.hs file uses 'uuagcLibUserHook' from the
> package uuagc-cabal to do this, which in particular overrides Cabal's
> 'buildHook' for me.
>
> Now I am trying to add a test-suite (of type exitcode-stdio-1.0).  I
> want the test suite to be able to import the modules which implement
> the main program.  Unfortunately, building the test suite fails,
> because the .ag files don't seem to be built into .hs files.
>
> Does anybody know if Cabal actually supports using custom
> preprocessors for building a test-suite?  If so, is 'buildHook' still
> the right hook to override?

Try overriding the test hook. If it doesn't work file a bug at
https://github.com/haskell/cabal/issues

-- Johan
Iain Nicol | 26 Aug 22:03 2012
Picon

Re: Cabal Test-suites + custom preprocessors

Johan Tibell wrote:
> On Sun, Aug 26, 2012 at 12:40 PM, Iain Nicol <iain <at> thenicols.net> wrote:
>> Does anybody know if Cabal actually supports using custom
>> preprocessors for building a test-suite?  If so, is 'buildHook' still
>> the right hook to override?
>
> Try overriding the test hook.

Bleh; that's too obvious.  I will give that a shot.

[resending this reply to the list, sorry for the dupe Johan]

Thanks,
Iain
Johan Tibell | 26 Aug 22:35 2012
Picon

Re: Cabal Test-suites + custom preprocessors

On Sun, Aug 26, 2012 at 1:03 PM, Iain Nicol <iain <at> thenicols.net> wrote:
> Johan Tibell wrote:
>> On Sun, Aug 26, 2012 at 12:40 PM, Iain Nicol <iain <at> thenicols.net> wrote:
>>> Does anybody know if Cabal actually supports using custom
>>> preprocessors for building a test-suite?  If so, is 'buildHook' still
>>> the right hook to override?
>>
>> Try overriding the test hook.
>
> Bleh; that's too obvious.  I will give that a shot.

Well, I think's it's reasonable for test to imply build so in my mind
the build hook should also be executed when building test suites.

Gmane