Community
Participate
Working Groups
When building byte codes, the exact version of the compiler used can make a difference, so its would be nice to have a better record of it. I know that you provide a '-showversion' directive that can cause this to happen, but many people do not (its not currently be used in base or eclipse builder, for example ... not sure why). My own feeling is that it should not have to depend on the exact build process ... since a log WAS requested, seems to be no harm. Plus, by requiring the "-showversion" it leads to ant scripts which have to differ based on the target compiler ... not nice. [I'd even like to see other "byte code effecting parameters" listed there, such as target compliance level, etc.
Created attachment 26325 [details] Seems easy enough to do ... right where you put in the current date? Thanks for considering (not to mention all your help).
Note, also please see 107550 ... it seems current (R3_1) version of build process can not "pass through" the compilearg=-showversion parameter ... which, to me, just hieghtens the need to make it "automatic" and not part of a particular build process.
Changing title to say "batch compiler" instead of "batch builder". (It is the JDT batch compiler I'm talking about, if any doubt).
It already does it if you create an xml log. In the compiler tag, you can find the version: <compiler name="Eclipse Java Compiler" copyright="Copyright IBM Corp 2000, 2005. All rights reserved." version="0.607, 3.2.0 milestone-2"> I will add the version if you create a log that is not an xml log, but it won't be automatic when no log is requested.
Passing: -showversion in a compilerarg nested element works fine. I got: # 22 août 2005 10:06:20 Eclipse Java Compiler 0.606, 3.2.0 milestone-2, Copyright IBM Corp 2000, 2005. All rights reserved. Using the following javac ant task: <javac srcdir="${root}" destdir="${destdir}" nowarn="on" deprecation="off" source="1.5" debug="on" verbose="on"> <compilerarg compiler="org.eclipse.jdt.core.JDTCompilerAdapter" line="-showversion"/> </javac> So I would say that the support is already in. Isn't this enough?
Yes, "it is possible" ... but its not easy. For example, it depends on the build script being written just right and current one (see bug 107550) seems not to be. I think using current pde type builds, there is no way to change the "log" file to "xml". And, as far as I could tell, the current "showversion" is not "passed through" as part of the normal build process. Plus, the "showversion" is "none standard" for compilers (if there's any standard), so any build script has to be sensitive to which compiler is being used on any particular run. So ... guess you could say this is a request to make it easier and automatic, so it will * always * work ... if logging if requested at all.
The problem of adding it where you suggested is that you can end up dumping twice the compiler version in the log file is that -showversion has been passed as a compiler arg. >And, as far as I could tell, the current "showversion" is not "passed through" >as part of the normal build process. No, but nothing prevents you from adding it. >Plus, the "showversion" is "none standard" for compilers (if there's any >standard), so any build script has to be sensitive to which compiler is being >used on any particular run. If you specify the compiler name in the compiler arg nested element, this is not a problem. As I stated in comment 5, <compilerarg compiler="org.eclipse.jdt.core.JDTCompilerAdapter" line="-showversion"/> will only be considered if the compiler used to compile is the Eclipse compiler. It it is the Sun compiler, it will be ignored. I will investigate and propose a patch.
Created attachment 26345 [details] Proposed fix This should garantee that the version is not printed twice.
Wrong patch. The version is not printed at all if -showversion is not used. In this case, we still want the version to be printed in the log.
Created attachment 26346 [details] Proposed fix Better fix
Fixed and released in HEAD. Updated existing batch compiler tests to filter out the first two lines.
Olivier - are we now different from other Ant javac adapters? i.e. do they print the version for free ?
No javac adapter prints the version for free. I don't do it in the console for free. I do it only in the log if there is a log or if the -showversion option has been specified using a compiler arg nested element. So no visible changes except in the log file.
Verified for 3.2 M2 on build Build id: I20050920-0010.
Verified in I20050920-0010 for 3.2M2