Allow custom shell commands to specify a dependency discovery scheme (bug 5997 part 3, r=ds).
Allow custom shell commands to specify a dependency discovery scheme (
bug 5997 part 3, r=ds).
1.1 --- a/ambuild2/frontend/amb2/gen.py Sat Dec 28 10:24:26 2013 -0500
1.2 +++ b/ambuild2/frontend/amb2/gen.py Sat Dec 28 10:21:31 2013 -0500
1.3 @@ -595,15 +595,30 @@
1.4 def addFolder(self, context, folder):
1.5 return self.generateFolder(context.localFolder, folder)
1.6
1.7 - def addShellCommand(self, context, inputs, argv, outputs, folder=-1):
1.8 + def addShellCommand(self, context, inputs, argv, outputs, folder=-1, dep_type=None):
1.9 if folder is -1:
1.10 folder = context.localFolder
1.11
1.12 + if dep_type is None:
1.13 + node_type = nodetypes.Command
1.14 + data = argv
1.15 + else:
1.16 + node_type = nodetypes.Cxx
1.17 + if dep_type not in ['gcc', 'msvc', 'sun']:
1.18 + util.con_err(util.ConsoleRed, 'Invalid dependency spew type: ',
1.19 + util.ConsoleBlue, dep_type,
1.20 + util.ConsoleNormal)
1.21 + raise Exception('Invalid dependency spew type')
1.22 + data = {
1.23 + 'type': dep_type,
1.24 + 'argv': argv,
1.25 + }
1.26 +
1.27 return self.addCommand(
1.28 context = context,
1.29 - node_type = nodetypes.Command,
1.30 + node_type = node_type,
1.31 folder = folder,
1.32 - data = argv,
1.33 + data = data,
1.34 inputs = inputs,
1.35 outputs = outputs
1.36 )
2.1 --- a/ambuild2/frontend/base_gen.py Sat Dec 28 10:24:26 2013 -0500
2.2 +++ b/ambuild2/frontend/base_gen.py Sat Dec 28 10:21:31 2013 -0500
2.3 @@ -122,8 +122,8 @@
2.4 def AddCopy(self, source, output_path):
2.5 return self.generator.addCopy(self, source, output_path)
2.6
2.7 - def AddCommand(self, inputs, argv, outputs):
2.8 - return self.generator.addShellCommand(self, inputs, argv, outputs)
2.9 + def AddCommand(self, inputs, argv, outputs, dep_type=None):
2.10 + return self.generator.addShellCommand(self, inputs, argv, outputs, dep_type=dep_type)
2.11
2.12 def AddConfigureFile(self, path):
2.13 return self.generator.addConfigureFile(self, path)
2.14 @@ -236,7 +236,7 @@
2.15 def addCopy(self, context, source, output_path):
2.16 raise Exception('Must be implemented!')
2.17
2.18 - def addShellCommand(self, context, inputs, argv, outputs):
2.19 + def addShellCommand(self, context, inputs, argv, outputs, dep_type=None):
2.20 raise Exception('Must be implemented!')
2.21
2.22 def addConfigureFile(self, context, path):