I would like to embed versioning and build date information in my application
executable, and I'm not sure how to do that.  To clarify, in C or C++, I would
write the following:

   #include <stdio.h>

   #ifndef APPVER
   #define APPVER "no version"
   #endif

   void main()
   {
        printf("%s\n", APPVER);
   }

I can than compile the code by passing "-D APPVER=1.0" to the compiler command
line and have it print the correct version.

How can this be done in Racket?

I don't really want to check-in a file with the version number in it, and
besides, I would like to add my GIT commit ID and build date as well in the
same way.

My idea is that the build script would write a file like this at build time:

   #lang racket/base
   (define (app-version) "1.0")
   (define (app-commit-id) "abcdefg")
   (define (app-build-date) "06-01-2017T09:10:12")
   (provide app-version app-commit-id app-build-date)

I would than require this file from other places, but only if it exists,
something like this:

   (if (file-exists? "app-version.rkt")
       (require "app-version.rkt")
       (begin
         (define (app-version) "dev build")
         (define (app-commit-id) "unknown")
         (define (app-build-date) "no build")))

Unfortunately, the code above does not work because require needs to be
defined at top level.

Does anyone have any suggestions?

Thanks,
Alex.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to