|
Message: 2
Date: Wed, 05 Feb 2003 22:48:10 -0500
From: >
Subject: Automatic build numbers [was: libraries]
Here's one better: you can use this technique to automatically generate
build numbers. Create an NVO to hold the build and version numbers.
You can put any expression to the right of the equals in the
initialization statement as long as it contains only literals or
constants (So unfortunately you can't do "ii_dummy = ds.Retrieve()"
because of the object reference) Note that the variable ii_dummy serves
no purpose other than to enforce the syntax for compile-time evaluation
of the statement
I save the build & version numbers in the pb.ini file, but it
can be
anywhere. The ini file does not need to exist at runtime (and would
be
ignored even if it did). In the pb.ini file, add the following section
(the first two lines should have already been created when you saved
the
NVO above):
[Build]
MyApp.Build=1
MyApp.Version=v1.0
The way I set it up, the build increments automatically each time
you
save the NVO or do a build which includes the NVO. With no outside
object references, incremental builds will usually not increase the
build number, though full builds always will. This is why the code
is
in a separate NVO; if you put it someplace else like the app manager
it
would increment each time you saved that object. (If you have a
dedicated build machine, this would not be an issue) The version
number
is set manually, but doing it my way doesn't require editing the code
(and incurring multiple needless checkouts if using version control)
to
change the version, just a rebuild. You can also initialize the build
number manually to some other value.
You can then call the object to get the build and version numbers,
as
in
this n_cst_appmanager.constructor () snippet:
n_cst_version lnv_version
this.of_SetVersion (lnv_version.of_getVersion () + &
' Build ' + string (lnv_version.of_getBuild ()) + &
' ' + string (lnv_version.of_getBuildDate (), 'mmm d,
yyyy - hh:mm AM/PM'))
Hope you find this useful!
Jim
|