[Scons-users] Jar builds fail with SConscript variant directory
Dirk Bächle
tshortik at gmx.de
Sat May 3 17:39:21 EDT 2014
Hi Bill,
On 01.05.2014 17:52, William Roberts wrote:
> Ok trying again on the right list with the attachment...
>
> I typically set up my builds with a hierachical layout and a variant
> directory and do some other things to make it all work together.
> Normally I program in C, and this all works.
>
> Recently, I tried using java and broke. I have a very simple example
> that doesnt work. If I change the SConscript calls to use a variant
> dir, its broken, if I dont it works...
>
> Sconstruct:
>
> <snip>
> SConscript(script)
> #SConscript(script, variant_dir=outdir, duplicate=1)
> <snip>
>
> to
> <snip>
> #SConscript(script)
> SConscript(script, variant_dir=outdir, duplicate=1)
> <snip>
>
> it breaks...
>
> Can someone explain what's going on here? Thanks.
I also tried my luck and had a short look at your build setup. In your
SConscript you have:
Java("classes", ".")
Jar("myjar.jar", "classes")
which works fine as long as you don't use variant dirs. The problem is
the first line, which creates a dependency between "classes" and ".".
These are both Dir nodes, so when the VariantDir stuff jumps in and
starts to copy things, it won't pick up the "*.java" source files living
*under* the "." directory. You can check this with calling "scons
--tree=derived", which won't show any "*.java" files as leaves in the
dependency tree, as one might expect.
A possible way out is to compile the Java files one at a time. This
requires to additionally set the "-classpath" option, and a proper
SConscript for your situation would be:
Java("classes", Glob("*.java"), JAVACLASSPATH=Dir("classes"))
Jar("myjar.jar", "classes")
This works for duplicate=1, as well as duplicate=0.
Best regards,
Dirk
More information about the Scons-users
mailing list