Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

legacy: remove "tools" dir

Presumably everything that was in here is now being bundled directly by
node-gyp...
  • Loading branch information...
commit 924b06ee1b042fce27b205b2371574dcddafd21c 1 parent 788e418
@TooTallNate TooTallNate authored
Showing with 0 additions and 22,499 deletions.
  1. +0 −24 legacy/tools/addon.gypi
  2. +0 −1  legacy/tools/gyp/.gitignore
  3. +0 −6 legacy/tools/gyp/AUTHORS
  4. +0 −22 legacy/tools/gyp/DEPS
  5. +0 −27 legacy/tools/gyp/LICENSE
  6. +0 −21 legacy/tools/gyp/MANIFEST
  7. +0 −1  legacy/tools/gyp/OWNERS
  8. +0 −51 legacy/tools/gyp/PRESUBMIT.py
  9. +0 −97 legacy/tools/gyp/buildbot/buildbot_run.py
  10. +0 −10 legacy/tools/gyp/codereview.settings
  11. +0 −18 legacy/tools/gyp/gyp
  12. +0 −5 legacy/tools/gyp/gyp.bat
  13. +0 −7 legacy/tools/gyp/gyp_dummy.c
  14. +0 −256 legacy/tools/gyp/gyptest.py
  15. +0 −338 legacy/tools/gyp/pylib/gyp/MSVSNew.py
  16. +0 −208 legacy/tools/gyp/pylib/gyp/MSVSProject.py
  17. +0 −1,032 legacy/tools/gyp/pylib/gyp/MSVSSettings.py
  18. +0 −1,481 legacy/tools/gyp/pylib/gyp/MSVSSettings_test.py
  19. +0 −58 legacy/tools/gyp/pylib/gyp/MSVSToolFile.py
  20. +0 −146 legacy/tools/gyp/pylib/gyp/MSVSUserFile.py
  21. +0 −264 legacy/tools/gyp/pylib/gyp/MSVSVersion.py
  22. +0 −199 legacy/tools/gyp/pylib/gyp/SCons.py
  23. +0 −487 legacy/tools/gyp/pylib/gyp/__init__.py
  24. +0 −402 legacy/tools/gyp/pylib/gyp/common.py
  25. +0 −148 legacy/tools/gyp/pylib/gyp/easy_xml.py
  26. +0 −102 legacy/tools/gyp/pylib/gyp/easy_xml_test.py
  27. 0  legacy/tools/gyp/pylib/gyp/generator/__init__.py
  28. +0 −64 legacy/tools/gyp/pylib/gyp/generator/dump_dependency_json.py
  29. +0 −87 legacy/tools/gyp/pylib/gyp/generator/gypd.py
  30. +0 −56 legacy/tools/gyp/pylib/gyp/generator/gypsh.py
  31. +0 −2,149 legacy/tools/gyp/pylib/gyp/generator/make.py
  32. +0 −2,935 legacy/tools/gyp/pylib/gyp/generator/msvs.py
  33. +0 −35 legacy/tools/gyp/pylib/gyp/generator/msvs_test.py
  34. +0 −1,256 legacy/tools/gyp/pylib/gyp/generator/ninja.py
  35. +0 −42 legacy/tools/gyp/pylib/gyp/generator/ninja_test.py
  36. +0 −1,044 legacy/tools/gyp/pylib/gyp/generator/scons.py
  37. +0 −1,205 legacy/tools/gyp/pylib/gyp/generator/xcode.py
  38. +0 −2,382 legacy/tools/gyp/pylib/gyp/input.py
  39. +0 −204 legacy/tools/gyp/pylib/gyp/mac_tool.py
  40. +0 −145 legacy/tools/gyp/pylib/gyp/ninja_syntax.py
  41. +0 −51 legacy/tools/gyp/pylib/gyp/sun_tool.py
  42. +0 −68 legacy/tools/gyp/pylib/gyp/system_test.py
  43. +0 −972 legacy/tools/gyp/pylib/gyp/xcode_emulation.py
  44. +0 −2,838 legacy/tools/gyp/pylib/gyp/xcodeproj_file.py
  45. +0 −69 legacy/tools/gyp/pylib/gyp/xml_fix.py
  46. +0 −307 legacy/tools/gyp/pylintrc
  47. +0 −81 legacy/tools/gyp/samples/samples
  48. +0 −5 legacy/tools/gyp/samples/samples.bat
  49. +0 −26 legacy/tools/gyp/setup.py
  50. +0 −15 legacy/tools/gyp/tools/README
  51. +0 −5 legacy/tools/gyp/tools/Xcode/README
  52. +0 −27 legacy/tools/gyp/tools/Xcode/Specifications/gyp.pbfilespec
  53. +0 −226 legacy/tools/gyp/tools/Xcode/Specifications/gyp.xclangspec
  54. +0 −100 legacy/tools/gyp/tools/graphviz.py
  55. +0 −154 legacy/tools/gyp/tools/pretty_gyp.py
  56. +0 −168 legacy/tools/gyp/tools/pretty_sln.py
  57. +0 −330 legacy/tools/gyp/tools/pretty_vcproj.py
  58. +0 −42 legacy/tools/gyp_addon
