[Scons-users] problem with new Jar builder-wrapper in 3.0.1

Mats Wichmann mats at wichmann.us
Fri Nov 17 18:28:22 EST 2017


Okay, this has turned into a complete rathole of a day, sigh.  There's a
reason I hate Java, it always wastes my time :)

One thing that's going wrong is that we don't get our manifest file
actually included in the jarfile, we get a default one instead.  This
seems to be due to an unaware check in Tool/jar.py, namely from this
sequence:

    for s in source:
        s = env.subst(s)
        if isinstance(s, SCons.Node.FS.Base):
            ...
        else:
            if os.path.isfile(s):

if the file is the manifest file, it should be picked by this "if", but
it is not if I pass "MANIFEST.MF" in the list to Jar.  However if I pass
it as a file object using File("MANIFEST.MF") it is picked up. In other
words,following this call:

simpleserver_classes = jdk_env.Java(target='classes',
source=['src/main/java'])

this call fails to pick up the manifest:

example_jar = jdk_env.Jar(target='simpleserver.jar',
    source=simpleserver_classes + ['MANIFEST.MF'])

but this call successfully includes it:

example_jar = jdk_env.Jar(target='simpleserver.jar',
    source=simpleserver_classes + [File('MANIFEST.MF')])

Is this expected behavior?

(adding a bunch of debugs to Tool/jar.py shows that in the former case
it has failed the first three checks under the else: clause above which
are os.path.isfile, os.path.isdir and s[-len(java_suffix):], and fallen
through to the else clause at the end which makes the wrong assumption -
it's either a swig file or an uncreated directory).

Is this due to variantdir stuff?





More information about the Scons-users mailing list