[Scons-users] java builder not working with variant directory

William Roberts bill.c.roberts at gmail.com
Wed Jun 25 15:36:37 EDT 2014


I *think* i've tried that before with the same results.

I applied the changes you suggested, and still hit the same error, can
you send me your modifications or a diff?

See attached for what I changed based on your recommendations.

Thank you,
Bill

On Wed, Jun 25, 2014 at 12:22 PM, Dirk Bächle <tshortik at gmx.de> wrote:
> Hi William,
>
> On 25.06.2014 18:09, William Roberts wrote:
>>
>> [...]
>>
>>
>> When running "broken" we see the following output from the java builder:
>> scons: Reading SConscript files ...
>> CWD: /home/wroberts/simple/broken/out
>> Entry: .
>> Is directory
>> Source files: []
>> Classes: []
>>
>> It switched to the variant dir, but never made the hardlink back to
>> the java sources, and never switch into that hardlink. Based on what I
>> see for my C code projects that do this we should see out/broken/<src>
>> and we do not.
>
>
> all your problems go back to your SConscript file, where you set
>
>   cls = Java(target = 'classes', source = '.')
>
> . This may work at first, but gives errors when used with VariantDirs, as
> you experienced. SCons internally tries to resolve the "." string to either
> a File or Dir Node, and correctly decides that "." is a folder...while being
> in the output directory (abspath = ".../simple/broken/out"). In the javac.py
> Tool, method emit_java_classes(target, source, env), the "." is resolved to
> its variant dir via the FS.Dir.rdir() method.
> But the folder ".../simple/broken/out" (= ".") already exists, because your
> SConscript was linked to it (check with the --debug=duplicate option). So,
> resolving stops and the original folder is returned from rdir()...where the
> Java sources don't exist yet.
>
> The solution is to create an additional subfolder "simple/broken/src" with
> the SConscript, and a Java source folder "simple/broken/src/main" with all
> the *.java files, and then have in your SConscript:
>
>   cls = Java(target = 'classes', source = 'main')
>
> and in your SConstruct:
>
>   SConscript("src/SConscript", variant_dir="out", duplicate=1)
>
> This approach works fine on my side.
>
>
> Best regards,
>
> Dirk
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> http://four.pairlist.net/mailman/listinfo/scons-users



-- 
Respectfully,

William C Roberts
-------------- next part --------------
A non-text attachment was scrubbed...
Name: scons_javav2.tar.bz2
Type: application/x-bzip2
Size: 3282 bytes
Desc: not available
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20140625/adbb8471/attachment.bin>


More information about the Scons-users mailing list