summaryrefslogtreecommitdiff
path: root/site_scons
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2017-04-20 09:48:31 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2017-04-20 09:48:31 -0400
commit37073e44e9895ea4ecc18fdd0a9b54f5ebb052fa (patch)
treee82aac08fa2a06d2011fca367195daa35a5c17ae /site_scons
parentc192a1b9b1e223f8075ab5ce72dde372467f9650 (diff)
downloadmongo-37073e44e9895ea4ecc18fdd0a9b54f5ebb052fa.tar.gz
SERVER-28515 Add import support to IDL
Diffstat (limited to 'site_scons')
-rw-r--r--site_scons/site_tools/idl_tool.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/site_scons/site_tools/idl_tool.py b/site_scons/site_tools/idl_tool.py
index 22e75c4ac42..d44aa5a40d4 100644
--- a/site_scons/site_tools/idl_tool.py
+++ b/site_scons/site_tools/idl_tool.py
@@ -16,6 +16,7 @@
"""IDL Compiler Scons Tool."""
import os.path
+import subprocess
import sys
import SCons
@@ -44,15 +45,32 @@ IDLCBuilder = SCons.Builder.Builder(
suffix=".cpp"
)
+def idl_scanner(node, env, path):
+ # Use the import scanner mode of the IDL compiler to file imported files
+ cmd = [sys.executable, "buildscripts/idl/idlc.py", '--include','src', str(node), '--write-dependencies']
+ deps_str = subprocess.check_output(cmd)
+
+ deps_list = deps_str.splitlines()
+
+ nodes_deps_list = [ env.File(d) for d in deps_list]
+
+ return nodes_deps_list
+
+idl_scanner = SCons.Scanner.Scanner(function=idl_scanner, skeys=['.idl'])
+
def generate(env):
bld = IDLCBuilder
+
+ env.Append(SCANNERS = idl_scanner)
+
env['BUILDERS']['Idlc'] = bld
env['IDLC'] = sys.executable + " buildscripts/idl/idlc.py"
env['IDLCFLAGS'] = ''
base_dir = env.subst('$BUILD_ROOT/$VARIANT_DIR').replace("#", "")
- env['IDLCCOM'] = '$IDLC --base_dir %s --header ${TARGETS[1]} --output ${TARGETS[0]} $SOURCES ' % (base_dir)
+ env['IDLCCOM'] = '$IDLC --include src --base_dir %s --header ${TARGETS[1]} --output ${TARGETS[0]} $SOURCES ' % (base_dir)
env['IDLCSUFFIX'] = '.idl'
+
def exists(env):
return True \ No newline at end of file