Bug 107535 - batch compiler should put is own version in the compiler log file
Summary: batch compiler should put is own version in the compiler log file
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.2 M2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-21 03:40 EDT by David Williams CLA
Modified: 2005-09-20 13:04 EDT (History)
1 user (show)

See Also:


Attachments
Seems easy enough to do ... right where you put in the current date? (917 bytes, patch)
2005-08-21 03:41 EDT, David Williams CLA
no flags Details | Diff
Proposed fix (3.87 KB, patch)
2005-08-22 11:26 EDT, Olivier Thomann CLA
no flags Details | Diff
Proposed fix (3.37 KB, patch)
2005-08-22 12:29 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Williams CLA 2005-08-21 03:40:12 EDT
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.
Comment 1 David Williams CLA 2005-08-21 03:41:50 EDT
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).
Comment 2 David Williams CLA 2005-08-21 18:12:31 EDT
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. 
Comment 3 David Williams CLA 2005-08-21 19:54:25 EDT
Changing title to say "batch compiler" instead of "batch builder". 
(It is the JDT batch compiler I'm talking about, if any doubt). 
Comment 4 Olivier Thomann CLA 2005-08-22 10:01:07 EDT
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.
Comment 5 Olivier Thomann CLA 2005-08-22 10:10:16 EDT
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?
Comment 6 David Williams CLA 2005-08-22 10:49:11 EDT
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. 
Comment 7 Olivier Thomann CLA 2005-08-22 11:00:30 EDT
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.
Comment 8 Olivier Thomann CLA 2005-08-22 11:26:43 EDT
Created attachment 26345 [details]
Proposed fix

This should garantee that the version is not printed twice.
Comment 9 Olivier Thomann CLA 2005-08-22 11:43:42 EDT
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.
Comment 10 Olivier Thomann CLA 2005-08-22 12:29:21 EDT
Created attachment 26346 [details]
Proposed fix

Better fix
Comment 11 Olivier Thomann CLA 2005-08-22 13:47:25 EDT
Fixed and released in HEAD.
Updated existing batch compiler tests to filter out the first two lines.
Comment 12 Philipe Mulet CLA 2005-08-23 04:27:19 EDT
Olivier - are we now different from other Ant javac adapters? i.e. do they print
the version for free ?
Comment 13 Olivier Thomann CLA 2005-08-23 09:53:08 EDT
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.
Comment 14 Maxime Daniel CLA 2005-09-20 12:55:09 EDT
Verified for 3.2 M2 on build Build id: I20050920-0010.
Comment 15 Olivier Thomann CLA 2005-09-20 13:04:25 EDT
Verified in I20050920-0010 for 3.2M2