diff options
author | William Deegan <bill@baddogconsulting.com> | 2018-02-14 02:47:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-14 02:47:27 (GMT) |
commit | 85669388ecbd9af7dcfbf739ab767684888230a5 (patch) | |
tree | 3d9ed82c13c981e2a94fbd4466db70ff3819bac7 /src/engine | |
parent | 1228c728835e1dc4b403b4509ee45bac0fdf6ef6 (diff) | |
parent | b7dda62fbfface49432fd05d9c7ff507a3b381b3 (diff) | |
download | SCons-85669388ecbd9af7dcfbf739ab767684888230a5.zip SCons-85669388ecbd9af7dcfbf739ab767684888230a5.tar.gz SCons-85669388ecbd9af7dcfbf739ab767684888230a5.tar.bz2 |
Merge pull request #3098 from dmoody256/JavaSconsFiles
Fix Jar to use SCons to check for files instead of python
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/SCons/Tool/jar.py | 50 |
1 files changed, 16 insertions, 34 deletions
diff --git a/src/engine/SCons/Tool/jar.py b/src/engine/SCons/Tool/jar.py index b31ccb9..5e3711a 100644 --- a/src/engine/SCons/Tool/jar.py +++ b/src/engine/SCons/Tool/jar.py @@ -163,19 +163,6 @@ def Jar(env, target = None, source = [], *args, **kw): else: return dir_targets - # In the case that we are passed just string to a node which is directory - # but does not exist, we need to check all the current targets to see if - # that directory is going to exist so we can add it as a source to Jar builder - def get_all_targets(env, node='.'): - def get_all_targets_iter(env, node): - if node.has_builder(): - yield node - for kid in node.all_children(): - for kid in get_all_targets(env, kid): - yield kid - node = env.arg2nodes(node, env.fs.Entry)[0] - return list(get_all_targets_iter(env, node)) - # loop through the sources and handle each accordingly # the goal here is to get all the source files into a class # file or a directory that contains class files @@ -189,27 +176,22 @@ def Jar(env, target = None, source = [], *args, **kw): # found a dir so get the class files out of it target_nodes.extend(dir_to_class(s)) else: - if os.path.isfile(s): - # found a file that exists on the FS, make sure its a class file - target_nodes.extend(file_to_class(s)) - elif os.path.isdir(s): - # found a dir so get the class files out of it - target_nodes.extend(dir_to_class(s)) - elif s[-len(java_suffix):] == java_suffix or s[-len(java_class_suffix):] == java_class_suffix: - # found a file that may not exists and is only a string - # so add it after converting it to a class file - target_nodes.extend(file_to_class(s)) - else: - # found a swig file so add it after converting it to class files - if(os.path.splitext(str(s))[1] == ".i"): - target_nodes.extend(env.JavaClassFile(source = s, *args, **kw)) - else: - # The final else case handles anything not caught above and makes - # sure other nodes that are sources for this jar get add as - # a source to the JarFile builder - for node in get_all_targets(env): - if(s == str(node)): - target_nodes.append(node) + try: + # source is string try to convert it to file + target_nodes.extend(file_to_class(env.fs.File(s))) + continue + except: + pass + + try: + # source is string try to covnert it to dir + target_nodes.extend(dir_to_class(env.fs.Dir(s))) + continue + except: + pass + + SCons.Warnings.Warning("File: " + str(s) + " could not be identified as File or Directory, skipping.") + # at this point all our sources have been converted to classes or directories of class # so pass it to the Jar builder return env.JarFile(target = target, source = target_nodes, *args, **kw) |