View
24 legacy/tools/addon.gypi
@@ -1,24 +0,0 @@
-{
- 'target_defaults': {
- 'type': 'loadable_module',
- 'product_extension': 'node',
- 'product_prefix': '',
- 'include_dirs': [
- '<(node_root_dir)/src',
- '<(node_root_dir)/deps/uv/include',
- '<(node_root_dir)/deps/v8/include'
- ],
-
- 'conditions': [
- [ 'OS=="mac"', {
- 'libraries': [ '-undefined dynamic_lookup' ],
- }],
- [ 'OS=="win"', {
- 'libraries': [ '-l<(node_root_dir)/$(Configuration)/node.lib' ],
- }],
- [ 'OS=="freebsd" or OS=="openbsd" or OS=="solaris" or (OS=="linux" and target_arch!="ia32")', {
- 'cflags': [ '-fPIC' ],
- }]
- ]
- }
-}
View
1  legacy/tools/gyp/.gitignore
@@ -1 +0,0 @@
-*.pyc
View
6 legacy/tools/gyp/AUTHORS
@@ -1,6 +0,0 @@
-# Names should be added to this file like so:
-# Name or Organization <email address>
-
-Google Inc.
-Steven Knight <knight@baldmt.com>
-Ryan Norton <rnorton10@gmail.com>
View
22 legacy/tools/gyp/DEPS
@@ -1,22 +0,0 @@
-# DEPS file for gclient use in buildbot execution of gyp tests.
-#
-# (You don't need to use gclient for normal GYP development work.)
-
-vars = {
- "chrome_trunk": "http://src.chromium.org/svn/trunk",
-}
-
-deps = {
- "scons":
- Var("chrome_trunk") + "/src/third_party/scons@44099",
-}
-
-deps_os = {
- "win": {
- "third_party/cygwin":
- Var("chrome_trunk") + "/deps/third_party/cygwin@66844",
-
- "third_party/python_26":
- Var("chrome_trunk") + "/tools/third_party/python_26@89111",
- },
-}
View
27 legacy/tools/gyp/LICENSE
@@ -1,27 +0,0 @@
-Copyright (c) 2009 Google Inc. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
21 legacy/tools/gyp/MANIFEST
@@ -1,21 +0,0 @@
-setup.py
-gyp
-LICENSE
-AUTHORS
-pylib/gyp/MSVSNew.py
-pylib/gyp/MSVSProject.py
-pylib/gyp/MSVSToolFile.py
-pylib/gyp/MSVSUserFile.py
-pylib/gyp/MSVSVersion.py
-pylib/gyp/SCons.py
-pylib/gyp/__init__.py
-pylib/gyp/common.py
-pylib/gyp/input.py
-pylib/gyp/xcodeproj_file.py
-pylib/gyp/generator/__init__.py
-pylib/gyp/generator/gypd.py
-pylib/gyp/generator/gypsh.py
-pylib/gyp/generator/make.py
-pylib/gyp/generator/msvs.py
-pylib/gyp/generator/scons.py
-pylib/gyp/generator/xcode.py
View
1  legacy/tools/gyp/OWNERS
@@ -1 +0,0 @@
-*
View
51 legacy/tools/gyp/PRESUBMIT.py
@@ -1,51 +0,0 @@
-# Copyright (c) 2011 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-
-"""Top-level presubmit script for GYP.
-
-See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
-for more details about the presubmit API built into gcl.
-"""
-
-
-def CheckChangeOnUpload(input_api, output_api):
- report = []
- report.extend(input_api.canned_checks.PanProjectChecks(
- input_api, output_api))
- return report
-
-
-def CheckChangeOnCommit(input_api, output_api):
- report = []
- license = (
- r'.*? Copyright \(c\) %(year)s Google Inc\. All rights reserved\.\n'
- r'.*? Use of this source code is governed by a BSD-style license that '
- r'can be\n'
- r'.*? found in the LICENSE file\.\n'
- ) % {
- 'year': input_api.time.strftime('%Y'),
- }
-
- report.extend(input_api.canned_checks.PanProjectChecks(
- input_api, output_api, license_header=license))
- report.extend(input_api.canned_checks.CheckTreeIsOpen(
- input_api, output_api,
- 'http://gyp-status.appspot.com/status',
- 'http://gyp-status.appspot.com/current'))
-
- import sys
- old_sys_path = sys.path
- try:
- sys.path = ['pylib', 'test/lib'] + sys.path
- report.extend(input_api.canned_checks.RunPylint(
- input_api,
- output_api))
- finally:
- sys.path = old_sys_path
- return report
-
-
-def GetPreferredTrySlaves():
- return ['gyp-win32', 'gyp-win64', 'gyp-linux', 'gyp-mac']
View
97 legacy/tools/gyp/buildbot/buildbot_run.py
@@ -1,97 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2012 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-
-"""Argument-less script to select what to run on the buildbots."""
-
-
-import os
-import shutil
-import subprocess
-import sys
-
-
-if sys.platform in ['win32', 'cygwin']:
- EXE_SUFFIX = '.exe'
-else:
- EXE_SUFFIX = ''
-
-
-BUILDBOT_DIR = os.path.dirname(os.path.abspath(__file__))
-TRUNK_DIR = os.path.dirname(BUILDBOT_DIR)
-ROOT_DIR = os.path.dirname(TRUNK_DIR)
-OUT_DIR = os.path.join(TRUNK_DIR, 'out')
-
-
-def GypTestFormat(title, format=None, msvs_version=None):
- """Run the gyp tests for a given format, emitting annotator tags.
-
- See annotator docs at:
- https://sites.google.com/a/chromium.org/dev/developers/testing/chromium-build-infrastructure/buildbot-annotations
- Args:
- format: gyp format to test.
- Returns:
- 0 for sucesss, 1 for failure.
- """
- if not format:
- format = title
-
- print '@@@BUILD_STEP ' + title + '@@@'
- sys.stdout.flush()
- env = os.environ.copy()
- # TODO(bradnelson): remove this when this issue is resolved:
- # http://code.google.com/p/chromium/issues/detail?id=108251
- if format == 'ninja':
- env['NOGOLD'] = '1'
- if msvs_version:
- env['GYP_MSVS_VERSION'] = msvs_version
- retcode = subprocess.call(' '.join(
- [sys.executable, 'trunk/gyptest.py',
- '--all',
- '--passed',
- '--format', format,
- '--chdir', 'trunk',
- '--path', '../scons']),
- cwd=ROOT_DIR, env=env, shell=True)
- if retcode:
- # Emit failure tag, and keep going.
- print '@@@STEP_FAILURE@@@'
- return 1
- return 0
-
-
-def GypBuild():
- # Dump out/ directory.
- print '@@@BUILD_STEP cleanup@@@'
- print 'Removing %s...' % OUT_DIR
- shutil.rmtree(OUT_DIR, ignore_errors=True)
- print 'Done.'
-
- retcode = 0
- if sys.platform.startswith('linux'):
- retcode += GypTestFormat('ninja')
- retcode += GypTestFormat('scons')
- retcode += GypTestFormat('make')
- elif sys.platform == 'darwin':
- retcode += GypTestFormat('ninja')
- retcode += GypTestFormat('xcode')
- retcode += GypTestFormat('make')
- elif sys.platform == 'win32':
- retcode += GypTestFormat('msvs-2008', format='msvs', msvs_version='2008')
- if os.environ['BUILDBOT_BUILDERNAME'] == 'gyp-win64':
- retcode += GypTestFormat('msvs-2010', format='msvs', msvs_version='2010')
- else:
- raise Exception('Unknown platform')
- if retcode:
- # TODO(bradnelson): once the annotator supports a postscript (section for
- # after the build proper that could be used for cumulative failures),
- # use that instead of this. This isolates the final return value so
- # that it isn't misattributed to the last stage.
- print '@@@BUILD_STEP failures@@@'
- sys.exit(retcode)
-
-
-if __name__ == '__main__':
- GypBuild()
View
10 legacy/tools/gyp/codereview.settings
@@ -1,10 +0,0 @@
-# This file is used by gcl to get repository specific information.
-CODE_REVIEW_SERVER: codereview.chromium.org
-CC_LIST: gyp-developer@googlegroups.com
-VIEW_VC: http://code.google.com/p/gyp/source/detail?r=
-TRY_ON_UPLOAD: True
-TRYSERVER_PROJECT: gyp
-TRYSERVER_PATCHLEVEL: 0
-TRYSERVER_ROOT: trunk
-TRYSERVER_SVN_URL: svn://svn.chromium.org/chrome-try/try-nacl
-
View
18 legacy/tools/gyp/gyp
@@ -1,18 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2009 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import sys
-
-# TODO(mark): sys.path manipulation is some temporary testing stuff.
-try:
- import gyp
-except ImportError, e:
- import os.path
- sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), 'pylib'))
- import gyp
-
-if __name__ == '__main__':
- sys.exit(gyp.main(sys.argv[1:]))
View
5 legacy/tools/gyp/gyp.bat
@@ -1,5 +0,0 @@
-@rem Copyright (c) 2009 Google Inc. All rights reserved.
-@rem Use of this source code is governed by a BSD-style license that can be
-@rem found in the LICENSE file.
-
-@python "%~dp0/gyp" %*
View
7 legacy/tools/gyp/gyp_dummy.c
@@ -1,7 +0,0 @@
-/* Copyright (c) 2009 Google Inc. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file. */
-
-int main() {
- return 0;
-}
View
256 legacy/tools/gyp/gyptest.py
@@ -1,256 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2012 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-__doc__ = """
-gyptest.py -- test runner for GYP tests.
-"""
-
-import os
-import optparse
-import subprocess
-import sys
-
-class CommandRunner:
- """
- Executor class for commands, including "commands" implemented by
- Python functions.
- """
- verbose = True
- active = True
-
- def __init__(self, dictionary={}):
- self.subst_dictionary(dictionary)
-
- def subst_dictionary(self, dictionary):
- self._subst_dictionary = dictionary
-
- def subst(self, string, dictionary=None):
- """
- Substitutes (via the format operator) the values in the specified
- dictionary into the specified command.
-
- The command can be an (action, string) tuple. In all cases, we
- perform substitution on strings and don't worry if something isn't
- a string. (It's probably a Python function to be executed.)
- """
- if dictionary is None:
- dictionary = self._subst_dictionary
- if dictionary:
- try:
- string = string % dictionary
- except TypeError:
- pass
- return string
-
- def display(self, command, stdout=None, stderr=None):
- if not self.verbose:
- return
- if type(command) == type(()):
- func = command[0]
- args = command[1:]
- s = '%s(%s)' % (func.__name__, ', '.join(map(repr, args)))
- if type(command) == type([]):
- # TODO: quote arguments containing spaces
- # TODO: handle meta characters?
- s = ' '.join(command)
- else:
- s = self.subst(command)
- if not s.endswith('\n'):
- s += '\n'
- sys.stdout.write(s)
- sys.stdout.flush()
-
- def execute(self, command, stdout=None, stderr=None):
- """
- Executes a single command.
- """
- if not self.active:
- return 0
- if type(command) == type(''):
- command = self.subst(command)
- cmdargs = shlex.split(command)
- if cmdargs[0] == 'cd':
- command = (os.chdir,) + tuple(cmdargs[1:])
- if type(command) == type(()):
- func = command[0]
- args = command[1:]
- return func(*args)
- else:
- if stdout is sys.stdout:
- # Same as passing sys.stdout, except python2.4 doesn't fail on it.
- subout = None
- else:
- # Open pipe for anything else so Popen works on python2.4.
- subout = subprocess.PIPE
- if stderr is sys.stderr:
- # Same as passing sys.stderr, except python2.4 doesn't fail on it.
- suberr = None
- elif stderr is None:
- # Merge with stdout if stderr isn't specified.
- suberr = subprocess.STDOUT
- else:
- # Open pipe for anything else so Popen works on python2.4.
- suberr = subprocess.PIPE
- p = subprocess.Popen(command,
- shell=(sys.platform == 'win32'),
- stdout=subout,
- stderr=suberr)
- p.wait()
- if stdout is None:
- self.stdout = p.stdout.read()
- elif stdout is not sys.stdout:
- stdout.write(p.stdout.read())
- if stderr not in (None, sys.stderr):
- stderr.write(p.stderr.read())
- return p.returncode
-
- def run(self, command, display=None, stdout=None, stderr=None):
- """
- Runs a single command, displaying it first.
- """
- if display is None:
- display = command
- self.display(display)
- return self.execute(command, stdout, stderr)
-
-
-class Unbuffered:
- def __init__(self, fp):
- self.fp = fp
- def write(self, arg):
- self.fp.write(arg)
- self.fp.flush()
- def __getattr__(self, attr):
- return getattr(self.fp, attr)
-
-sys.stdout = Unbuffered(sys.stdout)
-sys.stderr = Unbuffered(sys.stderr)
-
-
-def find_all_gyptest_files(directory):
- result = []
- for root, dirs, files in os.walk(directory):
- if '.svn' in dirs:
- dirs.remove('.svn')
- result.extend([ os.path.join(root, f) for f in files
- if f.startswith('gyptest') and f.endswith('.py') ])
- result.sort()
- return result
-
-
-def main(argv=None):
- if argv is None:
- argv = sys.argv
-
- usage = "gyptest.py [-ahlnq] [-f formats] [test ...]"
- parser = optparse.OptionParser(usage=usage)
- parser.add_option("-a", "--all", action="store_true",
- help="run all tests")
- parser.add_option("-C", "--chdir", action="store", default=None,
- help="chdir to the specified directory")
- parser.add_option("-f", "--format", action="store", default='',
- help="run tests with the specified formats")
- parser.add_option("-l", "--list", action="store_true",
- help="list available tests and exit")
- parser.add_option("-n", "--no-exec", action="store_true",
- help="no execute, just print the command line")
- parser.add_option("--passed", action="store_true",
- help="report passed tests")
- parser.add_option("--path", action="append", default=[],
- help="additional $PATH directory")
- parser.add_option("-q", "--quiet", action="store_true",
- help="quiet, don't print test command lines")
- opts, args = parser.parse_args(argv[1:])
-
- if opts.chdir:
- os.chdir(opts.chdir)
-
- if opts.path:
- os.environ['PATH'] += ':' + ':'.join(opts.path)
-
- if not args:
- if not opts.all:
- sys.stderr.write('Specify -a to get all tests.\n')
- return 1
- args = ['test']
-
- tests = []
- for arg in args:
- if os.path.isdir(arg):
- tests.extend(find_all_gyptest_files(os.path.normpath(arg)))
- else:
- tests.append(arg)
-
- if opts.list:
- for test in tests:
- print test
- sys.exit(0)
-
- CommandRunner.verbose = not opts.quiet
- CommandRunner.active = not opts.no_exec
- cr = CommandRunner()
-
- os.environ['PYTHONPATH'] = os.path.abspath('test/lib')
- if not opts.quiet:
- sys.stdout.write('PYTHONPATH=%s\n' % os.environ['PYTHONPATH'])
-
- passed = []
- failed = []
- no_result = []
-
- if opts.format:
- format_list = opts.format.split(',')
- else:
- # TODO: not duplicate this mapping from pylib/gyp/__init__.py
- format_list = {
- 'freebsd7': ['make'],
- 'freebsd8': ['make'],
- 'cygwin': ['msvs'],
- 'win32': ['msvs', 'ninja'],
- 'linux2': ['make', 'ninja'],
- 'linux3': ['make', 'ninja'],
- 'darwin': ['make', 'ninja', 'xcode'],
- }[sys.platform]
-
- for format in format_list:
- os.environ['TESTGYP_FORMAT'] = format
- if not opts.quiet:
- sys.stdout.write('TESTGYP_FORMAT=%s\n' % format)
-
- for test in tests:
- status = cr.run([sys.executable, test],
- stdout=sys.stdout,
- stderr=sys.stderr)
- if status == 2:
- no_result.append(test)
- elif status:
- failed.append(test)
- else:
- passed.append(test)
-
- if not opts.quiet:
- def report(description, tests):
- if tests:
- if len(tests) == 1:
- sys.stdout.write("\n%s the following test:\n" % description)
- else:
- fmt = "\n%s the following %d tests:\n"
- sys.stdout.write(fmt % (description, len(tests)))
- sys.stdout.write("\t" + "\n\t".join(tests) + "\n")
-
- if opts.passed:
- report("Passed", passed)
- report("Failed", failed)
- report("No result from", no_result)
-
- if failed:
- return 1
- else:
- return 0
-
-
-if __name__ == "__main__":
- sys.exit(main())
View
338 legacy/tools/gyp/pylib/gyp/MSVSNew.py
@@ -1,338 +0,0 @@
-# Copyright (c) 2011 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""New implementation of Visual Studio project generation for SCons."""
-
-import common
-import os
-import random
-
-import gyp.common
-
-# hashlib is supplied as of Python 2.5 as the replacement interface for md5
-# and other secure hashes. In 2.6, md5 is deprecated. Import hashlib if
-# available, avoiding a deprecation warning under 2.6. Import md5 otherwise,
-# preserving 2.4 compatibility.
-try:
- import hashlib
- _new_md5 = hashlib.md5
-except ImportError:
- import md5
- _new_md5 = md5.new
-
-
-# Initialize random number generator
-random.seed()
-
-# GUIDs for project types
-ENTRY_TYPE_GUIDS = {
- 'project': '{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}',
- 'folder': '{2150E333-8FDC-42A3-9474-1A3956D46DE8}',
-}
-
-#------------------------------------------------------------------------------
-# Helper functions
-
-
-def MakeGuid(name, seed='msvs_new'):
- """Returns a GUID for the specified target name.
-
- Args:
- name: Target name.
- seed: Seed for MD5 hash.
- Returns:
- A GUID-line string calculated from the name and seed.
-
- This generates something which looks like a GUID, but depends only on the
- name and seed. This means the same name/seed will always generate the same
- GUID, so that projects and solutions which refer to each other can explicitly
- determine the GUID to refer to explicitly. It also means that the GUID will
- not change when the project for a target is rebuilt.
- """
- # Calculate a MD5 signature for the seed and name.
- d = _new_md5(str(seed) + str(name)).hexdigest().upper()
- # Convert most of the signature to GUID form (discard the rest)
- guid = ('{' + d[:8] + '-' + d[8:12] + '-' + d[12:16] + '-' + d[16:20]
- + '-' + d[20:32] + '}')
- return guid
-
-#------------------------------------------------------------------------------
-
-
-class MSVSFolder(object):
- """Folder in a Visual Studio project or solution."""
-
- def __init__(self, path, name = None, entries = None,
- guid = None, items = None):
- """Initializes the folder.
-
- Args:
- path: Full path to the folder.
- name: Name of the folder.
- entries: List of folder entries to nest inside this folder. May contain
- Folder or Project objects. May be None, if the folder is empty.
- guid: GUID to use for folder, if not None.
- items: List of solution items to include in the folder project. May be
- None, if the folder does not directly contain items.
- """
- if name:
- self.name = name
- else:
- # Use last layer.
- self.name = os.path.basename(path)
-
- self.path = path
- self.guid = guid
-
- # Copy passed lists (or set to empty lists)
- self.entries = list(entries or [])
- self.items = list(items or [])
-
- self.entry_type_guid = ENTRY_TYPE_GUIDS['folder']
-
- def get_guid(self):
- if self.guid is None:
- # Use consistent guids for folders (so things don't regenerate).
- self.guid = MakeGuid(self.path, seed='msvs_folder')
- return self.guid
-
-
-#------------------------------------------------------------------------------
-
-
-class MSVSProject(object):
- """Visual Studio project."""
-
- def __init__(self, path, name = None, dependencies = None, guid = None,
- spec = None, build_file = None, config_platform_overrides = None,
- fixpath_prefix = None):
- """Initializes the project.
-
- Args:
- path: Absolute path to the project file.
- name: Name of project. If None, the name will be the same as the base
- name of the project file.
- dependencies: List of other Project objects this project is dependent
- upon, if not None.
- guid: GUID to use for project, if not None.
- spec: Dictionary specifying how to build this project.
- build_file: Filename of the .gyp file that the vcproj file comes from.
- config_platform_overrides: optional dict of configuration platforms to
- used in place of the default for this target.
- fixpath_prefix: the path used to adjust the behavior of _fixpath
- """
- self.path = path
- self.guid = guid
- self.spec = spec
- self.build_file = build_file
- # Use project filename if name not specified
- self.name = name or os.path.splitext(os.path.basename(path))[0]
-
- # Copy passed lists (or set to empty lists)
- self.dependencies = list(dependencies or [])
-
- self.entry_type_guid = ENTRY_TYPE_GUIDS['project']
-
- if config_platform_overrides:
- self.config_platform_overrides = config_platform_overrides
- else:
- self.config_platform_overrides = {}
- self.fixpath_prefix = fixpath_prefix
-
- def set_dependencies(self, dependencies):
- self.dependencies = list(dependencies or [])
-
- def get_guid(self):
- if self.guid is None:
- # Set GUID from path
- # TODO(rspangler): This is fragile.
- # 1. We can't just use the project filename sans path, since there could
- # be multiple projects with the same base name (for example,
- # foo/unittest.vcproj and bar/unittest.vcproj).
- # 2. The path needs to be relative to $SOURCE_ROOT, so that the project
- # GUID is the same whether it's included from base/base.sln or
- # foo/bar/baz/baz.sln.
- # 3. The GUID needs to be the same each time this builder is invoked, so
- # that we don't need to rebuild the solution when the project changes.
- # 4. We should be able to handle pre-built project files by reading the
- # GUID from the files.
- self.guid = MakeGuid(self.name)
- return self.guid
-
-#------------------------------------------------------------------------------
-
-
-class MSVSSolution:
- """Visual Studio solution."""
-
- def __init__(self, path, version, entries=None, variants=None,
- websiteProperties=True):
- """Initializes the solution.
-
- Args:
- path: Path to solution file.
- version: Format version to emit.
- entries: List of entries in solution. May contain Folder or Project
- objects. May be None, if the folder is empty.
- variants: List of build variant strings. If none, a default list will
- be used.
- websiteProperties: Flag to decide if the website properties section
- is generated.
- """
- self.path = path
- self.websiteProperties = websiteProperties
- self.version = version
-
- # Copy passed lists (or set to empty lists)
- self.entries = list(entries or [])
-
- if variants:
- # Copy passed list
- self.variants = variants[:]
- else:
- # Use default
- self.variants = ['Debug|Win32', 'Release|Win32']
- # TODO(rspangler): Need to be able to handle a mapping of solution config
- # to project config. Should we be able to handle variants being a dict,
- # or add a separate variant_map variable? If it's a dict, we can't
- # guarantee the order of variants since dict keys aren't ordered.
-
-
- # TODO(rspangler): Automatically write to disk for now; should delay until
- # node-evaluation time.
- self.Write()
-
-
- def Write(self, writer=common.WriteOnDiff):
- """Writes the solution file to disk.
-
- Raises:
- IndexError: An entry appears multiple times.
- """
- # Walk the entry tree and collect all the folders and projects.
- all_entries = set()
- entries_to_check = self.entries[:]
- while entries_to_check:
- e = entries_to_check.pop(0)
-
- # If this entry has been visited, nothing to do.
- if e in all_entries:
- continue
-
- all_entries.add(e)
-
- # If this is a folder, check its entries too.
- if isinstance(e, MSVSFolder):
- entries_to_check += e.entries
-
- # Sort by name then guid (so things are in order on vs2008).
- def NameThenGuid(a, b):
- if a.name < b.name: return -1
- if a.name > b.name: return 1
- if a.get_guid() < b.get_guid(): return -1
- if a.get_guid() > b.get_guid(): return 1
- return 0
-
- all_entries = sorted(all_entries, NameThenGuid)
-
- # Open file and print header
- f = writer(self.path)
- f.write('Microsoft Visual Studio Solution File, '
- 'Format Version %s\r\n' % self.version.SolutionVersion())
- f.write('# %s\r\n' % self.version.Description())
-
- # Project entries
- sln_root = os.path.split(self.path)[0]
- for e in all_entries:
- relative_path = gyp.common.RelativePath(e.path, sln_root)
- # msbuild does not accept an empty folder_name.
- # use '.' in case relative_path is empty.
- folder_name = relative_path.replace('/', '\\') or '.'
- f.write('Project("%s") = "%s", "%s", "%s"\r\n' % (
- e.entry_type_guid, # Entry type GUID
- e.name, # Folder name
- folder_name, # Folder name (again)
- e.get_guid(), # Entry GUID
- ))
-
- # TODO(rspangler): Need a way to configure this stuff
- if self.websiteProperties:
- f.write('\tProjectSection(WebsiteProperties) = preProject\r\n'
- '\t\tDebug.AspNetCompiler.Debug = "True"\r\n'
- '\t\tRelease.AspNetCompiler.Debug = "False"\r\n'
- '\tEndProjectSection\r\n')
-
- if isinstance(e, MSVSFolder):
- if e.items:
- f.write('\tProjectSection(SolutionItems) = preProject\r\n')
- for i in e.items:
- f.write('\t\t%s = %s\r\n' % (i, i))
- f.write('\tEndProjectSection\r\n')
-
- if isinstance(e, MSVSProject):
- if e.dependencies:
- f.write('\tProjectSection(ProjectDependencies) = postProject\r\n')
- for d in e.dependencies:
- f.write('\t\t%s = %s\r\n' % (d.get_guid(), d.get_guid()))
- f.write('\tEndProjectSection\r\n')
-
- f.write('EndProject\r\n')
-
- # Global section
- f.write('Global\r\n')
-
- # Configurations (variants)
- f.write('\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n')
- for v in self.variants:
- f.write('\t\t%s = %s\r\n' % (v, v))
- f.write('\tEndGlobalSection\r\n')
-
- # Sort config guids for easier diffing of solution changes.
- config_guids = []
- config_guids_overrides = {}
- for e in all_entries:
- if isinstance(e, MSVSProject):
- config_guids.append(e.get_guid())
- config_guids_overrides[e.get_guid()] = e.config_platform_overrides
- config_guids.sort()
-
- f.write('\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n')
- for g in config_guids:
- for v in self.variants:
- nv = config_guids_overrides[g].get(v, v)
- # Pick which project configuration to build for this solution
- # configuration.
- f.write('\t\t%s.%s.ActiveCfg = %s\r\n' % (
- g, # Project GUID
- v, # Solution build configuration
- nv, # Project build config for that solution config
- ))
-
- # Enable project in this solution configuration.
- f.write('\t\t%s.%s.Build.0 = %s\r\n' % (
- g, # Project GUID
- v, # Solution build configuration
- nv, # Project build config for that solution config
- ))
- f.write('\tEndGlobalSection\r\n')
-
- # TODO(rspangler): Should be able to configure this stuff too (though I've
- # never seen this be any different)
- f.write('\tGlobalSection(SolutionProperties) = preSolution\r\n')
- f.write('\t\tHideSolutionNode = FALSE\r\n')
- f.write('\tEndGlobalSection\r\n')
-
- # Folder mappings
- # TODO(rspangler): Should omit this section if there are no folders
- f.write('\tGlobalSection(NestedProjects) = preSolution\r\n')
- for e in all_entries:
- if not isinstance(e, MSVSFolder):
- continue # Does not apply to projects, only folders
- for subentry in e.entries:
- f.write('\t\t%s = %s\r\n' % (subentry.get_guid(), e.get_guid()))
- f.write('\tEndGlobalSection\r\n')
-
- f.write('EndGlobal\r\n')
-
- f.close()
View
208 legacy/tools/gyp/pylib/gyp/MSVSProject.py
@@ -1,208 +0,0 @@
-# Copyright (c) 2011 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Visual Studio project reader/writer."""
-
-import common
-import gyp.easy_xml as easy_xml
-
-#------------------------------------------------------------------------------
-
-
-class Tool(object):
- """Visual Studio tool."""
-
- def __init__(self, name, attrs=None):
- """Initializes the tool.
-
- Args:
- name: Tool name.
- attrs: Dict of tool attributes; may be None.
- """
- self._attrs = attrs or {}
- self._attrs['Name'] = name
-
- def _GetSpecification(self):
- """Creates an element for the tool.
-
- Returns:
- A new xml.dom.Element for the tool.
- """
- return ['Tool', self._attrs]
-
-class Filter(object):
- """Visual Studio filter - that is, a virtual folder."""
-
- def __init__(self, name, contents=None):
- """Initializes the folder.
-
- Args:
- name: Filter (folder) name.
- contents: List of filenames and/or Filter objects contained.
- """
- self.name = name
- self.contents = list(contents or [])
-
-
-#------------------------------------------------------------------------------
-
-
-class Writer(object):
- """Visual Studio XML project writer."""
-
- def __init__(self, project_path, version, name, guid=None, platforms=None):
- """Initializes the project.
-
- Args:
- project_path: Path to the project file.
- version: Format version to emit.
- name: Name of the project.
- guid: GUID to use for project, if not None.
- platforms: Array of string, the supported platforms. If null, ['Win32']
- """
- self.project_path = project_path
- self.version = version
- self.name = name
- self.guid = guid
-
- # Default to Win32 for platforms.
- if not platforms:
- platforms = ['Win32']
-
- # Initialize the specifications of the various sections.
- self.platform_section = ['Platforms']
- for platform in platforms:
- self.platform_section.append(['Platform', {'Name': platform}])
- self.tool_files_section = ['ToolFiles']
- self.configurations_section = ['Configurations']
- self.files_section = ['Files']
-
- # Keep a dict keyed on filename to speed up access.
- self.files_dict = dict()
-
- def AddToolFile(self, path):
- """Adds a tool file to the project.
-
- Args:
- path: Relative path from project to tool file.
- """
- self.tool_files_section.append(['ToolFile', {'RelativePath': path}])
-
- def _GetSpecForConfiguration(self, config_type, config_name, attrs, tools):
- """Returns the specification for a configuration.
-
- Args:
- config_type: Type of configuration node.
- config_name: Configuration name.
- attrs: Dict of configuration attributes; may be None.
- tools: List of tools (strings or Tool objects); may be None.
- Returns:
- """
- # Handle defaults
- if not attrs:
- attrs = {}
- if not tools:
- tools = []
-
- # Add configuration node and its attributes
- node_attrs = attrs.copy()
- node_attrs['Name'] = config_name
- specification = [config_type, node_attrs]
-
- # Add tool nodes and their attributes
- if tools:
- for t in tools:
- if isinstance(t, Tool):
- specification.append(t._GetSpecification())
- else:
- specification.append(Tool(t)._GetSpecification())
- return specification
-
-
- def AddConfig(self, name, attrs=None, tools=None):
- """Adds a configuration to the project.
-
- Args:
- name: Configuration name.
- attrs: Dict of configuration attributes; may be None.
- tools: List of tools (strings or Tool objects); may be None.
- """
- spec = self._GetSpecForConfiguration('Configuration', name, attrs, tools)
- self.configurations_section.append(spec)
-
- def _AddFilesToNode(self, parent, files):
- """Adds files and/or filters to the parent node.
-
- Args:
- parent: Destination node
- files: A list of Filter objects and/or relative paths to files.
-
- Will call itself recursively, if the files list contains Filter objects.
- """
- for f in files:
- if isinstance(f, Filter):
- node = ['Filter', {'Name': f.name}]
- self._AddFilesToNode(node, f.contents)
- else:
- node = ['File', {'RelativePath': f}]
- self.files_dict[f] = node
- parent.append(node)
-
- def AddFiles(self, files):
- """Adds files to the project.
-
- Args:
- files: A list of Filter objects and/or relative paths to files.
-
- This makes a copy of the file/filter tree at the time of this call. If you
- later add files to a Filter object which was passed into a previous call
- to AddFiles(), it will not be reflected in this project.
- """
- self._AddFilesToNode(self.files_section, files)
- # TODO(rspangler) This also doesn't handle adding files to an existing
- # filter. That is, it doesn't merge the trees.
-
- def AddFileConfig(self, path, config, attrs=None, tools=None):
- """Adds a configuration to a file.
-
- Args:
- path: Relative path to the file.
- config: Name of configuration to add.
- attrs: Dict of configuration attributes; may be None.
- tools: List of tools (strings or Tool objects); may be None.
-
- Raises:
- ValueError: Relative path does not match any file added via AddFiles().
- """
- # Find the file node with the right relative path
- parent = self.files_dict.get(path)
- if not parent:
- raise ValueError('AddFileConfig: file "%s" not in project.' % path)
-
- # Add the config to the file node
- spec = self._GetSpecForConfiguration('FileConfiguration', config, attrs,
- tools)
- parent.append(spec)
-
- def WriteIfChanged(self):
- """Writes the project file."""
- # First create XML content definition
- content = [
- 'VisualStudioProject',
- {'ProjectType': 'Visual C++',
- 'Version': self.version.ProjectVersion(),
- 'Name': self.name,
- 'ProjectGUID': self.guid,
- 'RootNamespace': self.name,
- 'Keyword': 'Win32Proj'
- },
- self.platform_section,
- self.tool_files_section,
- self.configurations_section,
- ['References'], # empty section
- self.files_section,
- ['Globals'] # empty section
- ]
- easy_xml.WriteXmlIfChanged(content, self.project_path,
- encoding="Windows-1252")
View
1,032 legacy/tools/gyp/pylib/gyp/MSVSSettings.py
@@ -1,1032 +0,0 @@
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Code to validate and convert settings of the Microsoft build tools.
-
-This file contains code to validate and convert settings of the Microsoft
-build tools. The function ConvertToMSBuildSettings(), ValidateMSVSSettings(),
-and ValidateMSBuildSettings() are the entry points.
-
-This file was created by comparing the projects created by Visual Studio 2008
-and Visual Studio 2010 for all available settings through the user interface.
-The MSBuild schemas were also considered. They are typically found in the
-MSBuild install directory, e.g. c:\Program Files (x86)\MSBuild
-"""
-
-import sys
-
-
-# Dictionaries of settings validators. The key is the tool name, the value is
-# a dictionary mapping setting names to validation functions.
-_msvs_validators = {}
-_msbuild_validators = {}
-
-
-# A dictionary of settings converters. The key is the tool name, the value is
-# a dictionary mapping setting names to conversion functions.
-_msvs_to_msbuild_converters = {}
-
-
-# Tool name mapping from MSVS to MSBuild.
-_msbuild_name_of_tool = {}
-
-
-class _Tool(object):
- """Represents a tool used by MSVS or MSBuild.
-
- Attributes:
- msvs_name: The name of the tool in MSVS.
- msbuild_name: The name of the tool in MSBuild.
- """
-
- def __init__(self, msvs_name, msbuild_name):
- self.msvs_name = msvs_name
- self.msbuild_name = msbuild_name
-
-
-def _AddTool(tool):
- """Adds a tool to the four dictionaries used to process settings.
-
- This only defines the tool. Each setting also needs to be added.
-
- Args:
- tool: The _Tool object to be added.
- """
- _msvs_validators[tool.msvs_name] = {}
- _msbuild_validators[tool.msbuild_name] = {}
- _msvs_to_msbuild_converters[tool.msvs_name] = {}
- _msbuild_name_of_tool[tool.msvs_name] = tool.msbuild_name
-
-
-def _GetMSBuildToolSettings(msbuild_settings, tool):
- """Returns an MSBuild tool dictionary. Creates it if needed."""
- return msbuild_settings.setdefault(tool.msbuild_name, {})
-
-
-class _Type(object):
- """Type of settings (Base class)."""
-
- def ValidateMSVS(self, value):
- """Verifies that the value is legal for MSVS.
-
- Args:
- value: the value to check for this type.
-
- Raises:
- ValueError if value is not valid for MSVS.
- """
-
- def ValidateMSBuild(self, value):
- """Verifies that the value is legal for MSBuild.
-
- Args:
- value: the value to check for this type.
-
- Raises:
- ValueError if value is not valid for MSBuild.
- """
-
- def ConvertToMSBuild(self, value):
- """Returns the MSBuild equivalent of the MSVS value given.
-
- Args:
- value: the MSVS value to convert.
-
- Returns:
- the MSBuild equivalent.
-
- Raises:
- ValueError if value is not valid.
- """
- return value
-
-
-class _String(_Type):
- """A setting that's just a string."""
-
- def ValidateMSVS(self, value):
- if not isinstance(value, basestring):
- raise ValueError('expected string; got %r' % value)
-
- def ValidateMSBuild(self, value):
- if not isinstance(value, basestring):
- raise ValueError('expected string; got %r' % value)
-
- def ConvertToMSBuild(self, value):
- # Convert the macros
- return ConvertVCMacrosToMSBuild(value)
-
-
-class _StringList(_Type):
- """A settings that's a list of strings."""
-
- def ValidateMSVS(self, value):
- if not isinstance(value, basestring) and not isinstance(value, list):
- raise ValueError('expected string list; got %r' % value)
-
- def ValidateMSBuild(self, value):
- if not isinstance(value, basestring) and not isinstance(value, list):
- raise ValueError('expected string list; got %r' % value)
-
- def ConvertToMSBuild(self, value):
- # Convert the macros
- if isinstance(value, list):
- return [ConvertVCMacrosToMSBuild(i) for i in value]
- else:
- return ConvertVCMacrosToMSBuild(value)
-
-
-class _Boolean(_Type):
- """Boolean settings, can have the values 'false' or 'true'."""
-
- def _Validate(self, value):
- if value != 'true' and value != 'false':
- raise ValueError('expected bool; got %r' % value)
-
- def ValidateMSVS(self, value):
- self._Validate(value)
-
- def ValidateMSBuild(self, value):
- self._Validate(value)
-
- def ConvertToMSBuild(self, value):
- self._Validate(value)
- return value
-
-
-class _Integer(_Type):
- """Integer settings."""
-
- def __init__(self, msbuild_base=10):
- _Type.__init__(self)
- self._msbuild_base = msbuild_base
-
- def ValidateMSVS(self, value):
- # Try to convert, this will raise ValueError if invalid.
- self.ConvertToMSBuild(value)
-
- def ValidateMSBuild(self, value):
- # Try to convert, this will raise ValueError if invalid.
- int(value, self._msbuild_base)
-
- def ConvertToMSBuild(self, value):
- msbuild_format = (self._msbuild_base == 10) and '%d' or '0x%04x'
- return msbuild_format % int(value)
-
-
-class _Enumeration(_Type):
- """Type of settings that is an enumeration.
-
- In MSVS, the values are indexes like '0', '1', and '2'.
- MSBuild uses text labels that are more representative, like 'Win32'.
-
- Constructor args:
- label_list: an array of MSBuild labels that correspond to the MSVS index.
- In the rare cases where MSVS has skipped an index value, None is
- used in the array to indicate the unused spot.
- new: an array of labels that are new to MSBuild.
- """
-
- def __init__(self, label_list, new=None):
- _Type.__init__(self)
- self._label_list = label_list
- self._msbuild_values = set(value for value in label_list
- if value is not None)
- if new is not None:
- self._msbuild_values.update(new)
-
- def ValidateMSVS(self, value):
- # Try to convert. It will raise an exception if not valid.
- self.ConvertToMSBuild(value)
-
- def ValidateMSBuild(self, value):
- if value not in self._msbuild_values:
- raise ValueError('unrecognized enumerated value %s' % value)
-
- def ConvertToMSBuild(self, value):
- index = int(value)
- if index < 0 or index >= len(self._label_list):
- raise ValueError('index value (%d) not in expected range [0, %d)' %
- (index, len(self._label_list)))
- label = self._label_list[index]
- if label is None:
- raise ValueError('converted value for %s not specified.' % value)
- return label
-
-
-# Instantiate the various generic types.
-_boolean = _Boolean()
-_integer = _Integer()
-# For now, we don't do any special validation on these types:
-_string = _String()
-_file_name = _String()
-_folder_name = _String()
-_file_list = _StringList()
-_folder_list = _StringList()
-_string_list = _StringList()
-# Some boolean settings went from numerical values to boolean. The
-# mapping is 0: default, 1: false, 2: true.
-_newly_boolean = _Enumeration(['', 'false', 'true'])
-
-
-def _Same(tool, name, setting_type):
- """Defines a setting that has the same name in MSVS and MSBuild.
-
- Args:
- tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
- name: the name of the setting.
- setting_type: the type of this setting.
- """
- _Renamed(tool, name, name, setting_type)
-
-
-def _Renamed(tool, msvs_name, msbuild_name, setting_type):
- """Defines a setting for which the name has changed.
-
- Args:
- tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
- msvs_name: the name of the MSVS setting.
- msbuild_name: the name of the MSBuild setting.
- setting_type: the type of this setting.
- """
-
- def _Translate(value, msbuild_settings):
- msbuild_tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool)
- msbuild_tool_settings[msbuild_name] = setting_type.ConvertToMSBuild(value)
-
- _msvs_validators[tool.msvs_name][msvs_name] = setting_type.ValidateMSVS
- _msbuild_validators[tool.msbuild_name][msbuild_name] = (
- setting_type.ValidateMSBuild)
- _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate
-
-
-def _Moved(tool, settings_name, msbuild_tool_name, setting_type):
- _MovedAndRenamed(tool, settings_name, msbuild_tool_name, settings_name,
- setting_type)
-
-
-def _MovedAndRenamed(tool, msvs_settings_name, msbuild_tool_name,
- msbuild_settings_name, setting_type):
- """Defines a setting that may have moved to a new section.
-
- Args:
- tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
- msvs_settings_name: the MSVS name of the setting.
- msbuild_tool_name: the name of the MSBuild tool to place the setting under.
- msbuild_settings_name: the MSBuild name of the setting.
- setting_type: the type of this setting.
- """
-
- def _Translate(value, msbuild_settings):
- tool_settings = msbuild_settings.setdefault(msbuild_tool_name, {})
- tool_settings[msbuild_settings_name] = setting_type.ConvertToMSBuild(value)
-
- _msvs_validators[tool.msvs_name][msvs_settings_name] = (
- setting_type.ValidateMSVS)
- validator = setting_type.ValidateMSBuild
- _msbuild_validators[msbuild_tool_name][msbuild_settings_name] = validator
- _msvs_to_msbuild_converters[tool.msvs_name][msvs_settings_name] = _Translate
-
-
-def _MSVSOnly(tool, name, setting_type):
- """Defines a setting that is only found in MSVS.
-
- Args:
- tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
- name: the name of the setting.
- setting_type: the type of this setting.
- """
-
- def _Translate(unused_value, unused_msbuild_settings):
- # Since this is for MSVS only settings, no translation will happen.
- pass
-
- _msvs_validators[tool.msvs_name][name] = setting_type.ValidateMSVS
- _msvs_to_msbuild_converters[tool.msvs_name][name] = _Translate
-
-
-def _MSBuildOnly(tool, name, setting_type):
- """Defines a setting that is only found in MSBuild.
-
- Args:
- tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
- name: the name of the setting.
- setting_type: the type of this setting.
- """
- _msbuild_validators[tool.msbuild_name][name] = setting_type.ValidateMSBuild
-
-
-def _ConvertedToAdditionalOption(tool, msvs_name, flag):
- """Defines a setting that's handled via a command line option in MSBuild.
-
- Args:
- tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
- msvs_name: the name of the MSVS setting that if 'true' becomes a flag
- flag: the flag to insert at the end of the AdditionalOptions
- """
-
- def _Translate(value, msbuild_settings):
- if value == 'true':
- tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool)
- if 'AdditionalOptions' in tool_settings:
- new_flags = '%s %s' % (tool_settings['AdditionalOptions'], flag)
- else:
- new_flags = flag
- tool_settings['AdditionalOptions'] = new_flags
- _msvs_validators[tool.msvs_name][msvs_name] = _boolean.ValidateMSVS
- _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate
-
-
-def _CustomGeneratePreprocessedFile(tool, msvs_name):
- def _Translate(value, msbuild_settings):
- tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool)
- if value == '0':
- tool_settings['PreprocessToFile'] = 'false'
- tool_settings['PreprocessSuppressLineNumbers'] = 'false'
- elif value == '1': # /P
- tool_settings['PreprocessToFile'] = 'true'
- tool_settings['PreprocessSuppressLineNumbers'] = 'false'
- elif value == '2': # /EP /P
- tool_settings['PreprocessToFile'] = 'true'
- tool_settings['PreprocessSuppressLineNumbers'] = 'true'
- else:
- raise ValueError('value must be one of [0, 1, 2]; got %s' % value)
- # Create a bogus validator that looks for '0', '1', or '2'
- msvs_validator = _Enumeration(['a', 'b', 'c']).ValidateMSVS
- _msvs_validators[tool.msvs_name][msvs_name] = msvs_validator
- msbuild_validator = _boolean.ValidateMSBuild
- msbuild_tool_validators = _msbuild_validators[tool.msbuild_name]
- msbuild_tool_validators['PreprocessToFile'] = msbuild_validator
- msbuild_tool_validators['PreprocessSuppressLineNumbers'] = msbuild_validator
- _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate
-
-
-def ConvertVCMacrosToMSBuild(s):
- """Convert the the MSVS macros found in the string to the MSBuild equivalent.
-
- This list is probably not exhaustive. Add as needed.
- """
- if '$' in s:
- replace_map = {
- '$(ConfigurationName)': '$(Configuration)',
- '$(InputDir)': '%(RootDir)%(Directory)',
- '$(InputExt)': '%(Extension)',
- '$(InputFileName)': '%(Filename)%(Extension)',
- '$(InputName)': '%(Filename)',
- '$(InputPath)': '%(FullPath)',
- '$(ParentName)': '$(ProjectFileName)',
- '$(PlatformName)': '$(Platform)',
- '$(SafeInputName)': '%(Filename)',
-
- '$(IntDir)\\': '$(IntDir)',
- '$(OutDir)\\': '$(OutDir)',
- '$(IntDir)/': '$(IntDir)',
- '$(OutDir)/': '$(OutDir)',
- }
- for old, new in replace_map.iteritems():
- s = s.replace(old, new)
- return s
-
-
-def ConvertToMSBuildSettings(msvs_settings, stderr=sys.stderr):
- """Converts MSVS settings (VS2008 and earlier) to MSBuild settings (VS2010+).
-
- Args:
- msvs_settings: A dictionary. The key is the tool name. The values are
- themselves dictionaries of settings and their values.
- stderr: The stream receiving the error messages.
-
- Returns:
- A dictionary of MSBuild settings. The key is either the MSBuild tool name
- or the empty string (for the global settings). The values are themselves
- dictionaries of settings and their values.
- """
- msbuild_settings = {}
- for msvs_tool_name, msvs_tool_settings in msvs_settings.iteritems():
- if msvs_tool_name in _msvs_to_msbuild_converters:
- msvs_tool = _msvs_to_msbuild_converters[msvs_tool_name]
- for msvs_setting, msvs_value in msvs_tool_settings.iteritems():
- if msvs_setting in msvs_tool:
- # Invoke the translation function.
- try:
- msvs_tool[msvs_setting](msvs_value, msbuild_settings)
- except ValueError, e:
- print >> stderr, ('Warning: while converting %s/%s to MSBuild, '
- '%s' % (msvs_tool_name, msvs_setting, e))
- else:
- # We don't know this setting. Give a warning.
- print >> stderr, ('Warning: unrecognized setting %s/%s '
- 'while converting to MSBuild.' %
- (msvs_tool_name, msvs_setting))
- else:
- print >> stderr, ('Warning: unrecognized tool %s while converting to '
- 'MSBuild.' % msvs_tool_name)
- return msbuild_settings
-
-
-def ValidateMSVSSettings(settings, stderr=sys.stderr):
- """Validates that the names of the settings are valid for MSVS.
-
- Args:
- settings: A dictionary. The key is the tool name. The values are
- themselves dictionaries of settings and their values.
- stderr: The stream receiving the error messages.
- """
- _ValidateSettings(_msvs_validators, settings, stderr)
-
-
-def ValidateMSBuildSettings(settings, stderr=sys.stderr):
- """Validates that the names of the settings are valid for MSBuild.
-
- Args:
- settings: A dictionary. The key is the tool name. The values are
- themselves dictionaries of settings and their values.
- stderr: The stream receiving the error messages.
- """
- _ValidateSettings(_msbuild_validators, settings, stderr)
-
-
-def _ValidateSettings(validators, settings, stderr):
- """Validates that the settings are valid for MSBuild or MSVS.
-
- We currently only validate the names of the settings, not their values.
-
- Args:
- validators: A dictionary of tools and their validators.
- settings: A dictionary. The key is the tool name. The values are
- themselves dictionaries of settings and their values.
- stderr: The stream receiving the error messages.
- """
- for tool_name in settings:
- if tool_name in validators:
- tool_validators = validators[tool_name]
- for setting, value in settings[tool_name].iteritems():
- if setting in tool_validators:
- try:
- tool_validators[setting](value)
- except ValueError, e:
- print >> stderr, ('Warning: for %s/%s, %s' %
- (tool_name, setting, e))
- else:
- print >> stderr, ('Warning: unrecognized setting %s/%s' %
- (tool_name, setting))
- else:
- print >> stderr, ('Warning: unrecognized tool %s' % tool_name)
-
-
-# MSVS and MBuild names of the tools.
-_compile = _Tool('VCCLCompilerTool', 'ClCompile')
-_link = _Tool('VCLinkerTool', 'Link')
-_midl = _Tool('VCMIDLTool', 'Midl')
-_rc = _Tool('VCResourceCompilerTool', 'ResourceCompile')
-_lib = _Tool('VCLibrarianTool', 'Lib')
-_manifest = _Tool('VCManifestTool', 'Mt')
-
-
-_AddTool(_compile)
-_AddTool(_link)
-_AddTool(_midl)
-_AddTool(_rc)
-_AddTool(_lib)
-_AddTool(_manifest)
-# Add sections only found in the MSBuild settings.
-_msbuild_validators[''] = {}
-_msbuild_validators['ProjectReference'] = {}
-_msbuild_validators['ManifestResourceCompile'] = {}
-
-# Descriptions of the compiler options, i.e. VCCLCompilerTool in MSVS and
-# ClCompile in MSBuild.
-# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\cl.xml" for
-# the schema of the MSBuild ClCompile settings.
-
-# Options that have the same name in MSVS and MSBuild
-_Same(_compile, 'AdditionalIncludeDirectories', _folder_list) # /I
-_Same(_compile, 'AdditionalOptions', _string_list)
-_Same(_compile, 'AdditionalUsingDirectories', _folder_list) # /AI
-_Same(_compile, 'AssemblerListingLocation', _file_name) # /Fa
-_Same(_compile, 'BrowseInformationFile', _file_name)
-_Same(_compile, 'BufferSecurityCheck', _boolean) # /GS
-_Same(_compile, 'DisableLanguageExtensions', _boolean) # /Za
-_Same(_compile, 'DisableSpecificWarnings', _string_list) # /wd
-_Same(_compile, 'EnableFiberSafeOptimizations', _boolean) # /GT
-_Same(_compile, 'EnablePREfast', _boolean) # /analyze Visible='false'
-_Same(_compile, 'ExpandAttributedSource', _boolean) # /Fx
-_Same(_compile, 'FloatingPointExceptions', _boolean) # /fp:except
-_Same(_compile, 'ForceConformanceInForLoopScope', _boolean) # /Zc:forScope
-_Same(_compile, 'ForcedIncludeFiles', _file_list) # /FI
-_Same(_compile, 'ForcedUsingFiles', _file_list) # /FU
-_Same(_compile, 'GenerateXMLDocumentationFiles', _boolean) # /doc
-_Same(_compile, 'IgnoreStandardIncludePath', _boolean) # /X
-_Same(_compile, 'MinimalRebuild', _boolean) # /Gm
-_Same(_compile, 'OmitDefaultLibName', _boolean) # /Zl
-_Same(_compile, 'OmitFramePointers', _boolean) # /Oy
-_Same(_compile, 'PreprocessorDefinitions', _string_list) # /D
-_Same(_compile, 'ProgramDataBaseFileName', _file_name) # /Fd
-_Same(_compile, 'RuntimeTypeInfo', _boolean) # /GR
-_Same(_compile, 'ShowIncludes', _boolean) # /showIncludes
-_Same(_compile, 'SmallerTypeCheck', _boolean) # /RTCc
-_Same(_compile, 'StringPooling', _boolean) # /GF
-_Same(_compile, 'SuppressStartupBanner', _boolean) # /nologo
-_Same(_compile, 'TreatWChar_tAsBuiltInType', _boolean) # /Zc:wchar_t
-_Same(_compile, 'UndefineAllPreprocessorDefinitions', _boolean) # /u
-_Same(_compile, 'UndefinePreprocessorDefinitions', _string_list) # /U
-_Same(_compile, 'UseFullPaths', _boolean) # /FC
-_Same(_compile, 'WholeProgramOptimization', _boolean) # /GL
-_Same(_compile, 'XMLDocumentationFileName', _file_name)
-
-_Same(_compile, 'AssemblerOutput',
- _Enumeration(['NoListing',
- 'AssemblyCode', # /FA
- 'All', # /FAcs
- 'AssemblyAndMachineCode', # /FAc
- 'AssemblyAndSourceCode'])) # /FAs
-_Same(_compile, 'BasicRuntimeChecks',
- _Enumeration(['Default',
- 'StackFrameRuntimeCheck', # /RTCs
- 'UninitializedLocalUsageCheck', # /RTCu
- 'EnableFastChecks'])) # /RTC1
-_Same(_compile, 'BrowseInformation',
- _Enumeration(['false',
- 'true', # /FR
- 'true'])) # /Fr
-_Same(_compile, 'CallingConvention',
- _Enumeration(['Cdecl', # /Gd
- 'FastCall', # /Gr
- 'StdCall'])) # /Gz
-_Same(_compile, 'CompileAs',
- _Enumeration(['Default',
- 'CompileAsC', # /TC
- 'CompileAsCpp'])) # /TP
-_Same(_compile, 'DebugInformationFormat',
- _Enumeration(['', # Disabled
- 'OldStyle', # /Z7
- None,
- 'ProgramDatabase', # /Zi
- 'EditAndContinue'])) # /ZI
-_Same(_compile, 'EnableEnhancedInstructionSet',
- _Enumeration(['NotSet',
- 'StreamingSIMDExtensions', # /arch:SSE
- 'StreamingSIMDExtensions2'])) # /arch:SSE2
-_Same(_compile, 'ErrorReporting',
- _Enumeration(['None', # /errorReport:none
- 'Prompt', # /errorReport:prompt
- 'Queue'], # /errorReport:queue
- new=['Send'])) # /errorReport:send"
-_Same(_compile, 'ExceptionHandling',
- _Enumeration(['false',
- 'Sync', # /EHsc
- 'Async'], # /EHa
- new=['SyncCThrow'])) # /EHs
-_Same(_compile, 'FavorSizeOrSpeed',
- _Enumeration(['Neither',
- 'Speed', # /Ot
- 'Size'])) # /Os
-_Same(_compile, 'FloatingPointModel',
- _Enumeration(['Precise', # /fp:precise
- 'Strict', # /fp:strict
- 'Fast'])) # /fp:fast
-_Same(_compile, 'InlineFunctionExpansion',
- _Enumeration(['Default',
- 'OnlyExplicitInline', # /Ob1
- 'AnySuitable'], # /Ob2
- new=['Disabled'])) # /Ob0
-_Same(_compile, 'Optimization',
- _Enumeration(['Disabled', # /Od
- 'MinSpace', # /O1
- 'MaxSpeed', # /O2
- 'Full'])) # /Ox
-_Same(_compile, 'RuntimeLibrary',
- _Enumeration(['MultiThreaded', # /MT
- 'MultiThreadedDebug', # /MTd
- 'MultiThreadedDLL', # /MD
- 'MultiThreadedDebugDLL'])) # /MDd
-_Same(_compile, 'StructMemberAlignment',
- _Enumeration(['Default',
- '1Byte', # /Zp1
- '2Bytes', # /Zp2
- '4Bytes', # /Zp4
- '8Bytes', # /Zp8
- '16Bytes'])) # /Zp16
-_Same(_compile, 'WarningLevel',
- _Enumeration(['TurnOffAllWarnings', # /W0
- 'Level1', # /W1
- 'Level2', # /W2
- 'Level3', # /W3
- 'Level4'], # /W4
- new=['EnableAllWarnings'])) # /Wall
-
-# Options found in MSVS that have been renamed in MSBuild.
-_Renamed(_compile, 'EnableFunctionLevelLinking', 'FunctionLevelLinking',
- _boolean) # /Gy
-_Renamed(_compile, 'EnableIntrinsicFunctions', 'IntrinsicFunctions',
- _boolean) # /Oi
-_Renamed(_compile, 'KeepComments', 'PreprocessKeepComments', _boolean) # /C
-_Renamed(_compile, 'ObjectFile', 'ObjectFileName', _file_name) # /Fo
-_Renamed(_compile, 'OpenMP', 'OpenMPSupport', _boolean) # /openmp
-_Renamed(_compile, 'PrecompiledHeaderThrough', 'PrecompiledHeaderFile',
- _file_name) # Used with /Yc and /Yu
-_Renamed(_compile, 'PrecompiledHeaderFile', 'PrecompiledHeaderOutputFile',
- _file_name) # /Fp
-_Renamed(_compile, 'UsePrecompiledHeader', 'PrecompiledHeader',
- _Enumeration(['NotUsing', # VS recognized '' for this value too.
- 'Create', # /Yc
- 'Use'])) # /Yu
-_Renamed(_compile, 'WarnAsError', 'TreatWarningAsError', _boolean) # /WX
-
-_ConvertedToAdditionalOption(_compile, 'DefaultCharIsUnsigned', '/J')
-
-# MSVS options not found in MSBuild.
-_MSVSOnly(_compile, 'Detect64BitPortabilityProblems', _boolean)
-_MSVSOnly(_compile, 'UseUnicodeResponseFiles', _boolean)
-
-# MSBuild options not found in MSVS.
-_MSBuildOnly(_compile, 'BuildingInIDE', _boolean)
-_MSBuildOnly(_compile, 'CompileAsManaged',
- _Enumeration([], new=['false',
- 'true', # /clr
- 'Pure', # /clr:pure
- 'Safe', # /clr:safe
- 'OldSyntax'])) # /clr:oldSyntax
-_MSBuildOnly(_compile, 'CreateHotpatchableImage', _boolean) # /hotpatch
-_MSBuildOnly(_compile, 'MultiProcessorCompilation', _boolean) # /MP
-_MSBuildOnly(_compile, 'PreprocessOutputPath', _string) # /Fi
-_MSBuildOnly(_compile, 'ProcessorNumber', _integer) # the number of processors
-_MSBuildOnly(_compile, 'TrackerLogDirectory', _folder_name)
-_MSBuildOnly(_compile, 'TreatSpecificWarningsAsErrors', _string_list) # /we
-_MSBuildOnly(_compile, 'UseUnicodeForAssemblerListing', _boolean) # /FAu
-
-# Defines a setting that needs very customized processing
-_CustomGeneratePreprocessedFile(_compile, 'GeneratePreprocessedFile')
-
-
-# Directives for converting MSVS VCLinkerTool to MSBuild Link.
-# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\link.xml" for
-# the schema of the MSBuild Link settings.
-
-# Options that have the same name in MSVS and MSBuild
-_Same(_link, 'AdditionalDependencies', _file_list)
-_Same(_link, 'AdditionalLibraryDirectories', _folder_list) # /LIBPATH
-# /MANIFESTDEPENDENCY:
-_Same(_link, 'AdditionalManifestDependencies', _file_list)
-_Same(_link, 'AdditionalOptions', _string_list)
-_Same(_link, 'AddModuleNamesToAssembly', _file_list) # /ASSEMBLYMODULE
-_Same(_link, 'AllowIsolation', _boolean) # /ALLOWISOLATION
-_Same(_link, 'AssemblyLinkResource', _file_list) # /ASSEMBLYLINKRESOURCE
-_Same(_link, 'BaseAddress', _string) # /BASE
-_Same(_link, 'CLRUnmanagedCodeCheck', _boolean) # /CLRUNMANAGEDCODECHECK
-_Same(_link, 'DelayLoadDLLs', _file_list) # /DELAYLOAD
-_Same(_link, 'DelaySign', _boolean) # /DELAYSIGN
-_Same(_link, 'EmbedManagedResourceFile', _file_list) # /ASSEMBLYRESOURCE
-_Same(_link, 'EnableUAC', _boolean) # /MANIFESTUAC
-_Same(_link, 'EntryPointSymbol', _string) # /ENTRY
-_Same(_link, 'ForceSymbolReferences', _file_list) # /INCLUDE
-_Same(_link, 'FunctionOrder', _file_name) # /ORDER
-_Same(_link, 'GenerateDebugInformation', _boolean) # /DEBUG
-_Same(_link, 'GenerateMapFile', _boolean) # /MAP
-_Same(_link, 'HeapCommitSize', _string)
-_Same(_link, 'HeapReserveSize', _string) # /HEAP
-_Same(_link, 'IgnoreAllDefaultLibraries', _boolean) # /NODEFAULTLIB
-_Same(_link, 'IgnoreEmbeddedIDL', _boolean) # /IGNOREIDL
-_Same(_link, 'ImportLibrary', _file_name) # /IMPLIB
-_Same(_link, 'KeyContainer', _file_name) # /KEYCONTAINER
-_Same(_link, 'KeyFile', _file_name) # /KEYFILE
-_Same(_link, 'ManifestFile', _file_name) # /ManifestFile
-_Same(_link, 'MapExports', _boolean) # /MAPINFO:EXPORTS
-_Same(_link, 'MapFileName', _file_name)
-_Same(_link, 'MergedIDLBaseFileName', _file_name) # /IDLOUT
-_Same(_link, 'MergeSections', _string) # /MERGE
-_Same(_link, 'MidlCommandFile', _file_name) # /MIDL
-_Same(_link, 'ModuleDefinitionFile', _file_name) # /DEF
-_Same(_link, 'OutputFile', _file_name) # /OUT
-_Same(_link, 'PerUserRedirection', _boolean)
-_Same(_link, 'Profile', _boolean) # /PROFILE
-_Same(_link, 'ProfileGuidedDatabase', _file_name) # /PGD
-_Same(_link, 'ProgramDatabaseFile', _file_name) # /PDB
-_Same(_link, 'RegisterOutput', _boolean)
-_Same(_link, 'SetChecksum', _boolean) # /RELEASE
-_Same(_link, 'StackCommitSize', _string)
-_Same(_link, 'StackReserveSize', _string) # /STACK
-_Same(_link, 'StripPrivateSymbols', _file_name) # /PDBSTRIPPED
-_Same(_link, 'SupportUnloadOfDelayLoadedDLL', _boolean) # /DELAY:UNLOAD
-_Same(_link, 'SuppressStartupBanner', _boolean) # /NOLOGO
-_Same(_link, 'SwapRunFromCD', _boolean) # /SWAPRUN:CD
-_Same(_link, 'TurnOffAssemblyGeneration', _boolean) # /NOASSEMBLY
-_Same(_link, 'TypeLibraryFile', _file_name) # /TLBOUT
-_Same(_link, 'TypeLibraryResourceID', _integer) # /TLBID
-_Same(_link, 'UACUIAccess', _boolean) # /uiAccess='true'
-_Same(_link, 'Version', _string) # /VERSION
-
-_Same(_link, 'EnableCOMDATFolding', _newly_boolean) # /OPT:ICF
-_Same(_link, 'FixedBaseAddress', _newly_boolean) # /FIXED
-_Same(_link, 'LargeAddressAware', _newly_boolean) # /LARGEADDRESSAWARE
-_Same(_link, 'OptimizeReferences', _newly_boolean) # /OPT:REF
-_Same(_link, 'RandomizedBaseAddress', _newly_boolean) # /DYNAMICBASE
-_Same(_link, 'TerminalServerAware', _newly_boolean) # /TSAWARE
-
-_subsystem_enumeration = _Enumeration(
- ['NotSet',
- 'Console', # /SUBSYSTEM:CONSOLE
- 'Windows', # /SUBSYSTEM:WINDOWS
- 'Native', # /SUBSYSTEM:NATIVE
- 'EFI Application', # /SUBSYSTEM:EFI_APPLICATION
- 'EFI Boot Service Driver', # /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER
- 'EFI ROM', # /SUBSYSTEM:EFI_ROM
- 'EFI Runtime', # /SUBSYSTEM:EFI_RUNTIME_DRIVER
- 'WindowsCE'], # /SUBSYSTEM:WINDOWSCE
- new=['POSIX']) # /SUBSYSTEM:POSIX
-
-_target_machine_enumeration = _Enumeration(
- ['NotSet',
- 'MachineX86', # /MACHINE:X86
- None,
- 'MachineARM', # /MACHINE:ARM
- 'MachineEBC', # /MACHINE:EBC
- 'MachineIA64', # /MACHINE:IA64
- None,
- 'MachineMIPS', # /MACHINE:MIPS
- 'MachineMIPS16', # /MACHINE:MIPS16
- 'MachineMIPSFPU', # /MACHINE:MIPSFPU
- 'MachineMIPSFPU16', # /MACHINE:MIPSFPU16
- None,
- None,
- None,
- 'MachineSH4', # /MACHINE:SH4
- None,
- 'MachineTHUMB', # /MACHINE:THUMB
- 'MachineX64']) # /MACHINE:X64
-
-_Same(_link, 'AssemblyDebug',
- _Enumeration(['',
- 'true', # /ASSEMBLYDEBUG
- 'false'])) # /ASSEMBLYDEBUG:DISABLE
-_Same(_link, 'CLRImageType',
- _Enumeration(['Default',
- 'ForceIJWImage', # /CLRIMAGETYPE:IJW
- 'ForcePureILImage', # /Switch="CLRIMAGETYPE:PURE
- 'ForceSafeILImage'])) # /Switch="CLRIMAGETYPE:SAFE
-_Same(_link, 'CLRThreadAttribute',
- _Enumeration(['DefaultThreadingAttribute', # /CLRTHREADATTRIBUTE:NONE
- 'MTAThreadingAttribute', # /CLRTHREADATTRIBUTE:MTA
- 'STAThreadingAttribute'])) # /CLRTHREADATTRIBUTE:STA
-_Same(_link, 'DataExecutionPrevention',
- _Enumeration(['',
- 'false', # /NXCOMPAT:NO
- 'true'])) # /NXCOMPAT
-_Same(_link, 'Driver',
- _Enumeration(['NotSet',
- 'Driver', # /Driver
- 'UpOnly', # /DRIVER:UPONLY
- 'WDM'])) # /DRIVER:WDM
-_Same(_link, 'LinkTimeCodeGeneration',
- _Enumeration(['Default',
- 'UseLinkTimeCodeGeneration', # /LTCG
- 'PGInstrument', # /LTCG:PGInstrument
- 'PGOptimization', # /LTCG:PGOptimize
- 'PGUpdate'])) # /LTCG:PGUpdate
-_Same(_link, 'ShowProgress',
- _Enumeration(['NotSet',
- 'LinkVerbose', # /VERBOSE
- 'LinkVerboseLib'], # /VERBOSE:Lib
- new=['LinkVerboseICF', # /VERBOSE:ICF
- 'LinkVerboseREF', # /VERBOSE:REF
- 'LinkVerboseSAFESEH', # /VERBOSE:SAFESEH
- 'LinkVerboseCLR'])) # /VERBOSE:CLR
-_Same(_link, 'SubSystem', _subsystem_enumeration)
-_Same(_link, 'TargetMachine', _target_machine_enumeration)
-_Same(_link, 'UACExecutionLevel',
- _Enumeration(['AsInvoker', # /level='asInvoker'
- 'HighestAvailable', # /level='highestAvailable'
- 'RequireAdministrator'])) # /level='requireAdministrator'
-
-
-# Options found in MSVS that have been renamed in MSBuild.
-_Renamed(_link, 'ErrorReporting', 'LinkErrorReporting',
- _Enumeration(['NoErrorReport', # /ERRORREPORT:NONE
- 'PromptImmediately', # /ERRORREPORT:PROMPT
- 'QueueForNextLogin'], # /ERRORREPORT:QUEUE
- new=['SendErrorReport'])) # /ERRORREPORT:SEND
-_Renamed(_link, 'IgnoreDefaultLibraryNames', 'IgnoreSpecificDefaultLibraries',
- _file_list) # /NODEFAULTLIB
-_Renamed(_link, 'ResourceOnlyDLL', 'NoEntryPoint', _boolean) # /NOENTRY
-_Renamed(_link, 'SwapRunFromNet', 'SwapRunFromNET', _boolean) # /SWAPRUN:NET
-
-_Moved(_link, 'GenerateManifest', '', _boolean)
-_Moved(_link, 'IgnoreImportLibrary', '', _boolean)
-_Moved(_link, 'LinkIncremental', '', _newly_boolean)
-_Moved(_link, 'LinkLibraryDependencies', 'ProjectReference', _boolean)
-_Moved(_link, 'UseLibraryDependencyInputs', 'ProjectReference', _boolean)
-
-# MSVS options not found in MSBuild.
-_MSVSOnly(_link, 'OptimizeForWindows98', _newly_boolean)
-_MSVSOnly(_link, 'UseUnicodeResponseFiles', _boolean)
-# TODO(jeanluc) I don't think these are genuine settings but byproducts of Gyp.
-_MSVSOnly(_link, 'AdditionalLibraryDirectories_excluded', _folder_list)
-
-# MSBuild options not found in MSVS.
-_MSBuildOnly(_link, 'BuildingInIDE', _boolean)
-_MSBuildOnly(_link, 'ImageHasSafeExceptionHandlers', _boolean) # /SAFESEH
-_MSBuildOnly(_link, 'LinkDLL', _boolean) # /DLL Visible='false'
-_MSBuildOnly(_link, 'LinkStatus', _boolean) # /LTCG:STATUS
-_MSBuildOnly(_link, 'PreventDllBinding', _boolean) # /ALLOWBIND
-_MSBuildOnly(_link, 'SupportNobindOfDelayLoadedDLL', _boolean) # /DELAY:NOBIND
-_MSBuildOnly(_link, 'TrackerLogDirectory', _folder_name)
-_MSBuildOnly(_link, 'TreatLinkerWarningAsErrors', _boolean) # /WX
-_MSBuildOnly(_link, 'MinimumRequiredVersion', _string)
-_MSBuildOnly(_link, 'MSDOSStubFileName', _file_name) # /STUB Visible='false'
-_MSBuildOnly(_link, 'SectionAlignment', _integer) # /ALIGN
-_MSBuildOnly(_link, 'SpecifySectionAttributes', _string) # /SECTION
-_MSBuildOnly(_link, 'ForceFileOutput',
- _Enumeration([], new=['Enabled', # /FORCE
- # /FORCE:MULTIPLE
- 'MultiplyDefinedSymbolOnly',
- 'UndefinedSymbolOnly'])) # /FORCE:UNRESOLVED
-_MSBuildOnly(_link, 'CreateHotPatchableImage',
- _Enumeration([], new=['Enabled', # /FUNCTIONPADMIN
- 'X86Image', # /FUNCTIONPADMIN:5
- 'X64Image', # /FUNCTIONPADMIN:6
- 'ItaniumImage'])) # /FUNCTIONPADMIN:16
-_MSBuildOnly(_link, 'CLRSupportLastError',
- _Enumeration([], new=['Enabled', # /CLRSupportLastError
- 'Disabled', # /CLRSupportLastError:NO
- # /CLRSupportLastError:SYSTEMDLL
- 'SystemDlls']))
-
-
-# Directives for converting VCResourceCompilerTool to ResourceCompile.
-# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\rc.xml" for
-# the schema of the MSBuild ResourceCompile settings.
-
-_Same(_rc, 'AdditionalOptions', _string_list)
-_Same(_rc, 'AdditionalIncludeDirectories', _folder_list) # /I
-_Same(_rc, 'Culture', _Integer(msbuild_base=16))
-_Same(_rc, 'IgnoreStandardIncludePath', _boolean) # /X
-_Same(_rc, 'PreprocessorDefinitions', _string_list) # /D
-_Same(_rc, 'ResourceOutputFileName', _string) # /fo
-_Same(_rc, 'ShowProgress', _boolean) # /v
-# There is no UI in VisualStudio 2008 to set the following properties.
-# However they are found in CL and other tools. Include them here for
-# completeness, as they are very likely to have the same usage pattern.
-_Same(_rc, 'SuppressStartupBanner', _boolean) # /nologo
-_Same(_rc, 'UndefinePreprocessorDefinitions', _string_list) # /u
-
-# MSBuild options not found in MSVS.
-_MSBuildOnly(_rc, 'NullTerminateStrings', _boolean) # /n
-_MSBuildOnly(_rc, 'TrackerLogDirectory', _folder_name)
-
-
-# Directives for converting VCMIDLTool to Midl.
-# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\midl.xml" for
-# the schema of the MSBuild Midl settings.
-
-_Same(_midl, 'AdditionalIncludeDirectories', _folder_list) # /I
-_Same(_midl, 'AdditionalOptions', _string_list)
-_Same(_midl, 'CPreprocessOptions', _string) # /cpp_opt
-_Same(_midl, 'ErrorCheckAllocations', _boolean) # /error allocation
-_Same(_midl, 'ErrorCheckBounds', _boolean) # /error bounds_check
-_Same(_midl, 'ErrorCheckEnumRange', _boolean) # /error enum
-_Same(_midl, 'ErrorCheckRefPointers', _boolean) # /error ref
-_Same(_midl, 'ErrorCheckStubData', _boolean) # /error stub_data
-_Same(_midl, 'GenerateStublessProxies', _boolean) # /Oicf
-_Same(_midl, 'GenerateTypeLibrary', _boolean)
-_Same(_midl, 'HeaderFileName', _file_name) # /h
-_Same(_midl, 'IgnoreStandardIncludePath', _boolean) # /no_def_idir
-_Same(_midl, 'InterfaceIdentifierFileName', _file_name) # /iid
-_Same(_midl, 'MkTypLibCompatible', _boolean) # /mktyplib203
-_Same(_midl, 'OutputDirectory', _string) # /out
-_Same(_midl, 'PreprocessorDefinitions', _string_list) # /D
-_Same(_midl, 'ProxyFileName', _file_name) # /proxy
-_Same(_midl, 'RedirectOutputAndErrors', _file_name) # /o
-_Same(_midl, 'SuppressStartupBanner', _boolean) # /nologo
-_Same(_midl, 'TypeLibraryName', _file_name) # /tlb
-_Same(_midl, 'UndefinePreprocessorDefinitions', _string_list) # /U
-_Same(_midl, 'WarnAsError', _boolean) # /WX
-
-_Same(_midl, 'DefaultCharType',
- _Enumeration(['Unsigned', # /char unsigned
- 'Signed', # /char signed
- 'Ascii'])) # /char ascii7
-_Same(_midl, 'TargetEnvironment',
- _Enumeration(['NotSet',
- 'Win32', # /env win32
- 'Itanium', # /env ia64
- 'X64'])) # /env x64
-_Same(_midl, 'EnableErrorChecks',
- _Enumeration(['EnableCustom',
- 'None', # /error none
- 'All'])) # /error all
-_Same(_midl, 'StructMemberAlignment',
- _Enumeration(['NotSet',
- '1', # Zp1
- '2', # Zp2
- '4', # Zp4
- '8'])) # Zp8
-_Same(_midl, 'WarningLevel',
- _Enumeration(['0', # /W0
- '1', # /W1
- '2', # /W2
- '3', # /W3
- '4'])) # /W4
-
-_Renamed(_midl, 'DLLDataFileName', 'DllDataFileName', _file_name) # /dlldata
-_Renamed(_midl, 'ValidateParameters', 'ValidateAllParameters',
- _boolean) # /robust
-
-# MSBuild options not found in MSVS.
-_MSBuildOnly(_midl, 'ApplicationConfigurationMode', _boolean) # /app_config
-_MSBuildOnly(_midl, 'ClientStubFile', _file_name) # /cstub
-_MSBuildOnly(_midl, 'GenerateClientFiles',
- _Enumeration([], new=['Stub', # /client stub
- 'None'])) # /client none
-_MSBuildOnly(_midl, 'GenerateServerFiles',
- _Enumeration([], new=['Stub', # /client stub
- 'None'])) # /client none
-_MSBuildOnly(_midl, 'LocaleID', _integer) # /lcid DECIMAL
-_MSBuildOnly(_midl, 'ServerStubFile', _file_name) # /sstub
-_MSBuildOnly(_midl, 'SuppressCompilerWarnings', _boolean) # /no_warn
-_MSBuildOnly(_midl, 'TrackerLogDirectory', _folder_name)
-_MSBuildOnly(_midl, 'TypeLibFormat',
- _Enumeration([], new=['NewFormat', # /newtlb
- 'OldFormat'])) # /oldtlb
-
-
-# Directives for converting VCLibrarianTool to Lib.
-# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\lib.xml" for
-# the schema of the MSBuild Lib settings.
-
-_Same(_lib, 'AdditionalDependencies', _file_list)
-_Same(_lib, 'AdditionalLibraryDirectories', _folder_list) # /LIBPATH
-_Same(_lib, 'AdditionalOptions', _string_list)
-_Same(_lib, 'ExportNamedFunctions', _string_list) # /EXPORT
-_Same(_lib, 'ForceSymbolReferences', _string) # /INCLUDE
-_Same(_lib, 'IgnoreAllDefaultLibraries', _boolean) # /NODEFAULTLIB
-_Same(_lib, 'IgnoreSpecificDefaultLibraries', _file_list) # /NODEFAULTLIB
-_Same(_lib, 'ModuleDefinitionFile', _file_name) # /DEF
-_Same(_lib, 'OutputFile', _file_name) # /OUT
-_Same(_lib, 'SuppressStartupBanner', _boolean) # /NOLOGO
-_Same(_lib, 'UseUnicodeResponseFiles', _boolean)
-_Same(_lib, 'LinkTimeCodeGeneration', _boolean) # /LTCG
-
-# TODO(jeanluc) _link defines the same value that gets moved to
-# ProjectReference. We may want to validate that they are consistent.
-_Moved(_lib, 'LinkLibraryDependencies', 'ProjectReference', _boolean)
-
-# TODO(jeanluc) I don't think these are genuine settings but byproducts of Gyp.
-_MSVSOnly(_lib, 'AdditionalLibraryDirectories_excluded', _folder_list)
-
-_MSBuildOnly(_lib, 'DisplayLibrary', _string) # /LIST Visible='false'
-_MSBuildOnly(_lib, 'ErrorReporting',
- _Enumeration([], new=['PromptImmediately', # /ERRORREPORT:PROMPT
- 'QueueForNextLogin', # /ERRORREPORT:QUEUE
- 'SendErrorReport', # /ERRORREPORT:SEND
- 'NoErrorReport'])) # /ERRORREPORT:NONE
-_MSBuildOnly(_lib, 'MinimumRequiredVersion', _string)
-_MSBuildOnly(_lib, 'Name', _file_name) # /NAME
-_MSBuildOnly(_lib, 'RemoveObjects', _file_list) # /REMOVE
-_MSBuildOnly(_lib, 'SubSystem', _subsystem_enumeration)
-_MSBuildOnly(_lib, 'TargetMachine', _target_machine_enumeration)
-_MSBuildOnly(_lib, 'TrackerLogDirectory', _folder_name)
-_MSBuildOnly(_lib, 'TreatLibWarningAsErrors', _boolean) # /WX
-_MSBuildOnly(_lib, 'Verbose', _boolean)
-
-
-# Directives for converting VCManifestTool to Mt.
-# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\mt.xml" for
-# the schema of the MSBuild Lib settings.
-
-# Options that have the same name in MSVS and MSBuild
-_Same(_manifest, 'AdditionalManifestFiles', _file_list) # /manifest
-_Same(_manifest, 'AdditionalOptions', _string_list)
-_Same(_manifest, 'AssemblyIdentity', _string) # /identity:
-_Same(_manifest, 'ComponentFileName', _file_name) # /dll
-_Same(_manifest, 'GenerateCatalogFiles', _boolean) # /makecdfs
-_Same(_manifest, 'InputResourceManifests', _string) # /inputresource
-_Same(_manifest, 'OutputManifestFile', _file_name) # /out
-_Same(_manifest, 'RegistrarScriptFile', _file_name) # /rgs
-_Same(_manifest, 'ReplacementsFile', _file_name) # /replacements
-_Same(_manifest, 'SuppressStartupBanner', _boolean) # /nologo
-_Same(_manifest, 'TypeLibraryFile', _file_name) # /tlb:
-_Same(_manifest, 'UpdateFileHashes', _boolean) # /hashupdate
-_Same(_manifest, 'UpdateFileHashesSearchPath', _file_name)
-_Same(_manifest, 'VerboseOutput', _boolean) # /verbose
-
-# Options that have moved location.
-_MovedAndRenamed(_manifest, 'ManifestResourceFile',
- 'ManifestResourceCompile',
- 'ResourceOutputFileName',
- _file_name)
-_Moved(_manifest, 'EmbedManifest', '', _boolean)
-
-# MSVS options not found in MSBuild.
-_MSVSOnly(_manifest, 'DependencyInformationFile', _file_name)
-_MSVSOnly(_manifest, 'UseFAT32Workaround', _boolean)
-_MSVSOnly(_manifest, 'UseUnicodeResponseFiles', _boolean)
-
-# MSBuild options not found in MSVS.
-_MSBuildOnly(_manifest, 'EnableDPIAwareness', _boolean)
-_MSBuildOnly(_manifest, 'GenerateCategoryTags', _boolean) # /category
-_MSBuildOnly(_manifest, 'ManifestFromManagedAssembly',
- _file_name) # /managedassemblyname
-_MSBuildOnly(_manifest, 'OutputResourceManifests', _string) # /outputresource
-_MSBuildOnly(_manifest, 'SuppressDependencyElement', _boolean) # /nodependency
-_MSBuildOnly(_manifest, 'TrackerLogDirectory', _folder_name)
View
1,481 legacy/tools/gyp/pylib/gyp/MSVSSettings_test.py
@@ -1,1481 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2011 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Unit tests for the MSVSSettings.py file."""
-
-import StringIO
-import unittest
-import gyp.MSVSSettings as MSVSSettings
-
-
-class TestSequenceFunctions(unittest.TestCase):
-
- def setUp(self):
- self.stderr = StringIO.StringIO()
-
- def _ExpectedWarnings(self, expected):
- """Compares recorded lines to expected warnings."""
- self.stderr.seek(0)
- actual = self.stderr.read().split('\n')
- actual = [line for line in actual if line]
- self.assertEqual(sorted(expected), sorted(actual))
-
- def testValidateMSVSSettings_tool_names(self):
- """Tests that only MSVS tool names are allowed."""
- MSVSSettings.ValidateMSVSSettings(
- {'VCCLCompilerTool': {},
- 'VCLinkerTool': {},
- 'VCMIDLTool': {},
- 'foo': {},
- 'VCResourceCompilerTool': {},
- 'VCLibrarianTool': {},
- 'VCManifestTool': {},
- 'ClCompile': {}},
- self.stderr)
- self._ExpectedWarnings([
- 'Warning: unrecognized tool foo',
- 'Warning: unrecognized tool ClCompile'])
-
- def testValidateMSVSSettings_settings(self):
- """Tests that for invalid MSVS settings."""
- MSVSSettings.ValidateMSVSSettings(
- {'VCCLCompilerTool': {
- 'AdditionalIncludeDirectories': 'folder1;folder2',
- 'AdditionalOptions': ['string1', 'string2'],
- 'AdditionalUsingDirectories': 'folder1;folder2',
- 'AssemblerListingLocation': 'a_file_name',
- 'AssemblerOutput': '0',
- 'BasicRuntimeChecks': '5',
- 'BrowseInformation': 'fdkslj',
- 'BrowseInformationFile': 'a_file_name',
- 'BufferSecurityCheck': 'true',
- 'CallingConvention': '-1',
- 'CompileAs': '1',
- 'DebugInformationFormat': '2',
- 'DefaultCharIsUnsigned': 'true',
- 'Detect64BitPortabilityProblems': 'true',
- 'DisableLanguageExtensions': 'true',
- 'DisableSpecificWarnings': 'string1;string2',
- 'EnableEnhancedInstructionSet': '1',
- 'EnableFiberSafeOptimizations': 'true',