cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bertrand Delacretaz <>
Subject Use of the what command with java code (was: Including source files in jars)
Date Tue, 08 Jun 2004 07:01:50 GMT
Le 8 juin 04, à 08:32, Sylvain Wallez a écrit :
> ...You can know when the build was done by looking at the class files 
> creation date in the jars, but you cannot know what sources were used 
> to produce them, except that they're older than the build. But how 
> much older? Was the checkout done a day before or a week? Also, was it 
> a full cvs update or only a partial one (e.g. on a particular 
> block)?...

In the Good Old Times (C++ programming under unix) we were using the 
"what" command to tell us from which versions of source files our 
binaries were built (see "man what" for more info if you're running a 
decent platform) (I know I'll get flamed for saying "decent" ;-)

A quick test shows that this works with java as well, using unzip -p to 
decompress jars before letting "what" process their content.

g4:/tmp> cat
class A {
         public static final String WHAT_ID = "@(#)$Id:,v 1.3 
1999/07/08 14:16:07 sylvain Exp $";
         public static void main(String args[]) {

g4:/tmp> javac
g4:/tmp> what A.class
         $Id:,v 1.3 1999/07/08 14:16:07 sylvain Exp $

g4:/tmp> jar cvf a.jar A.class
. . .
g4:/tmp> unzip -p a.jar | what
         $Id:,v 1.3 1999/07/08 14:16:07 sylvain Exp $

So I think, by simply adding WHAT_ID strings to our source files we 
could have this info without having to include source code in jars (but 
of course, your solution works *now* ;-)


View raw message