Subject: Re: [Haskell-cafe] Inject cabal version or VCS version as a CPP macro
On Wed, Feb 22, 2012 at 2:57 PM, Herbert Valerio Riedel <hvr@xxxxxxx> wrote:

> Eugene Kirpichov <ekirpichov@xxxxxxxxx> writes:
>
> > It can be used like this:
> >
> > {-# LANGUAGE TemplateHaskell #-}
> > import Distribution.VcsRevision.Git
> > import Language.Haskell.TH.Syntax
> >
> > showMyGitVersion :: String
> > showMyGitVersion = $(do
> > v <- qRunIO getRevision
> > lift $ case v of
> > Nothing -> "<none>"
> > Just (hash,True) -> hash ++ " (with local modifications)"
> > Just (hash,False) -> hash)
>
> Btw, I'm wondering (haven't tried myself), when using TH to generate the
> version string, does GHC's and/or cabal's dependency tracking
>
> a) reliably refresh the generated hash so that you can be sure it's
> the git-commit id compiled into the binary is reliable, and
>
> b) avoid re-generating the TH file and redundant recompilation if the
> git commit-id hasn't changed?
>
> Do you mean all this in the context where this resides in a library rather
than an application? I haven't thought about that yet.


> hvr
> --
>



--
Eugene Kirpichov
Principal Engineer, Mirantis Inc. http://www.mirantis.com/
Editor, http://fprog.ru/
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@xxxxxxxxxxx
http://www.haskell.org/mailman/listinfo/haskell-cafe
(C)2011 mailinglist-archive.com