[Scons-users] Problems with the Java builder
Brady Johnson
bradyallenjohnson at gmail.com
Tue Jan 21 08:07:57 EST 2014
I figured out what the problem is with the SCons Java builder. The problem
occurs for *generated *Java code. When SCons is analyzing the build scripts
to setup all the targets and related sources, these Java files havent been
generated yet. So when its analyzing the targets for the Java code,
(obviously) it cant get the package name from them (which is needed for the
resulting java target class directory structure), nor figure out the inner
classes. Actually SCons does a best-effort and makes the target directory
as best it can. Im surprised it actually made it this far :)
I cant think of a solution for this problem, other than including direct
calls to the java compiler in the builder that generates the java files,
and figure out the correct java target class directory structure based on
the input thrift files.
I have this same problem for Java code that is being generated based on a
WSDL.
Can anybody else think of a better solution?
Thanks,
Brady
On Wed, Jan 15, 2014 at 3:23 PM, Brady Johnson
<bradyallenjohnson at gmail.com>wrote:
>
> Hello all,
>
> I remember some months back there were some emails on this list that
> mentioned that the SCons Java builder was lacking and needed improvements.
> Im wondering if the problems im seeing are related.
>
> Here is the situation: I am trying to compile some java source files that
> are generated using Apache Thrift, and subsequently cant modify them. Im
> compiling as follows:
>
> tgt = env.Java(target='classes', source='ServiceMmasClApi.java')
> for t in target: print 'java target %s' % (t)
>
> This compiles as expected, but the result from the print statement is not
> expected:
>
> java target: classes/ServiceMmasClApi.class
>
> But the actual compiled targets are as follows:
>
> $ tree classes/
> classes/
> `-- com
> `-- ericsson
> `-- sccf
> `-- thrift
> `-- gen
> |-- ServiceMmasClApi$1.class
> |-- ServiceMmasClApi$AsyncClient$Factory.class
> |--
> ServiceMmasClApi$AsyncClient$assign_subscriber_profile_call.class
> |--
> ServiceMmasClApi$AsyncClient$create_domain_reporting_call.class
> |--
> ServiceMmasClApi$AsyncClient$remove_subscriber_profile_call.class
> |-- ServiceMmasClApi$AsyncClient.class
> |-- ServiceMmasClApi$AsyncIface.class
> and lots more...
>
> Subsequently, the ServiceMmasClApi.java file is always compiled, since
> classes/ServiceMmasClApi.class doesnt exist.
>
> The problem seems simple:
> - SCons is not taking into account the package definition when creating
> the target, hence the com sub-directory tree
> - SCons is not correctly considering inner classes in the source file
>
> Perhaps Im doing something wrong?? Has anyone else seen this, and know how
> to fix it?
>
> Im considering just writing my own builder, but maybe we should instead
> get this fixed.
>
> BTW: Im using the following version:
>
> $ scons --version
> SCons by Steven Knight et al.:
> script: v2.3.0.rel_2.3.0:2870:c8dbbaa4598e, 2013/07/31 13:02:49, by
> bdbaddog on Williams-MacBook
> engine: v2.3.0.rel_2.3.0:2870:c8dbbaa4598e, 2013/07/31 13:02:49, by
> bdbaddog on Williams-MacBook
> engine path:
> ['/tmp/ebrjohn/pythonbrew/venvs/Python-2.7.2/py_master/lib/scons-2.3.0/SCons']
> Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
> 2011, 2012, 2013 The SCons Foundation
>
>
> Thanks in advance,
>
> Brady
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20140121/9e0d75e5/attachment.html
More information about the Scons-users
mailing list