[Scons-dev] SCons and Java

William Blevins wblevins001 at gmail.com
Tue May 27 22:54:43 EDT 2014


Team,

I have a couple points I'd like to discuss, but for the sake of
organization, I intend to split them into separate emails.

Java Part #1

There has been some discussion on making Scons more ANT-like,
http://www.scons.org/wiki/JavaSupport, and that might solve some issues
like identifying Java targets, but first I'd like to consider making Scons
Java support more Scons-like.

Wait. What does that even mean? The Scons Java API doesn't feel consistent.
Some of these issues may simply be bugs (not sure honestly), but let me
point out some oddities. In order to construct some cases, I will compare
the API for different Scons tools like CPP builders and Java builders.

1. JAVACLASSPATH does not work as expected (inconsistent with other SCons
builders and/or doesn't work as desired).

> JAVACLASSPATH
> Specifies the list of directories that will be searched for Java .class file.
> The directories in this list will be added to the javac and javah command
> lines via the -classpath option. The individual directory names will be
> separated by the operating system's path separate character (: on
> UNIX/Linux/POSIX, ; on Windows).
> Note that this currently just adds the specified directory via the
> -classpath option. SCons does not currently search the $JAVACLASSPATH directories
> for dependency .class files.

Firstly, I think that adding item(s) to the JAVACLASSPATH should work the
same as adding libraries to LIBS.

> CPP
> env['LIBS'] = [ a, b, c] // now a, b, c are dependencies!
> Java
> env['JAVACLASSPATH'] = [ a, b, c ] // now a, b, c are dependencies!

Currently, anything (jars or other) listed in the JAVACLASSPATH must be
manually added as a dependency (via Depends) which makes no sense.  This is
what SCons does best or should do best.

Thoughts and question(s):

1. If JAVACLASSPATH isn't scanned for dependencies, what is the best post
processing step of compiling *.java file(s)?  Is this related to target
list generation?

2. I hope that SCons never tries to scan *.java file(s) like the c-scanners
do for header file(s); I think that (at least initially) adding the list of
dependencies as specified by the user is enough.  Right now I have to do
this twice :(

3. Scons should list dependencies in library form whenever possible (IE.
*.jar vice *.class) unless *.class file(s) are explicitly added to the path.

V/R,

William
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/scons-dev/attachments/20140527/b63cf3a4/attachment.html>


More information about the Scons-dev mailing list