Re: ecj javac target/source build.xml rewriting

Joshua Nichols <[email protected]>
Newsgroups gmane.linux.gentoo.java
Message-ID <[email protected]>
Roy Wright wrote:
> Howdy,
>
> I'm looking at http://bugs.gentoo.org/show_bug.cgi?id=196080
>
> Basically what is happening is that these lines in build.xml
> are not being rewritten with the correct version:
>
>   <property name="javac.target" value="1.2"/>
>   <property name="javac.source" value="1.2"/>
>
> Ideally these should be:
>
>   <property name="javac.target" value="$JAVA_PKG_WANT_TARGET"/>
>   <property name="javac.source" value="$JAVA_PKG_WANT_SOURCE"/>
>
> While [email protected] has created a patch to bump these
> values to 1.3, this just postpones the real problem.
>
> Digging into java-ant-2.eclass I think that java-ant_bsfix_files()
> is the method that is modifying build.xml.  The problem seems
> to be that the xml-rewrite*.py scripts are designed to only
> match element name (e) plus attribute (a) to change new value (v):
>
>   <e a=v>
>
> I don't see how to specify element name (eM) plus an attribute
> (aM) with value (vM) to match plus attribute (a) to change to
> new value (v):
>
>   <eM aM=vM a=v>
>
> Does anyone have any ideas of how this could be done?
>   
Here's a little background on our friend xml-rewrite.py.

The original intent of the xml-rewrite.py was to add source/target 
attributes to things that did not have them.

This was a big part of our strategy for dealing with a system that had 
1.4 and 1.5. If not specified otherwise, javac defaults to the highest 
possible source/target (ie Java 1.5 defaults to 1.5). That means if you 
build something with 1.5 that did not specify the target, and then want 
to use it with 1.4, you were pretty much out of luck and had to go about 
rebuilding everything with 1.4. The solution was to create xml-rewrite, 
and have it fill in target/source to be the lowest possible value the 
package could support. If a package specified its own source/target, 
then those were respected knew better than xml-rewrite.

So, back to this particular issue...

If the values of source/target are causing issues with ecj, it should be 
reported to upstream. Using a patch until it gets fixed would be 
acceptable in this case.

If it's just an issue on Gentoo, it's worth looking at patching 
xml-rewrite to allow values to be forced, like with a --force flag or 
something similar. This shouldn't be a default behavior (definitely not 
initially at least) due to the large number of ebuilds (stable or 
otherwise) already using xml-rewrite's behavior as is.

-- 
Joshua Nichols
Gentoo/Ruby Developer
Gentoo/Java Developer
http://technicalpickles.com

-- 
[email protected] mailing list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.