Fix Visual Studio commands not specifying autogenerated files as outputs (bug 6024, r=ds).
Fix Visual Studio commands not specifying autogenerated files as outputs (
bug 6024, r=ds).
1.1 --- a/ambuild2/frontend/amb2/gen.py Sat Feb 01 16:56:01 2014 -0800
1.2 +++ b/ambuild2/frontend/amb2/gen.py Sat Feb 01 17:04:02 2014 -0800
1.3 @@ -571,7 +571,8 @@
1.4 outputs = [objfile.outputFile],
1.5 node_type = nodetypes.Cxx,
1.6 folder = folder_node,
1.7 - data = cxxData
1.8 + data = cxxData,
1.9 + shared_outputs = objfile.sharedOutputs
1.10 )
1.11 inputs.append(cxxNode)
1.12 for rcfile in binary.resources:
2.1 --- a/ambuild2/frontend/cpp.py Sat Feb 01 16:56:01 2014 -0800
2.2 +++ b/ambuild2/frontend/cpp.py Sat Feb 01 17:04:02 2014 -0800
2.3 @@ -324,10 +324,11 @@
2.4 return re.sub('[^a-zA-Z0-9_]+', '_', os.path.splitext(file)[0]);
2.5
2.6 class ObjectFile(object):
2.7 - def __init__(self, sourceFile, outputFile, argv):
2.8 + def __init__(self, sourceFile, outputFile, argv, sharedOutputs):
2.9 self.sourceFile = sourceFile
2.10 self.outputFile = outputFile
2.11 self.argv = argv
2.12 + self.sharedOutputs = sharedOutputs
2.13
2.14 class RCFile(object):
2.15 def __init__(self, sourceFile, preprocFile, outputFile, cl_argv, rc_argv):
2.16 @@ -394,6 +395,12 @@
2.17 self.default_c_env = CCommandEnv(self.outputPath, self.compiler, self.compiler.cc)
2.18 self.default_cxx_env = CCommandEnv(self.outputPath, self.compiler, self.compiler.cxx)
2.19
2.20 + shared_cc_outputs = []
2.21 + if self.compiler.debuginfo:
2.22 + cl_version = int(self.compiler.cc.version) - 600
2.23 + shared_pdb = 'vc{0}.pdb'.format(int(cl_version / 10))
2.24 + shared_cc_outputs += [shared_pdb]
2.25 +
2.26 self.objects = []
2.27 self.resources = []
2.28 for item in self.sources:
2.29 @@ -438,7 +445,8 @@
2.30 self.resources.append(RCFile(sourceFile, encname + '.i', objectFile, cl_argv, rc_argv))
2.31 else:
2.32 argv = cenv.argv + cenv.compiler.objectArgs(sourceFile, objectFile)
2.33 - self.objects.append(ObjectFile(sourceFile, objectFile, argv))
2.34 + obj = ObjectFile(sourceFile, objectFile, argv, shared_cc_outputs)
2.35 + self.objects.append(obj)
2.36
2.37 if not self.linker_:
2.38 if self.used_cxx_:
2.39 @@ -451,11 +459,15 @@
2.40 self.linker_outputs = [self.outputFile]
2.41 self.debug_entry = None
2.42
2.43 + if self.linker_.behavior == 'msvc' and '/INCREMENTAL:NO' not in self.argv:
2.44 + self.linker_outputs += [self.name_ + '.ilk']
2.45 +
2.46 if self.compiler.debuginfo:
2.47 self.perform_symbol_steps(cx)
2.48
2.49 def perform_symbol_steps(self, cx):
2.50 if isinstance(self.linker_, MSVC):
2.51 + # Note, pdb is last since we read the pdb as outputs[-1].
2.52 self.linker_outputs += [self.name_ + '.pdb']
2.53 elif cx.target_platform is 'mac':
2.54 bundle_folder = os.path.join(self.localFolder, self.outputFile + '.dSYM')
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/tests/vcfiles/AMBuildScript Sat Feb 01 17:04:02 2014 -0800
3.3 @@ -0,0 +1,12 @@
3.4 +# vim: set ts=8 sts=2 tw=99 et ft=python:
3.5 +import os, sys
3.6 +
3.7 +builder.DetectCompilers()
3.8 +
3.9 +program = builder.compiler.Library("hello")
3.10 +program.sources = [
3.11 + 'main.cpp'
3.12 +]
3.13 +
3.14 +# Comment below to test successful folder removal.
3.15 +builder.Add(program)
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/tests/vcfiles/configure.py Sat Feb 01 17:04:02 2014 -0800
4.3 @@ -0,0 +1,6 @@
4.4 +# vim: set sts=2 ts=8 sw=2 tw=99 et:
4.5 +import sys
4.6 +from ambuild2 import run
4.7 +
4.8 +builder = run.PrepareBuild(sourcePath = sys.path[0])
4.9 +builder.Configure()
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/tests/vcfiles/main.cpp Sat Feb 01 17:04:02 2014 -0800
5.3 @@ -0,0 +1,7 @@
5.4 +#include <stdio.h>
5.5 +
5.6 +extern "C" int egg()
5.7 +{
5.8 + return printf("hello!\n");
5.9 +}
5.10 +