Wow. I think it is an amazing solution! Have this impact at runtime in Java?
Another solution is for SVN:
Include in META-INF the SVN number inside each generated jar. I think it
is the least disturbing and cost less.
WDYT?
Best Regards,
Antonio Gallardo
Bertrand Delacretaz dijo:
> 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 A.java
> class A {
> public static final String WHAT_ID = "@(#)$Id: A.java,v 1.3
> 1999/07/08 14:16:07 sylvain Exp $";
> public static void main(String args[]) {
> System.out.println(WHAT_ID);
> }
> }
>
> g4:/tmp> javac A.java
> g4:/tmp> what A.class
> A.class
> $Id: A.java,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: A.java,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* ;-)
>
> -Bertrand
>
>