From d55fd3cfa0e691c8aecebbcc066e186b1a2ac4aa Mon Sep 17 00:00:00 2001 From: Daniel Moody Date: Mon, 13 Nov 2017 20:37:51 -0500 Subject: Added a way to handle multiple targets for the Jar builder and an extra warning message. --- src/engine/SCons/Tool/jar.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/engine/SCons/Tool/jar.py b/src/engine/SCons/Tool/jar.py index 62cd86a..f22e68b 100644 --- a/src/engine/SCons/Tool/jar.py +++ b/src/engine/SCons/Tool/jar.py @@ -95,10 +95,22 @@ def Jar(env, target = None, source = [], *args, **kw): Builders. """ + # mutiple targets pass so build each target the same from the + # same source + #TODO Maybe this should only be done once, and the result copied + # for each target since it should result in the same? + if SCons.Util.is_List(target) and SCons.Util.is_List(source): + jars = [] + for single_target in target: + jars += env.Jar( target = single_target, source = source, *args, **kw) + return jars + # jar target should not be a list so assume they passed # no target and want implicit target to be made and the arg # was actaully the list of sources - if SCons.Util.is_List(target): + if SCons.Util.is_List(target) and source == []: + SCons.Warning.Warning("Making implicit target jar file, " + + "and treating the list as sources") source = target target = None @@ -118,10 +130,6 @@ def Jar(env, target = None, source = [], *args, **kw): if not SCons.Util.is_List(source): source = [source] - # Pad the target list with repetitions of the last element in the - # list so we have a target for every source element. - target = target + ([target[-1]] * (len(source) - len(target))) - # setup for checking through all the sources and handle accordingly java_class_suffix = env.subst('$JAVACLASSSUFFIX') java_suffix = env.subst('$JAVASUFFIX') -- cgit v0.12