playground test update for swig with -outdir parameter

This commit is contained in:
christophe.duvernois 2015-05-03 18:47:05 +02:00
parent 533599b7ba
commit 28639e5c98
1 changed files with 5 additions and 15 deletions

View File

@ -92,10 +92,10 @@ def build(bld):
from waflib.extras import swig
srcdir = bld.path.get_bld().make_node('extend/java/hmm') # destination for generated java file (without the packages!)
srcdir = bld.path.get_bld().make_node('extend/java') # destination for generated java file
#""" # BEGIN BLOCK 1
d = bld.path.make_node('extend/java')
d = bld.path.make_node('extend/java/foo/bar/pouet')
javanodes = [d.find_or_declare(x) for x in 'A.java test_swig_waf.java test_swig_wafJNI.java'.split()]
dec = bld.tools['swig'].swigf
#@dec <- python 2.3 does not support the @decorator notation
@ -106,23 +106,17 @@ def build(bld):
#"""# do not remove
bld(
features = 'cxx cxxshlib',
source = 'extend/java/test_swig_waf.i',
target = 'extend/java/_test_swig_waf',
swig_flags = '-c++ -java -package foo.bar.pouet',
swig_flags = '-c++ -java -package foo.bar.pouet -outdir extend/java/foo/bar/pouet',
includes = 'extend',
vnum = '1.2.3',
uselib = 'JAVA',
use = 'mylib')
#""" # BEGIN BLOCK 2
for x in javanodes:
bld(rule='cp ${SRC} ${TGT}', source=x,
target=srcdir.make_node('foo/bar/pouet/' + x.name), before=['javac'], after=['swig'])
""" # END BLOCK 2
def move_java_files(task):
@ -130,22 +124,18 @@ def build(bld):
from waflib import Utils
node = srcdir.make_node('foo/bar/pouet/')
node.mkdir()
orig = task.inputs[0].parent.get_bld().abspath()
files = Utils.listdir(orig)
files = Utils.listdir(node.abspath())
for x in files:
if x.endswith('.java'):
# create a node in the directory we want to
j = node.make_node(x) # create a node
shutil.copy2(orig + os.sep + x, j.abspath()) # create the physical file for the node
j.sig = Utils.h_file(j.abspath()) # update the node signature
# depend on the .i file to make sure the .java files are copied after swig is executed
bld(name='move_and_read', rule=move_java_files, source='extend/java/test_swig_waf.i', after=['swig'], before=['javac'])
#"""
bld(rule='cp ${SRC} ${TGT}', source=bld.path.find_resource('extend/java/Foo.java'),
target=srcdir.make_node('foo/bar/pouet/Foo.java'), before=['javac'], after=['swig'])
bld(rule='cp ${SRC} ${TGT}', source=bld.path.find_resource('extend/java/Foo.java'), target=srcdir.make_node('foo/bar/pouet/Foo.java'), before=['javac'], after=['swig'])
tmp = bld.path.get_bld().make_node('maha')