diff --git a/tools/gyp/DEPS b/tools/gyp/DEPS index c331448091..c17571ae0c 100644 --- a/tools/gyp/DEPS +++ b/tools/gyp/DEPS @@ -4,6 +4,7 @@ vars = { "chrome_trunk": "http://src.chromium.org/svn/trunk", + "googlecode_url": "http://%s.googlecode.com/svn", } deps = { @@ -18,5 +19,8 @@ deps_os = { "third_party/python_26": Var("chrome_trunk") + "/tools/third_party/python_26@89111", + + "src/third_party/pefile": + (Var("googlecode_url") % "pefile") + "/trunk@63", }, } diff --git a/tools/gyp/PRESUBMIT.py b/tools/gyp/PRESUBMIT.py index 146327d784..0338fb4a96 100644 --- a/tools/gyp/PRESUBMIT.py +++ b/tools/gyp/PRESUBMIT.py @@ -1,4 +1,4 @@ -# Copyright (c) 2011 Google Inc. All rights reserved. +# 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. @@ -10,6 +10,62 @@ for more details about the presubmit API built into gcl. """ +PYLINT_BLACKLIST = [ + # TODO: fix me. + # From SCons, not done in google style. + 'test/lib/TestCmd.py', + 'test/lib/TestCommon.py', + 'test/lib/TestGyp.py', + # Needs style fix. + 'pylib/gyp/generator/scons.py', + 'pylib/gyp/generator/xcode.py', +] + + +PYLINT_DISABLED_WARNINGS = [ + # TODO: fix me. + # Many tests include modules they don't use. + 'W0611', + # Include order doesn't properly include local files? + 'F0401', + # Some use of built-in names. + 'W0622', + # Some unused variables. + 'W0612', + # Operator not preceded/followed by space. + 'C0323', + 'C0322', + # Unnecessary semicolon. + 'W0301', + # Unused argument. + 'W0613', + # String has no effect (docstring in wrong place). + 'W0105', + # Comma not followed by space. + 'C0324', + # Access to a protected member. + 'W0212', + # Bad indent. + 'W0311', + # Line too long. + 'C0301', + # Undefined variable. + 'E0602', + # Not exception type specified. + 'W0702', + # No member of that name. + 'E1101', + # Dangerous default {}. + 'W0102', + # Others, too many to sort. + 'W0201', 'W0232', 'E1103', 'W0621', 'W0108', 'W0223', 'W0231', + 'R0201', 'E0101', 'C0321', + # ************* Module copy + # W0104:427,12:_test.odict.__setitem__: Statement seems to have no effect + 'W0104', +] + + def CheckChangeOnUpload(input_api, output_api): report = [] report.extend(input_api.canned_checks.PanProjectChecks( @@ -41,7 +97,9 @@ def CheckChangeOnCommit(input_api, output_api): sys.path = ['pylib', 'test/lib'] + sys.path report.extend(input_api.canned_checks.RunPylint( input_api, - output_api)) + output_api, + black_list=PYLINT_BLACKLIST, + disabled_warnings=PYLINT_DISABLED_WARNINGS)) finally: sys.path = old_sys_path return report diff --git a/tools/gyp/buildbot/buildbot_run.py b/tools/gyp/buildbot/buildbot_run.py index e0fda368ae..57fdb655ba 100755 --- a/tools/gyp/buildbot/buildbot_run.py +++ b/tools/gyp/buildbot/buildbot_run.py @@ -79,6 +79,7 @@ def GypBuild(): retcode += GypTestFormat('xcode') retcode += GypTestFormat('make') elif sys.platform == 'win32': + retcode += GypTestFormat('ninja') 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') diff --git a/tools/gyp/pylib/gyp/MSVSNew.py b/tools/gyp/pylib/gyp/MSVSNew.py index 6906c7bc77..0865973783 100644 --- a/tools/gyp/pylib/gyp/MSVSNew.py +++ b/tools/gyp/pylib/gyp/MSVSNew.py @@ -1,10 +1,9 @@ -# Copyright (c) 2011 Google Inc. All rights reserved. +# 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. """New implementation of Visual Studio project generation for SCons.""" -import common import os import random @@ -139,10 +138,11 @@ class MSVSProject(object): else: self.config_platform_overrides = {} self.fixpath_prefix = fixpath_prefix + self.msbuild_toolset = None def set_dependencies(self, dependencies): self.dependencies = list(dependencies or []) - + def get_guid(self): if self.guid is None: # Set GUID from path @@ -160,6 +160,9 @@ class MSVSProject(object): self.guid = MakeGuid(self.name) return self.guid + def set_msbuild_toolset(self, msbuild_toolset): + self.msbuild_toolset = msbuild_toolset + #------------------------------------------------------------------------------ @@ -204,7 +207,7 @@ class MSVSSolution: self.Write() - def Write(self, writer=common.WriteOnDiff): + def Write(self, writer=gyp.common.WriteOnDiff): """Writes the solution file to disk. Raises: diff --git a/tools/gyp/pylib/gyp/MSVSProject.py b/tools/gyp/pylib/gyp/MSVSProject.py index 4713787cd4..db1ceede34 100644 --- a/tools/gyp/pylib/gyp/MSVSProject.py +++ b/tools/gyp/pylib/gyp/MSVSProject.py @@ -1,10 +1,10 @@ -# Copyright (c) 2011 Google Inc. All rights reserved. +# 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. """Visual Studio project reader/writer.""" -import common +import gyp.common import gyp.easy_xml as easy_xml #------------------------------------------------------------------------------ diff --git a/tools/gyp/pylib/gyp/MSVSSettings.py b/tools/gyp/pylib/gyp/MSVSSettings.py index bf3cc7300f..3821fb9256 100644 --- a/tools/gyp/pylib/gyp/MSVSSettings.py +++ b/tools/gyp/pylib/gyp/MSVSSettings.py @@ -1,4 +1,4 @@ -# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# Copyright (c) 2012 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. @@ -481,7 +481,7 @@ _link = _Tool('VCLinkerTool', 'Link') _midl = _Tool('VCMIDLTool', 'Midl') _rc = _Tool('VCResourceCompilerTool', 'ResourceCompile') _lib = _Tool('VCLibrarianTool', 'Lib') -_manifest = _Tool('VCManifestTool', 'Mt') +_manifest = _Tool('VCManifestTool', 'Manifest') _AddTool(_compile) diff --git a/tools/gyp/pylib/gyp/MSVSSettings_test.py b/tools/gyp/pylib/gyp/MSVSSettings_test.py index 49e8a1d57f..4e06da3bbe 100755 --- a/tools/gyp/pylib/gyp/MSVSSettings_test.py +++ b/tools/gyp/pylib/gyp/MSVSSettings_test.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright (c) 2011 Google Inc. All rights reserved. +# 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. @@ -514,7 +514,7 @@ class TestSequenceFunctions(unittest.TestCase): 'TreatLibWarningAsErrors': 'true', 'UseUnicodeResponseFiles': 'true', 'Verbose': 'true'}, - 'Mt': { + 'Manifest': { 'AdditionalManifestFiles': 'file1;file2', 'AdditionalOptions': 'a string1', 'AssemblyIdentity': 'a string1', @@ -550,11 +550,12 @@ class TestSequenceFunctions(unittest.TestCase): self._ExpectedWarnings([ 'Warning: unrecognized setting ClCompile/Enableprefast', 'Warning: unrecognized setting ClCompile/ZZXYZ', - 'Warning: unrecognized setting Mt/notgood3', - "Warning: for Mt/GenerateCatalogFiles, expected bool; got 'truel'", + 'Warning: unrecognized setting Manifest/notgood3', + 'Warning: for Manifest/GenerateCatalogFiles, ' + "expected bool; got 'truel'", 'Warning: for Lib/TargetMachine, unrecognized enumerated value ' 'MachineX86i', - "Warning: for Mt/EnableDPIAwareness, expected bool; got 'fal'"]) + "Warning: for Manifest/EnableDPIAwareness, expected bool; got 'fal'"]) def testConvertToMSBuildSettings_empty(self): """Tests an empty conversion.""" @@ -1054,7 +1055,7 @@ class TestSequenceFunctions(unittest.TestCase): 'OutputFile': 'a_file_name', 'SuppressStartupBanner': 'true', 'UseUnicodeResponseFiles': 'true'}, - 'Mt': { + 'Manifest': { 'AdditionalManifestFiles': 'file1;file2;file3', 'AdditionalOptions': 'a_string', 'AssemblyIdentity': 'a_string', @@ -1124,7 +1125,7 @@ class TestSequenceFunctions(unittest.TestCase): AdditionalIncludeDirectories: ';%(AdditionalIncludeDirectories)', AdditionalOptions: ' %(AdditionalOptions)', PreprocessorDefinitions: ';%(PreprocessorDefinitions)', - Mt: + Manifest: AdditionalManifestFiles: ';%(AdditionalManifestFiles)', AdditionalOptions: ' %(AdditionalOptions)', InputResourceManifests: ';%(InputResourceManifests)', @@ -1442,7 +1443,7 @@ class TestSequenceFunctions(unittest.TestCase): 'PreprocessorDefinitions': '_UNICODE;UNICODE2', 'ResourceOutputFileName': '$(IntDir)%(Filename)3.res', 'ShowProgress': 'true'}, - 'Mt': { + 'Manifest': { 'AdditionalManifestFiles': 'sfsdfsd', 'AdditionalOptions': 'afdsdafsd', 'AssemblyIdentity': 'sddfdsadfsa', diff --git a/tools/gyp/pylib/gyp/MSVSToolFile.py b/tools/gyp/pylib/gyp/MSVSToolFile.py index 25d97a1798..74e529a17f 100644 --- a/tools/gyp/pylib/gyp/MSVSToolFile.py +++ b/tools/gyp/pylib/gyp/MSVSToolFile.py @@ -1,10 +1,10 @@ -# Copyright (c) 2009 Google Inc. All rights reserved. +# 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. """Visual Studio project reader/writer.""" -import common +import gyp.common import gyp.easy_xml as easy_xml diff --git a/tools/gyp/pylib/gyp/MSVSUserFile.py b/tools/gyp/pylib/gyp/MSVSUserFile.py index 8cc5def568..6c07e9a893 100644 --- a/tools/gyp/pylib/gyp/MSVSUserFile.py +++ b/tools/gyp/pylib/gyp/MSVSUserFile.py @@ -1,13 +1,14 @@ -# Copyright (c) 2009 Google Inc. All rights reserved. +# 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. """Visual Studio user preferences file writer.""" -import common import os import re import socket # for gethostname + +import gyp.common import gyp.easy_xml as easy_xml diff --git a/tools/gyp/pylib/gyp/MSVSVersion.py b/tools/gyp/pylib/gyp/MSVSVersion.py index 4958ee0d3d..5ca5493508 100644 --- a/tools/gyp/pylib/gyp/MSVSVersion.py +++ b/tools/gyp/pylib/gyp/MSVSVersion.py @@ -1,4 +1,4 @@ -# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# 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. @@ -15,13 +15,16 @@ class VisualStudioVersion(object): """Information regarding a version of Visual Studio.""" def __init__(self, short_name, description, - solution_version, project_version, flat_sln, uses_vcxproj): + solution_version, project_version, flat_sln, uses_vcxproj, + path, sdk_based): self.short_name = short_name self.description = description self.solution_version = solution_version self.project_version = project_version self.flat_sln = flat_sln self.uses_vcxproj = uses_vcxproj + self.path = path + self.sdk_based = sdk_based def ShortName(self): return self.short_name @@ -49,6 +52,43 @@ class VisualStudioVersion(object): """Returns the file extension for the project.""" return self.uses_vcxproj and '.vcxproj' or '.vcproj' + def Path(self): + """Returns the path to Visual Studio installation.""" + return self.path + + def ToolPath(self, tool): + """Returns the path to a given compiler tool. """ + return os.path.normpath(os.path.join(self.path, "VC/bin", tool)) + + def SetupScript(self, target_arch): + """Returns a command (with arguments) to be used to set up the + environment.""" + # Check if we are running in the SDK command line environment and use + # the setup script from the SDK if so. |target_arch| should be either + # 'x86' or 'x64'. + assert target_arch in ('x86', 'x64') + sdk_dir = os.environ.get('WindowsSDKDir') + if self.sdk_based and sdk_dir: + return [os.path.normpath(os.path.join(sdk_dir, 'Bin/SetEnv.Cmd')), + '/' + target_arch] + else: + # We don't use VC/vcvarsall.bat for x86 because vcvarsall calls + # vcvars32, which it can only find if VS??COMNTOOLS is set, which it + # isn't always. + if target_arch == 'x86': + return [os.path.normpath( + os.path.join(self.path, 'Common7/Tools/vsvars32.bat'))] + else: + assert target_arch == 'x64' + arg = 'x86_amd64' + if (os.environ.get('PROCESSOR_ARCHITECTURE') == 'AMD64' or + os.environ.get('PROCESSOR_ARCHITEW6432') == 'AMD64'): + # Use the 64-on-64 compiler if we can. + arg = 'amd64' + return [os.path.normpath( + os.path.join(self.path, 'VC/vcvarsall.bat')), arg] + + def _RegistryQueryBase(sysdir, key, value): """Use reg.exe to read a particular key. @@ -140,7 +180,7 @@ def _RegistryKeyExists(key): return True -def _CreateVersion(name): +def _CreateVersion(name, path, sdk_based=False): """Sets up MSVS project generation. Setup is based off the GYP_MSVS_VERSION environment variable or whatever is @@ -153,42 +193,54 @@ def _CreateVersion(name): solution_version='11.00', project_version='4.0', flat_sln=False, - uses_vcxproj=True), + uses_vcxproj=True, + path=path, + sdk_based=sdk_based), '2010e': VisualStudioVersion('2010e', 'Visual Studio 2010', solution_version='11.00', project_version='4.0', flat_sln=True, - uses_vcxproj=True), + uses_vcxproj=True, + path=path, + sdk_based=sdk_based), '2008': VisualStudioVersion('2008', 'Visual Studio 2008', solution_version='10.00', project_version='9.00', flat_sln=False, - uses_vcxproj=False), + uses_vcxproj=False, + path=path, + sdk_based=sdk_based), '2008e': VisualStudioVersion('2008e', 'Visual Studio 2008', solution_version='10.00', project_version='9.00', flat_sln=True, - uses_vcxproj=False), + uses_vcxproj=False, + path=path, + sdk_based=sdk_based), '2005': VisualStudioVersion('2005', 'Visual Studio 2005', solution_version='9.00', project_version='8.00', flat_sln=False, - uses_vcxproj=False), + uses_vcxproj=False, + path=path, + sdk_based=sdk_based), '2005e': VisualStudioVersion('2005e', 'Visual Studio 2005', solution_version='9.00', project_version='8.00', flat_sln=True, - uses_vcxproj=False), + uses_vcxproj=False, + path=path, + sdk_based=sdk_based), } return versions[str(name)] -def _DetectVisualStudioVersions(): +def _DetectVisualStudioVersions(versions_to_check, force_express): """Collect the list of installed visual studio versions. Returns: @@ -204,25 +256,10 @@ def _DetectVisualStudioVersions(): """ version_to_year = {'8.0': '2005', '9.0': '2008', '10.0': '2010'} versions = [] - # For now, prefer versions before VS2010 - for version in ('9.0', '8.0', '10.0'): - # Check if VS2010 and later is installed as specified by - # http://msdn.microsoft.com/en-us/library/bb164659.aspx - keys = [r'HKLM\SOFTWARE\Microsoft\DevDiv\VS\Servicing\%s' % version, - r'HKLM\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VS\Servicing\%s' % ( - version)] - for index in range(len(keys)): - if not _RegistryKeyExists(keys[index]): - continue - # Check for express - if _RegistryKeyExists(keys[index] + '\\expbsln'): - # Add this one - versions.append(_CreateVersion(version_to_year[version] + 'e')) - else: - # Add this one - versions.append(_CreateVersion(version_to_year[version])) - - # Old (pre-VS2010) method of searching for which VS version is installed + for version in versions_to_check: + # Old method of searching for which VS version is installed + # We don't use the 2010-encouraged-way because we also want to get the + # path to the binaries, which it doesn't offer. keys = [r'HKLM\Software\Microsoft\VisualStudio\%s' % version, r'HKLM\Software\Wow6432Node\Microsoft\VisualStudio\%s' % version, r'HKLM\Software\Microsoft\VCExpress\%s' % version, @@ -232,13 +269,28 @@ def _DetectVisualStudioVersions(): if not path: continue # Check for full. - if os.path.exists(os.path.join(path, 'devenv.exe')): + full_path = os.path.join(path, 'devenv.exe') + express_path = os.path.join(path, 'vcexpress.exe') + if not force_express and os.path.exists(full_path): # Add this one. - versions.append(_CreateVersion(version_to_year[version])) + versions.append(_CreateVersion(version_to_year[version], + os.path.join(path, '..', '..'))) # Check for express. - elif os.path.exists(os.path.join(path, 'vcexpress.exe')): + elif os.path.exists(express_path): # Add this one. - versions.append(_CreateVersion(version_to_year[version] + 'e')) + versions.append(_CreateVersion(version_to_year[version] + 'e', + os.path.join(path, '..', '..'))) + + # The old method above does not work when only SDK is installed. + keys = [r'HKLM\Software\Microsoft\VisualStudio\SxS\VC7', + r'HKLM\Software\Wow6432Node\Microsoft\VisualStudio\SxS\VC7'] + for index in range(len(keys)): + path = _RegistryGetValue(keys[index], version) + if not path: + continue + versions.append(_CreateVersion(version_to_year[version] + 'e', + os.path.join(path, '..'), sdk_based=True)) + return versions @@ -253,12 +305,21 @@ def SelectVisualStudioVersion(version='auto'): # In auto mode, check environment variable for override. if version == 'auto': version = os.environ.get('GYP_MSVS_VERSION', 'auto') - # In auto mode, pick the most preferred version present. - if version == 'auto': - versions = _DetectVisualStudioVersions() - if not versions: - # Default to 2005. - return _CreateVersion('2005') - return versions[0] - # Convert version string into a version object. - return _CreateVersion(version) + version_map = { + 'auto': ('10.0', '9.0', '8.0'), + '2005': ('8.0',), + '2005e': ('8.0',), + '2008': ('9.0',), + '2008e': ('9.0',), + '2010': ('10.0',), + '2010e': ('10.0',), + } + version = str(version) + versions = _DetectVisualStudioVersions(version_map[version], 'e' in version) + if not versions: + if version == 'auto': + # Default to 2005 if we couldn't find anything + return _CreateVersion('2005', None) + else: + return _CreateVersion(version, None) + return versions[0] diff --git a/tools/gyp/pylib/gyp/SCons.py b/tools/gyp/pylib/gyp/SCons.py index 568645daa6..42d845ebed 100644 --- a/tools/gyp/pylib/gyp/SCons.py +++ b/tools/gyp/pylib/gyp/SCons.py @@ -1,4 +1,4 @@ -# Copyright (c) 2011 Google Inc. All rights reserved. +# 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. @@ -84,7 +84,7 @@ class NoneTarget(TargetBase): """ A GYP target type of 'none', implicitly or explicitly. """ - def write_target(self, fp, pre=''): + def write_target(self, fp, src_dir='', pre=''): fp.write('\ntarget_files.extend(input_files)\n') diff --git a/tools/gyp/pylib/gyp/common.py b/tools/gyp/pylib/gyp/common.py index 614d207c30..5b06a9746f 100644 --- a/tools/gyp/pylib/gyp/common.py +++ b/tools/gyp/pylib/gyp/common.py @@ -355,15 +355,16 @@ def GetFlavor(params): 'sunos5': 'solaris', 'freebsd7': 'freebsd', 'freebsd8': 'freebsd', + 'freebsd9': 'freebsd', } flavor = flavors.get(sys.platform, 'linux') return params.get('flavor', flavor) def CopyTool(flavor, out_path): - """Finds (mac|sun)_tool.gyp in the gyp directory and copies it + """Finds (mac|sun|win)_tool.gyp in the gyp directory and copies it to |out_path|.""" - prefix = { 'solaris': 'sun', 'mac': 'mac' }.get(flavor, None) + prefix = { 'solaris': 'sun', 'mac': 'mac', 'win': 'win' }.get(flavor, None) if not prefix: return @@ -391,7 +392,7 @@ def CopyTool(flavor, out_path): def uniquer(seq, idfun=None): if idfun is None: - def idfun(x): return x + idfun = lambda x: x seen = {} result = [] for item in seq: @@ -400,3 +401,52 @@ def uniquer(seq, idfun=None): seen[marker] = 1 result.append(item) return result + + +class CycleError(Exception): + """An exception raised when an unexpected cycle is detected.""" + def __init__(self, nodes): + self.nodes = nodes + def __str__(self): + return 'CycleError: cycle involving: ' + str(self.nodes) + + +def TopologicallySorted(graph, get_edges): + """Topologically sort based on a user provided edge definition. + + Args: + graph: A list of node names. + get_edges: A function mapping from node name to a hashable collection + of node names which this node has outgoing edges to. + Returns: + A list containing all of the node in graph in topological order. + It is assumed that calling get_edges once for each node and caching is + cheaper than repeatedly calling get_edges. + Raises: + CycleError in the event of a cycle. + Example: + graph = {'a': '$(b) $(c)', 'b': 'hi', 'c': '$(b)'} + def GetEdges(node): + return re.findall(r'\$\(([^))]\)', graph[node]) + print TopologicallySorted(graph.keys(), GetEdges) + ==> + ['a', 'c', b'] + """ + get_edges = memoize(get_edges) + visited = set() + visiting = set() + ordered_nodes = [] + def Visit(node): + if node in visiting: + raise CycleError(visiting) + if node in visited: + return + visited.add(node) + visiting.add(node) + for neighbor in get_edges(node): + Visit(neighbor) + visiting.remove(node) + ordered_nodes.insert(0, node) + for node in sorted(graph): + Visit(node) + return ordered_nodes diff --git a/tools/gyp/pylib/gyp/common_test.py b/tools/gyp/pylib/gyp/common_test.py new file mode 100755 index 0000000000..aabaf344b0 --- /dev/null +++ b/tools/gyp/pylib/gyp/common_test.py @@ -0,0 +1,44 @@ +#!/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. + +"""Unit tests for the common.py file.""" + +import gyp.common +import unittest + + +class TestTopologicallySorted(unittest.TestCase): + def test_Valid(self): + """Test that sorting works on a valid graph with one possible order.""" + graph = { + 'a': ['b', 'c'], + 'b': [], + 'c': ['d'], + 'd': ['b'], + } + def GetEdge(node): + return tuple(graph[node]) + self.assertEqual( + gyp.common.TopologicallySorted(graph.keys(), GetEdge), + ['a', 'c', 'd', 'b']) + + def test_Cycle(self): + """Test that an exception is thrown on a cyclic graph.""" + graph = { + 'a': ['b'], + 'b': ['c'], + 'c': ['d'], + 'd': ['a'], + } + def GetEdge(node): + return tuple(graph[node]) + self.assertRaises( + gyp.common.CycleError, gyp.common.TopologicallySorted, + graph.keys(), GetEdge) + + +if __name__ == '__main__': + unittest.main() diff --git a/tools/gyp/pylib/gyp/generator/dump_dependency_json.py b/tools/gyp/pylib/gyp/generator/dump_dependency_json.py index c1c2fbdc98..acee72ebb1 100644 --- a/tools/gyp/pylib/gyp/generator/dump_dependency_json.py +++ b/tools/gyp/pylib/gyp/generator/dump_dependency_json.py @@ -8,6 +8,8 @@ import gyp.common import json import sys +generator_supports_multiple_toolsets = True + generator_wants_static_library_dependencies_adjusted = False generator_default_variables = { diff --git a/tools/gyp/pylib/gyp/generator/eclipse.py b/tools/gyp/pylib/gyp/generator/eclipse.py new file mode 100644 index 0000000000..5e16c02739 --- /dev/null +++ b/tools/gyp/pylib/gyp/generator/eclipse.py @@ -0,0 +1,271 @@ +# 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. + +"""GYP backend that generates Eclipse CDT settings files. + +This backend DOES NOT generate Eclipse CDT projects. Instead, it generates XML +files that can be imported into an Eclipse CDT project. The XML file contains a +list of include paths and symbols (i.e. defines). + +Because a full .cproject definition is not created by this generator, it's not +possible to properly define the include dirs and symbols for each file +individually. Instead, one set of includes/symbols is generated for the entire +project. This works fairly well (and is a vast improvement in general), but may +still result in a few indexer issues here and there. + +This generator has no automated tests, so expect it to be broken. +""" + +import os.path +import subprocess +import gyp +import gyp.common +import shlex + +generator_wants_static_library_dependencies_adjusted = False + +generator_default_variables = { +} + +for dirname in ['INTERMEDIATE_DIR', 'PRODUCT_DIR', 'LIB_DIR', 'SHARED_LIB_DIR']: + # Some gyp steps fail if these are empty(!). + generator_default_variables[dirname] = 'dir' + +for unused in ['RULE_INPUT_PATH', 'RULE_INPUT_ROOT', 'RULE_INPUT_NAME', + 'RULE_INPUT_DIRNAME', 'RULE_INPUT_EXT', + 'EXECUTABLE_PREFIX', 'EXECUTABLE_SUFFIX', + 'STATIC_LIB_PREFIX', 'STATIC_LIB_SUFFIX', + 'SHARED_LIB_PREFIX', 'SHARED_LIB_SUFFIX']: + generator_default_variables[unused] = '' + +# Include dirs will occasionaly use the SHARED_INTERMEDIATE_DIR variable as +# part of the path when dealing with generated headers. This value will be +# replaced dynamically for each configuration. +generator_default_variables['SHARED_INTERMEDIATE_DIR'] = \ + '$SHARED_INTERMEDIATES_DIR' + + +def CalculateVariables(default_variables, params): + generator_flags = params.get('generator_flags', {}) + for key, val in generator_flags.items(): + default_variables.setdefault(key, val) + default_variables.setdefault('OS', gyp.common.GetFlavor(params)) + + +def CalculateGeneratorInputInfo(params): + """Calculate the generator specific info that gets fed to input (called by + gyp).""" + generator_flags = params.get('generator_flags', {}) + if generator_flags.get('adjust_static_libraries', False): + global generator_wants_static_library_dependencies_adjusted + generator_wants_static_library_dependencies_adjusted = True + + +def GetAllIncludeDirectories(target_list, target_dicts, + shared_intermediates_dir, config_name): + """Calculate the set of include directories to be used. + + Returns: + A list including all the include_dir's specified for every target followed + by any include directories that were added as cflag compiler options. + """ + + gyp_includes_set = set() + compiler_includes_list = [] + + for target_name in target_list: + target = target_dicts[target_name] + if config_name in target['configurations']: + config = target['configurations'][config_name] + + # Look for any include dirs that were explicitly added via cflags. This + # may be done in gyp files to force certain includes to come at the end. + # TODO(jgreenwald): Change the gyp files to not abuse cflags for this, and + # remove this. + cflags = config['cflags'] + for cflag in cflags: + include_dir = '' + if cflag.startswith('-I'): + include_dir = cflag[2:] + if include_dir and not include_dir in compiler_includes_list: + compiler_includes_list.append(include_dir) + + # Find standard gyp include dirs. + if config.has_key('include_dirs'): + include_dirs = config['include_dirs'] + for include_dir in include_dirs: + include_dir = include_dir.replace('$SHARED_INTERMEDIATES_DIR', + shared_intermediates_dir) + if not os.path.isabs(include_dir): + base_dir = os.path.dirname(target_name) + + include_dir = base_dir + '/' + include_dir + include_dir = os.path.abspath(include_dir) + + if not include_dir in gyp_includes_set: + gyp_includes_set.add(include_dir) + + + # Generate a list that has all the include dirs. + all_includes_list = list(gyp_includes_set) + all_includes_list.sort() + for compiler_include in compiler_includes_list: + if not compiler_include in gyp_includes_set: + all_includes_list.append(compiler_include) + + # All done. + return all_includes_list + + +def GetCompilerPath(target_list, target_dicts, data): + """Determine a command that can be used to invoke the compiler. + + Returns: + If this is a gyp project that has explicit make settings, try to determine + the compiler from that. Otherwise, see if a compiler was specified via the + CC_target environment variable. + """ + + # First, see if the compiler is configured in make's settings. + build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0]) + make_global_settings_dict = data[build_file].get('make_global_settings', {}) + for key, value in make_global_settings_dict: + if key in ['CC', 'CXX']: + return value + + # Check to see if the compiler was specified as an environment variable. + for key in ['CC_target', 'CC', 'CXX']: + compiler = os.environ.get(key) + if compiler: + return compiler + + return 'gcc' + + +def GetAllDefines(target_list, target_dicts, data, config_name): + """Calculate the defines for a project. + + Returns: + A dict that includes explict defines declared in gyp files along with all of + the default defines that the compiler uses. + """ + + # Get defines declared in the gyp files. + all_defines = {} + for target_name in target_list: + target = target_dicts[target_name] + + if config_name in target['configurations']: + config = target['configurations'][config_name] + for define in config['defines']: + split_define = define.split('=', 1) + if len(split_define) == 1: + split_define.append('1') + if split_define[0].strip() in all_defines: + # Already defined + continue + + all_defines[split_define[0].strip()] = split_define[1].strip() + + # Get default compiler defines (if possible). + cc_target = GetCompilerPath(target_list, target_dicts, data) + if cc_target: + command = shlex.split(cc_target) + command.extend(['-E', '-dM', '-']) + cpp_proc = subprocess.Popen(args=command, cwd='.', + stdin=subprocess.PIPE, stdout=subprocess.PIPE) + cpp_output = cpp_proc.communicate()[0] + cpp_lines = cpp_output.split('\n') + for cpp_line in cpp_lines: + if not cpp_line.strip(): + continue + cpp_line_parts = cpp_line.split(' ', 2) + key = cpp_line_parts[1] + if len(cpp_line_parts) >= 3: + val = cpp_line_parts[2] + else: + val = '1' + all_defines[key] = val + + return all_defines + + +def WriteIncludePaths(out, eclipse_langs, include_dirs): + """Write the includes section of a CDT settings export file.""" + + out.write('
\n') + out.write(' \n') + for lang in eclipse_langs: + out.write(' \n' % lang) + for include_dir in include_dirs: + out.write(' %s\n' % + include_dir) + out.write(' \n') + out.write('
\n') + + +def WriteMacros(out, eclipse_langs, defines): + """Write the macros section of a CDT settings export file.""" + + out.write('
\n') + out.write(' \n') + for lang in eclipse_langs: + out.write(' \n' % lang) + for key in sorted(defines.iterkeys()): + out.write(' %s%s\n' % + (key, defines[key])) + out.write(' \n') + out.write('
\n') + + +def GenerateOutputForConfig(target_list, target_dicts, data, params, + config_name): + options = params['options'] + generator_flags = params.get('generator_flags', {}) + + # build_dir: relative path from source root to our output files. + # e.g. "out/Debug" + build_dir = os.path.join(generator_flags.get('output_dir', 'out'), + config_name) + + toplevel_build = os.path.join(options.toplevel_dir, build_dir) + shared_intermediate_dir = os.path.join(toplevel_build, 'obj', 'gen') + + if not os.path.exists(toplevel_build): + os.makedirs(toplevel_build) + out = open(os.path.join(toplevel_build, 'eclipse-cdt-settings.xml'), 'w') + + out.write('\n') + out.write('\n') + + eclipse_langs = ['C++ Source File', 'C Source File', 'Assembly Source File', + 'GNU C++', 'GNU C', 'Assembly'] + include_dirs = GetAllIncludeDirectories(target_list, target_dicts, + shared_intermediate_dir, config_name) + WriteIncludePaths(out, eclipse_langs, include_dirs) + defines = GetAllDefines(target_list, target_dicts, data, config_name) + WriteMacros(out, eclipse_langs, defines) + + out.write('\n') + out.close() + + +def GenerateOutput(target_list, target_dicts, data, params): + """Generate an XML settings file that can be imported into a CDT project.""" + + if params['options'].generator_output: + raise NotImplementedError, "--generator_output not implemented for eclipse" + + user_config = params.get('generator_flags', {}).get('config', None) + if user_config: + GenerateOutputForConfig(target_list, target_dicts, data, params, + user_config) + else: + config_names = target_dicts[target_list[0]]['configurations'].keys() + for config_name in config_names: + GenerateOutputForConfig(target_list, target_dicts, data, params, + config_name) + diff --git a/tools/gyp/pylib/gyp/generator/make.py b/tools/gyp/pylib/gyp/generator/make.py index ec05190814..2b7f729340 100644 --- a/tools/gyp/pylib/gyp/generator/make.py +++ b/tools/gyp/pylib/gyp/generator/make.py @@ -43,8 +43,6 @@ generator_default_variables = { 'RULE_INPUT_PATH': '$(abspath $<)', 'RULE_INPUT_EXT': '$(suffix $<)', 'RULE_INPUT_NAME': '$(notdir $<)', - - # This appears unused --- ? 'CONFIGURATION_NAME': '$(BUILDTYPE)', } @@ -54,6 +52,11 @@ generator_supports_multiple_toolsets = True # Request sorted dependencies in the order from dependents to dependencies. generator_wants_sorted_dependencies = False +# Placates pylint. +generator_additional_non_configuration_keys = [] +generator_additional_path_sections = [] +generator_extra_sources_for_rules = [] + def CalculateVariables(default_variables, params): """Calculate additional variables for use in the build (called by gyp).""" @@ -79,7 +82,6 @@ def CalculateVariables(default_variables, params): global generator_extra_sources_for_rules generator_extra_sources_for_rules = getattr(xcode_generator, 'generator_extra_sources_for_rules', []) - global COMPILABLE_EXTENSIONS COMPILABLE_EXTENSIONS.update({'.m': 'objc', '.mm' : 'objcxx'}) else: operating_system = flavor @@ -438,6 +440,11 @@ endef .PHONY: %(default_target)s %(default_target)s: +# make looks for ways to re-generate included makefiles, but in our case, we +# don't have a direct way. Explicitly telling make that it has nothing to do +# for them makes it go faster. +%%.d: ; + # Use FORCE_DO_CMD to force a target to run. Should be coupled with # do_cmd. .PHONY: FORCE_DO_CMD @@ -523,18 +530,7 @@ all: # target in our tree. Only consider the ones with .d (dependency) info: d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d)) ifneq ($(d_files),) - # Rather than include each individual .d file, concatenate them into a - # single file which make is able to load faster. We split this into - # commands that take 512 files at a time to avoid overflowing the - # command line. - $(shell cat $(wordlist 1,512,$(d_files)) > $(depsdir)/all.deps) -%(generate_all_deps)s - # make looks for ways to re-generate included makefiles, but in our case, we - # don't have a direct way. Explicitly telling make that it has nothing to do - # for them makes it go faster. - $(depsdir)/all.deps: ; - - include $(depsdir)/all.deps + include $(d_files) endif """ @@ -589,7 +585,9 @@ def EscapeCppDefine(s): """Escapes a CPP define so that it will reach the compiler unaltered.""" s = EscapeShellArgument(s) s = EscapeMakeVariableExpansion(s) - return s + # '#' characters must be escaped even embedded in a string, else Make will + # treat it as the start of a comment. + return s.replace('#', r'\#') def QuoteIfNecessary(string): @@ -602,8 +600,7 @@ def QuoteIfNecessary(string): def StringToMakefileVariable(string): """Convert a string to a value that is acceptable as a make variable name.""" - # TODO: replace other metacharacters that we encounter. - return re.sub('[ {}$]', '_', string) + return re.sub('[^a-zA-Z0-9_]', '_', string) srcdir_prefix = '' @@ -620,6 +617,21 @@ def QuoteSpaces(s, quote=r'\ '): return s.replace(' ', quote) +def InvertRelativePath(path): + """Given a relative path like foo/bar, return the inverse relative path: + the path from the relative path back to the origin dir. + + E.g. os.path.normpath(os.path.join(path, InvertRelativePath(path))) + should always produce the empty string.""" + + if not path: + return path + # Only need to handle relative paths into subdirectories for now. + assert '..' not in path, path + depth = len(path.split(os.path.sep)) + return os.path.sep.join(['..'] * depth) + + # Map from qualified target to path to output. target_outputs = {} # Map from qualified target to any linkable output. A subset @@ -638,8 +650,6 @@ class MakefileWriter: def __init__(self, generator_flags, flavor): self.generator_flags = generator_flags self.flavor = flavor - # Keep track of the total number of outputs for this makefile. - self._num_outputs = 0 self.suffix_rules_srcdir = {} self.suffix_rules_objdir1 = {} @@ -664,10 +674,6 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD """ % (ext, COMPILABLE_EXTENSIONS[ext]))}) - def NumOutputs(self): - return self._num_outputs - - def Write(self, qualified_target, base_path, output_filename, spec, configs, part_of_all): """The main entry point: writes a .mk file for a single target. @@ -686,6 +692,7 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD self.fp.write(header) + self.qualified_target = qualified_target self.path = base_path self.target = spec['target_name'] self.type = spec['type'] @@ -753,7 +760,8 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD configs, deps, all_sources, extra_outputs, extra_link_deps, part_of_all, gyp.xcode_emulation.MacPrefixHeader( - self.xcode_settings, self.Absolutify, self.Pchify)) + self.xcode_settings, lambda p: Sourceify(self.Absolutify(p)), + self.Pchify)) sources = filter(Compilable, all_sources) if sources: self.WriteLn(SHARED_HEADER_SUFFIX_RULES_COMMENT1) @@ -831,7 +839,8 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD part_of_all: flag indicating this target is part of 'all' """ for action in actions: - name = self.target + '_' + StringToMakefileVariable(action['action_name']) + name = StringToMakefileVariable('%s_%s' % (self.qualified_target, + action['action_name'])) self.WriteLn('### Rules for action "%s":' % action['action_name']) inputs = action['inputs'] outputs = action['outputs'] @@ -888,7 +897,7 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD # Same for environment. self.WriteLn("%s: obj := $(abs_obj)" % QuoteSpaces(outputs[0])) self.WriteLn("%s: builddir := $(abs_builddir)" % QuoteSpaces(outputs[0])) - self.WriteXcodeEnv(outputs[0], self.GetXcodeEnv()) + self.WriteSortedXcodeEnv(outputs[0], self.GetSortedXcodeEnv()) for input in inputs: assert ' ' not in input, ( @@ -898,7 +907,7 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD "Spaces in action output filenames not supported (%s)" % output) # See the comment in WriteCopies about expanding env vars. - env = self.GetXcodeEnv() + env = self.GetSortedXcodeEnv() outputs = [gyp.xcode_emulation.ExpandEnvVars(o, env) for o in outputs] inputs = [gyp.xcode_emulation.ExpandEnvVars(i, env) for i in inputs] @@ -925,7 +934,8 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD part_of_all: flag indicating this target is part of 'all' """ for rule in rules: - name = self.target + '_' + StringToMakefileVariable(rule['rule_name']) + name = StringToMakefileVariable('%s_%s' % (self.qualified_target, + rule['rule_name'])) count = 0 self.WriteLn('### Generated for rule %s:' % name) @@ -941,12 +951,6 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD rule_source_dirname) for out in rule['outputs']] - # If an output is just the file name, turn it into a path so - # FixupArgPath() will know to Absolutify() it. - outputs = map( - lambda x : os.path.dirname(x) and x or os.path.join('.', x), - outputs) - for out in outputs: dir = os.path.dirname(out) if dir: @@ -955,7 +959,6 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD extra_sources += outputs if int(rule.get('process_outputs_as_mac_bundle_resources', False)): extra_mac_bundle_resources += outputs - all_outputs += outputs inputs = map(Sourceify, map(self.Absolutify, [rule_source] + rule.get('inputs', []))) actions = ['$(call do_cmd,%s_%d)' % (name, count)] @@ -969,6 +972,8 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD # amount of pain. actions += ['@touch --no-create $@'] + outputs = map(self.Absolutify, outputs) + all_outputs += outputs # Only write the 'obj' and 'builddir' rules for the "primary" output # (:1); it's superfluous for the "extra outputs", and this avoids # accidentally writing duplicate dummy rules for those outputs. @@ -979,7 +984,6 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD assert ' ' not in output, ( "Spaces in rule filenames not yet supported (%s)" % output) self.WriteLn('all_deps += %s' % ' '.join(outputs)) - self._num_outputs += len(outputs) action = [self.ExpandInputRoot(ac, rule_source_root, rule_source_dirname) @@ -1041,7 +1045,7 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD """ self.WriteLn('### Generated for copy rule.') - variable = self.target + '_copies' + variable = StringToMakefileVariable(self.qualified_target + '_copies') outputs = [] for copy in copies: for path in copy['files']: @@ -1060,7 +1064,7 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD # As a workaround, manually expand variables at gyp time. Since 'copies' # can't run scripts, there's no need to write the env then. # WriteDoCmd() will escape spaces for .d files. - env = self.GetXcodeEnv() + env = self.GetSortedXcodeEnv() output = gyp.xcode_emulation.ExpandEnvVars(output, env) path = gyp.xcode_emulation.ExpandEnvVars(path, env) self.WriteDoCmd([output], [path], 'copy', part_of_all) @@ -1086,7 +1090,7 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD """Write Makefile code for bundle Info.plist files.""" info_plist, out, defines, extra_env = gyp.xcode_emulation.GetMacInfoPlist( generator_default_variables['PRODUCT_DIR'], self.xcode_settings, - self.Absolutify) + lambda p: Sourceify(self.Absolutify(p))) if not info_plist: return if defines: @@ -1102,7 +1106,8 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD '@plutil -convert xml1 $@ $@']) info_plist = intermediate_plist # plists can contain envvars and substitute them into the file. - self.WriteXcodeEnv(out, self.GetXcodeEnv(additional_settings=extra_env)) + self.WriteSortedXcodeEnv( + out, self.GetSortedXcodeEnv(additional_settings=extra_env)) self.WriteDoCmd([out], [info_plist], 'mac_tool,,,copy-info-plist', part_of_all=True) bundle_deps.append(out) @@ -1165,7 +1170,6 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD self.WriteLn('# Add to the list of files we specially track ' 'dependencies for.') self.WriteLn('all_deps += $(OBJS)') - self._num_outputs += len(objs) self.WriteLn() # Make sure our dependencies are built first. @@ -1225,7 +1229,7 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD "$(CFLAGS_CC_$(BUILDTYPE)) " "$(CFLAGS_OBJCC_$(BUILDTYPE))") - self.WritePchTargets(precompiled_header.GetGchBuildCommands()) + self.WritePchTargets(precompiled_header.GetPchBuildCommands()) # If there are any object files in our input file list, link them into our # output. @@ -1384,8 +1388,7 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD self.WriteMakeRule(extra_outputs, deps, comment=('Preserve order dependency of ' 'special output on deps.'), - order_only = True, - multiple_output_trick = False) + order_only = True) target_postbuilds = {} if self.type != 'none': @@ -1393,13 +1396,17 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD config = configs[configname] if self.flavor == 'mac': ldflags = self.xcode_settings.GetLdflags(configname, - generator_default_variables['PRODUCT_DIR'], self.Absolutify) + generator_default_variables['PRODUCT_DIR'], + lambda p: Sourceify(self.Absolutify(p))) # TARGET_POSTBUILDS_$(BUILDTYPE) is added to postbuilds later on. + gyp_to_build = InvertRelativePath(self.path) target_postbuild = self.xcode_settings.GetTargetPostbuilds( configname, - QuoteSpaces(self.output), - QuoteSpaces(self.output_binary)) + QuoteSpaces(os.path.normpath(os.path.join(gyp_to_build, + self.output))), + QuoteSpaces(os.path.normpath(os.path.join(gyp_to_build, + self.output_binary)))) if target_postbuild: target_postbuilds[configname] = target_postbuild else: @@ -1430,13 +1437,13 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD if target_postbuilds: postbuilds.append('$(TARGET_POSTBUILDS_$(BUILDTYPE))') postbuilds.extend( - gyp.xcode_emulation.GetSpecPostbuildCommands(spec, self.Absolutify)) + gyp.xcode_emulation.GetSpecPostbuildCommands(spec)) if postbuilds: # Envvars may be referenced by TARGET_POSTBUILDS_$(BUILDTYPE), # so we must output its definition first, since we declare variables # using ":=". - self.WriteXcodeEnv(self.output, self.GetXcodePostbuildEnv()) + self.WriteSortedXcodeEnv(self.output, self.GetSortedXcodePostbuildEnv()) for configname in target_postbuilds: self.WriteLn('%s: TARGET_POSTBUILDS_%s := %s' % @@ -1444,6 +1451,9 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD configname, gyp.common.EncodePOSIXShellList(target_postbuilds[configname]))) + # Postbuilds expect to be run in the gyp file's directory, so insert an + # implicit postbuild to cd to there. + postbuilds.insert(0, gyp.common.EncodePOSIXShellList(['cd', self.path])) for i in xrange(len(postbuilds)): if not postbuilds[i].startswith('$'): postbuilds[i] = EscapeShellArgument(postbuilds[i]) @@ -1555,7 +1565,8 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD file_desc = 'executable' install_path = self._InstallableTargetInstallPath() installable_deps = [self.output] - if self.flavor == 'mac' and not 'product_dir' in spec: + if (self.flavor == 'mac' and not 'product_dir' in spec and + self.toolset == 'target'): # On mac, products are created in install_path immediately. assert install_path == self.output, '%s != %s' % ( install_path, self.output) @@ -1614,12 +1625,10 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD # other functions. outputs = [QuoteSpaces(o, SPACE_REPLACEMENT) for o in outputs] self.WriteLn('all_deps += %s' % ' '.join(outputs)) - self._num_outputs += len(outputs) def WriteMakeRule(self, outputs, inputs, actions=None, comment=None, - order_only=False, force=False, phony=False, - multiple_output_trick=True): + order_only=False, force=False, phony=False): """Write a Makefile rule, with some extra tricks. outputs: a list of outputs for the rule (note: this is not directly @@ -1632,8 +1641,6 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD force: if true, include FORCE_DO_CMD as an order-only dep phony: if true, the rule does not actually generate the named output, the output is just a name to run the rule - multiple_output_trick: if true (the default), perform tricks such as dummy - rules to avoid problems with multiple outputs. """ outputs = map(QuoteSpaces, outputs) inputs = map(QuoteSpaces, inputs) @@ -1645,20 +1652,22 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD # TODO(evanm): just make order_only a list of deps instead of these hacks. if order_only: order_insert = '| ' + pick_output = ' '.join(outputs) else: order_insert = '' + pick_output = outputs[0] if force: force_append = ' FORCE_DO_CMD' else: force_append = '' if actions: self.WriteLn("%s: TOOLSET := $(TOOLSET)" % outputs[0]) - self.WriteLn('%s: %s%s%s' % (outputs[0], order_insert, ' '.join(inputs), + self.WriteLn('%s: %s%s%s' % (pick_output, order_insert, ' '.join(inputs), force_append)) if actions: for action in actions: self.WriteLn('\t%s' % action) - if multiple_output_trick and len(outputs) > 1: + if not order_only and len(outputs) > 1: # If we have more than one output, a rule like # foo bar: baz # that for *each* output we must run the action, potentially @@ -1768,37 +1777,33 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD self.fp.write(text + '\n') - def GetXcodeEnv(self, additional_settings=None): - return gyp.xcode_emulation.GetXcodeEnv( + def GetSortedXcodeEnv(self, additional_settings=None): + return gyp.xcode_emulation.GetSortedXcodeEnv( self.xcode_settings, "$(abs_builddir)", os.path.join("$(abs_srcdir)", self.path), "$(BUILDTYPE)", additional_settings) - def GetXcodePostbuildEnv(self): + def GetSortedXcodePostbuildEnv(self): # CHROMIUM_STRIP_SAVE_FILE is a chromium-specific hack. # TODO(thakis): It would be nice to have some general mechanism instead. strip_save_file = self.xcode_settings.GetPerTargetSetting( - 'CHROMIUM_STRIP_SAVE_FILE') - if strip_save_file: - strip_save_file = self.Absolutify(strip_save_file) - else: - # Explicitly clear this out, else a postbuild might pick up an export - # from an earlier target. - strip_save_file = '' - return self.GetXcodeEnv( + 'CHROMIUM_STRIP_SAVE_FILE', '') + # Even if strip_save_file is empty, explicitly write it. Else a postbuild + # might pick up an export from an earlier target. + return self.GetSortedXcodeEnv( additional_settings={'CHROMIUM_STRIP_SAVE_FILE': strip_save_file}) - def WriteXcodeEnv(self, target, env): - for k in gyp.xcode_emulation.TopologicallySortedEnvVarKeys(env): + def WriteSortedXcodeEnv(self, target, env): + for k, v in env: # For # foo := a\ b # the escaped space does the right thing. For # export foo := a\ b # it does not -- the backslash is written to the env as literal character. # So don't escape spaces in |env[k]|. - self.WriteLn('%s: export %s := %s' % (QuoteSpaces(target), k, env[k])) + self.WriteLn('%s: export %s := %s' % (QuoteSpaces(target), k, v)) def Objectify(self, path): @@ -1829,12 +1834,6 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD return os.path.normpath(os.path.join(self.path, path)) - def FixupArgPath(self, arg): - if '/' in arg or '.h.' in arg: - return self.Absolutify(arg) - return arg - - def ExpandInputRoot(self, template, expansion, dirname): if '%(INPUT_ROOT)s' not in template and '%(INPUT_DIRNAME)s' not in template: return template @@ -1849,7 +1848,8 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD """Returns the location of the final output for an installable target.""" # Xcode puts shared_library results into PRODUCT_DIR, and some gyp files # rely on this. Emulate this behavior for mac. - if self.type == 'shared_library' and self.flavor != 'mac': + if (self.type == 'shared_library' and + (self.flavor != 'mac' or self.toolset != 'target')): # Install all shared libs into a common directory (per toolset) for # convenient access with LD_LIBRARY_PATH. return '$(builddir)/lib.%s/%s' % (self.toolset, self.alias) @@ -2040,7 +2040,6 @@ def GenerateOutput(target_list, target_dicts, data, params): for target in gyp.common.AllTargets(target_list, target_dicts, build_file): needed_targets.add(target) - num_outputs = 0 build_files = set() include_list = set() for qualified_target in target_list: @@ -2081,7 +2080,6 @@ def GenerateOutput(target_list, target_dicts, data, params): writer = MakefileWriter(generator_flags, flavor) writer.Write(qualified_target, base_path, output_file, spec, configs, part_of_all=qualified_target in needed_targets) - num_outputs += writer.NumOutputs() # Our root_makefile lives at the source root. Compute the relative path # from there to the output_file for including. @@ -2128,22 +2126,6 @@ def GenerateOutput(target_list, target_dicts, data, params): if generator_flags.get('auto_regeneration', True): WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) - # Write the rule to load dependencies. We batch 512 files at a time to - # avoid overflowing the command line. - all_deps = "" - for i in range(513, num_outputs, 512): - all_deps += (""" - ifneq ($(word %(start)d,$(d_files)),) - $(shell cat $(wordlist %(start)d,%(end)d,$(d_files)) >> $(depsdir)/all.deps) - endif""" % { 'start': i, 'end': i + 999 }) - - # Add a check to make sure we tried to process all the .d files. - all_deps += """ - ifneq ($(word %(last)d,$(d_files)),) - $(error Found unprocessed dependency files (gyp didn't generate enough rules!)) - endif -""" % { 'last': ((num_outputs / 512) + 1) * 512 + 1 } - - root_makefile.write(SHARED_FOOTER % { 'generate_all_deps': all_deps }) + root_makefile.write(SHARED_FOOTER) root_makefile.close() diff --git a/tools/gyp/pylib/gyp/generator/msvs.py b/tools/gyp/pylib/gyp/generator/msvs.py index a4c6efd1a4..cca04e14ac 100644 --- a/tools/gyp/pylib/gyp/generator/msvs.py +++ b/tools/gyp/pylib/gyp/generator/msvs.py @@ -42,19 +42,7 @@ generator_default_variables = { 'SHARED_INTERMEDIATE_DIR': '$(OutDir)/obj/global_intermediate', 'OS': 'win', 'PRODUCT_DIR': '$(OutDir)', - - # TODO(jeanluc) The way we currently generate libraries makes Visual - # Studio 2010 unhappy. We get a lot of warnings like: - # warning MSB8012: TargetPath(...\Debug\gles2_c_lib.lib) does not match - # the Library's OutputFile property value (...\Debug\lib\gles2_c_lib.lib). - # This may cause your project to build incorrectly. To correct this, - # please make sure that $(OutDir), $(TargetName) and $(TargetExt) property - # values match the value specified in %(Lib.OutputFile). - # Despite the warnings, this compile correctly. It would be nice to get rid - # of the warnings. - - # TODO(jeanluc) I had: 'LIB_DIR': '$(OutDir)lib', - 'LIB_DIR': '$(OutDir)/lib', + 'LIB_DIR': '$(OutDir)\\lib', 'RULE_INPUT_ROOT': '$(InputName)', 'RULE_INPUT_DIRNAME': '$(InputDir)', 'RULE_INPUT_EXT': '$(InputExt)', @@ -254,7 +242,7 @@ def _ConfigFullName(config_name, config_data): def _BuildCommandLineForRuleRaw(spec, cmd, cygwin_shell, has_input_path, - quote_cmd): + quote_cmd, do_setup_env): if [x for x in cmd if '$(InputDir)' in x]: input_dir_preamble = ( @@ -285,9 +273,10 @@ def _BuildCommandLineForRuleRaw(spec, cmd, cygwin_shell, has_input_path, #direct_cmd = gyp.common.EncodePOSIXShellList(direct_cmd) direct_cmd = ' '.join(direct_cmd) # TODO(quote): regularize quoting path names throughout the module - cmd = ( - 'call "$(ProjectDir)%(cygwin_dir)s\\setup_env.bat" && ' - 'set CYGWIN=nontsec&& ') + cmd = '' + if do_setup_env: + cmd += 'call "$(ProjectDir)%(cygwin_dir)s\\setup_env.bat" && ' + cmd += 'set CYGWIN=nontsec&& ' if direct_cmd.find('NUMBER_OF_PROCESSORS') >= 0: cmd += 'set /a NUMBER_OF_PROCESSORS_PLUS_1=%%NUMBER_OF_PROCESSORS%%+1&& ' if direct_cmd.find('INTDIR') >= 0: @@ -319,10 +308,7 @@ def _BuildCommandLineForRuleRaw(spec, cmd, cygwin_shell, has_input_path, return input_dir_preamble + ' '.join(command + arguments) -def _BuildCommandLineForRule(spec, rule, has_input_path): - # Find path to cygwin. - cygwin_dir = _FixPath(spec.get('msvs_cygwin_dirs', ['.'])[0]) - +def _BuildCommandLineForRule(spec, rule, has_input_path, do_setup_env): # Currently this weird argument munging is used to duplicate the way a # python script would need to be run as part of the chrome tree. # Eventually we should add some sort of rule_default option to set this @@ -334,7 +320,7 @@ def _BuildCommandLineForRule(spec, rule, has_input_path): mcs = int(mcs) quote_cmd = int(rule.get('msvs_quote_cmd', 1)) return _BuildCommandLineForRuleRaw(spec, rule['action'], mcs, has_input_path, - quote_cmd) + quote_cmd, do_setup_env=do_setup_env) def _AddActionStep(actions_dict, inputs, outputs, description, command): @@ -503,7 +489,11 @@ def _GenerateNativeRulesForMSVS(p, rules, output_dir, spec, options): rule_ext = r['extension'] inputs = _FixPaths(r.get('inputs', [])) outputs = _FixPaths(r.get('outputs', [])) - cmd = _BuildCommandLineForRule(spec, r, has_input_path=True) + # Skip a rule with no action and no inputs. + if 'action' not in r and not r.get('rule_sources', []): + continue + cmd = _BuildCommandLineForRule(spec, r, has_input_path=True, + do_setup_env=True) rules_file.AddCustomBuildRule(name=rule_name, description=r.get('message', rule_name), extensions=[rule_ext], @@ -591,7 +581,7 @@ def _GenerateExternalRules(rules, output_dir, spec, 'IntDir=$(IntDir)', '-j', '${NUMBER_OF_PROCESSORS_PLUS_1}', '-f', filename] - cmd = _BuildCommandLineForRuleRaw(spec, cmd, True, False, True) + cmd = _BuildCommandLineForRuleRaw(spec, cmd, True, False, True, True) # Insert makefile as 0'th input, so it gets the action attached there, # as this is easier to understand from in the IDE. all_inputs = list(all_inputs) @@ -599,7 +589,8 @@ def _GenerateExternalRules(rules, output_dir, spec, _AddActionStep(actions_to_add, inputs=_FixPaths(all_inputs), outputs=_FixPaths(all_outputs), - description='Running %s' % cmd, + description='Running external rules for %s' % + spec['target_name'], command=cmd) @@ -707,6 +698,9 @@ def _EscapeCppDefineForMSVS(s): s = _EscapeEnvironmentVariableExpansion(s) s = _EscapeCommandLineArgumentForMSVS(s) s = _EscapeVCProjCommandLineArgListItem(s) + # cl.exe replaces literal # characters with = in preprocesor definitions for + # some reason. Octal-encode to work around that. + s = s.replace('#', '\\%03o' % ord('#')) return s @@ -743,6 +737,9 @@ def _EscapeCppDefineForMSBuild(s): s = _EscapeEnvironmentVariableExpansion(s) s = _EscapeCommandLineArgumentForMSBuild(s) s = _EscapeMSBuildSpecialCharacters(s) + # cl.exe replaces literal # characters with = in preprocesor definitions for + # some reason. Octal-encode to work around that. + s = s.replace('#', '\\%03o' % ord('#')) return s @@ -833,6 +830,20 @@ def _GetGuidOfProject(proj_path, spec): return guid +def _GetMsbuildToolsetOfProject(proj_path, spec): + """Get the platform toolset for the project. + + Arguments: + proj_path: Path of the vcproj or vcxproj file to generate. + spec: The target dictionary containing the properties of the target. + Returns: + the platform toolset string or None. + """ + # Pluck out the default configuration. + default_config = _GetDefaultConfiguration(spec) + return default_config.get('msbuild_toolset') + + def _GenerateProject(project, options, version, generator_flags): """Generates a vcproj file. @@ -841,17 +852,19 @@ def _GenerateProject(project, options, version, generator_flags): options: global generator options. version: the MSVSVersion object. generator_flags: dict of generator-specific flags. + Returns: + A list of source files that cannot be found on disk. """ default_config = _GetDefaultConfiguration(project.spec) # Skip emitting anything if told to with msvs_existing_vcproj option. if default_config.get('msvs_existing_vcproj'): - return + return [] if version.UsesVcxproj(): - _GenerateMSBuildProject(project, options, version, generator_flags) + return _GenerateMSBuildProject(project, options, version, generator_flags) else: - _GenerateMSVSProject(project, options, version, generator_flags) + return _GenerateMSVSProject(project, options, version, generator_flags) def _GenerateMSVSProject(project, options, version, generator_flags): @@ -896,7 +909,7 @@ def _GenerateMSVSProject(project, options, version, generator_flags): spec, options, project_dir, sources, excluded_sources, list_excluded)) # Add in files. - _VerifySourcesExist(sources, project_dir) + missing_sources = _VerifySourcesExist(sources, project_dir) p.AddFiles(sources) _AddToolFilesToMSVS(p, spec) @@ -916,6 +929,8 @@ def _GenerateMSVSProject(project, options, version, generator_flags): # Write it out. p.WriteIfChanged() + return missing_sources + def _GetUniquePlatforms(spec): """Returns the list of unique platforms for this spec, e.g ['win32', ...]. @@ -1121,9 +1136,6 @@ def _GetOutputFilePathAndTool(spec): 'executable': ('VCLinkerTool', 'Link', '$(OutDir)\\', '.exe'), 'shared_library': ('VCLinkerTool', 'Link', '$(OutDir)\\', '.dll'), 'loadable_module': ('VCLinkerTool', 'Link', '$(OutDir)\\', '.dll'), - # TODO(jeanluc) If we want to avoid the MSB8012 warnings in - # VisualStudio 2010, we will have to change the value of $(OutDir) - # to contain the \lib suffix, rather than doing it as below. 'static_library': ('VCLibrarianTool', 'Lib', '$(OutDir)\\lib\\', '.lib'), } output_file_props = output_file_map.get(spec['type']) @@ -1164,7 +1176,7 @@ def _GetDisabledWarnings(config): def _GetModuleDefinition(spec): def_file = '' - if spec['type'] in ['shared_library', 'loadable_module']: + if spec['type'] in ['shared_library', 'loadable_module', 'executable']: def_files = [s for s in spec.get('sources', []) if s.endswith('.def')] if len(def_files) == 1: def_file = _FixPath(def_files[0]) @@ -1237,10 +1249,6 @@ def _GetMSVSAttributes(spec, config, config_type): prepared_attrs['ConfigurationType'] = config_type output_dir = prepared_attrs.get('OutputDirectory', '$(SolutionDir)$(ConfigurationName)') - # TODO(jeanluc) If we want to avoid the MSB8012 warning, we should - # add code like the following to place libraries in their own directory. - # if config_type == '4': - # output_dir = spec.get('product_dir', output_dir + '\\lib') prepared_attrs['OutputDirectory'] = output_dir if 'IntermediateDirectory' not in prepared_attrs: intermediate = '$(ConfigurationName)\\obj\\$(ProjectName)' @@ -1276,7 +1284,7 @@ def _PrepareListOfSources(spec, gyp_file): # Add in 'action' inputs and outputs. for a in spec.get('actions', []): - inputs = a.get('inputs', []) + inputs = a['inputs'] inputs = [_NormalizedSource(i) for i in inputs] # Add all inputs to sources and excluded sources. inputs = set(inputs) @@ -1445,10 +1453,19 @@ def _HandlePreCompiledHeaders(p, sources, spec): def _AddActions(actions_to_add, spec, relative_path_of_gyp_file): # Add actions. actions = spec.get('actions', []) + # Don't setup_env every time. When all the actions are run together in one + # batch file in VS, the PATH will grow too long. + # Membership in this set means that the cygwin environment has been set up, + # and does not need to be set up again. + have_setup_env = set() for a in actions: - cmd = _BuildCommandLineForRule(spec, a, has_input_path=False) # Attach actions to the gyp file if nothing else is there. inputs = a.get('inputs') or [relative_path_of_gyp_file] + attached_to = inputs[0] + need_setup_env = attached_to not in have_setup_env + cmd = _BuildCommandLineForRule(spec, a, has_input_path=False, + do_setup_env=need_setup_env) + have_setup_env.add(attached_to) # Add the action. _AddActionStep(actions_to_add, inputs=inputs, @@ -1638,6 +1655,9 @@ def _CreateProjectObjects(target_list, target_dicts, options, msvs_version): build_file=build_file, config_platform_overrides=overrides, fixpath_prefix=fixpath_prefix) + # Set project toolset if any (MS build only) + if msvs_version.UsesVcxproj(): + obj.set_msbuild_toolset(_GetMsbuildToolsetOfProject(proj_path, spec)) projects[qualified_target] = obj # Set all the dependencies for project in projects.values(): @@ -1775,9 +1795,11 @@ def GenerateOutput(target_list, target_dicts, data, params): msvs_version) # Generate each project. + missing_sources = [] for project in project_objects.values(): fixpath_prefix = project.fixpath_prefix - _GenerateProject(project, options, msvs_version, generator_flags) + missing_sources.extend(_GenerateProject(project, options, msvs_version, + generator_flags)) fixpath_prefix = None for build_file in data: @@ -1801,6 +1823,14 @@ def GenerateOutput(target_list, target_dicts, data, params): version=msvs_version) sln.Write() + if missing_sources: + error_message = "Missing input files:\n" + \ + '\n'.join(set(missing_sources)) + if generator_flags.get('msvs_error_on_missing_sources', False): + raise Exception(error_message) + else: + print >>sys.stdout, "Warning: " + error_message + def _GenerateMSBuildFiltersFile(filters_path, source_files, extension_to_rule_name): @@ -1916,6 +1946,9 @@ def _GenerateRulesForMSBuild(output_dir, options, spec, msbuild_rules = [] for rule in rules_native: + # Skip a rule with no action and no inputs. + if 'action' not in rule and not rule.get('rule_sources', []): + continue msbuild_rule = MSBuildRule(rule, spec) msbuild_rules.append(msbuild_rule) extension_to_rule_name[msbuild_rule.extension] = msbuild_rule.rule_name @@ -1953,6 +1986,7 @@ class MSBuildRule(object): depends_on: The name of the DependsOn element. compute_output: The name of the ComputeOutput element. dirs_to_make: The name of the DirsToMake element. + inputs: The name of the _inputs element. tlog: The name of the _tlog element. extension: The extension this rule applies to. description: The message displayed when this rule is invoked. @@ -1974,6 +2008,7 @@ class MSBuildRule(object): self.depends_on = self.rule_name + 'DependsOn' self.compute_output = 'Compute%sOutput' % self.rule_name self.dirs_to_make = self.rule_name + 'DirsToMake' + self.inputs = self.rule_name + '_inputs' self.tlog = self.rule_name + '_tlog' self.extension = rule['extension'] if not self.extension.startswith('.'): @@ -1988,7 +2023,8 @@ class MSBuildRule(object): old_outputs = _FixPaths(rule.get('outputs', [])) self.outputs = ';'.join([MSVSSettings.ConvertVCMacrosToMSBuild(i) for i in old_outputs]) - old_command = _BuildCommandLineForRule(spec, rule, has_input_path=True) + old_command = _BuildCommandLineForRule(spec, rule, has_input_path=True, + do_setup_env=True) self.command = MSVSSettings.ConvertVCMacrosToMSBuild(old_command) @@ -2072,6 +2108,10 @@ def _GenerateMSBuildRuleTargetsFile(targets_path, msbuild_rules): } ] ] + inputs_section = [ + 'ItemGroup', + [rule.inputs, {'Include': '%%(%s.AdditionalDependencies)' % rule_name}] + ] logging_section = [ 'ItemGroup', [rule.tlog, @@ -2081,6 +2121,7 @@ def _GenerateMSBuildRuleTargetsFile(targets_path, msbuild_rules): (rule_name, rule_name)) }, ['Source', "@(%s, '|')" % rule_name], + ['Inputs', "@(%s -> '%%(Fullpath)', ';')" % rule.inputs], ], ] message_section = [ @@ -2089,7 +2130,7 @@ def _GenerateMSBuildRuleTargetsFile(targets_path, msbuild_rules): 'Text': '%%(%s.ExecutionDescription)' % rule_name } ] - write_lines_section = [ + write_tlog_section = [ 'WriteLinesToFile', {'Condition': "'@(%s)' != '' and '%%(%s.ExcludedFromBuild)' != " "'true'" % (rule.tlog, rule.tlog), @@ -2098,6 +2139,14 @@ def _GenerateMSBuildRuleTargetsFile(targets_path, msbuild_rules): rule.tlog) } ] + read_tlog_section = [ + 'WriteLinesToFile', + {'Condition': "'@(%s)' != '' and '%%(%s.ExcludedFromBuild)' != " + "'true'" % (rule.tlog, rule.tlog), + 'File': '$(IntDir)$(ProjectName).read.1.tlog', + 'Lines': "^%%(%s.Source);%%(%s.Inputs)" % (rule.tlog, rule.tlog) + } + ] command_and_input_section = [ rule_name, {'Condition': "'@(%s)' != '' and '%%(%s.ExcludedFromBuild)' != " @@ -2119,9 +2168,11 @@ def _GenerateMSBuildRuleTargetsFile(targets_path, msbuild_rules): 'Inputs': target_inputs }, remove_section, + inputs_section, logging_section, message_section, - write_lines_section, + write_tlog_section, + read_tlog_section, command_and_input_section, ], ['PropertyGroup', @@ -2373,16 +2424,12 @@ def _GetMSBuildProjectConfigurations(configurations): def _GetMSBuildGlobalProperties(spec, guid, gyp_file_name): - prefix = spec.get('product_prefix', '') - product_name = spec.get('product_name', '$(ProjectName)') - target_name = prefix + product_name namespace = os.path.splitext(gyp_file_name)[0] return [ ['PropertyGroup', {'Label': 'Globals'}, ['ProjectGuid', guid], ['Keyword', 'Win32Proj'], ['RootNamespace', namespace], - ['TargetName', target_name], ] ] @@ -2401,24 +2448,66 @@ def _GetMSBuildConfigurationDetails(spec, build_file): return _GetMSBuildPropertyGroup(spec, 'Configuration', properties) +def _GetMSBuildLocalProperties(msbuild_toolset): + # Currently the only local property we support is PlatformToolset + properties = {} + if msbuild_toolset: + properties = [ + ['PropertyGroup', {'Label': 'Locals'}, + ['PlatformToolset', msbuild_toolset], + ] + ] + return properties + + def _GetMSBuildPropertySheets(configurations): user_props = r'$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props' - return [ - ['ImportGroup', - {'Label': 'PropertySheets'}, - ['Import', - {'Project': user_props, - 'Condition': "exists('%s')" % user_props, - 'Label': 'LocalAppDataPlatform' - } - ] - ] + additional_props = {} + props_specified = False + for name, settings in sorted(configurations.iteritems()): + configuration = _GetConfigurationCondition(name, settings) + if settings.has_key('msbuild_props'): + additional_props[configuration] = _FixPaths(settings['msbuild_props']) + props_specified = True + else: + additional_props[configuration] = '' + + if not props_specified: + return [ + ['ImportGroup', + {'Label': 'PropertySheets'}, + ['Import', + {'Project': user_props, + 'Condition': "exists('%s')" % user_props, + 'Label': 'LocalAppDataPlatform' + } + ] + ] ] + else: + sheets = [] + for condition, props in additional_props.iteritems(): + import_group = [ + 'ImportGroup', + {'Label': 'PropertySheets', + 'Condition': condition + }, + ['Import', + {'Project': user_props, + 'Condition': "exists('%s')" % user_props, + 'Label': 'LocalAppDataPlatform' + } + ] + ] + for props_file in props: + import_group.append(['Import', {'Project':props_file}]) + sheets.append(import_group) + return sheets + +def _ConvertMSVSBuildAttributes(spec, config, build_file): + -def _GetMSBuildAttributes(spec, config, build_file): - # Use the MSVS attributes and convert them. In the future, we may want to - # support Gyp files specifying 'msbuild_configuration_attributes' directly. config_type = _GetMSVSConfigurationType(spec, build_file) msvs_attributes = _GetMSVSAttributes(spec, config, config_type) msbuild_attributes = {} @@ -2429,22 +2518,77 @@ def _GetMSBuildAttributes(spec, config, build_file): directory += '\\' msbuild_attributes[a] = directory elif a == 'CharacterSet': - msbuild_attributes[a] = { - '0': 'MultiByte', - '1': 'Unicode' - }[msvs_attributes[a]] + msbuild_attributes[a] = _ConvertMSVSCharacterSet(msvs_attributes[a]) elif a == 'ConfigurationType': - msbuild_attributes[a] = { - '1': 'Application', - '2': 'DynamicLibrary', - '4': 'StaticLibrary', - '10': 'Utility' - }[msvs_attributes[a]] + msbuild_attributes[a] = _ConvertMSVSConfigurationType(msvs_attributes[a]) else: print 'Warning: Do not know how to convert MSVS attribute ' + a return msbuild_attributes +def _ConvertMSVSCharacterSet(char_set): + if char_set.isdigit(): + char_set = { + '0': 'MultiByte', + '1': 'Unicode', + '2': 'MultiByte', + }[char_set] + return char_set + + +def _ConvertMSVSConfigurationType(config_type): + if config_type.isdigit(): + config_type = { + '1': 'Application', + '2': 'DynamicLibrary', + '4': 'StaticLibrary', + '10': 'Utility' + }[config_type] + return config_type + + +def _GetMSBuildAttributes(spec, config, build_file): + if 'msbuild_configuration_attributes' not in config: + msbuild_attributes = _ConvertMSVSBuildAttributes(spec, config, build_file) + + else: + config_type = _GetMSVSConfigurationType(spec, build_file) + config_type = _ConvertMSVSConfigurationType(config_type) + msbuild_attributes = config.get('msbuild_configuration_attributes', {}) + msbuild_attributes['ConfigurationType'] = config_type + output_dir = msbuild_attributes.get('OutputDirectory', + '$(SolutionDir)$(Configuration)\\') + msbuild_attributes['OutputDirectory'] = output_dir + if 'IntermediateDirectory' not in msbuild_attributes: + intermediate = '$(Configuration)\\' + msbuild_attributes['IntermediateDirectory'] = intermediate + if 'CharacterSet' in msbuild_attributes: + msbuild_attributes['CharacterSet'] = _ConvertMSVSCharacterSet( + msbuild_attributes['CharacterSet']) + if 'TargetName' not in msbuild_attributes: + prefix = spec.get('product_prefix', '') + product_name = spec.get('product_name', '$(ProjectName)') + target_name = prefix + product_name + msbuild_attributes['TargetName'] = target_name + + # Make sure that 'TargetPath' matches 'Lib.OutputFile' or 'Link.OutputFile' + # (depending on the tool used) to avoid MSB8012 warning. + msbuild_tool_map = { + 'executable': 'Link', + 'shared_library': 'Link', + 'loadable_module': 'Link', + 'static_library': 'Lib', + } + msbuild_tool = msbuild_tool_map.get(spec['type']) + if msbuild_tool: + msbuild_settings = config['finalized_msbuild_settings'] + out_file = msbuild_settings[msbuild_tool].get('OutputFile') + if out_file: + msbuild_attributes['TargetPath'] = out_file + + return msbuild_attributes + + def _GetMSBuildConfigurationGlobalProperties(spec, configurations, build_file): # TODO(jeanluc) We could optimize out the following and do it only if # there are actions. @@ -2470,6 +2614,13 @@ def _GetMSBuildConfigurationGlobalProperties(spec, configurations, build_file): attributes['IntermediateDirectory']) _AddConditionalProperty(properties, condition, 'OutDir', attributes['OutputDirectory']) + _AddConditionalProperty(properties, condition, 'TargetName', + attributes['TargetName']) + + if attributes.get('TargetPath'): + _AddConditionalProperty(properties, condition, 'TargetPath', + attributes['TargetPath']) + if new_paths: _AddConditionalProperty(properties, condition, 'ExecutablePath', new_paths) @@ -2500,6 +2651,10 @@ def _AddConditionalProperty(properties, condition, name, value): conditions.append(condition) +# Regex for msvs variable references ( i.e. $(FOO) ). +MSVS_VARIABLE_REFERENCE = re.compile('\$\(([a-zA-Z_][a-zA-Z0-9_]*)\)') + + def _GetMSBuildPropertyGroup(spec, label, properties): """Returns a PropertyGroup definition for the specified properties. @@ -2514,7 +2669,31 @@ def _GetMSBuildPropertyGroup(spec, label, properties): if label: group.append({'Label': label}) num_configurations = len(spec['configurations']) - for name, values in sorted(properties.iteritems()): + def GetEdges(node): + # Use a definition of edges such that user_of_variable -> used_varible. + # This happens to be easier in this case, since a variable's + # definition contains all variables it references in a single string. + edges = set() + for value in sorted(properties[node].keys()): + # Add to edges all $(...) references to variables. + # + # Variable references that refer to names not in properties are excluded + # These can exist for instance to refer built in definitions like + # $(SolutionDir). + # + # Self references are ignored. Self reference is used in a few places to + # append to the default value. I.e. PATH=$(PATH);other_path + edges.update(set([v for v in MSVS_VARIABLE_REFERENCE.findall(value) + if v in properties and v != node])) + return edges + properties_ordered = gyp.common.TopologicallySorted( + properties.keys(), GetEdges) + # Walk properties in the reverse of a topological sort on + # user_of_variable -> used_variable as this ensures variables are + # defined before they are used. + # NOTE: reverse(topsort(DAG)) = topsort(reverse_edges(DAG)) + for name in reversed(properties_ordered): + values = properties[name] for value, conditions in sorted(values.iteritems()): if len(conditions) == num_configurations: # If the value is the same all configurations, @@ -2658,16 +2837,19 @@ def _VerifySourcesExist(sources, root_dir): Arguments: sources: A recursive list of Filter/file names. root_dir: The root directory for the relative path names. + Returns: + A list of source files that cannot be found on disk. """ + missing_sources = [] for source in sources: if isinstance(source, MSVSProject.Filter): - _VerifySourcesExist(source.contents, root_dir) + missing_sources.extend(_VerifySourcesExist(source.contents, root_dir)) else: if '$' not in source: full_path = os.path.join(root_dir, source) if not os.path.exists(full_path): - print 'Warning: Missing input file ' + full_path + ' pwd=' +\ - os.getcwd() + missing_sources.append(full_path) + return missing_sources def _GetMSBuildSources(spec, sources, exclusions, extension_to_rule_name, @@ -2808,7 +2990,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags): _GenerateMSBuildFiltersFile(project.path + '.filters', sources, extension_to_rule_name) - _VerifySourcesExist(sources, project_dir) + missing_sources = _VerifySourcesExist(sources, project_dir) for (_, configuration) in configurations.iteritems(): _FinalizeMSBuildSettings(spec, configuration) @@ -2834,6 +3016,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags): content += _GetMSBuildGlobalProperties(spec, project.guid, project_file_name) content += import_default_section content += _GetMSBuildConfigurationDetails(spec, project.build_file) + content += _GetMSBuildLocalProperties(project.msbuild_toolset) content += import_cpp_props_section content += _GetMSBuildExtensions(props_files_of_rules) content += _GetMSBuildPropertySheets(configurations) @@ -2853,6 +3036,8 @@ def _GenerateMSBuildProject(project, options, version, generator_flags): easy_xml.WriteXmlIfChanged(content, project.path) + return missing_sources + def _GetMSBuildExtensions(props_files_of_rules): extensions = ['ImportGroup', {'Label': 'ExtensionSettings'}] @@ -2900,7 +3085,13 @@ def _GenerateActionsForMSBuild(spec, actions_to_add): commands.append(cmd) # Add the custom build action for one input file. description = ', and also '.join(descriptions) - command = ' && '.join(commands) + + # We can't join the commands simply with && because the command line will + # get too long. See also _AddActions: cygwin's setup_env mustn't be called + # for every invocation or the command that sets the PATH will grow too + # long. + command = ( + '\r\nif %errorlevel% neq 0 exit /b %errorlevel%\r\n'.join(commands)) _AddMSBuildAction(spec, primary_input, inputs, diff --git a/tools/gyp/pylib/gyp/generator/ninja.py b/tools/gyp/pylib/gyp/generator/ninja.py index 8d6c6f52d1..6f6fc5bb64 100644 --- a/tools/gyp/pylib/gyp/generator/ninja.py +++ b/tools/gyp/pylib/gyp/generator/ninja.py @@ -5,8 +5,11 @@ import copy import gyp import gyp.common +import gyp.msvs_emulation +import gyp.MSVSVersion import gyp.system_test import gyp.xcode_emulation +import hashlib import os.path import re import subprocess @@ -43,11 +46,16 @@ generator_default_variables = { 'RULE_INPUT_NAME': '${name}', } -# TODO: enable cross compiling once we figure out: -# - how to not build extra host objects in the non-cross-compile case. -# - how to decide what the host compiler is (should not just be $cc). -# - need ld_host as well. -generator_supports_multiple_toolsets = False +# Placates pylint. +generator_additional_non_configuration_keys = [] +generator_additional_path_sections = [] +generator_extra_sources_for_rules = [] + +# TODO: figure out how to not build extra host objects in the non-cross-compile +# case when this is enabled, and enable unconditionally. +generator_supports_multiple_toolsets = ( + os.environ.get('AR_target') or os.environ.get('CC_target') or + os.environ.get('CXX_target')) def StripPrefix(arg, prefix): @@ -56,16 +64,28 @@ def StripPrefix(arg, prefix): return arg -def QuoteShellArgument(arg): +def QuoteShellArgument(arg, flavor): """Quote a string such that it will be interpreted as a single argument by the shell.""" # Rather than attempting to enumerate the bad shell characters, just # whitelist common OK ones and quote anything else. - if re.match(r'^[a-zA-Z0-9_=-]+$', arg): + if re.match(r'^[a-zA-Z0-9_=.\\/-]+$', arg): return arg # No quoting necessary. + if flavor == 'win': + return gyp.msvs_emulation.QuoteForRspFile(arg) return "'" + arg.replace("'", "'" + '"\'"' + "'") + "'" +def Define(d, flavor): + """Takes a preprocessor define and returns a -D parameter that's ninja- and + shell-escaped.""" + if flavor == 'win': + # cl.exe replaces literal # characters with = in preprocesor definitions for + # some reason. Octal-encode to work around that. + d = d.replace('#', '\\%03o' % ord('#')) + return QuoteShellArgument(ninja_syntax.escape('-D' + d), flavor) + + def InvertRelativePath(path): """Given a relative path like foo/bar, return the inverse relative path: the path from the relative path back to the origin dir. @@ -120,14 +140,34 @@ class Target: # Path to the file representing the completion of building the bundle, # if any. self.bundle = None + # On Windows, incremental linking requires linking against all the .objs + # that compose a .lib (rather than the .lib itself). That list is stored + # here. + self.component_objs = None + # Windows only. The import .lib is the output of a build step, but + # because dependents only link against the lib (not both the lib and the + # dll) we keep track of the import library here. + self.import_lib = None def Linkable(self): """Return true if this is a target that can be linked against.""" return self.type in ('static_library', 'shared_library') - def PreActionInput(self): + def UsesToc(self, flavor): + """Return true if the target should produce a restat rule based on a TOC + file.""" + # For bundles, the .TOC should be produced for the binary, not for + # FinalOutput(). But the naive approach would put the TOC file into the + # bundle, so don't do this for bundles for now. + if flavor == 'win' or self.bundle: + return False + return self.type in ('shared_library', 'loadable_module') + + def PreActionInput(self, flavor): """Return the path, if any, that should be used as a dependency of any dependent action step.""" + if self.UsesToc(flavor): + return self.FinalOutput() + '.TOC' return self.FinalOutput() or self.preaction_stamp def PreCompileInput(self): @@ -162,12 +202,12 @@ class Target: # into the equivalent ninja path. # # - GypPathToUniqueOutput translates a gyp path into a ninja path to write -# an output file; the result can be namespaced such that is unique +# an output file; the result can be namespaced such that it is unique # to the input file name as well as the output target name. class NinjaWriter: - def __init__(self, target_outputs, base_dir, build_dir, output_file, flavor, - abs_build_dir=None): + def __init__(self, qualified_target, target_outputs, base_dir, build_dir, + output_file, flavor, abs_build_dir=None): """ base_dir: path from source root to directory containing this gyp file, by gyp semantics, all input paths are relative to this @@ -175,6 +215,7 @@ class NinjaWriter: abs_build_dir: absolute path to the build directory """ + self.qualified_target = qualified_target self.target_outputs = target_outputs self.base_dir = base_dir self.build_dir = build_dir @@ -182,6 +223,11 @@ class NinjaWriter: self.flavor = flavor self.abs_build_dir = abs_build_dir self.obj_ext = '.obj' if flavor == 'win' else '.o' + if flavor == 'win': + # See docstring of msvs_emulation.GenerateEnvironmentFiles(). + self.win_env = {} + for arch in ('x86', 'x64'): + self.win_env[arch] = 'environment.' + arch # Relative path from build output dir to base dir. self.build_to_base = os.path.join(InvertRelativePath(build_dir), base_dir) @@ -212,10 +258,12 @@ class NinjaWriter: # so insert product_dir in front if it is provided. path = path.replace(INTERMEDIATE_DIR, os.path.join(product_dir or '', int_dir)) - - return os.path.normpath(path) + return path def ExpandRuleVariables(self, path, root, dirname, source, ext, name): + if self.flavor == 'win': + path = self.msvs_settings.ConvertVSMacros( + path, config=self.config_name) path = path.replace(generator_default_variables['RULE_INPUT_ROOT'], root) path = path.replace(generator_default_variables['RULE_INPUT_DIRNAME'], dirname) @@ -230,9 +278,15 @@ class NinjaWriter: See the above discourse on path conversions.""" if env: - path = gyp.xcode_emulation.ExpandEnvVars(path, env) + if self.flavor == 'mac': + path = gyp.xcode_emulation.ExpandEnvVars(path, env) + elif self.flavor == 'win': + path = gyp.msvs_emulation.ExpandMacros(path, env) if path.startswith('$!'): - return self.ExpandSpecial(path) + expanded = self.ExpandSpecial(path) + if self.flavor == 'win': + expanded = os.path.normpath(expanded) + return expanded assert '$' not in path, path return os.path.normpath(os.path.join(self.build_to_base, path)) @@ -284,7 +338,7 @@ class NinjaWriter: self.ninja.newline() return targets[0] - def WriteSpec(self, spec, config_name): + def WriteSpec(self, spec, config_name, generator_flags): """The main entry point for NinjaWriter: write the build rules for a spec. Returns a Target object, which represents the output paths for this spec. @@ -298,10 +352,14 @@ class NinjaWriter: self.target = Target(spec['type']) self.is_mac_bundle = gyp.xcode_emulation.IsMacBundle(self.flavor, spec) + self.xcode_settings = self.msvs_settings = None if self.flavor == 'mac': self.xcode_settings = gyp.xcode_emulation.XcodeSettings(spec) - else: - self.xcode_settings = None + if self.flavor == 'win': + self.msvs_settings = gyp.msvs_emulation.MsvsSettings(spec, + generator_flags) + target_platform = self.msvs_settings.GetTargetPlatform(config_name) + self.ninja.variable('arch', self.win_env[target_platform]) # Compute predepends for all rules. # actions_depends is the dependencies this target depends on before running @@ -316,7 +374,7 @@ class NinjaWriter: for dep in spec['dependencies']: if dep in self.target_outputs: target = self.target_outputs[dep] - actions_depends.append(target.PreActionInput()) + actions_depends.append(target.PreActionInput(self.flavor)) compile_depends.append(target.PreCompileInput()) actions_depends = filter(None, actions_depends) compile_depends = filter(None, compile_depends) @@ -345,15 +403,23 @@ class NinjaWriter: link_deps = [] sources = spec.get('sources', []) + extra_sources if sources: + pch = None + if self.flavor == 'win': + pch = gyp.msvs_emulation.PrecompiledHeader( + self.msvs_settings, config_name, self.GypPathToNinja) + else: + pch = gyp.xcode_emulation.MacPrefixHeader( + self.xcode_settings, self.GypPathToNinja, + lambda path, lang: self.GypPathToUniqueOutput(path + '-' + lang)) link_deps = self.WriteSources( - config_name, config, sources, compile_depends_stamp, - gyp.xcode_emulation.MacPrefixHeader( - self.xcode_settings, self.GypPathToNinja, - lambda path, lang: self.GypPathToUniqueOutput(path + '-' + lang))) + config_name, config, sources, compile_depends_stamp, pch) # Some actions/rules output 'sources' that are already object files. link_deps += [self.GypPathToNinja(f) for f in sources if f.endswith(self.obj_ext)] + if self.flavor == 'win' and self.target.type == 'static_library': + self.target.component_objs = link_deps + # Write out a link step, if needed. output = None if link_deps or self.target.actions_stamp or actions_depends: @@ -369,15 +435,43 @@ class NinjaWriter: if not output: return None - if self.name != output and self.toolset == 'target': - # Write a short name to build this target. This benefits both the - # "build chrome" case as well as the gyp tests, which expect to be - # able to run actions and build libraries by their short name. - self.ninja.build(self.name, 'phony', output) - assert self.target.FinalOutput(), output return self.target + def _WinIdlRule(self, source, prebuild, outputs): + """Handle the implicit VS .idl rule for one source file. Fills |outputs| + with files that are generated.""" + outdir, output, vars, flags = self.msvs_settings.GetIdlBuildData( + source, self.config_name) + outdir = self.GypPathToNinja(outdir) + def fix_path(path, rel=None): + path = os.path.join(outdir, path) + dirname, basename = os.path.split(source) + root, ext = os.path.splitext(basename) + path = self.ExpandRuleVariables( + path, root, dirname, source, ext, basename) + if rel: + path = os.path.relpath(path, rel) + return path + vars = [(name, fix_path(value, outdir)) for name, value in vars] + output = [fix_path(p) for p in output] + vars.append(('outdir', outdir)) + vars.append(('idlflags', flags)) + input = self.GypPathToNinja(source) + self.ninja.build(output, 'idl', input, + variables=vars, order_only=prebuild) + outputs.extend(output) + + def WriteWinIdlFiles(self, spec, prebuild): + """Writes rules to match MSVS's implicit idl handling.""" + assert self.flavor == 'win' + if self.msvs_settings.HasExplicitIdlRules(spec): + return [] + outputs = [] + for source in filter(lambda x: x.endswith('.idl'), spec['sources']): + self._WinIdlRule(source, prebuild, outputs) + return outputs + def WriteActionsRulesCopies(self, spec, extra_sources, prebuild, mac_bundle_depends): """Write out the Actions, Rules, and Copies steps. Return a path @@ -394,6 +488,9 @@ class NinjaWriter: if 'copies' in spec: outputs += self.WriteCopies(spec['copies'], prebuild) + if 'sources' in spec and self.flavor == 'win': + outputs += self.WriteWinIdlFiles(spec, prebuild) + stamp = self.WriteCollapsedDependencies('actions_rules_copies', outputs) if self.is_mac_bundle: @@ -421,16 +518,26 @@ class NinjaWriter: def WriteActions(self, actions, extra_sources, prebuild, extra_mac_bundle_resources): # Actions cd into the base directory. - env = self.GetXcodeEnv() + env = self.GetSortedXcodeEnv() + if self.flavor == 'win': + env = self.msvs_settings.GetVSMacroEnv( + '$!PRODUCT_DIR', config=self.config_name) all_outputs = [] for action in actions: # First write out a rule for the action. - name = re.sub(r'[ {}$]', '_', action['action_name']) + name = '%s_%s' % (action['action_name'], + hashlib.md5(self.qualified_target).hexdigest()) description = self.GenerateDescription('ACTION', action.get('message', None), name) - rule_name = self.WriteNewNinjaRule(name, action['action'], description, - env=env) + is_cygwin = (self.msvs_settings.IsRuleRunUnderCygwin(action) + if self.flavor == 'win' else False) + args = action['action'] + args = [self.msvs_settings.ConvertVSMacros( + arg, self.base_to_build, config=self.config_name) + for arg in args] if self.flavor == 'win' else args + rule_name = self.WriteNewNinjaRule(name, args, description, + is_cygwin, env=env) inputs = [self.GypPathToNinja(i, env) for i in action['inputs']] if int(action.get('process_outputs_as_sources', False)): @@ -453,13 +560,22 @@ class NinjaWriter: all_outputs = [] for rule in rules: # First write out a rule for the rule action. - name = rule['rule_name'] + name = '%s_%s' % (rule['rule_name'], + hashlib.md5(self.qualified_target).hexdigest()) + # Skip a rule with no action and no inputs. + if 'action' not in rule and not rule.get('rule_sources', []): + continue args = rule['action'] description = self.GenerateDescription( 'RULE', rule.get('message', None), ('%s ' + generator_default_variables['RULE_INPUT_PATH']) % name) - rule_name = self.WriteNewNinjaRule(name, args, description) + is_cygwin = (self.msvs_settings.IsRuleRunUnderCygwin(rule) + if self.flavor == 'win' else False) + args = [self.msvs_settings.ConvertVSMacros( + arg, self.base_to_build, config=self.config_name) + for arg in args] if self.flavor == 'win' else args + rule_name = self.WriteNewNinjaRule(name, args, description, is_cygwin) # TODO: if the command references the outputs directly, we should # simplify it to just use $out. @@ -474,16 +590,23 @@ class NinjaWriter: if ('${%s}' % var) in argument: needed_variables.add(var) + def cygwin_munge(path): + if is_cygwin: + return path.replace('\\', '/') + return path + # For each source file, write an edge that generates all the outputs. for source in rule.get('rule_sources', []): dirname, basename = os.path.split(source) root, ext = os.path.splitext(basename) - # Gather the list of outputs, expanding $vars if possible. - outputs = [] - for output in rule['outputs']: - outputs.append(self.ExpandRuleVariables(output, root, dirname, - source, ext, basename)) + # Gather the list of inputs and outputs, expanding $vars if possible. + outputs = [self.ExpandRuleVariables(o, root, dirname, + source, ext, basename) + for o in rule['outputs']] + inputs = [self.ExpandRuleVariables(i, root, dirname, + source, ext, basename) + for i in rule.get('inputs', [])] if int(rule.get('process_outputs_as_sources', False)): extra_sources += outputs @@ -493,24 +616,26 @@ class NinjaWriter: extra_bindings = [] for var in needed_variables: if var == 'root': - extra_bindings.append(('root', root)) + extra_bindings.append(('root', cygwin_munge(root))) elif var == 'dirname': - extra_bindings.append(('dirname', dirname)) + extra_bindings.append(('dirname', cygwin_munge(dirname))) elif var == 'source': # '$source' is a parameter to the rule action, which means # it shouldn't be converted to a Ninja path. But we don't # want $!PRODUCT_DIR in there either. source_expanded = self.ExpandSpecial(source, self.base_to_build) - extra_bindings.append(('source', source_expanded)) + extra_bindings.append(('source', cygwin_munge(source_expanded))) elif var == 'ext': extra_bindings.append(('ext', ext)) elif var == 'name': - extra_bindings.append(('name', basename)) + extra_bindings.append(('name', cygwin_munge(basename))) else: assert var == None, repr(var) - inputs = map(self.GypPathToNinja, rule.get('inputs', [])) + inputs = map(self.GypPathToNinja, inputs) outputs = map(self.GypPathToNinja, outputs) + extra_bindings.append(('unique_name', + re.sub('[^a-zA-Z0-9_]', '_', outputs[0]))) self.ninja.build(outputs, rule_name, self.GypPathToNinja(source), implicit=inputs, order_only=prebuild, @@ -522,7 +647,7 @@ class NinjaWriter: def WriteCopies(self, copies, prebuild): outputs = [] - env = self.GetXcodeEnv() + env = self.GetSortedXcodeEnv() for copy in copies: for path in copy['files']: # Normalize the path so trailing slashes don't confuse us. @@ -555,12 +680,11 @@ class NinjaWriter: # Create an intermediate file to store preprocessed results. intermediate_plist = self.GypPathToUniqueOutput( os.path.basename(info_plist)) - defines = ' '.join( - [QuoteShellArgument(ninja_syntax.escape('-D' + d)) for d in defines]) + defines = ' '.join([Define(d, self.flavor) for d in defines]) info_plist = self.ninja.build(intermediate_plist, 'infoplist', info_plist, variables=[('defines',defines)]) - env = self.GetXcodeEnv(additional_settings=extra_env) + env = self.GetSortedXcodeEnv(additional_settings=extra_env) env = self.ComputeExportEnvString(env) self.ninja.build(out, 'mac_tool', info_plist, @@ -571,10 +695,13 @@ class NinjaWriter: def WriteSources(self, config_name, config, sources, predepends, precompiled_header): """Write build rules to compile all of |sources|.""" - if self.toolset == 'host': - self.ninja.variable('cc', '$cc_host') - self.ninja.variable('cxx', '$cxx_host') + if self.toolset == 'target': + self.ninja.variable('ar', '$ar_target') + self.ninja.variable('cc', '$cc_target') + self.ninja.variable('cxx', '$cxx_target') + self.ninja.variable('ld', '$ld_target') + extra_defines = [] if self.flavor == 'mac': cflags = self.xcode_settings.GetCflags(config_name) cflags_c = self.xcode_settings.GetCflagsC(config_name) @@ -583,19 +710,35 @@ class NinjaWriter: self.xcode_settings.GetCflagsObjC(config_name) cflags_objcc = ['$cflags_cc'] + \ self.xcode_settings.GetCflagsObjCC(config_name) + elif self.flavor == 'win': + cflags = self.msvs_settings.GetCflags(config_name) + cflags_c = self.msvs_settings.GetCflagsC(config_name) + cflags_cc = self.msvs_settings.GetCflagsCC(config_name) + extra_defines = self.msvs_settings.GetComputedDefines(config_name) + self.WriteVariableList('pdbname', [self.name + '.pdb']) + self.WriteVariableList('pchprefix', [self.name]) else: cflags = config.get('cflags', []) cflags_c = config.get('cflags_c', []) cflags_cc = config.get('cflags_cc', []) - self.WriteVariableList('defines', - [QuoteShellArgument(ninja_syntax.escape('-D' + d)) - for d in config.get('defines', [])]) + defines = config.get('defines', []) + extra_defines + self.WriteVariableList('defines', [Define(d, self.flavor) for d in defines]) + if self.flavor == 'win': + self.WriteVariableList('rcflags', + [QuoteShellArgument(self.ExpandSpecial(f), self.flavor) + for f in self.msvs_settings.GetRcflags(config_name, + self.GypPathToNinja)]) + + include_dirs = config.get('include_dirs', []) + if self.flavor == 'win': + include_dirs = self.msvs_settings.AdjustIncludeDirs(include_dirs, + config_name) self.WriteVariableList('includes', - ['-I' + self.GypPathToNinja(i) - for i in config.get('include_dirs', [])]) + [QuoteShellArgument('-I' + self.GypPathToNinja(i), self.flavor) + for i in include_dirs]) - pch_commands = precompiled_header.GetGchBuildCommands() + pch_commands = precompiled_header.GetPchBuildCommands() if self.flavor == 'mac': self.WriteVariableList('cflags_pch_c', [precompiled_header.GetInclude('c')]) @@ -619,19 +762,30 @@ class NinjaWriter: for source in sources: filename, ext = os.path.splitext(source) ext = ext[1:] + obj_ext = self.obj_ext if ext in ('cc', 'cpp', 'cxx'): command = 'cxx' - elif ext in ('c', 's', 'S'): + elif ext == 'c' or (ext in ('s', 'S') and self.flavor != 'win'): command = 'cc' + elif (self.flavor == 'win' and ext == 'asm' and + self.msvs_settings.GetTargetPlatform(config_name) == 'Win32'): + # Asm files only get auto assembled for x86 (not x64). + command = 'asm' + # Add the _asm suffix as msvs is capable of handling .cc and + # .asm files of the same name without collision. + obj_ext = '_asm.obj' elif self.flavor == 'mac' and ext == 'm': command = 'objc' elif self.flavor == 'mac' and ext == 'mm': command = 'objcxx' + elif self.flavor == 'win' and ext == 'rc': + command = 'rc' + obj_ext = '.res' else: - # TODO: should we assert here on unexpected extensions? + # Ignore unhandled extensions. continue input = self.GypPathToNinja(source) - output = self.GypPathToUniqueOutput(filename + self.obj_ext) + output = self.GypPathToUniqueOutput(filename + obj_ext) implicit = precompiled_header.GetObjDependencies([input], [output]) self.ninja.build(output, command, input, implicit=[gch for _, _, gch in implicit], @@ -656,12 +810,14 @@ class NinjaWriter: 'mm': 'cflags_pch_objcc', }[lang] - cmd = { 'c': 'cc', 'cc': 'cxx', 'm': 'objc', 'mm': 'objcxx', }.get(lang) + map = { 'c': 'cc', 'cc': 'cxx', 'm': 'objc', 'mm': 'objcxx', } + if self.flavor == 'win': + map.update({'c': 'cc_pch', 'cc': 'cxx_pch'}) + cmd = map.get(lang) self.ninja.build(gch, cmd, input, variables=[(var_name, lang_flag)]) - def WriteLink(self, spec, config_name, config, link_deps): - """Write out a link step. Returns the path to the output.""" + """Write out a link step. Fills out target.binary. """ command = { 'executable': 'link', @@ -670,6 +826,7 @@ class NinjaWriter: }[spec['type']] implicit_deps = set() + solibs = set() if 'dependencies' in spec: # Two kinds of dependencies: @@ -683,7 +840,17 @@ class NinjaWriter: continue linkable = target.Linkable() if linkable: - extra_link_deps.add(target.binary) + if (self.flavor == 'win' and + target.component_objs and + self.msvs_settings.IsUseLibraryDependencyInputs(config_name)): + extra_link_deps |= set(target.component_objs) + elif self.flavor == 'win' and target.import_lib: + extra_link_deps.add(target.import_lib) + elif target.UsesToc(self.flavor): + solibs.add(target.binary) + implicit_deps.add(target.binary + '.TOC') + else: + extra_link_deps.add(target.binary) final_output = target.FinalOutput() if not linkable or final_output != target.binary: @@ -703,6 +870,13 @@ class NinjaWriter: ldflags = self.xcode_settings.GetLdflags(config_name, self.ExpandSpecial(generator_default_variables['PRODUCT_DIR']), self.GypPathToNinja) + elif self.flavor == 'win': + libflags = self.msvs_settings.GetLibFlags(config_name, + self.GypPathToNinja) + self.WriteVariableList( + 'libflags', gyp.common.uniquer(map(self.ExpandSpecial, libflags))) + ldflags = self.msvs_settings.GetLdflags(config_name, + self.GypPathToNinja, self.ExpandSpecial) else: ldflags = config.get('ldflags', []) self.WriteVariableList('ldflags', @@ -713,15 +887,30 @@ class NinjaWriter: spec.get('libraries', []))) if self.flavor == 'mac': libraries = self.xcode_settings.AdjustLibraries(libraries) + elif self.flavor == 'win': + libraries = self.msvs_settings.AdjustLibraries(libraries) self.WriteVariableList('libs', libraries) + self.target.binary = output + if command in ('solink', 'solink_module'): extra_bindings.append(('soname', os.path.split(output)[1])) + extra_bindings.append(('lib', + gyp.common.EncodePOSIXShellArgument(output))) + if self.flavor == 'win': + self.target.import_lib = output + '.lib' + extra_bindings.append(('dll', output)) + extra_bindings.append(('implib', self.target.import_lib)) + output = [output, self.target.import_lib] + else: + output = [output, output + '.TOC'] + + if len(solibs): + extra_bindings.append(('solibs', gyp.common.EncodePOSIXShellList(solibs))) self.ninja.build(output, command, link_deps, implicit=list(implicit_deps), variables=extra_bindings) - return output def WriteTarget(self, spec, config_name, config, link_deps, compile_deps): if spec['type'] == 'none': @@ -735,7 +924,7 @@ class NinjaWriter: variables=[('postbuilds', self.GetPostbuildCommand( spec, self.target.binary, self.target.binary))]) else: - self.target.binary = self.WriteLink(spec, config_name, config, link_deps) + self.WriteLink(spec, config_name, config, link_deps) return self.target.binary def WriteMacBundle(self, spec, mac_bundle_depends): @@ -757,16 +946,16 @@ class NinjaWriter: self.target.bundle = output return output - def GetXcodeEnv(self, additional_settings=None): + def GetSortedXcodeEnv(self, additional_settings=None): """Returns the variables Xcode would set for build steps.""" assert self.abs_build_dir abs_build_dir = self.abs_build_dir - return gyp.xcode_emulation.GetXcodeEnv( + return gyp.xcode_emulation.GetSortedXcodeEnv( self.xcode_settings, abs_build_dir, os.path.join(abs_build_dir, self.build_to_base), self.config_name, additional_settings) - def GetXcodePostbuildEnv(self): + def GetSortedXcodePostbuildEnv(self): """Returns the variables Xcode would set for postbuild steps.""" postbuild_settings = {} # CHROMIUM_STRIP_SAVE_FILE is a chromium-specific hack. @@ -774,9 +963,8 @@ class NinjaWriter: strip_save_file = self.xcode_settings.GetPerTargetSetting( 'CHROMIUM_STRIP_SAVE_FILE') if strip_save_file: - postbuild_settings['CHROMIUM_STRIP_SAVE_FILE'] = self.GypPathToNinja( - strip_save_file) - return self.GetXcodeEnv(additional_settings=postbuild_settings) + postbuild_settings['CHROMIUM_STRIP_SAVE_FILE'] = strip_save_file + return self.GetSortedXcodeEnv(additional_settings=postbuild_settings) def GetPostbuildCommand(self, spec, output, output_binary, is_command_start=False): @@ -785,20 +973,31 @@ class NinjaWriter: returned string will start with ' && '.""" if not self.xcode_settings or spec['type'] == 'none' or not output: return '' - output = QuoteShellArgument(output) + output = QuoteShellArgument(output, self.flavor) target_postbuilds = self.xcode_settings.GetTargetPostbuilds( - self.config_name, output, QuoteShellArgument(output_binary), quiet=True) - postbuilds = gyp.xcode_emulation.GetSpecPostbuildCommands( - spec, self.GypPathToNinja, quiet=True) + self.config_name, + os.path.normpath(os.path.join(self.base_to_build, output)), + QuoteShellArgument( + os.path.normpath(os.path.join(self.base_to_build, output_binary)), + self.flavor), + quiet=True) + postbuilds = gyp.xcode_emulation.GetSpecPostbuildCommands(spec, quiet=True) postbuilds = target_postbuilds + postbuilds if not postbuilds: return '' - env = self.ComputeExportEnvString(self.GetXcodePostbuildEnv()) - commands = env + ' F=0; ' + \ + # Postbuilds expect to be run in the gyp file's directory, so insert an + # implicit postbuild to cd to there. + postbuilds.insert(0, gyp.common.EncodePOSIXShellList( + ['cd', self.build_to_base])) + env = self.ComputeExportEnvString(self.GetSortedXcodePostbuildEnv()) + # G will be non-null if any postbuild fails. Run all postbuilds in a + # subshell. + commands = env + ' (F=0; ' + \ ' '.join([ninja_syntax.escape(command) + ' || F=$$?;' for command in postbuilds]) - command_string = env + commands + ' ((exit $$F) || rm -rf %s) ' % output + \ - '&& exit $$F)' + command_string = (commands + ' exit $$F); G=$$?; ' + # Remove the final output if any postbuild failed. + '((exit $$G) || rm -rf %s) ' % output + '&& exit $$G)') if is_command_start: return '(' + command_string + ' && ' else: @@ -809,9 +1008,9 @@ class NinjaWriter: 'export FOO=foo; export BAR="${FOO} bar;' that exports |env| to the shell.""" export_str = [] - for k in gyp.xcode_emulation.TopologicallySortedEnvVarKeys(env): + for k, v in env: export_str.append('export %s=%s;' % - (k, ninja_syntax.escape(gyp.common.EncodePOSIXShellArgument(env[k])))) + (k, ninja_syntax.escape(gyp.common.EncodePOSIXShellArgument(v)))) return ' '.join(export_str) def ComputeMacBundleOutput(self): @@ -874,7 +1073,7 @@ class NinjaWriter: elif type == 'none': return '%s.stamp' % target else: - raise 'Unhandled output type', type + raise Exception('Unhandled output type %s' % type) def ComputeOutput(self, spec, type=None): """Compute the path for the final output of the spec.""" @@ -883,6 +1082,12 @@ class NinjaWriter: if not type: type = spec['type'] + if self.flavor == 'win': + override = self.msvs_settings.GetOutputName(self.config_name, + self.ExpandSpecial) + if override: + return override + if self.flavor == 'mac' and type in ( 'static_library', 'executable', 'shared_library', 'loadable_module'): filename = self.xcode_settings.GetExecutablePath() @@ -898,6 +1103,8 @@ class NinjaWriter: type_in_output_root = ['executable', 'loadable_module'] if self.flavor == 'mac' and self.toolset == 'target': type_in_output_root += ['shared_library', 'static_library'] + elif self.flavor == 'win' and self.toolset == 'target': + type_in_output_root += ['shared_library'] if type in type_in_output_root: return filename @@ -910,11 +1117,12 @@ class NinjaWriter: return self.GypPathToUniqueOutput(filename, qualified=False) def WriteVariableList(self, var, values): + assert not isinstance(values, str) if values is None: values = [] self.ninja.variable(var, ' '.join(values)) - def WriteNewNinjaRule(self, name, args, description, env={}): + def WriteNewNinjaRule(self, name, args, description, is_cygwin, env={}): """Write out a new ninja "rule" statement for a given command. Returns the name of the new rule.""" @@ -926,36 +1134,45 @@ class NinjaWriter: if self.toolset == 'target': rule_name += '.' + self.toolset rule_name += '.' + name - rule_name = rule_name.replace(' ', '_') + rule_name = re.sub('[^a-zA-Z0-9_]', '_', rule_name) args = args[:] + if self.flavor == 'win': + description = self.msvs_settings.ConvertVSMacros( + description, config=self.config_name) + # gyp dictates that commands are run from the base directory. # cd into the directory before running, and adjust paths in # the arguments to point to the proper locations. - if self.flavor == 'win': - cd = 'cmd /s /c "cd %s && ' % self.build_to_base - else: - cd = 'cd %s; ' % self.build_to_base + rspfile = None + rspfile_content = None args = [self.ExpandSpecial(arg, self.base_to_build) for arg in args] - env = self.ComputeExportEnvString(env) if self.flavor == 'win': - # TODO(scottmg): Really don't want encourage cygwin, but I'm not sure - # how much sh is depended upon. For now, double quote args to make most - # things work. - command = args[0] + ' "' + '" "'.join(args[1:]) + '""' + rspfile = rule_name + '.$unique_name.rsp' + # The cygwin case handles this inside the bash sub-shell. + run_in = '' if is_cygwin else ' ' + self.build_to_base + if is_cygwin: + rspfile_content = self.msvs_settings.BuildCygwinBashCommandLine( + args, self.build_to_base) + else: + rspfile_content = gyp.msvs_emulation.EncodeRspFileList(args) + command = ('%s gyp-win-tool action-wrapper $arch ' % sys.executable + + rspfile + run_in) else: + env = self.ComputeExportEnvString(env) command = gyp.common.EncodePOSIXShellList(args) - if env: - # If an environment is passed in, variables in the command should be - # read from it, instead of from ninja's internal variables. - command = ninja_syntax.escape(command) + if env: + # If an environment is passed in, variables in the command should be + # read from it, instead of from ninja's internal variables. + command = ninja_syntax.escape(command) + command = 'cd %s; ' % self.build_to_base + env + command - command = cd + env + command # GYP rules/actions express being no-ops by not touching their outputs. # Avoid executing downstream dependencies in this case by specifying # restat=1 to ninja. - self.ninja.rule(rule_name, command, description, restat=True) + self.ninja.rule(rule_name, command, description, restat=True, + rspfile=rspfile, rspfile_content=rspfile_content) self.ninja.newline() return rule_name @@ -963,6 +1180,8 @@ class NinjaWriter: def CalculateVariables(default_variables, params): """Calculate additional variables for use in the build (called by gyp).""" + global generator_additional_non_configuration_keys + global generator_additional_path_sections cc_target = os.environ.get('CC.target', os.environ.get('CC', 'cc')) flavor = gyp.common.GetFlavor(params) if flavor == 'mac': @@ -976,22 +1195,43 @@ def CalculateVariables(default_variables, params): # Copy additional generator configuration data from Xcode, which is shared # by the Mac Ninja generator. import gyp.generator.xcode as xcode_generator - global generator_additional_non_configuration_keys generator_additional_non_configuration_keys = getattr(xcode_generator, 'generator_additional_non_configuration_keys', []) - global generator_additional_path_sections generator_additional_path_sections = getattr(xcode_generator, 'generator_additional_path_sections', []) global generator_extra_sources_for_rules generator_extra_sources_for_rules = getattr(xcode_generator, 'generator_extra_sources_for_rules', []) elif flavor == 'win': - default_variables['OS'] = 'win' + default_variables.setdefault('OS', 'win') default_variables['EXECUTABLE_SUFFIX'] = '.exe' default_variables['STATIC_LIB_PREFIX'] = '' default_variables['STATIC_LIB_SUFFIX'] = '.lib' default_variables['SHARED_LIB_PREFIX'] = '' default_variables['SHARED_LIB_SUFFIX'] = '.dll' + generator_flags = params.get('generator_flags', {}) + + # Copy additional generator configuration data from VS, which is shared + # by the Windows Ninja generator. + import gyp.generator.msvs as msvs_generator + generator_additional_non_configuration_keys = getattr(msvs_generator, + 'generator_additional_non_configuration_keys', []) + generator_additional_path_sections = getattr(msvs_generator, + 'generator_additional_path_sections', []) + + # Set a variable so conditions can be based on msvs_version. + msvs_version = gyp.msvs_emulation.GetVSVersion(generator_flags) + default_variables['MSVS_VERSION'] = msvs_version.ShortName() + + # To determine processor word size on Windows, in addition to checking + # PROCESSOR_ARCHITECTURE (which reflects the word size of the current + # process), it is also necessary to check PROCESSOR_ARCHITEW6432 (which + # contains the actual word size of the system when running thru WOW64). + if ('64' in os.environ.get('PROCESSOR_ARCHITECTURE', '') or + '64' in os.environ.get('PROCESSOR_ARCHITEW6432', '')): + default_variables['MSVS_OS_BITS'] = 64 + else: + default_variables['MSVS_OS_BITS'] = 32 else: operating_system = flavor if flavor == 'android': @@ -1000,16 +1240,17 @@ def CalculateVariables(default_variables, params): default_variables.setdefault('SHARED_LIB_SUFFIX', '.so') default_variables.setdefault('SHARED_LIB_DIR', os.path.join('$!PRODUCT_DIR', 'lib')) - default_variables.setdefault('LIB_DIR', '') + default_variables.setdefault('LIB_DIR', + os.path.join('$!PRODUCT_DIR', 'obj')) -def OpenOutput(path): +def OpenOutput(path, mode='w'): """Open |path| for writing, creating directories if necessary.""" try: os.makedirs(os.path.dirname(path)) except OSError: pass - return open(path, 'w') + return open(path, mode) def GenerateOutputForConfig(target_list, target_dicts, data, params, @@ -1023,16 +1264,20 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, build_dir = os.path.join(generator_flags.get('output_dir', 'out'), config_name) + toplevel_build = os.path.join(options.toplevel_dir, build_dir) + master_ninja = ninja_syntax.Writer( - OpenOutput(os.path.join(options.toplevel_dir, build_dir, 'build.ninja')), + OpenOutput(os.path.join(toplevel_build, 'build.ninja')), width=120) # Put build-time support tools in out/{config_name}. - gyp.common.CopyTool(flavor, os.path.join(options.toplevel_dir, build_dir)) + gyp.common.CopyTool(flavor, toplevel_build) # Grab make settings for CC/CXX. if flavor == 'win': - cc = cxx = 'cl' + cc = cxx = 'cl.exe' + gyp.msvs_emulation.GenerateEnvironmentFiles( + toplevel_build, generator_flags, OpenOutput) else: cc, cxx = 'gcc', 'g++' build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0]) @@ -1048,11 +1293,23 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, master_ninja.variable('cc', os.environ.get('CC', cc)) master_ninja.variable('cxx', os.environ.get('CXX', cxx)) if flavor == 'win': - master_ninja.variable('ld', 'link') + master_ninja.variable('ld', 'link.exe') + master_ninja.variable('idl', 'midl.exe') + master_ninja.variable('ar', 'lib.exe') + master_ninja.variable('rc', 'rc.exe') + master_ninja.variable('asm', 'ml.exe') else: master_ninja.variable('ld', flock + ' linker.lock $cxx') - master_ninja.variable('cc_host', '$cc') - master_ninja.variable('cxx_host', '$cxx') + master_ninja.variable('ar', os.environ.get('AR', 'ar')) + + master_ninja.variable('ar_target', os.environ.get('AR_target', '$ar')) + master_ninja.variable('cc_target', os.environ.get('CC_target', '$cc')) + master_ninja.variable('cxx_target', os.environ.get('CXX_target', '$cxx')) + if flavor == 'win': + master_ninja.variable('ld_target', os.environ.get('LD_target', '$ld')) + else: + master_ninja.variable('ld_target', flock + ' linker.lock $cxx_target') + if flavor == 'mac': master_ninja.variable('mac_tool', os.path.join('.', 'gyp-mac-tool')) master_ninja.newline() @@ -1071,62 +1328,142 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, '$cflags_pch_cc -c $in -o $out'), depfile='$out.d') else: - # TODO(scottmg): Requires deplist branch of ninja for now (for - # /showIncludes handling). + # TODO(scottmg): Requires fork of ninja for dependency and linking + # support: https://github.com/sgraham/ninja + # Template for compile commands mostly shared between compiling files + # and generating PCH. In the case of PCH, the "output" is specified by /Fp + # rather than /Fo (for object files), but we still need to specify an /Fo + # when compiling PCH. + cc_template = ('ninja-deplist-helper -r . -q -f cl -o $out.dl -e $arch ' + '--command ' + '$cc /nologo /showIncludes /FC ' + '@$out.rsp ' + '$cflags_pch_c /c $in %(outspec)s /Fd$pdbname ') + cxx_template = ('ninja-deplist-helper -r . -q -f cl -o $out.dl -e $arch ' + '--command ' + '$cxx /nologo /showIncludes /FC ' + '@$out.rsp ' + '$cflags_pch_cc /c $in %(outspec)s $pchobj /Fd$pdbname ') master_ninja.rule( 'cc', description='CC $out', - command=('cmd /c $cc /nologo /showIncludes ' - '$defines $includes $cflags $cflags_c ' - '$cflags_pch_c /c $in /Fo$out ' - '| ninja-deplist-helper -f cl -o $out.dl'), - deplist='$out.dl') + command=cc_template % {'outspec': '/Fo$out'}, + deplist='$out.dl', + rspfile='$out.rsp', + rspfile_content='$defines $includes $cflags $cflags_c') + master_ninja.rule( + 'cc_pch', + description='CC PCH $out', + command=cc_template % {'outspec': '/Fp$out /Fo$out.obj'}, + deplist='$out.dl', + rspfile='$out.rsp', + rspfile_content='$defines $includes $cflags $cflags_c') master_ninja.rule( 'cxx', description='CXX $out', - command=('cmd /c $cxx /nologo /showIncludes ' - '$defines $includes $cflags $cflags_cc ' - '$cflags_pch_cc /c $in /Fo$out ' - '| ninja-deplist-helper -f cl -o $out.dl'), - deplist='$out.dl') + command=cxx_template % {'outspec': '/Fo$out'}, + deplist='$out.dl', + rspfile='$out.rsp', + rspfile_content='$defines $includes $cflags $cflags_cc') + master_ninja.rule( + 'cxx_pch', + description='CXX PCH $out', + command=cxx_template % {'outspec': '/Fp$out /Fo$out.obj'}, + deplist='$out.dl', + rspfile='$out.rsp', + rspfile_content='$defines $includes $cflags $cflags_cc') + master_ninja.rule( + 'idl', + description='IDL $in', + command=('%s gyp-win-tool midl-wrapper $arch $outdir ' + '$tlb $h $dlldata $iid $proxy $in ' + '$idlflags' % sys.executable)) + master_ninja.rule( + 'rc', + description='RC $in', + # Note: $in must be last otherwise rc.exe complains. + command=('%s gyp-win-tool rc-wrapper ' + '$arch $rc $defines $includes $rcflags /fo$out $in' % + sys.executable)) + master_ninja.rule( + 'asm', + description='ASM $in', + command=('%s gyp-win-tool asm-wrapper ' + '$arch $asm $defines $includes /c /Fo $out $in' % + sys.executable)) if flavor != 'mac' and flavor != 'win': master_ninja.rule( 'alink', description='AR $out', - command='rm -f $out && ar rcsT $out $in') + command='rm -f $out && $ar rcsT $out $in') + + # This allows targets that only need to depend on $lib's API to declare an + # order-only dependency on $lib.TOC and avoid relinking such downstream + # dependencies when $lib changes only in non-public ways. + # The resulting string leaves an uninterpolated %{suffix} which + # is used in the final substitution below. + mtime_preserving_solink_base = ( + 'if [ ! -e $lib -o ! -e ${lib}.TOC ]; then ' + '%(solink)s && %(extract_toc)s > ${lib}.TOC; else ' + '%(solink)s && %(extract_toc)s > ${lib}.tmp && ' + 'if ! cmp -s ${lib}.tmp ${lib}.TOC; then mv ${lib}.tmp ${lib}.TOC ; ' + 'fi; fi' + % { 'solink': + '$ld -shared $ldflags -o $lib -Wl,-soname=$soname %(suffix)s', + 'extract_toc': + ('{ readelf -d ${lib} | grep SONAME ; ' + 'nm -gD -f p ${lib} | cut -f1-2 -d\' \'; }')}) + master_ninja.rule( 'solink', - description='SOLINK $out', - command=('$ld -shared $ldflags -o $out -Wl,-soname=$soname ' - '-Wl,--whole-archive $in -Wl,--no-whole-archive $libs')) + description='SOLINK $lib', + restat=True, + command=(mtime_preserving_solink_base % { + 'suffix': '-Wl,--whole-archive $in $solibs -Wl,--no-whole-archive ' + '$libs'})) master_ninja.rule( 'solink_module', - description='SOLINK(module) $out', - command=('$ld -shared $ldflags -o $out -Wl,-soname=$soname ' - '-Wl,--start-group $in -Wl,--end-group $libs')) + description='SOLINK(module) $lib', + restat=True, + command=(mtime_preserving_solink_base % { + 'suffix': '-Wl,--start-group $in $solibs -Wl,--end-group $libs'})) master_ninja.rule( 'link', description='LINK $out', command=('$ld $ldflags -o $out -Wl,-rpath=\$$ORIGIN/lib ' - '-Wl,--start-group $in -Wl,--end-group $libs')) + '-Wl,--start-group $in $solibs -Wl,--end-group $libs')) elif flavor == 'win': master_ninja.rule( - 'alink', - description='AR $out', - command='lib /nologo /OUT:$out $in') - master_ninja.rule( - 'solink', - description='SOLINK $out', - command=('$ld /nologo /DLL $ldflags /OUT:$out $in $libs')) - master_ninja.rule( - 'solink_module', - description='SOLINK(module) $out', - command=('$ld /nologo /DLL $ldflags /OUT:$out $in $libs')) + 'alink', + description='LIB $out', + command=('%s gyp-win-tool link-wrapper $arch ' + '$ar /nologo /ignore:4221 /OUT:$out @$out.rsp' % + sys.executable), + rspfile='$out.rsp', + rspfile_content='$in_newline $libflags') + dlldesc = 'LINK(DLL) $dll' + dllcmd = ('%s gyp-win-tool link-wrapper $arch ' + '$ld /nologo /IMPLIB:$implib /DLL /OUT:$dll ' + '/PDB:$dll.pdb @$dll.rsp' % sys.executable) + master_ninja.rule('solink', description=dlldesc, command=dllcmd, + rspfile='$dll.rsp', + rspfile_content='$libs $in_newline $ldflags', + restat=True) + master_ninja.rule('solink_module', description=dlldesc, command=dllcmd, + rspfile='$dll.rsp', + rspfile_content='$libs $in_newline $ldflags', + restat=True) + # Note that ldflags goes at the end so that it has the option of + # overriding default settings earlier in the command line. master_ninja.rule( - 'link', - description='LINK $out', - command=('$ld /nologo $ldflags /OUT:$out $in $libs')) + 'link', + description='LINK $out', + command=('%s gyp-win-tool link-wrapper $arch ' + '$ld /nologo /OUT:$out /PDB:$out.pdb @$out.rsp' % + sys.executable), + rspfile='$out.rsp', + rspfile_content='$in_newline $libs $ldflags') else: master_ninja.rule( 'objc', @@ -1146,23 +1483,47 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, command='rm -f $out && ' './gyp-mac-tool filter-libtool libtool -static -o $out $in' '$postbuilds') + + # Record the public interface of $lib in $lib.TOC. See the corresponding + # comment in the posix section above for details. + mtime_preserving_solink_base = ( + 'if [ ! -e $lib -o ! -e ${lib}.TOC ] || ' + # Always force dependent targets to relink if this library + # reexports something. Handling this correctly would require + # recursive TOC dumping but this is rare in practice, so punt. + 'otool -l $lib | grep -q LC_REEXPORT_DYLIB ; then ' + '%(solink)s && %(extract_toc)s > ${lib}.TOC; ' + 'else ' + '%(solink)s && %(extract_toc)s > ${lib}.tmp && ' + 'if ! cmp -s ${lib}.tmp ${lib}.TOC; then ' + 'mv ${lib}.tmp ${lib}.TOC ; ' + 'fi; ' + 'fi' + % { 'solink': '$ld -shared $ldflags -o $lib %(suffix)s', + 'extract_toc': + '{ otool -l $lib | grep LC_ID_DYLIB -A 5; ' + 'nm -gP $lib | cut -f1-2 -d\' \' | grep -v U$$; true; }'}) + # TODO(thakis): The solink_module rule is likely wrong. Xcode seems to pass # -bundle -single_module here (for osmesa.so). master_ninja.rule( 'solink', - description='SOLINK $out, POSTBUILDS', - command=('$ld -shared $ldflags -o $out ' - '$in $libs$postbuilds')) + description='SOLINK $lib, POSTBUILDS', + restat=True, + command=(mtime_preserving_solink_base % { + 'suffix': '$in $solibs $libs$postbuilds'})) master_ninja.rule( 'solink_module', - description='SOLINK(module) $out, POSTBUILDS', - command=('$ld -shared $ldflags -o $out ' - '$in $libs$postbuilds')) + description='SOLINK(module) $lib, POSTBUILDS', + restat=True, + command=(mtime_preserving_solink_base % { + 'suffix': '$in $solibs $libs$postbuilds'})) + master_ninja.rule( 'link', description='LINK $out, POSTBUILDS', command=('$ld $ldflags -o $out ' - '$in $libs$postbuilds')) + '$in $solibs $libs$postbuilds')) master_ninja.rule( 'infoplist', description='INFOPLIST $out', @@ -1177,17 +1538,20 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, description='PACKAGE FRAMEWORK $out, POSTBUILDS', command='$mac_tool package-framework $out $version$postbuilds ' '&& touch $out') - master_ninja.rule( - 'stamp', - description='STAMP $out', - command='${postbuilds}touch $out') if flavor == 'win': - # TODO(scottmg): Copy fallback? + master_ninja.rule( + 'stamp', + description='STAMP $out', + command='%s gyp-win-tool stamp $out' % sys.executable) master_ninja.rule( 'copy', description='COPY $in $out', - command='cmd /c mklink /h $out $in >nul || mklink /h /j $out $in >nul') + command='%s gyp-win-tool recursive-mirror $in $out' % sys.executable) else: + master_ninja.rule( + 'stamp', + description='STAMP $out', + command='${postbuilds}touch $out') master_ninja.rule( 'copy', description='COPY $in $out', @@ -1196,12 +1560,17 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, all_targets = set() for build_file in params['build_files']: - for target in gyp.common.AllTargets(target_list, target_dicts, build_file): + for target in gyp.common.AllTargets(target_list, + target_dicts, + os.path.normpath(build_file)): all_targets.add(target) all_outputs = set() # target_outputs is a map from qualified target name to a Target object. target_outputs = {} + # target_short_names is a map from target short name to a list of Target + # objects. + target_short_names = {} for qualified_target in target_list: # qualified_target is like: third_party/icu/icu.gyp:icui18n#target build_file, name, toolset = \ @@ -1223,22 +1592,34 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, obj += '.' + toolset output_file = os.path.join(obj, base_path, name + '.ninja') - abs_build_dir=os.path.abspath(os.path.join(options.toplevel_dir, build_dir)) - writer = NinjaWriter(target_outputs, base_path, build_dir, - OpenOutput(os.path.join(options.toplevel_dir, - build_dir, - output_file)), + abs_build_dir = os.path.abspath(toplevel_build) + writer = NinjaWriter(qualified_target, target_outputs, base_path, build_dir, + OpenOutput(os.path.join(toplevel_build, output_file)), flavor, abs_build_dir=abs_build_dir) master_ninja.subninja(output_file) - target = writer.WriteSpec(spec, config_name) + target = writer.WriteSpec(spec, config_name, generator_flags) if target: + if name != target.FinalOutput() and spec['toolset'] == 'target': + target_short_names.setdefault(name, []).append(target) target_outputs[qualified_target] = target if qualified_target in all_targets: all_outputs.add(target.FinalOutput()) + if target_short_names: + # Write a short name to build this target. This benefits both the + # "build chrome" case as well as the gyp tests, which expect to be + # able to run actions and build libraries by their short name. + master_ninja.newline() + master_ninja.comment('Short names for targets.') + for short_name in target_short_names: + master_ninja.build(short_name, 'phony', [x.FinalOutput() for x in + target_short_names[short_name]]) + if all_outputs: + master_ninja.newline() master_ninja.build('all', 'phony', list(all_outputs)) + master_ninja.default('all') def GenerateOutput(target_list, target_dicts, data, params): diff --git a/tools/gyp/pylib/gyp/generator/ninja_test.py b/tools/gyp/pylib/gyp/generator/ninja_test.py index af2e6d32fc..90dd153730 100644 --- a/tools/gyp/pylib/gyp/generator/ninja_test.py +++ b/tools/gyp/pylib/gyp/generator/ninja_test.py @@ -9,34 +9,36 @@ import gyp.generator.ninja as ninja import unittest import StringIO +import sys import TestCommon class TestPrefixesAndSuffixes(unittest.TestCase): - def test_BinaryNamesWindows(self): - writer = ninja.NinjaWriter('wee', '.', '.', 'ninja.build', 'win') - spec = { 'target_name': 'wee' } - self.assertTrue(writer.ComputeOutputFileName(spec, 'executable'). - endswith('.exe')) - self.assertTrue(writer.ComputeOutputFileName(spec, 'shared_library'). - endswith('.dll')) - self.assertTrue(writer.ComputeOutputFileName(spec, 'static_library'). - endswith('.lib')) + if sys.platform in ('win32', 'cygwin'): + def test_BinaryNamesWindows(self): + writer = ninja.NinjaWriter('foo', 'wee', '.', '.', 'ninja.build', 'win') + spec = { 'target_name': 'wee' } + self.assertTrue(writer.ComputeOutputFileName(spec, 'executable'). + endswith('.exe')) + self.assertTrue(writer.ComputeOutputFileName(spec, 'shared_library'). + endswith('.dll')) + self.assertTrue(writer.ComputeOutputFileName(spec, 'static_library'). + endswith('.lib')) - def test_BinaryNamesLinux(self): - writer = ninja.NinjaWriter('wee', '.', '.', 'ninja.build', 'linux') - spec = { - 'target_name': 'wee' - } - self.assertTrue('.' not in writer.ComputeOutputFileName(spec, 'executable')) - self.assertTrue(writer.ComputeOutputFileName(spec, 'shared_library'). - startswith('lib')) - self.assertTrue(writer.ComputeOutputFileName(spec, 'static_library'). - startswith('lib')) - self.assertTrue(writer.ComputeOutputFileName(spec, 'shared_library'). - endswith('.so')) - self.assertTrue(writer.ComputeOutputFileName(spec, 'static_library'). - endswith('.a')) + if sys.platform == 'linux2': + def test_BinaryNamesLinux(self): + writer = ninja.NinjaWriter('foo', 'wee', '.', '.', 'ninja.build', 'linux') + spec = { 'target_name': 'wee' } + self.assertTrue('.' not in writer.ComputeOutputFileName(spec, + 'executable')) + self.assertTrue(writer.ComputeOutputFileName(spec, 'shared_library'). + startswith('lib')) + self.assertTrue(writer.ComputeOutputFileName(spec, 'static_library'). + startswith('lib')) + self.assertTrue(writer.ComputeOutputFileName(spec, 'shared_library'). + endswith('.so')) + self.assertTrue(writer.ComputeOutputFileName(spec, 'static_library'). + endswith('.a')) if __name__ == '__main__': unittest.main() diff --git a/tools/gyp/pylib/gyp/generator/scons.py b/tools/gyp/pylib/gyp/generator/scons.py index 90418875af..4d0feb0c9a 100644 --- a/tools/gyp/pylib/gyp/generator/scons.py +++ b/tools/gyp/pylib/gyp/generator/scons.py @@ -1,4 +1,4 @@ -# Copyright (c) 2011 Google Inc. All rights reserved. +# 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. @@ -462,8 +462,7 @@ def GenerateSConscript(output_filename, spec, build_file, build_file_data): rules = spec.get('rules', []) for rule in rules: - name = rule['rule_name'] - a = ['cd', src_subdir, '&&'] + rule['action'] + name = re.sub('[^a-zA-Z0-9_]', '_', rule['rule_name']) message = rule.get('message') if message: message = repr(message) @@ -473,6 +472,10 @@ def GenerateSConscript(output_filename, spec, build_file, build_file_data): poas_line = '_processed_input_files.append(infile)' inputs = [FixPath(f, src_subdir_) for f in rule.get('inputs', [])] outputs = [FixPath(f, src_subdir_) for f in rule.get('outputs', [])] + # Skip a rule with no action and no inputs. + if 'action' not in rule and not rule.get('rule_sources', []): + continue + a = ['cd', src_subdir, '&&'] + rule['action'] fp.write(_rule_template % { 'inputs' : pprint.pformat(inputs), 'outputs' : pprint.pformat(outputs), diff --git a/tools/gyp/pylib/gyp/generator/xcode.py b/tools/gyp/pylib/gyp/generator/xcode.py index 8b17517b76..a9fac46d0d 100644 --- a/tools/gyp/pylib/gyp/generator/xcode.py +++ b/tools/gyp/pylib/gyp/generator/xcode.py @@ -1,4 +1,4 @@ -# Copyright (c) 2011 Google Inc. All rights reserved. +# 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. @@ -513,7 +513,7 @@ def InstalledXcodeVersion(): return cached_xcode_version -def AddSourceToTarget(source, pbxp, xct): +def AddSourceToTarget(source, type, pbxp, xct): # TODO(mark): Perhaps source_extensions and library_extensions can be made a # little bit fancier. source_extensions = ['c', 'cc', 'cpp', 'cxx', 'm', 'mm', 's'] @@ -529,9 +529,9 @@ def AddSourceToTarget(source, pbxp, xct): if ext != '': ext = ext[1:].lower() - if ext in source_extensions: + if ext in source_extensions and type != 'none': xct.SourcesPhase().AddFile(source) - elif ext in library_extensions: + elif ext in library_extensions and type != 'none': xct.FrameworksPhase().AddFile(source) else: # Files that aren't added to a sources or frameworks build phase can still @@ -699,7 +699,7 @@ def GenerateOutput(target_list, target_dicts, data, params): # Xcode has some "issues" with checking dependencies for the "Compile # sources" step with any source files/headers generated by actions/rules. # To work around this, if a target is building anything directly (not - # type "none"), then a second target as used to run the GYP actions/rules + # type "none"), then a second target is used to run the GYP actions/rules # and is made a dependency of this target. This way the work is done # before the dependency checks for what should be recompiled. support_xct = None @@ -772,7 +772,7 @@ def GenerateOutput(target_list, target_dicts, data, params): # TODO(mark): Should verify that at most one of these is specified. if int(action.get('process_outputs_as_sources', False)): for output in action['outputs']: - AddSourceToTarget(output, pbxp, xct) + AddSourceToTarget(output, type, pbxp, xct) if int(action.get('process_outputs_as_mac_bundle_resources', False)): for output in action['outputs']: @@ -900,7 +900,7 @@ def GenerateOutput(target_list, target_dicts, data, params): # TODO(mark): Should verify that at most one of these is specified. if int(rule.get('process_outputs_as_sources', False)): for output in concrete_outputs_for_this_rule_source: - AddSourceToTarget(output, pbxp, xct) + AddSourceToTarget(output, type, pbxp, xct) # If the file came from the mac_bundle_resources list or if the rule # is marked to process outputs as bundle resource, do so. @@ -926,7 +926,8 @@ def GenerateOutput(target_list, target_dicts, data, params): if len(concrete_outputs_all) > 0: # TODO(mark): There's a possibilty for collision here. Consider # target "t" rule "A_r" and target "t_A" rule "r". - makefile_name = '%s_%s.make' % (target_name, rule['rule_name']) + makefile_name = '%s.make' % re.sub( + '[^a-zA-Z0-9_]', '_' , '%s_%s' % (target_name, rule['rule_name'])) makefile_path = os.path.join(xcode_projects[build_file].path, makefile_name) # TODO(mark): try/close? Write to a temporary file and swap it only @@ -1064,12 +1065,12 @@ exit 1 if source_extension[1:] not in rules_by_ext: # AddSourceToTarget will add the file to a root group if it's not # already there. - AddSourceToTarget(source, pbxp, xct) + AddSourceToTarget(source, type, pbxp, xct) else: pbxp.AddOrGetFileInRootGroup(source) - # Add "mac_bundle_resources", "mac_framework_headers", and - # "mac_framework_private_headers" if it's a bundle of any type. + # Add "mac_bundle_resources" and "mac_framework_private_headers" if + # it's a bundle of any type. if is_bundle: for resource in tgt_mac_bundle_resources: (resource_root, resource_extension) = posixpath.splitext(resource) @@ -1078,12 +1079,15 @@ exit 1 else: pbxp.AddOrGetFileInRootGroup(resource) - for header in spec.get('mac_framework_headers', []): - AddHeaderToTarget(header, pbxp, xct, True) - for header in spec.get('mac_framework_private_headers', []): AddHeaderToTarget(header, pbxp, xct, False) + # Add "mac_framework_headers". These can be valid for both frameworks + # and static libraries. + if is_bundle or type == 'static_library': + for header in spec.get('mac_framework_headers', []): + AddHeaderToTarget(header, pbxp, xct, True) + # Add "copies". for copy_group in spec.get('copies', []): pbxcp = gyp.xcodeproj_file.PBXCopyFilesBuildPhase({ diff --git a/tools/gyp/pylib/gyp/input.py b/tools/gyp/pylib/gyp/input.py index 74a96b6d8b..2678bab2c4 100644 --- a/tools/gyp/pylib/gyp/input.py +++ b/tools/gyp/pylib/gyp/input.py @@ -1,4 +1,4 @@ -# Copyright (c) 2011 Google Inc. All rights reserved. +# 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. @@ -302,7 +302,6 @@ def ProcessToolsetsInDict(data): if 'toolset' in target and 'toolsets' not in target: new_target_list.append(target) continue - global multiple_toolsets if multiple_toolsets: toolsets = target.get('toolsets', ['target']) else: @@ -331,8 +330,6 @@ def ProcessToolsetsInDict(data): # that contains the targets... def LoadTargetBuildFile(build_file_path, data, aux_data, variables, includes, depth, check): - global absolute_build_file_paths - # If depth is set, predefine the DEPTH variable to be a relative path from # this build file's directory to the directory identified by depth. if depth: @@ -383,8 +380,8 @@ def LoadTargetBuildFile(build_file_path, data, aux_data, variables, includes, ProcessToolsetsInDict(build_file_data) # Apply "pre"/"early" variable expansions and condition evaluations. - ProcessVariablesAndConditionsInDict(build_file_data, False, variables, - build_file_path) + ProcessVariablesAndConditionsInDict( + build_file_data, PHASE_EARLY, variables, build_file_path) # Since some toolsets might have been defined conditionally, perform # a second round of toolsets expansion now. @@ -499,6 +496,13 @@ late_variable_re = re.compile( '\((?P\s*\[?)' '(?P.*?)(\]?)\))') +# This matches the same as early_variable_re, but with '^' instead of '<'. +latelate_variable_re = re.compile( + '(?P(?P[\^](?:(?:!?@?)|\|)?)' + '(?P[-a-zA-Z0-9_.]+)?' + '\((?P\s*\[?)' + '(?P.*?)(\]?)\))') + # Global cache of results from running commands so they don't have to be run # more then once. cached_command_results = {} @@ -513,263 +517,297 @@ def FixupPlatformCommand(cmd): return cmd -def ExpandVariables(input, is_late, variables, build_file): +PHASE_EARLY = 0 +PHASE_LATE = 1 +PHASE_LATELATE = 2 + + +def ExpandVariables(input, phase, variables, build_file): # Look for the pattern that gets expanded into variables - if not is_late: + if phase == PHASE_EARLY: variable_re = early_variable_re expansion_symbol = '<' - else: + elif phase == PHASE_LATE: variable_re = late_variable_re expansion_symbol = '>' + elif phase == PHASE_LATELATE: + variable_re = latelate_variable_re + expansion_symbol = '^' + else: + assert False input_str = str(input) + if IsStrCanonicalInt(input_str): + return int(input_str) + # Do a quick scan to determine if an expensive regex search is warranted. - if expansion_symbol in input_str: - # Get the entire list of matches as a list of MatchObject instances. - # (using findall here would return strings instead of MatchObjects). - matches = [match for match in variable_re.finditer(input_str)] - else: - matches = None + if expansion_symbol not in input_str: + return input_str + + # Get the entire list of matches as a list of MatchObject instances. + # (using findall here would return strings instead of MatchObjects). + matches = [match for match in variable_re.finditer(input_str)] + if not matches: + return input_str output = input_str - if matches: - # Reverse the list of matches so that replacements are done right-to-left. - # That ensures that earlier replacements won't mess up the string in a - # way that causes later calls to find the earlier substituted text instead - # of what's intended for replacement. - matches.reverse() - for match_group in matches: - match = match_group.groupdict() - gyp.DebugOutput(gyp.DEBUG_VARIABLES, - "Matches: %s" % repr(match)) - # match['replace'] is the substring to look for, match['type'] - # is the character code for the replacement type (< > ! <| >| <@ - # >@ !@), match['is_array'] contains a '[' for command - # arrays, and match['content'] is the name of the variable (< >) - # or command to run (!). match['command_string'] is an optional - # command string. Currently, only 'pymod_do_main' is supported. - - # run_command is true if a ! variant is used. - run_command = '!' in match['type'] - command_string = match['command_string'] - - # file_list is true if a | variant is used. - file_list = '|' in match['type'] - - # Capture these now so we can adjust them later. - replace_start = match_group.start('replace') - replace_end = match_group.end('replace') - - # Find the ending paren, and re-evaluate the contained string. - (c_start, c_end) = FindEnclosingBracketGroup(input_str[replace_start:]) - - # Adjust the replacement range to match the entire command - # found by FindEnclosingBracketGroup (since the variable_re - # probably doesn't match the entire command if it contained - # nested variables). - replace_end = replace_start + c_end - - # Find the "real" replacement, matching the appropriate closing - # paren, and adjust the replacement start and end. - replacement = input_str[replace_start:replace_end] - - # Figure out what the contents of the variable parens are. - contents_start = replace_start + c_start + 1 - contents_end = replace_end - 1 - contents = input_str[contents_start:contents_end] - - # Do filter substitution now for <|(). - # Admittedly, this is different than the evaluation order in other - # contexts. However, since filtration has no chance to run on <|(), - # this seems like the only obvious way to give them access to filters. - if file_list: - processed_variables = copy.deepcopy(variables) - ProcessListFiltersInDict(contents, processed_variables) - # Recurse to expand variables in the contents - contents = ExpandVariables(contents, is_late, - processed_variables, build_file) + # Reverse the list of matches so that replacements are done right-to-left. + # That ensures that earlier replacements won't mess up the string in a + # way that causes later calls to find the earlier substituted text instead + # of what's intended for replacement. + matches.reverse() + for match_group in matches: + match = match_group.groupdict() + gyp.DebugOutput(gyp.DEBUG_VARIABLES, + "Matches: %s" % repr(match)) + # match['replace'] is the substring to look for, match['type'] + # is the character code for the replacement type (< > ! <| >| <@ + # >@ !@), match['is_array'] contains a '[' for command + # arrays, and match['content'] is the name of the variable (< >) + # or command to run (!). match['command_string'] is an optional + # command string. Currently, only 'pymod_do_main' is supported. + + # run_command is true if a ! variant is used. + run_command = '!' in match['type'] + command_string = match['command_string'] + + # file_list is true if a | variant is used. + file_list = '|' in match['type'] + + # Capture these now so we can adjust them later. + replace_start = match_group.start('replace') + replace_end = match_group.end('replace') + + # Find the ending paren, and re-evaluate the contained string. + (c_start, c_end) = FindEnclosingBracketGroup(input_str[replace_start:]) + + # Adjust the replacement range to match the entire command + # found by FindEnclosingBracketGroup (since the variable_re + # probably doesn't match the entire command if it contained + # nested variables). + replace_end = replace_start + c_end + + # Find the "real" replacement, matching the appropriate closing + # paren, and adjust the replacement start and end. + replacement = input_str[replace_start:replace_end] + + # Figure out what the contents of the variable parens are. + contents_start = replace_start + c_start + 1 + contents_end = replace_end - 1 + contents = input_str[contents_start:contents_end] + + # Do filter substitution now for <|(). + # Admittedly, this is different than the evaluation order in other + # contexts. However, since filtration has no chance to run on <|(), + # this seems like the only obvious way to give them access to filters. + if file_list: + processed_variables = copy.deepcopy(variables) + ProcessListFiltersInDict(contents, processed_variables) + # Recurse to expand variables in the contents + contents = ExpandVariables(contents, phase, + processed_variables, build_file) + else: + # Recurse to expand variables in the contents + contents = ExpandVariables(contents, phase, variables, build_file) + + # Strip off leading/trailing whitespace so that variable matches are + # simpler below (and because they are rarely needed). + contents = contents.strip() + + # expand_to_list is true if an @ variant is used. In that case, + # the expansion should result in a list. Note that the caller + # is to be expecting a list in return, and not all callers do + # because not all are working in list context. Also, for list + # expansions, there can be no other text besides the variable + # expansion in the input string. + expand_to_list = '@' in match['type'] and input_str == replacement + + if run_command or file_list: + # Find the build file's directory, so commands can be run or file lists + # generated relative to it. + build_file_dir = os.path.dirname(build_file) + if build_file_dir == '': + # If build_file is just a leaf filename indicating a file in the + # current directory, build_file_dir might be an empty string. Set + # it to None to signal to subprocess.Popen that it should run the + # command in the current directory. + build_file_dir = None + + # Support <|(listfile.txt ...) which generates a file + # containing items from a gyp list, generated at gyp time. + # This works around actions/rules which have more inputs than will + # fit on the command line. + if file_list: + if type(contents) == list: + contents_list = contents else: - # Recurse to expand variables in the contents - contents = ExpandVariables(contents, is_late, variables, build_file) - - # Strip off leading/trailing whitespace so that variable matches are - # simpler below (and because they are rarely needed). - contents = contents.strip() - - # expand_to_list is true if an @ variant is used. In that case, - # the expansion should result in a list. Note that the caller - # is to be expecting a list in return, and not all callers do - # because not all are working in list context. Also, for list - # expansions, there can be no other text besides the variable - # expansion in the input string. - expand_to_list = '@' in match['type'] and input_str == replacement - - if run_command or file_list: - # Find the build file's directory, so commands can be run or file lists - # generated relative to it. - build_file_dir = os.path.dirname(build_file) - if build_file_dir == '': - # If build_file is just a leaf filename indicating a file in the - # current directory, build_file_dir might be an empty string. Set - # it to None to signal to subprocess.Popen that it should run the - # command in the current directory. - build_file_dir = None - - # Support <|(listfile.txt ...) which generates a file - # containing items from a gyp list, generated at gyp time. - # This works around actions/rules which have more inputs than will - # fit on the command line. - if file_list: - if type(contents) == list: - contents_list = contents - else: - contents_list = contents.split(' ') - replacement = contents_list[0] - path = replacement - if not os.path.isabs(path): - path = os.path.join(build_file_dir, path) - f = gyp.common.WriteOnDiff(path) - for i in contents_list[1:]: - f.write('%s\n' % i) - f.close() - - elif run_command: - use_shell = True - if match['is_array']: - contents = eval(contents) - use_shell = False - - # Check for a cached value to avoid executing commands, or generating - # file lists more than once. - # TODO(http://code.google.com/p/gyp/issues/detail?id=112): It is - # possible that the command being invoked depends on the current - # directory. For that case the syntax needs to be extended so that the - # directory is also used in cache_key (it becomes a tuple). - # TODO(http://code.google.com/p/gyp/issues/detail?id=111): In theory, - # someone could author a set of GYP files where each time the command - # is invoked it produces different output by design. When the need - # arises, the syntax should be extended to support no caching off a - # command's output so it is run every time. - cache_key = str(contents) - cached_value = cached_command_results.get(cache_key, None) - if cached_value is None: - gyp.DebugOutput(gyp.DEBUG_VARIABLES, - "Executing command '%s' in directory '%s'" % - (contents,build_file_dir)) - - replacement = '' - - if command_string == 'pymod_do_main': - # (sources/) etc. to resolve to + # and empty list if undefined. This allows actions to: + # 'action!': [ + # '>@(_sources!)', + # ], + # 'action/': [ + # '>@(_sources/)', + # ], + replacement = [] + else: raise KeyError, 'Undefined variable ' + contents + \ ' in ' + build_file + else: replacement = variables[contents] + if isinstance(replacement, list): + for item in replacement: + if (not contents[-1] == '/' and + not isinstance(item, str) and not isinstance(item, int)): + raise TypeError, 'Variable ' + contents + \ + ' must expand to a string or list of strings; ' + \ + 'list contains a ' + \ + item.__class__.__name__ + # Run through the list and handle variable expansions in it. Since + # the list is guaranteed not to contain dicts, this won't do anything + # with conditions sections. + ProcessVariablesAndConditionsInList(replacement, phase, variables, + build_file) + elif not isinstance(replacement, str) and \ + not isinstance(replacement, int): + raise TypeError, 'Variable ' + contents + \ + ' must expand to a string or list of strings; ' + \ + 'found a ' + replacement.__class__.__name__ + + if expand_to_list: + # Expanding in list context. It's guaranteed that there's only one + # replacement to do in |input_str| and that it's this replacement. See + # above. if isinstance(replacement, list): - for item in replacement: - if not isinstance(item, str) and not isinstance(item, int): - raise TypeError, 'Variable ' + contents + \ - ' must expand to a string or list of strings; ' + \ - 'list contains a ' + \ - item.__class__.__name__ - # Run through the list and handle variable expansions in it. Since - # the list is guaranteed not to contain dicts, this won't do anything - # with conditions sections. - ProcessVariablesAndConditionsInList(replacement, is_late, variables, - build_file) - elif not isinstance(replacement, str) and \ - not isinstance(replacement, int): - raise TypeError, 'Variable ' + contents + \ - ' must expand to a string or list of strings; ' + \ - 'found a ' + replacement.__class__.__name__ - - if expand_to_list: - # Expanding in list context. It's guaranteed that there's only one - # replacement to do in |input_str| and that it's this replacement. See - # above. - if isinstance(replacement, list): - # If it's already a list, make a copy. - output = replacement[:] - else: - # Split it the same way sh would split arguments. - output = shlex.split(str(replacement)) + # If it's already a list, make a copy. + output = replacement[:] else: - # Expanding in string context. - encoded_replacement = '' - if isinstance(replacement, list): - # When expanding a list into string context, turn the list items - # into a string in a way that will work with a subprocess call. - # - # TODO(mark): This isn't completely correct. This should - # call a generator-provided function that observes the - # proper list-to-argument quoting rules on a specific - # platform instead of just calling the POSIX encoding - # routine. - encoded_replacement = gyp.common.EncodePOSIXShellList(replacement) - else: - encoded_replacement = replacement + # Split it the same way sh would split arguments. + output = shlex.split(str(replacement)) + else: + # Expanding in string context. + encoded_replacement = '' + if isinstance(replacement, list): + # When expanding a list into string context, turn the list items + # into a string in a way that will work with a subprocess call. + # + # TODO(mark): This isn't completely correct. This should + # call a generator-provided function that observes the + # proper list-to-argument quoting rules on a specific + # platform instead of just calling the POSIX encoding + # routine. + encoded_replacement = gyp.common.EncodePOSIXShellList(replacement) + else: + encoded_replacement = replacement - output = output[:replace_start] + str(encoded_replacement) + \ - output[replace_end:] - # Prepare for the next match iteration. - input_str = output + output = output[:replace_start] + str(encoded_replacement) + \ + output[replace_end:] + # Prepare for the next match iteration. + input_str = output - # Look for more matches now that we've replaced some, to deal with - # expanding local variables (variables defined in the same - # variables block as this one). - gyp.DebugOutput(gyp.DEBUG_VARIABLES, - "Found output %s, recursing." % repr(output)) - if isinstance(output, list): + # Look for more matches now that we've replaced some, to deal with + # expanding local variables (variables defined in the same + # variables block as this one). + gyp.DebugOutput(gyp.DEBUG_VARIABLES, + "Found output %s, recursing." % repr(output)) + if isinstance(output, list): + if output and isinstance(output[0], list): + # Leave output alone if it's a list of lists. + # We don't want such lists to be stringified. + pass + else: new_output = [] for item in output: - new_output.append(ExpandVariables(item, is_late, variables, build_file)) + new_output.append( + ExpandVariables(item, phase, variables, build_file)) output = new_output - else: - output = ExpandVariables(output, is_late, variables, build_file) + else: + output = ExpandVariables(output, phase, variables, build_file) # Convert all strings that are canonically-represented integers into integers. if isinstance(output, list): @@ -779,14 +817,15 @@ def ExpandVariables(input, is_late, variables, build_file): elif IsStrCanonicalInt(output): output = int(output) - gyp.DebugOutput(gyp.DEBUG_VARIABLES, - "Expanding %s to %s" % (repr(input), repr(output))) return output -def ProcessConditionsInDict(the_dict, is_late, variables, build_file): +def ProcessConditionsInDict(the_dict, phase, variables, build_file): # Process a 'conditions' or 'target_conditions' section in the_dict, - # depending on is_late. If is_late is False, 'conditions' is used. + # depending on phase. + # early -> conditions + # late -> target_conditions + # latelate -> no conditions # # Each item in a conditions list consists of cond_expr, a string expression # evaluated as the condition, and true_dict, a dict that will be merged into @@ -795,13 +834,17 @@ def ProcessConditionsInDict(the_dict, is_late, variables, build_file): # cond_expr evaluates to false. # # Any dict merged into the_dict will be recursively processed for nested - # conditionals and other expansions, also according to is_late, immediately + # conditionals and other expansions, also according to phase, immediately # prior to being merged. - if not is_late: + if phase == PHASE_EARLY: conditions_key = 'conditions' - else: + elif phase == PHASE_LATE: conditions_key = 'target_conditions' + elif phase == PHASE_LATELATE: + return + else: + assert False if not conditions_key in the_dict: return @@ -828,7 +871,7 @@ def ProcessConditionsInDict(the_dict, is_late, variables, build_file): # contain variable references without needing to resort to GYP expansion # syntax, this is of dubious value for variables, but someone might want to # use a command expansion directly inside a condition. - cond_expr_expanded = ExpandVariables(cond_expr, is_late, variables, + cond_expr_expanded = ExpandVariables(cond_expr, phase, variables, build_file) if not isinstance(cond_expr_expanded, str) and \ not isinstance(cond_expr_expanded, int): @@ -857,7 +900,7 @@ def ProcessConditionsInDict(the_dict, is_late, variables, build_file): if merge_dict != None: # Expand variables and nested conditinals in the merge_dict before # merging it. - ProcessVariablesAndConditionsInDict(merge_dict, is_late, + ProcessVariablesAndConditionsInDict(merge_dict, phase, variables, build_file) MergeDicts(the_dict, merge_dict, build_file, build_file) @@ -901,7 +944,7 @@ def LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key): variables[variable_name] = value -def ProcessVariablesAndConditionsInDict(the_dict, is_late, variables_in, +def ProcessVariablesAndConditionsInDict(the_dict, phase, variables_in, build_file, the_dict_key=None): """Handle all variable and command expansion and conditional evaluation. @@ -928,7 +971,7 @@ def ProcessVariablesAndConditionsInDict(the_dict, is_late, variables_in, # Pass a copy of the variables dict to avoid having it be tainted. # Otherwise, it would have extra automatics added for everything that # should just be an ordinary variable in this scope. - ProcessVariablesAndConditionsInDict(the_dict['variables'], is_late, + ProcessVariablesAndConditionsInDict(the_dict['variables'], phase, variables, build_file, 'variables') LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key) @@ -936,7 +979,7 @@ def ProcessVariablesAndConditionsInDict(the_dict, is_late, variables_in, for key, value in the_dict.iteritems(): # Skip "variables", which was already processed if present. if key != 'variables' and isinstance(value, str): - expanded = ExpandVariables(value, is_late, variables, build_file) + expanded = ExpandVariables(value, phase, variables, build_file) if not isinstance(expanded, str) and not isinstance(expanded, int): raise ValueError, \ 'Variable expansion in this context permits str and int ' + \ @@ -981,7 +1024,7 @@ def ProcessVariablesAndConditionsInDict(the_dict, is_late, variables_in, # 'target_conditions' section, perform appropriate merging and recursive # conditional and variable processing, and then remove the conditions section # from the_dict if it is present. - ProcessConditionsInDict(the_dict, is_late, variables, build_file) + ProcessConditionsInDict(the_dict, phase, variables, build_file) # Conditional processing may have resulted in changes to automatics or the # variables dict. Reload. @@ -999,21 +1042,21 @@ def ProcessVariablesAndConditionsInDict(the_dict, is_late, variables_in, if isinstance(value, dict): # Pass a copy of the variables dict so that subdicts can't influence # parents. - ProcessVariablesAndConditionsInDict(value, is_late, variables, + ProcessVariablesAndConditionsInDict(value, phase, variables, build_file, key) elif isinstance(value, list): # The list itself can't influence the variables dict, and # ProcessVariablesAndConditionsInList will make copies of the variables # dict if it needs to pass it to something that can influence it. No # copy is necessary here. - ProcessVariablesAndConditionsInList(value, is_late, variables, + ProcessVariablesAndConditionsInList(value, phase, variables, build_file) elif not isinstance(value, int): raise TypeError, 'Unknown type ' + value.__class__.__name__ + \ ' for ' + key -def ProcessVariablesAndConditionsInList(the_list, is_late, variables, +def ProcessVariablesAndConditionsInList(the_list, phase, variables, build_file): # Iterate using an index so that new values can be assigned into the_list. index = 0 @@ -1022,18 +1065,16 @@ def ProcessVariablesAndConditionsInList(the_list, is_late, variables, if isinstance(item, dict): # Make a copy of the variables dict so that it won't influence anything # outside of its own scope. - ProcessVariablesAndConditionsInDict(item, is_late, variables, build_file) + ProcessVariablesAndConditionsInDict(item, phase, variables, build_file) elif isinstance(item, list): - ProcessVariablesAndConditionsInList(item, is_late, variables, build_file) + ProcessVariablesAndConditionsInList(item, phase, variables, build_file) elif isinstance(item, str): - expanded = ExpandVariables(item, is_late, variables, build_file) + expanded = ExpandVariables(item, phase, variables, build_file) if isinstance(expanded, str) or isinstance(expanded, int): the_list[index] = expanded elif isinstance(expanded, list): - del the_list[index] - for expanded_item in expanded: - the_list.insert(index, expanded_item) - index = index + 1 + the_list[index:index+1] = expanded + index += len(expanded) # index now identifies the next item to examine. Continue right now # without falling into the index increment below. @@ -1098,7 +1139,6 @@ def QualifyDependencies(targets): for index in xrange(0, len(dependencies)): dep_file, dep_target, dep_toolset = gyp.common.ResolveTarget( target_build_file, dependencies[index], toolset) - global multiple_toolsets if not multiple_toolsets: # Ignore toolset specification in the dependency if it is specified. dep_toolset = toolset @@ -1184,6 +1224,22 @@ def ExpandWildcardDependencies(targets, data): index = index + 1 +def Unify(l): + """Removes duplicate elements from l, keeping the first element.""" + seen = {} + return [seen.setdefault(e, e) for e in l if e not in seen] + + +def RemoveDuplicateDependencies(targets): + """Makes sure every dependency appears only once in all targets's dependency + lists.""" + for target_name, target_dict in targets.iteritems(): + for dependency_key in dependency_sections: + dependencies = target_dict.get(dependency_key, []) + if dependencies: + target_dict[dependency_key] = Unify(dependencies) + + class DependencyGraphNode(object): """ @@ -1212,14 +1268,14 @@ class DependencyGraphNode(object): # dependencies not in flat_list. Initially, it is a copy of the children # of this node, because when the graph was built, nodes with no # dependencies were made implicit dependents of the root node. - in_degree_zeros = self.dependents[:] + in_degree_zeros = set(self.dependents[:]) while in_degree_zeros: # Nodes in in_degree_zeros have no dependencies not in flat_list, so they # can be appended to flat_list. Take these nodes out of in_degree_zeros # as work progresses, so that the next node to process from the list can # always be accessed at a consistent position. - node = in_degree_zeros.pop(0) + node = in_degree_zeros.pop() flat_list.append(node.ref) # Look at dependents of the node just added to flat_list. Some of them @@ -1239,7 +1295,7 @@ class DependencyGraphNode(object): # All of the dependent's dependencies are already in flat_list. Add # it to in_degree_zeros where it will be processed in a future # iteration of the outer loop. - in_degree_zeros.append(node_dependent) + in_degree_zeros.add(node_dependent) return flat_list @@ -1423,7 +1479,8 @@ def BuildDependencyList(targets): # targets that are not in flat_list. if len(flat_list) != len(targets): raise DependencyGraphNode.CircularException, \ - 'Some targets not reachable, cycle in dependency graph detected' + 'Some targets not reachable, cycle in dependency graph detected: ' + \ + ' '.join(set(flat_list) ^ set(targets)) return [dependency_nodes, flat_list] @@ -1584,7 +1641,7 @@ def AdjustStaticLibraryDependencies(flat_list, targets, dependency_nodes, # Initialize this here to speed up MakePathRelative. -exception_re = re.compile(r'''["']?[-/$<>]''') +exception_re = re.compile(r'''["']?[-/$<>^]''') def MakePathRelative(to_file, fro_file, item): @@ -1600,6 +1657,7 @@ def MakePathRelative(to_file, fro_file, item): # "libraries" section) # < Used for our own variable and command expansions (see ExpandVariables) # > Used for our own variable and command expansions (see ExpandVariables) + # ^ Used for our own variable and command expansions (see ExpandVariables) # # "/' Used when a value is quoted. If these are present, then we # check the second character instead. @@ -1816,7 +1874,6 @@ def MergeConfigWithInheritance(new_configuration_dict, build_file, def SetUpConfigurations(target, target_dict): - global non_configuration_keys # key_suffixes is a list of key suffixes that might appear on key names. # These suffixes are handled in conditional evaluations (for =, +, and ?) # and rules/exclude processing (for ! and /). Keys with these suffixes @@ -2004,7 +2061,7 @@ def ProcessListFiltersInDict(name, the_dict): else: # This is an action that doesn't make any sense. raise ValueError, 'Unrecognized action ' + action + ' in ' + name + \ - ' key ' + key + ' key ' + regex_key for index in xrange(0, len(the_list)): list_item = the_list[index] @@ -2084,6 +2141,33 @@ def ValidateTargetType(target, target_dict): (target, target_type, '/'.join(VALID_TARGET_TYPES))) +def ValidateSourcesInTarget(target, target_dict, build_file): + # TODO: Check if MSVC allows this for non-static_library targets. + if target_dict.get('type', None) != 'static_library': + return + sources = target_dict.get('sources', []) + basenames = {} + for source in sources: + name, ext = os.path.splitext(source) + is_compiled_file = ext in [ + '.c', '.cc', '.cpp', '.cxx', '.m', '.mm', '.s', '.S'] + if not is_compiled_file: + continue + basename = os.path.basename(name) # Don't include extension. + basenames.setdefault(basename, []).append(source) + + error = '' + for basename, files in basenames.iteritems(): + if len(files) > 1: + error += ' %s: %s\n' % (basename, ' '.join(files)) + + if error: + print ('static library %s has several files with the same basename:\n' % + target + error + 'Some build systems, e.g. MSVC08, ' + 'cannot handle that.') + raise KeyError, 'Duplicate basenames in sources section, see list above' + + def ValidateRulesInTarget(target, target_dict, extra_sources_for_rules): """Ensures that the rules sections in target_dict are valid and consistent, and determines which sources they apply to. @@ -2141,19 +2225,6 @@ def ValidateRulesInTarget(target, target_dict, extra_sources_for_rules): rule['rule_sources'] = rule_sources -def ValidateActionsInTarget(target, target_dict, build_file): - '''Validates the inputs to the actions in a target.''' - target_name = target_dict.get('target_name') - actions = target_dict.get('actions', []) - for action in actions: - action_name = action.get('action_name') - if not action_name: - raise Exception("Anonymous action in target %s. " - "An action must have an 'action_name' field." % - target_name) - inputs = action.get('inputs', []) - - def ValidateRunAsInTarget(target, target_dict, build_file): target_name = target_dict.get('target_name') run_as = target_dict.get('run_as') @@ -2184,6 +2255,24 @@ def ValidateRunAsInTarget(target, target_dict, build_file): (target_name, build_file)) +def ValidateActionsInTarget(target, target_dict, build_file): + '''Validates the inputs to the actions in a target.''' + target_name = target_dict.get('target_name') + actions = target_dict.get('actions', []) + for action in actions: + action_name = action.get('action_name') + if not action_name: + raise Exception("Anonymous action in target %s. " + "An action must have an 'action_name' field." % + target_name) + inputs = action.get('inputs', None) + if inputs is None: + raise Exception('Action in target %s has no inputs.' % target_name) + action_command = action.get('action') + if action_command and not action_command[0]: + raise Exception("Empty action as command in target %s." % target_name) + + def TurnIntIntoStrInDict(the_dict): """Given dict the_dict, recursively converts all integers into strings. """ @@ -2314,6 +2403,9 @@ def Load(build_files, variables, includes, depth, generator_input_info, check, for key in tmp_dict: target_dict[key] = tmp_dict[key] + # Make sure every dependency appears at most once. + RemoveDuplicateDependencies(targets) + if circular_check: # Make sure that any targets in a.gyp don't contain dependencies in other # .gyp files that further depend on a.gyp. @@ -2348,8 +2440,8 @@ def Load(build_files, variables, includes, depth, generator_input_info, check, for target in flat_list: target_dict = targets[target] build_file = gyp.common.BuildFile(target) - ProcessVariablesAndConditionsInDict(target_dict, True, variables, - build_file) + ProcessVariablesAndConditionsInDict( + target_dict, PHASE_LATE, variables, build_file) # Move everything that can go into a "configurations" section into one. for target in flat_list: @@ -2361,6 +2453,13 @@ def Load(build_files, variables, includes, depth, generator_input_info, check, target_dict = targets[target] ProcessListFiltersInDict(target, target_dict) + # Apply "latelate" variable expansions and condition evaluations. + for target in flat_list: + target_dict = targets[target] + build_file = gyp.common.BuildFile(target) + ProcessVariablesAndConditionsInDict( + target_dict, PHASE_LATELATE, variables, build_file) + # Make sure that the rules make sense, and build up rule_sources lists as # needed. Not all generators will need to use the rule_sources lists, but # some may, and it seems best to build the list in a common spot. @@ -2369,6 +2468,10 @@ def Load(build_files, variables, includes, depth, generator_input_info, check, target_dict = targets[target] build_file = gyp.common.BuildFile(target) ValidateTargetType(target, target_dict) + # TODO(thakis): Get vpx_scale/arm/scalesystemdependent.c to be renamed to + # scalesystemdependent_arm_additions.c or similar. + if 'arm' not in variables.get('target_arch', ''): + ValidateSourcesInTarget(target, target_dict, build_file) ValidateRulesInTarget(target, target_dict, extra_sources_for_rules) ValidateRunAsInTarget(target, target_dict, build_file) ValidateActionsInTarget(target, target_dict, build_file) diff --git a/tools/gyp/pylib/gyp/mac_tool.py b/tools/gyp/pylib/gyp/mac_tool.py index 42dd6c9923..b918c5826c 100755 --- a/tools/gyp/pylib/gyp/mac_tool.py +++ b/tools/gyp/pylib/gyp/mac_tool.py @@ -51,26 +51,31 @@ class MacTool(object): shutil.rmtree(dest) shutil.copytree(source, dest) elif extension == '.xib': - self._CopyXIBFile(source, dest) + return self._CopyXIBFile(source, dest) elif extension == '.strings': self._CopyStringsFile(source, dest) - # TODO: Given that files with arbitrary extensions can be copied to the - # bundle, we will want to get rid of this whitelist eventually. - elif extension in [ - '.icns', '.manifest', '.pak', '.pdf', '.png', '.sb', '.sh', - '.ttf', '.sdef']: - shutil.copyfile(source, dest) else: - raise NotImplementedError( - "Don't know how to copy bundle resources of type %s while copying " - "%s to %s)" % (extension, source, dest)) + shutil.copyfile(source, dest) def _CopyXIBFile(self, source, dest): """Compiles a XIB file with ibtool into a binary plist in the bundle.""" - args = ['/Developer/usr/bin/ibtool', '--errors', '--warnings', + tools_dir = os.environ.get('DEVELOPER_BIN_DIR', '/usr/bin') + args = [os.path.join(tools_dir, 'ibtool'), '--errors', '--warnings', '--notices', '--output-format', 'human-readable-text', '--compile', dest, source] - subprocess.call(args) + ibtool_section_re = re.compile(r'/\*.*\*/') + ibtool_re = re.compile(r'.*note:.*is clipping its content') + ibtoolout = subprocess.Popen(args, stdout=subprocess.PIPE) + current_section_header = None + for line in ibtoolout.stdout: + if ibtool_section_re.match(line): + current_section_header = line + elif not ibtool_re.match(line): + if current_section_header: + sys.stdout.write(current_section_header) + current_section_header = None + sys.stdout.write(line) + return ibtoolout.returncode def _CopyStringsFile(self, source, dest): """Copies a .strings file using iconv to reconvert the input into UTF-16.""" @@ -138,8 +143,8 @@ class MacTool(object): # The format of PkgInfo is eight characters, representing the bundle type # and bundle signature, each four characters. If that is missing, four # '?' characters are used instead. - signature_code = plist['CFBundleSignature'] - if len(signature_code) != 4: + signature_code = plist.get('CFBundleSignature', '????') + if len(signature_code) != 4: # Wrong length resets everything, too. signature_code = '?' * 4 dest = os.path.join(os.path.dirname(info_plist), 'PkgInfo') diff --git a/tools/gyp/pylib/gyp/msvs_emulation.py b/tools/gyp/pylib/gyp/msvs_emulation.py new file mode 100644 index 0000000000..4e1ecc6e3f --- /dev/null +++ b/tools/gyp/pylib/gyp/msvs_emulation.py @@ -0,0 +1,642 @@ +# 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. + +""" +This module helps emulate Visual Studio 2008 behavior on top of other +build systems, primarily ninja. +""" + +import os +import re +import subprocess +import sys + +import gyp.MSVSVersion + +windows_quoter_regex = re.compile(r'(\\*)"') + +def QuoteForRspFile(arg): + """Quote a command line argument so that it appears as one argument when + processed via cmd.exe and parsed by CommandLineToArgvW (as is typical for + Windows programs).""" + # See http://goo.gl/cuFbX and http://goo.gl/dhPnp including the comment + # threads. This is actually the quoting rules for CommandLineToArgvW, not + # for the shell, because the shell doesn't do anything in Windows. This + # works more or less because most programs (including the compiler, etc.) + # use that function to handle command line arguments. + + # For a literal quote, CommandLineToArgvW requires 2n+1 backslashes + # preceding it, and results in n backslashes + the quote. So we substitute + # in 2* what we match, +1 more, plus the quote. + arg = windows_quoter_regex.sub(lambda mo: 2 * mo.group(1) + '\\"', arg) + + # %'s also need to be doubled otherwise they're interpreted as batch + # positional arguments. Also make sure to escape the % so that they're + # passed literally through escaping so they can be singled to just the + # original %. Otherwise, trying to pass the literal representation that + # looks like an environment variable to the shell (e.g. %PATH%) would fail. + arg = arg.replace('%', '%%') + + # These commands are used in rsp files, so no escaping for the shell (via ^) + # is necessary. + + # Finally, wrap the whole thing in quotes so that the above quote rule + # applies and whitespace isn't a word break. + return '"' + arg + '"' + + +def EncodeRspFileList(args): + """Process a list of arguments using QuoteCmdExeArgument.""" + # Note that the first argument is assumed to be the command. Don't add + # quotes around it because then built-ins like 'echo', etc. won't work. + # Take care to normpath only the path in the case of 'call ../x.bat' because + # otherwise the whole thing is incorrectly interpreted as a path and not + # normalized correctly. + if not args: return '' + if args[0].startswith('call '): + call, program = args[0].split(' ', 1) + program = call + ' ' + os.path.normpath(program) + else: + program = os.path.normpath(args[0]) + return program + ' ' + ' '.join(QuoteForRspFile(arg) for arg in args[1:]) + + +def _GenericRetrieve(root, default, path): + """Given a list of dictionary keys |path| and a tree of dicts |root|, find + value at path, or return |default| if any of the path doesn't exist.""" + if not root: + return default + if not path: + return root + return _GenericRetrieve(root.get(path[0]), default, path[1:]) + + +def _AddPrefix(element, prefix): + """Add |prefix| to |element| or each subelement if element is iterable.""" + if element is None: + return element + # Note, not Iterable because we don't want to handle strings like that. + if isinstance(element, list) or isinstance(element, tuple): + return [prefix + e for e in element] + else: + return prefix + element + + +def _DoRemapping(element, map): + """If |element| then remap it through |map|. If |element| is iterable then + each item will be remapped. Any elements not found will be removed.""" + if map is not None and element is not None: + if not callable(map): + map = map.get # Assume it's a dict, otherwise a callable to do the remap. + if isinstance(element, list) or isinstance(element, tuple): + element = filter(None, [map(elem) for elem in element]) + else: + element = map(element) + return element + + +def _AppendOrReturn(append, element): + """If |append| is None, simply return |element|. If |append| is not None, + then add |element| to it, adding each item in |element| if it's a list or + tuple.""" + if append is not None and element is not None: + if isinstance(element, list) or isinstance(element, tuple): + append.extend(element) + else: + append.append(element) + else: + return element + + +def _FindDirectXInstallation(): + """Try to find an installation location for the DirectX SDK. Check for the + standard environment variable, and if that doesn't exist, try to find + via the registry. May return None if not found in either location.""" + dxsdk_dir = os.environ.get('DXSDK_DIR') + if not dxsdk_dir: + # Setup params to pass to and attempt to launch reg.exe. + cmd = ['reg.exe', 'query', r'HKLM\Software\Microsoft\DirectX', '/s'] + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + for line in p.communicate()[0].splitlines(): + if 'InstallPath' in line: + dxsdk_dir = line.split(' ')[3] + "\\" + return dxsdk_dir + + +class MsvsSettings(object): + """A class that understands the gyp 'msvs_...' values (especially the + msvs_settings field). They largely correpond to the VS2008 IDE DOM. This + class helps map those settings to command line options.""" + + def __init__(self, spec, generator_flags): + self.spec = spec + self.vs_version = GetVSVersion(generator_flags) + self.dxsdk_dir = _FindDirectXInstallation() + + # Try to find an installation location for the Windows DDK by checking + # the WDK_DIR environment variable, may be None. + self.wdk_dir = os.environ.get('WDK_DIR') + + supported_fields = [ + ('msvs_configuration_attributes', dict), + ('msvs_settings', dict), + ('msvs_system_include_dirs', list), + ('msvs_disabled_warnings', list), + ('msvs_precompiled_header', str), + ('msvs_precompiled_source', str), + ('msvs_target_platform', str), + ] + configs = spec['configurations'] + for field, default in supported_fields: + setattr(self, field, {}) + for configname, config in configs.iteritems(): + getattr(self, field)[configname] = config.get(field, default()) + + self.msvs_cygwin_dirs = spec.get('msvs_cygwin_dirs', ['.']) + + def GetVSMacroEnv(self, base_to_build=None, config=None): + """Get a dict of variables mapping internal VS macro names to their gyp + equivalents.""" + target_platform = self.GetTargetPlatform(config) + target_platform = {'x86': 'Win32'}.get(target_platform, target_platform) + replacements = { + '$(VSInstallDir)': self.vs_version.Path(), + '$(VCInstallDir)': os.path.join(self.vs_version.Path(), 'VC') + '\\', + '$(OutDir)\\': base_to_build + '\\' if base_to_build else '', + '$(IntDir)': '$!INTERMEDIATE_DIR', + '$(InputPath)': '${source}', + '$(InputName)': '${root}', + '$(ProjectName)': self.spec['target_name'], + '$(PlatformName)': target_platform, + } + # Chromium uses DXSDK_DIR in include/lib paths, but it may or may not be + # set. This happens when the SDK is sync'd via src-internal, rather than + # by typical end-user installation of the SDK. If it's not set, we don't + # want to leave the unexpanded variable in the path, so simply strip it. + replacements['$(DXSDK_DIR)'] = self.dxsdk_dir if self.dxsdk_dir else '' + replacements['$(WDK_DIR)'] = self.wdk_dir if self.wdk_dir else '' + return replacements + + def ConvertVSMacros(self, s, base_to_build=None, config=None): + """Convert from VS macro names to something equivalent.""" + env = self.GetVSMacroEnv(base_to_build, config=config) + return ExpandMacros(s, env) + + def AdjustLibraries(self, libraries): + """Strip -l from library if it's specified with that.""" + return [lib[2:] if lib.startswith('-l') else lib for lib in libraries] + + def _GetAndMunge(self, field, path, default, prefix, append, map): + """Retrieve a value from |field| at |path| or return |default|. If + |append| is specified, and the item is found, it will be appended to that + object instead of returned. If |map| is specified, results will be + remapped through |map| before being returned or appended.""" + result = _GenericRetrieve(field, default, path) + result = _DoRemapping(result, map) + result = _AddPrefix(result, prefix) + return _AppendOrReturn(append, result) + + class _GetWrapper(object): + def __init__(self, parent, field, base_path, append=None): + self.parent = parent + self.field = field + self.base_path = [base_path] + self.append = append + def __call__(self, name, map=None, prefix='', default=None): + return self.parent._GetAndMunge(self.field, self.base_path + [name], + default=default, prefix=prefix, append=self.append, map=map) + + def GetTargetPlatform(self, config): + target_platform = self.msvs_target_platform.get(config, '') + if not target_platform: + target_platform = 'Win32' + return {'Win32': 'x86'}.get(target_platform, target_platform) + + def _RealConfig(self, config): + target_platform = self.GetTargetPlatform(config) + if target_platform == 'x64' and not config.endswith('_x64'): + config += '_x64' + return config + + def _Setting(self, path, config, + default=None, prefix='', append=None, map=None): + """_GetAndMunge for msvs_settings.""" + config = self._RealConfig(config) + return self._GetAndMunge( + self.msvs_settings[config], path, default, prefix, append, map) + + def _ConfigAttrib(self, path, config, + default=None, prefix='', append=None, map=None): + """_GetAndMunge for msvs_configuration_attributes.""" + config = self._RealConfig(config) + return self._GetAndMunge( + self.msvs_configuration_attributes[config], + path, default, prefix, append, map) + + def AdjustIncludeDirs(self, include_dirs, config): + """Updates include_dirs to expand VS specific paths, and adds the system + include dirs used for platform SDK and similar.""" + config = self._RealConfig(config) + includes = include_dirs + self.msvs_system_include_dirs[config] + includes.extend(self._Setting( + ('VCCLCompilerTool', 'AdditionalIncludeDirectories'), config, default=[])) + return [self.ConvertVSMacros(p, config=config) for p in includes] + + def GetComputedDefines(self, config): + """Returns the set of defines that are injected to the defines list based + on other VS settings.""" + config = self._RealConfig(config) + defines = [] + if self._ConfigAttrib(['CharacterSet'], config) == '1': + defines.extend(('_UNICODE', 'UNICODE')) + if self._ConfigAttrib(['CharacterSet'], config) == '2': + defines.append('_MBCS') + defines.extend(self._Setting( + ('VCCLCompilerTool', 'PreprocessorDefinitions'), config, default=[])) + return defines + + def GetOutputName(self, config, expand_special): + """Gets the explicitly overridden output name for a target or returns None + if it's not overridden.""" + config = self._RealConfig(config) + type = self.spec['type'] + root = 'VCLibrarianTool' if type == 'static_library' else 'VCLinkerTool' + # TODO(scottmg): Handle OutputDirectory without OutputFile. + output_file = self._Setting((root, 'OutputFile'), config) + if output_file: + output_file = expand_special(self.ConvertVSMacros( + output_file, config=config)) + return output_file + + def GetCflags(self, config): + """Returns the flags that need to be added to .c and .cc compilations.""" + config = self._RealConfig(config) + cflags = [] + cflags.extend(['/wd' + w for w in self.msvs_disabled_warnings[config]]) + cl = self._GetWrapper(self, self.msvs_settings[config], + 'VCCLCompilerTool', append=cflags) + cl('Optimization', + map={'0': 'd', '1': '1', '2': '2', '3': 'x'}, prefix='/O') + cl('InlineFunctionExpansion', prefix='/Ob') + cl('OmitFramePointers', map={'false': '-', 'true': ''}, prefix='/Oy') + cl('FavorSizeOrSpeed', map={'1': 't', '2': 's'}, prefix='/O') + cl('WholeProgramOptimization', map={'true': '/GL'}) + cl('WarningLevel', prefix='/W') + cl('WarnAsError', map={'true': '/WX'}) + cl('DebugInformationFormat', + map={'1': '7', '3': 'i', '4': 'I'}, prefix='/Z') + cl('RuntimeTypeInfo', map={'true': '/GR', 'false': '/GR-'}) + cl('EnableFunctionLevelLinking', map={'true': '/Gy', 'false': '/Gy-'}) + cl('MinimalRebuild', map={'true': '/Gm'}) + cl('BufferSecurityCheck', map={'true': '/GS', 'false': '/GS-'}) + cl('BasicRuntimeChecks', map={'1': 's', '2': 'u', '3': '1'}, prefix='/RTC') + cl('RuntimeLibrary', + map={'0': 'T', '1': 'Td', '2': 'D', '3': 'Dd'}, prefix='/M') + cl('ExceptionHandling', map={'1': 'sc','2': 'a'}, prefix='/EH') + cl('AdditionalOptions', prefix='') + # ninja handles parallelism by itself, don't have the compiler do it too. + cflags = filter(lambda x: not x.startswith('/MP'), cflags) + return cflags + + def GetPrecompiledHeader(self, config, gyp_to_build_path): + """Returns an object that handles the generation of precompiled header + build steps.""" + config = self._RealConfig(config) + return _PchHelper(self, config, gyp_to_build_path) + + def _GetPchFlags(self, config, extension): + """Get the flags to be added to the cflags for precompiled header support. + """ + config = self._RealConfig(config) + # The PCH is only built once by a particular source file. Usage of PCH must + # only be for the same language (i.e. C vs. C++), so only include the pch + # flags when the language matches. + if self.msvs_precompiled_header[config]: + source_ext = os.path.splitext(self.msvs_precompiled_source[config])[1] + if _LanguageMatchesForPch(source_ext, extension): + pch = os.path.split(self.msvs_precompiled_header[config])[1] + return ['/Yu' + pch, '/FI' + pch, '/Fp${pchprefix}.' + pch + '.pch'] + return [] + + def GetCflagsC(self, config): + """Returns the flags that need to be added to .c compilations.""" + config = self._RealConfig(config) + return self._GetPchFlags(config, '.c') + + def GetCflagsCC(self, config): + """Returns the flags that need to be added to .cc compilations.""" + config = self._RealConfig(config) + return ['/TP'] + self._GetPchFlags(config, '.cc') + + def _GetAdditionalLibraryDirectories(self, root, config, gyp_to_build_path): + """Get and normalize the list of paths in AdditionalLibraryDirectories + setting.""" + config = self._RealConfig(config) + libpaths = self._Setting((root, 'AdditionalLibraryDirectories'), + config, default=[]) + libpaths = [os.path.normpath( + gyp_to_build_path(self.ConvertVSMacros(p, config=config))) + for p in libpaths] + return ['/LIBPATH:"' + p + '"' for p in libpaths] + + def GetLibFlags(self, config, gyp_to_build_path): + """Returns the flags that need to be added to lib commands.""" + config = self._RealConfig(config) + libflags = [] + lib = self._GetWrapper(self, self.msvs_settings[config], + 'VCLibrarianTool', append=libflags) + libflags.extend(self._GetAdditionalLibraryDirectories( + 'VCLibrarianTool', config, gyp_to_build_path)) + lib('AdditionalOptions') + return libflags + + def _GetDefFileAsLdflags(self, spec, ldflags, gyp_to_build_path): + """.def files get implicitly converted to a ModuleDefinitionFile for the + linker in the VS generator. Emulate that behaviour here.""" + def_file = '' + if spec['type'] in ('shared_library', 'loadable_module', 'executable'): + def_files = [s for s in spec.get('sources', []) if s.endswith('.def')] + if len(def_files) == 1: + ldflags.append('/DEF:"%s"' % gyp_to_build_path(def_files[0])) + elif len(def_files) > 1: + raise Exception("Multiple .def files") + + def GetLdflags(self, config, gyp_to_build_path, expand_special): + """Returns the flags that need to be added to link commands.""" + config = self._RealConfig(config) + ldflags = [] + ld = self._GetWrapper(self, self.msvs_settings[config], + 'VCLinkerTool', append=ldflags) + self._GetDefFileAsLdflags(self.spec, ldflags, gyp_to_build_path) + ld('GenerateDebugInformation', map={'true': '/DEBUG'}) + ld('TargetMachine', map={'1': 'X86', '17': 'X64'}, prefix='/MACHINE:') + ldflags.extend(self._GetAdditionalLibraryDirectories( + 'VCLinkerTool', config, gyp_to_build_path)) + ld('DelayLoadDLLs', prefix='/DELAYLOAD:') + out = self.GetOutputName(config, expand_special) + if out: + ldflags.append('/OUT:' + out) + ld('AdditionalOptions', prefix='') + ld('SubSystem', map={'1': 'CONSOLE', '2': 'WINDOWS'}, prefix='/SUBSYSTEM:') + ld('LinkIncremental', map={'1': ':NO', '2': ''}, prefix='/INCREMENTAL') + ld('FixedBaseAddress', map={'1': ':NO', '2': ''}, prefix='/FIXED') + ld('RandomizedBaseAddress', + map={'1': ':NO', '2': ''}, prefix='/DYNAMICBASE') + ld('DataExecutionPrevention', + map={'1': ':NO', '2': ''}, prefix='/NXCOMPAT') + ld('OptimizeReferences', map={'1': 'NOREF', '2': 'REF'}, prefix='/OPT:') + ld('EnableCOMDATFolding', map={'1': 'NOICF', '2': 'ICF'}, prefix='/OPT:') + ld('LinkTimeCodeGeneration', map={'1': '/LTCG'}) + ld('IgnoreDefaultLibraryNames', prefix='/NODEFAULTLIB:') + ld('ResourceOnlyDLL', map={'true': '/NOENTRY'}) + ld('EntryPointSymbol', prefix='/ENTRY:') + # TODO(scottmg): This should sort of be somewhere else (not really a flag). + ld('AdditionalDependencies', prefix='') + # TODO(scottmg): These too. + ldflags.extend(('kernel32.lib', 'user32.lib', 'gdi32.lib', 'winspool.lib', + 'comdlg32.lib', 'advapi32.lib', 'shell32.lib', 'ole32.lib', + 'oleaut32.lib', 'uuid.lib', 'odbc32.lib', 'DelayImp.lib')) + + # If the base address is not specifically controlled, DYNAMICBASE should + # be on by default. + base_flags = filter(lambda x: 'DYNAMICBASE' in x or x == '/FIXED', + ldflags) + if not base_flags: + ldflags.append('/DYNAMICBASE') + + # If the NXCOMPAT flag has not been specified, default to on. Despite the + # documentation that says this only defaults to on when the subsystem is + # Vista or greater (which applies to the linker), the IDE defaults it on + # unless it's explicitly off. + if not filter(lambda x: 'NXCOMPAT' in x, ldflags): + ldflags.append('/NXCOMPAT') + + return ldflags + + def IsUseLibraryDependencyInputs(self, config): + """Returns whether the target should be linked via Use Library Dependency + Inputs (using component .objs of a given .lib).""" + config = self._RealConfig(config) + uldi = self._Setting(('VCLinkerTool', 'UseLibraryDependencyInputs'), config) + return uldi == 'true' + + def GetRcflags(self, config, gyp_to_ninja_path): + """Returns the flags that need to be added to invocations of the resource + compiler.""" + config = self._RealConfig(config) + rcflags = [] + rc = self._GetWrapper(self, self.msvs_settings[config], + 'VCResourceCompilerTool', append=rcflags) + rc('AdditionalIncludeDirectories', map=gyp_to_ninja_path, prefix='/I') + rcflags.append('/I' + gyp_to_ninja_path('.')) + rc('PreprocessorDefinitions', prefix='/d') + # /l arg must be in hex without leading '0x' + rc('Culture', prefix='/l', map=lambda x: hex(int(x))[2:]) + return rcflags + + def BuildCygwinBashCommandLine(self, args, path_to_base): + """Build a command line that runs args via cygwin bash. We assume that all + incoming paths are in Windows normpath'd form, so they need to be + converted to posix style for the part of the command line that's passed to + bash. We also have to do some Visual Studio macro emulation here because + various rules use magic VS names for things. Also note that rules that + contain ninja variables cannot be fixed here (for example ${source}), so + the outer generator needs to make sure that the paths that are written out + are in posix style, if the command line will be used here.""" + cygwin_dir = os.path.normpath( + os.path.join(path_to_base, self.msvs_cygwin_dirs[0])) + cd = ('cd %s' % path_to_base).replace('\\', '/') + args = [a.replace('\\', '/') for a in args] + args = ["'%s'" % a.replace("'", "\\'") for a in args] + bash_cmd = ' '.join(args) + cmd = ( + 'call "%s\\setup_env.bat" && set CYGWIN=nontsec && ' % cygwin_dir + + 'bash -c "%s ; %s"' % (cd, bash_cmd)) + return cmd + + def IsRuleRunUnderCygwin(self, rule): + """Determine if an action should be run under cygwin. If the variable is + unset, or set to 1 we use cygwin.""" + return int(rule.get('msvs_cygwin_shell', + self.spec.get('msvs_cygwin_shell', 1))) != 0 + + def HasExplicitIdlRules(self, spec): + """Determine if there's an explicit rule for idl files. When there isn't we + need to generate implicit rules to build MIDL .idl files.""" + for rule in spec.get('rules', []): + if rule['extension'] == 'idl' and int(rule.get('msvs_external_rule', 0)): + return True + return False + + def GetIdlBuildData(self, source, config): + """Determine the implicit outputs for an idl file. Returns output + directory, outputs, and variables and flags that are required.""" + config = self._RealConfig(config) + midl_get = self._GetWrapper(self, self.msvs_settings[config], 'VCMIDLTool') + def midl(name, default=None): + return self.ConvertVSMacros(midl_get(name, default=default), + config=config) + tlb = midl('TypeLibraryName', default='${root}.tlb') + header = midl('HeaderFileName', default='${root}.h') + dlldata = midl('DLLDataFileName', default='dlldata.c') + iid = midl('InterfaceIdentifierFileName', default='${root}_i.c') + proxy = midl('ProxyFileName', default='${root}_p.c') + # Note that .tlb is not included in the outputs as it is not always + # generated depending on the content of the input idl file. + outdir = midl('OutputDirectory', default='') + output = [header, dlldata, iid, proxy] + variables = [('tlb', tlb), + ('h', header), + ('dlldata', dlldata), + ('iid', iid), + ('proxy', proxy)] + # TODO(scottmg): Are there configuration settings to set these flags? + flags = ['/char', 'signed', '/env', 'win32', '/Oicf'] + return outdir, output, variables, flags + + +def _LanguageMatchesForPch(source_ext, pch_source_ext): + c_exts = ('.c',) + cc_exts = ('.cc', '.cxx', '.cpp') + return ((source_ext in c_exts and pch_source_ext in c_exts) or + (source_ext in cc_exts and pch_source_ext in cc_exts)) + +class PrecompiledHeader(object): + """Helper to generate dependencies and build rules to handle generation of + precompiled headers. Interface matches the GCH handler in xcode_emulation.py. + """ + def __init__(self, settings, config, gyp_to_build_path): + self.settings = settings + self.config = config + self.gyp_to_build_path = gyp_to_build_path + + def _PchHeader(self): + """Get the header that will appear in an #include line for all source + files.""" + return os.path.split(self.settings.msvs_precompiled_header[self.config])[1] + + def _PchSource(self): + """Get the source file that is built once to compile the pch data.""" + return self.gyp_to_build_path( + self.settings.msvs_precompiled_source[self.config]) + + def _PchOutput(self): + """Get the name of the output of the compiled pch data.""" + return '${pchprefix}.' + self._PchHeader() + '.pch' + + def GetObjDependencies(self, sources, objs): + """Given a list of sources files and the corresponding object files, + returns a list of the pch files that should be depended upon. The + additional wrapping in the return value is for interface compatability + with make.py on Mac, and xcode_emulation.py.""" + if not self._PchHeader(): + return [] + source = self._PchSource() + assert source + pch_ext = os.path.splitext(self._PchSource())[1] + for source in sources: + if _LanguageMatchesForPch(os.path.splitext(source)[1], pch_ext): + return [(None, None, self._PchOutput())] + return [] + + def GetPchBuildCommands(self): + """Returns [(path_to_pch, language_flag, language, header)]. + |path_to_gch| and |header| are relative to the build directory.""" + header = self._PchHeader() + source = self._PchSource() + if not source or not header: + return [] + ext = os.path.splitext(source)[1] + lang = 'c' if ext == '.c' else 'cc' + return [(self._PchOutput(), '/Yc' + header, lang, source)] + + +vs_version = None +def GetVSVersion(generator_flags): + global vs_version + if not vs_version: + vs_version = gyp.MSVSVersion.SelectVisualStudioVersion( + generator_flags.get('msvs_version', 'auto')) + return vs_version + +def _GetVsvarsSetupArgs(generator_flags, arch): + vs = GetVSVersion(generator_flags) + return vs.SetupScript() + +def ExpandMacros(string, expansions): + """Expand $(Variable) per expansions dict. See MsvsSettings.GetVSMacroEnv + for the canonical way to retrieve a suitable dict.""" + if '$' in string: + for old, new in expansions.iteritems(): + assert '$(' not in new, new + string = string.replace(old, new) + return string + +def _ExtractImportantEnvironment(output_of_set): + """Extracts environment variables required for the toolchain to run from + a textual dump output by the cmd.exe 'set' command.""" + envvars_to_save = ( + 'goma_.*', # TODO(scottmg): This is ugly, but needed for goma. + 'include', + 'lib', + 'libpath', + 'path', + 'pathext', + 'systemroot', + 'temp', + 'tmp', + ) + env = {} + for line in output_of_set.splitlines(): + for envvar in envvars_to_save: + if re.match(envvar + '=', line.lower()): + var, setting = line.split('=', 1) + if envvar == 'path': + # Our own rules (for running gyp-win-tool) and other actions in + # Chromium rely on python being in the path. Add the path to this + # python here so that if it's not in the path when ninja is run + # later, python will still be found. + setting = os.path.dirname(sys.executable) + os.pathsep + setting + env[var.upper()] = setting + break + for required in ('SYSTEMROOT', 'TEMP', 'TMP'): + if required not in env: + raise Exception('Environment variable "%s" ' + 'required to be set to valid path' % required) + return env + +def _FormatAsEnvironmentBlock(envvar_dict): + """Format as an 'environment block' directly suitable for CreateProcess. + Briefly this is a list of key=value\0, terminated by an additional \0. See + CreateProcess documentation for more details.""" + block = '' + nul = '\0' + for key, value in envvar_dict.iteritems(): + block += key + '=' + value + nul + block += nul + return block + +def GenerateEnvironmentFiles(toplevel_build_dir, generator_flags, open_out): + """It's not sufficient to have the absolute path to the compiler, linker, + etc. on Windows, as those tools rely on .dlls being in the PATH. We also + need to support both x86 and x64 compilers within the same build (to support + msvs_target_platform hackery). Different architectures require a different + compiler binary, and different supporting environment variables (INCLUDE, + LIB, LIBPATH). So, we extract the environment here, wrap all invocations + of compiler tools (cl, link, lib, rc, midl, etc.) via win_tool.py which + sets up the environment, and then we do not prefix the compiler with + an absolute path, instead preferring something like "cl.exe" in the rule + which will then run whichever the environment setup has put in the path.""" + vs = GetVSVersion(generator_flags) + for arch in ('x86', 'x64'): + args = vs.SetupScript(arch) + args.extend(('&&', 'set')) + popen = subprocess.Popen( + args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + variables, _ = popen.communicate() + env = _ExtractImportantEnvironment(variables) + env_block = _FormatAsEnvironmentBlock(env) + f = open_out(os.path.join(toplevel_build_dir, 'environment.' + arch), 'wb') + f.write(env_block) + f.close() diff --git a/tools/gyp/pylib/gyp/ninja_syntax.py b/tools/gyp/pylib/gyp/ninja_syntax.py index 27e1908761..25b9f74428 100644 --- a/tools/gyp/pylib/gyp/ninja_syntax.py +++ b/tools/gyp/pylib/gyp/ninja_syntax.py @@ -35,7 +35,8 @@ class Writer(object): self._line('%s = %s' % (key, value), indent) def rule(self, name, command, description=None, depfile=None, - generator=False, restat=False, deplist=None): + generator=False, restat=False, deplist=None, rspfile=None, + rspfile_content=None): self._line('rule %s' % name) self.variable('command', command, indent=1) if description: @@ -48,13 +49,17 @@ class Writer(object): self.variable('generator', '1', indent=1) if restat: self.variable('restat', '1', indent=1) + if rspfile: + self.variable('rspfile', rspfile, indent=1) + if rspfile_content: + self.variable('rspfile_content', rspfile_content, indent=1) def build(self, outputs, rule, inputs=None, implicit=None, order_only=None, variables=None): outputs = self._as_list(outputs) all_inputs = self._as_list(inputs)[:] - out_outputs = map(escape_spaces, outputs) - all_inputs = map(escape_spaces, all_inputs) + out_outputs = list(map(escape_spaces, outputs)) + all_inputs = list(map(escape_spaces, all_inputs)) if implicit: implicit = map(escape_spaces, self._as_list(implicit)) @@ -70,7 +75,12 @@ class Writer(object): ' '.join(all_inputs))) if variables: - for key, val in variables: + if isinstance(variables, dict): + iterator = variables.iteritems() + else: + iterator = iter(variables) + + for key, val in iterator: self.variable(key, val, indent=1) return outputs @@ -96,7 +106,7 @@ class Writer(object): def _line(self, text, indent=0): """Write 'text' word-wrapped at self.width characters.""" leading_space = ' ' * indent - while len(text) > self.width: + while len(leading_space) + len(text) > self.width: # The text is too wide; wrap if possible. # Find the rightmost space that would obey our width constraint and diff --git a/tools/gyp/pylib/gyp/win_tool.py b/tools/gyp/pylib/gyp/win_tool.py new file mode 100644 index 0000000000..9548b1cfe3 --- /dev/null +++ b/tools/gyp/pylib/gyp/win_tool.py @@ -0,0 +1,161 @@ +#!/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. + +"""Utility functions for Windows builds. + +These functions are executed via gyp-win-tool when using the ninja generator. +""" + +import os +import shutil +import subprocess +import sys + + +def main(args): + executor = WinTool() + exit_code = executor.Dispatch(args) + if exit_code is not None: + sys.exit(exit_code) + + +class WinTool(object): + """This class performs all the Windows tooling steps. The methods can either + be executed directly, or dispatched from an argument list.""" + + def Dispatch(self, args): + """Dispatches a string command to a method.""" + if len(args) < 1: + raise Exception("Not enough arguments") + + method = "Exec%s" % self._CommandifyName(args[0]) + return getattr(self, method)(*args[1:]) + + def _CommandifyName(self, name_string): + """Transforms a tool name like recursive-mirror to RecursiveMirror.""" + return name_string.title().replace('-', '') + + def _GetEnv(self, arch): + """Gets the saved environment from a file for a given architecture.""" + # The environment is saved as an "environment block" (see CreateProcess + # and msvs_emulation for details). We convert to a dict here. + # Drop last 2 NULs, one for list terminator, one for trailing vs. separator. + pairs = open(arch).read()[:-2].split('\0') + kvs = [item.split('=', 1) for item in pairs] + return dict(kvs) + + def ExecStamp(self, path): + """Simple stamp command.""" + open(path, 'w').close() + + def ExecRecursiveMirror(self, source, dest): + """Emulation of rm -rf out && cp -af in out.""" + if os.path.exists(dest): + if os.path.isdir(dest): + shutil.rmtree(dest) + else: + os.unlink(dest) + if os.path.isdir(source): + shutil.copytree(source, dest) + else: + shutil.copy2(source, dest) + + def ExecLinkWrapper(self, arch, *args): + """Filter diagnostic output from link that looks like: + ' Creating library ui.dll.lib and object ui.dll.exp' + This happens when there are exports from the dll or exe. + """ + env = self._GetEnv(arch) + popen = subprocess.Popen(args, shell=True, env=env, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + out, _ = popen.communicate() + for line in out.splitlines(): + if not line.startswith(' Creating library '): + print line + return popen.returncode + + def ExecMidlWrapper(self, arch, outdir, tlb, h, dlldata, iid, proxy, idl, + *flags): + """Filter noisy filenames output from MIDL compile step that isn't + quietable via command line flags. + """ + args = ['midl', '/nologo'] + list(flags) + [ + '/out', outdir, + '/tlb', tlb, + '/h', h, + '/dlldata', dlldata, + '/iid', iid, + '/proxy', proxy, + idl] + env = self._GetEnv(arch) + popen = subprocess.Popen(args, shell=True, env=env, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + out, _ = popen.communicate() + # Filter junk out of stdout, and write filtered versions. Output we want + # to filter is pairs of lines that look like this: + # Processing C:\Program Files (x86)\Microsoft SDKs\...\include\objidl.idl + # objidl.idl + lines = out.splitlines() + prefix = 'Processing ' + processing = set(os.path.basename(x) for x in lines if x.startswith(prefix)) + for line in lines: + if not line.startswith(prefix) and line not in processing: + print line + return popen.returncode + + def ExecAsmWrapper(self, arch, *args): + """Filter logo banner from invocations of asm.exe.""" + env = self._GetEnv(arch) + # MSVS doesn't assemble x64 asm files. + if arch == 'environment.x64': + return 0 + popen = subprocess.Popen(args, shell=True, env=env, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + out, _ = popen.communicate() + for line in out.splitlines(): + if (not line.startswith('Copyright (C) Microsoft Corporation') and + not line.startswith('Microsoft (R) Macro Assembler') and + not line.startswith(' Assembling: ') and + line): + print line + return popen.returncode + + def ExecRcWrapper(self, arch, *args): + """Filter logo banner from invocations of rc.exe. Older versions of RC + don't support the /nologo flag.""" + env = self._GetEnv(arch) + popen = subprocess.Popen(args, shell=True, env=env, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + out, _ = popen.communicate() + for line in out.splitlines(): + if (not line.startswith('Microsoft (R) Windows (R) Resource Compiler') and + not line.startswith('Copyright (C) Microsoft Corporation') and + line): + print line + return popen.returncode + + def ExecClWrapper(self, arch, depname, *args): + """Runs cl.exe and filters output through ninja-deplist-helper to get + dependendency information which is stored in |depname|.""" + env = self._GetEnv(arch) + args = ' '.join(args) + \ + '| ninja-deplist-helper -r . -q -f cl -o ' + depname + '"' + popen = subprocess.Popen(args, shell=True, env=env) + popen.wait() + return popen.returncode + + def ExecActionWrapper(self, arch, rspfile, *dir): + """Runs an action command line from a response file using the environment + for |arch|. If |dir| is supplied, use that as the working directory.""" + env = self._GetEnv(arch) + args = open(rspfile).read() + dir = dir[0] if dir else None + popen = subprocess.Popen(args, shell=True, env=env, cwd=dir) + popen.wait() + return popen.returncode + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) diff --git a/tools/gyp/pylib/gyp/xcode_emulation.py b/tools/gyp/pylib/gyp/xcode_emulation.py index 4d8440b69f..ce2dabf960 100644 --- a/tools/gyp/pylib/gyp/xcode_emulation.py +++ b/tools/gyp/pylib/gyp/xcode_emulation.py @@ -15,6 +15,10 @@ import shlex class XcodeSettings(object): """A class that understands the gyp 'xcode_settings' object.""" + # Computed lazily by _GetSdkBaseDir(). Shared by all XcodeSettings, so cached + # at class-level for efficiency. + _sdk_base_dir = None + def __init__(self, spec): self.spec = spec @@ -215,11 +219,33 @@ class XcodeSettings(object): else: return self._GetStandaloneBinaryPath() + def _GetSdkBaseDir(self): + """Returns the root of the 'Developer' directory. On Xcode 4.2 and prior, + this is usually just /Developer. Xcode 4.3 moved that folder into the Xcode + bundle.""" + if not XcodeSettings._sdk_base_dir: + import subprocess + job = subprocess.Popen(['xcode-select', '-print-path'], + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + out, err = job.communicate() + if job.returncode != 0: + print out + raise Exception('Error %d running xcode-select' % job.returncode) + # The Developer folder moved in Xcode 4.3. + xcode43_sdk_path = os.path.join( + out.rstrip(), 'Platforms/MacOSX.platform/Developer/SDKs') + if os.path.isdir(xcode43_sdk_path): + XcodeSettings._sdk_base_dir = xcode43_sdk_path + else: + XcodeSettings._sdk_base_dir = os.path.join(out.rstrip(), 'SDKs') + return XcodeSettings._sdk_base_dir + def _SdkPath(self): sdk_root = self.GetPerTargetSetting('SDKROOT', default='macosx10.5') if sdk_root.startswith('macosx'): sdk_root = 'MacOSX' + sdk_root[len('macosx'):] - return '/Developer/SDKs/%s.sdk' % sdk_root + return os.path.join(self._GetSdkBaseDir(), '%s.sdk' % sdk_root) def GetCflags(self, configname): """Returns flags that need to be added to .c, .cc, .m, and .mm @@ -281,7 +307,6 @@ class XcodeSettings(object): self._WarnUnimplemented('COPY_PHASE_STRIP') self._WarnUnimplemented('GCC_DEBUGGING_SYMBOLS') self._WarnUnimplemented('GCC_ENABLE_OBJC_EXCEPTIONS') - self._WarnUnimplemented('GCC_ENABLE_OBJC_GC') # TODO: This is exported correctly, but assigning to it is not supported. self._WarnUnimplemented('MACH_O_TYPE') @@ -305,7 +330,6 @@ class XcodeSettings(object): if self._Test('GCC_ENABLE_SSE42_EXTENSIONS', 'YES', default='NO'): cflags.append('-msse4.2') - cflags += self._Settings().get('OTHER_CFLAGS', []) cflags += self._Settings().get('WARNING_CFLAGS', []) config = self.spec['configurations'][self.configname] @@ -321,6 +345,7 @@ class XcodeSettings(object): self.configname = configname cflags_c = [] self._Appendf(cflags_c, 'GCC_C_LANGUAGE_STANDARD', '-std=%s') + cflags_c += self._Settings().get('OTHER_CFLAGS', []) self.configname = None return cflags_c @@ -336,24 +361,140 @@ class XcodeSettings(object): cflags_cc.append('-fvisibility-inlines-hidden') if self._Test('GCC_THREADSAFE_STATICS', 'NO', default='YES'): cflags_cc.append('-fno-threadsafe-statics') + if self._Test('GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO', 'NO', default='YES'): + cflags_cc.append('-Wno-invalid-offsetof') + + other_ccflags = [] + + for flag in self._Settings().get('OTHER_CPLUSPLUSFLAGS', ['$(inherited)']): + # TODO: More general variable expansion. Missing in many other places too. + if flag in ('$inherited', '$(inherited)', '${inherited}'): + flag = '$OTHER_CFLAGS' + if flag in ('$OTHER_CFLAGS', '$(OTHER_CFLAGS)', '${OTHER_CFLAGS}'): + other_ccflags += self._Settings().get('OTHER_CFLAGS', []) + else: + other_ccflags.append(flag) + cflags_cc += other_ccflags + self.configname = None return cflags_cc + def _AddObjectiveCGarbageCollectionFlags(self, flags): + gc_policy = self._Settings().get('GCC_ENABLE_OBJC_GC', 'unsupported') + if gc_policy == 'supported': + flags.append('-fobjc-gc') + elif gc_policy == 'required': + flags.append('-fobjc-gc-only') + def GetCflagsObjC(self, configname): """Returns flags that need to be added to .m compilations.""" self.configname = configname + cflags_objc = [] + + self._AddObjectiveCGarbageCollectionFlags(cflags_objc) + self.configname = None - return [] + return cflags_objc def GetCflagsObjCC(self, configname): """Returns flags that need to be added to .mm compilations.""" self.configname = configname cflags_objcc = [] + self._AddObjectiveCGarbageCollectionFlags(cflags_objcc) if self._Test('GCC_OBJC_CALL_CXX_CDTORS', 'YES', default='NO'): cflags_objcc.append('-fobjc-call-cxx-cdtors') self.configname = None return cflags_objcc + def GetInstallNameBase(self): + """Return DYLIB_INSTALL_NAME_BASE for this target.""" + # Xcode sets this for shared_libraries, and for nonbundled loadable_modules. + if (self.spec['type'] != 'shared_library' and + (self.spec['type'] != 'loadable_module' or self._IsBundle())): + return None + install_base = self.GetPerTargetSetting( + 'DYLIB_INSTALL_NAME_BASE', + default='/Library/Frameworks' if self._IsBundle() else '/usr/local/lib') + return install_base + + def _StandardizePath(self, path): + """Do :standardizepath processing for path.""" + # I'm not quite sure what :standardizepath does. Just call normpath(), + # but don't let @executable_path/../foo collapse to foo. + if '/' in path: + prefix, rest = '', path + if path.startswith('@'): + prefix, rest = path.split('/', 1) + rest = os.path.normpath(rest) # :standardizepath + path = os.path.join(prefix, rest) + return path + + def GetInstallName(self): + """Return LD_DYLIB_INSTALL_NAME for this target.""" + # Xcode sets this for shared_libraries, and for nonbundled loadable_modules. + if (self.spec['type'] != 'shared_library' and + (self.spec['type'] != 'loadable_module' or self._IsBundle())): + return None + + default_install_name = \ + '$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)' + install_name = self.GetPerTargetSetting( + 'LD_DYLIB_INSTALL_NAME', default=default_install_name) + + # Hardcode support for the variables used in chromium for now, to + # unblock people using the make build. + if '$' in install_name: + assert install_name in ('$(DYLIB_INSTALL_NAME_BASE:standardizepath)/' + '$(WRAPPER_NAME)/$(PRODUCT_NAME)', default_install_name), ( + 'Variables in LD_DYLIB_INSTALL_NAME are not generally supported ' + 'yet in target \'%s\' (got \'%s\')' % + (self.spec['target_name'], install_name)) + + install_name = install_name.replace( + '$(DYLIB_INSTALL_NAME_BASE:standardizepath)', + self._StandardizePath(self.GetInstallNameBase())) + if self._IsBundle(): + # These are only valid for bundles, hence the |if|. + install_name = install_name.replace( + '$(WRAPPER_NAME)', self.GetWrapperName()) + install_name = install_name.replace( + '$(PRODUCT_NAME)', self.GetProductName()) + else: + assert '$(WRAPPER_NAME)' not in install_name + assert '$(PRODUCT_NAME)' not in install_name + + install_name = install_name.replace( + '$(EXECUTABLE_PATH)', self.GetExecutablePath()) + return install_name + + def _MapLinkerFlagFilename(self, ldflag, gyp_to_build_path): + """Checks if ldflag contains a filename and if so remaps it from + gyp-directory-relative to build-directory-relative.""" + # This list is expanded on demand. + # They get matched as: + # -exported_symbols_list file + # -Wl,exported_symbols_list file + # -Wl,exported_symbols_list,file + LINKER_FILE = '(\S+)' + WORD = '\S+' + linker_flags = [ + ['-exported_symbols_list', LINKER_FILE], # Needed for NaCl. + ['-unexported_symbols_list', LINKER_FILE], + ['-reexported_symbols_list', LINKER_FILE], + ['-sectcreate', WORD, WORD, LINKER_FILE], # Needed for remoting. + ] + for flag_pattern in linker_flags: + regex = re.compile('(?:-Wl,)?' + '[ ,]'.join(flag_pattern)) + m = regex.match(ldflag) + if m: + ldflag = ldflag[:m.start(1)] + gyp_to_build_path(m.group(1)) + \ + ldflag[m.end(1):] + # Required for ffmpeg (no idea why they don't use LIBRARY_SEARCH_PATHS, + # TODO(thakis): Update ffmpeg.gyp): + if ldflag.startswith('-L'): + ldflag = '-L' + gyp_to_build_path(ldflag[len('-L'):]) + return ldflag + def GetLdflags(self, configname, product_dir, gyp_to_build_path): """Returns flags that need to be passed to the linker. @@ -368,19 +509,9 @@ class XcodeSettings(object): ldflags = [] # The xcode build is relative to a gyp file's directory, and OTHER_LDFLAGS - # contains two entries that depend on this. Explicitly absolutify for these - # two cases. - def MapGypPathWithPrefix(flag, prefix): - if flag.startswith(prefix): - flag = prefix + gyp_to_build_path(flag[len(prefix):]) - return flag + # can contain entries that depend on this. Explicitly absolutify these. for ldflag in self._Settings().get('OTHER_LDFLAGS', []): - # Required for ffmpeg (no idea why they don't use LIBRARY_SEARCH_PATHS, - # TODO(thakis): Update ffmpeg.gyp): - ldflag = MapGypPathWithPrefix(ldflag, '-L') - # Required for the nacl plugin: - ldflag = MapGypPathWithPrefix(ldflag, '-Wl,-exported_symbols_list ') - ldflags.append(ldflag) + ldflags.append(self._MapLinkerFlagFilename(ldflag, gyp_to_build_path)) if self._Test('DEAD_CODE_STRIPPING', 'YES', default='NO'): ldflags.append('-Wl,-dead_strip') @@ -415,48 +546,12 @@ class XcodeSettings(object): # Xcode adds the product directory by default. ldflags.append('-L' + product_dir) - install_name = self.GetPerTargetSetting('LD_DYLIB_INSTALL_NAME') - install_base = self.GetPerTargetSetting('DYLIB_INSTALL_NAME_BASE') - default_install_name = \ - '$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)' - if not install_name and install_base: - install_name = default_install_name - + install_name = self.GetInstallName() if install_name: - # Hardcode support for the variables used in chromium for now, to unblock - # people using the make build. - if '$' in install_name: - assert install_name in ('$(DYLIB_INSTALL_NAME_BASE:standardizepath)/' - '$(WRAPPER_NAME)/$(PRODUCT_NAME)', default_install_name), ( - 'Variables in LD_DYLIB_INSTALL_NAME are not generally supported yet' - ' in target \'%s\' (got \'%s\')' % - (self.spec['target_name'], install_name)) - # I'm not quite sure what :standardizepath does. Just call normpath(), - # but don't let @executable_path/../foo collapse to foo. - if '/' in install_base: - prefix, rest = '', install_base - if install_base.startswith('@'): - prefix, rest = install_base.split('/', 1) - rest = os.path.normpath(rest) # :standardizepath - install_base = os.path.join(prefix, rest) - - install_name = install_name.replace( - '$(DYLIB_INSTALL_NAME_BASE:standardizepath)', install_base) - if self._IsBundle(): - # These are only valid for bundles, hence the |if|. - install_name = install_name.replace( - '$(WRAPPER_NAME)', self.GetWrapperName()) - install_name = install_name.replace( - '$(PRODUCT_NAME)', self.GetProductName()) - else: - assert '$(WRAPPER_NAME)' not in install_name - assert '$(PRODUCT_NAME)' not in install_name - - install_name = install_name.replace( - '$(EXECUTABLE_PATH)', self.GetExecutablePath()) + ldflags.append('-install_name ' + install_name.replace(' ', r'\ ')) - install_name = install_name.replace(' ', r'\ ') - ldflags.append('-install_name ' + install_name) + for rpath in self._Settings().get('LD_RUNPATH_SEARCH_PATHS', []): + ldflags.append('-Wl,-rpath,' + rpath) self.configname = None return ldflags @@ -660,7 +755,7 @@ class MacPrefixHeader(object): result.append((source, obj, self._Gch(lang))) return result - def GetGchBuildCommands(self): + def GetPchBuildCommands(self): """Returns [(path_to_gch, language_flag, language, header)]. |path_to_gch| and |header| are relative to the build directory. """ @@ -788,7 +883,7 @@ def GetMacInfoPlist(product_dir, xcode_settings, gyp_path_to_build_path): return info_plist, dest_plist, defines, extra_env -def GetXcodeEnv(xcode_settings, built_products_dir, srcroot, configuration, +def _GetXcodeEnv(xcode_settings, built_products_dir, srcroot, configuration, additional_settings=None): """Return the environment variables that Xcode would set. See http://developer.apple.com/library/mac/#documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html#//apple_ref/doc/uid/TP40003931-CH3-SW153 @@ -839,6 +934,13 @@ def GetXcodeEnv(xcode_settings, built_products_dir, srcroot, configuration, env['INFOPLIST_PATH'] = xcode_settings.GetBundlePlistPath() env['WRAPPER_NAME'] = xcode_settings.GetWrapperName() + install_name = xcode_settings.GetInstallName() + if install_name: + env['LD_DYLIB_INSTALL_NAME'] = install_name + install_name_base = xcode_settings.GetInstallNameBase() + if install_name_base: + env['DYLIB_INSTALL_NAME_BASE'] = install_name_base + if not additional_settings: additional_settings = {} else: @@ -873,17 +975,17 @@ def _NormalizeEnvVarReferences(str): def ExpandEnvVars(string, expansions): """Expands ${VARIABLES}, $(VARIABLES), and $VARIABLES in string per the - expansions dict. If the variable expands to something that references + expansions list. If the variable expands to something that references another variable, this variable is expanded as well if it's in env -- until no variables present in env are left.""" - for k in reversed(TopologicallySortedEnvVarKeys(expansions)): - string = string.replace('${' + k + '}', expansions[k]) - string = string.replace('$(' + k + ')', expansions[k]) - string = string.replace('$' + k, expansions[k]) + for k, v in reversed(expansions): + string = string.replace('${' + k + '}', v) + string = string.replace('$(' + k + ')', v) + string = string.replace('$' + k, v) return string -def TopologicallySortedEnvVarKeys(env): +def _TopologicallySortedEnvVarKeys(env): """Takes a dict |env| whose values are strings that can refer to other keys, for example env['foo'] = '$(bar) and $(baz)'. Returns a list L of all keys of env such that key2 is after key1 in L if env[key2] refers to env[key1]. @@ -894,62 +996,37 @@ def TopologicallySortedEnvVarKeys(env): # order is important. Below is the logic to compute the dependency graph # and sort it. regex = re.compile(r'\$\{([a-zA-Z0-9\-_]+)\}') + def GetEdges(node): + # Use a definition of edges such that user_of_variable -> used_varible. + # This happens to be easier in this case, since a variable's + # definition contains all variables it references in a single string. + # We can then reverse the result of the topological sort at the end. + # Since: reverse(topsort(DAG)) = topsort(reverse_edges(DAG)) + matches = set([v for v in regex.findall(env[node]) if v in env]) + for dependee in matches: + assert '${' not in dependee, 'Nested variables not supported: ' + dependee + return matches - # First sort the list of keys. - key_list = sorted(env.keys()) + try: + # Topologically sort, and then reverse, because we used an edge definition + # that's inverted from the expected result of this function (see comment + # above). + order = gyp.common.TopologicallySorted(env.keys(), GetEdges) + order.reverse() + return order + except gyp.common.CycleError, e: + raise Exception( + 'Xcode environment variables are cyclically dependent: ' + str(e.nodes)) - # Phase 1: Create a set of edges of (DEPENDEE, DEPENDER) where in the graph, - # DEPENDEE -> DEPENDER. Also create sets of dependers and dependees. - edges = set() - dependees = set() - dependers = set() - for k in key_list: - matches = regex.findall(env[k]) - if not len(matches): - continue - depends_on_other_var = False - for dependee in matches: - assert '${' not in dependee, 'Nested variables not supported: ' + dependee - if dependee in env: - edges.add((dependee, k)) - dependees.add(dependee) - depends_on_other_var = True - if depends_on_other_var: - dependers.add(k) - - # Phase 2: Create a list of graph nodes with no incoming edges. - sorted_nodes = [] - edgeless_nodes = dependees - dependers - - # Phase 3: Perform Kahn topological sort. - while len(edgeless_nodes): - # Find a node with no incoming edges, add it to the sorted list, and - # remove it from the list of nodes that aren't part of the graph. - node = edgeless_nodes.pop() - sorted_nodes.append(node) - key_list.remove(node) - - # Find all the edges between |node| and other nodes. - edges_to_node = [e for e in edges if e[0] == node] - for edge in edges_to_node: - edges.remove(edge) - # If the node connected to |node| by |edge| has no other incoming edges, - # add it to |edgeless_nodes|. - if not len([e for e in edges if e[1] == edge[1]]): - edgeless_nodes.add(edge[1]) - - # Any remaining edges indicate a cycle. - if len(edges): - raise Exception('Xcode environment variables are cyclically dependent: ' + - str(edges)) - - # Append the "nodes" not in the graph to those that were just sorted. - sorted_nodes.extend(key_list) - - return sorted_nodes - -def GetSpecPostbuildCommands(spec, gyp_path_to_build_path, quiet=False): +def GetSortedXcodeEnv(xcode_settings, built_products_dir, srcroot, + configuration, additional_settings=None): + env = _GetXcodeEnv(xcode_settings, built_products_dir, srcroot, configuration, + additional_settings) + return [(key, env[key]) for key in _TopologicallySortedEnvVarKeys(env)] + + +def GetSpecPostbuildCommands(spec, quiet=False): """Returns the list of postbuilds explicitly defined on |spec|, in a form executable by a shell.""" postbuilds = [] @@ -957,16 +1034,5 @@ def GetSpecPostbuildCommands(spec, gyp_path_to_build_path, quiet=False): if not quiet: postbuilds.append('echo POSTBUILD\\(%s\\) %s' % ( spec['target_name'], postbuild['postbuild_name'])) - shell_list = postbuild['action'][:] - # The first element is the command. If it's a relative path, it's - # a script in the source tree relative to the gyp file and needs to be - # absolutified. Else, it's in the PATH (e.g. install_name_tool, ln). - if os.path.sep in shell_list[0]: - shell_list[0] = gyp_path_to_build_path(shell_list[0]) - - # "script.sh" -> "./script.sh" - if not os.path.sep in shell_list[0]: - shell_list[0] = os.path.join('.', shell_list[0]) - postbuilds.append(gyp.common.EncodePOSIXShellList(shell_list)) - + postbuilds.append(gyp.common.EncodePOSIXShellList(postbuild['action'])) return postbuilds diff --git a/tools/gyp/pylib/gyp/xcodeproj_file.py b/tools/gyp/pylib/gyp/xcodeproj_file.py index f6ee765d59..403407a413 100644 --- a/tools/gyp/pylib/gyp/xcodeproj_file.py +++ b/tools/gyp/pylib/gyp/xcodeproj_file.py @@ -419,7 +419,7 @@ class XCObject(object): hash.update(struct.pack('>i', len(data))) hash.update(data) - if hash == None: + if hash is None: hash = _new_sha1() hashables = self.Hashables() @@ -431,7 +431,7 @@ class XCObject(object): for child in self.Children(): child.ComputeIDs(recursive, overwrite, hash.copy()) - if overwrite or self.id == None: + if overwrite or self.id is None: # Xcode IDs are only 96 bits (24 hex characters), but a SHA-1 digest is # is 160 bits. Instead of throwing out 64 bits of the digest, xor them # into the portion that gets used. @@ -736,7 +736,7 @@ class XCObject(object): references added. """ - if properties == None: + if properties is None: return for property, value in properties.iteritems(): @@ -918,7 +918,7 @@ class XCHierarchicalElement(XCObject): self._properties['sourceTree'] = source_tree if path != None: self._properties['path'] = path - if source_tree != None and path == None and \ + if source_tree != None and path is None and \ not 'name' in self._properties: # The path was of the form "$(SDKROOT)" with no path following it. # This object is now relative to that variable, so it has no path @@ -1068,7 +1068,7 @@ class XCHierarchicalElement(XCObject): xche = self path = None while isinstance(xche, XCHierarchicalElement) and \ - (path == None or \ + (path is None or \ (not path.startswith('/') and not path.startswith('$'))): this_path = xche.PathFromSourceTreeAndPath() if this_path != None and path != None: @@ -1222,7 +1222,7 @@ class PBXGroup(XCHierarchicalElement): grandparent = None # Putting a directory inside a variant group is not currently supported. - assert not is_dir or variant_name == None + assert not is_dir or variant_name is None path_split = path.split(posixpath.sep) if len(path_split) == 1 or \ @@ -1230,7 +1230,7 @@ class PBXGroup(XCHierarchicalElement): not hierarchical: # The PBXFileReference or PBXVariantGroup will be added to or gotten from # this PBXGroup, no recursion necessary. - if variant_name == None: + if variant_name is None: # Add or get a PBXFileReference. file_ref = self.GetChildByPath(normpath) if file_ref != None: @@ -1583,14 +1583,14 @@ class XCConfigurationList(XCObject): value = None for configuration in self._properties['buildConfigurations']: configuration_has = configuration.HasBuildSetting(key) - if has == None: + if has is None: has = configuration_has elif has != configuration_has: return -1 if configuration_has: configuration_value = configuration.GetBuildSetting(key) - if value == None: + if value is None: value = configuration_value elif value != configuration_value: return -1 @@ -1613,7 +1613,7 @@ class XCConfigurationList(XCObject): value = None for configuration in self._properties['buildConfigurations']: configuration_value = configuration.GetBuildSetting(key) - if value == None: + if value is None: value = configuration_value else: if value != configuration_value: @@ -1941,7 +1941,7 @@ class PBXCopyFilesBuildPhase(XCBuildPhase): if path_tree in self.path_tree_to_subfolder: subfolder = self.path_tree_to_subfolder[path_tree] - if relative_path == None: + if relative_path is None: relative_path = '' else: # The path starts with an unrecognized Xcode variable @@ -2117,8 +2117,7 @@ class XCTarget(XCRemoteObject): pbxproject = self.PBXProjectAncestor() other_pbxproject = other.PBXProjectAncestor() if pbxproject == other_pbxproject: - # The easy case. Add a dependency to another target in the same - # project file. + # Add a dependency to another target in the same project file. container = PBXContainerItemProxy({'containerPortal': pbxproject, 'proxyType': 1, 'remoteGlobalIDString': other, @@ -2127,8 +2126,7 @@ class XCTarget(XCRemoteObject): 'targetProxy': container}) self.AppendProperty('dependencies', dependency) else: - # The hard case. Add a dependency to a target in a different project - # file. Actually, this case isn't really so hard. + # Add a dependency to a target in a different project file. other_project_ref = \ pbxproject.AddOrGetProjectReference(other_pbxproject)[1] container = PBXContainerItemProxy({ @@ -2257,7 +2255,7 @@ class PBXNativeTarget(XCTarget): self.SetBuildSetting('MACH_O_TYPE', 'mh_bundle') self.SetBuildSetting('DYLIB_CURRENT_VERSION', '') self.SetBuildSetting('DYLIB_COMPATIBILITY_VERSION', '') - if force_extension == None: + if force_extension is None: force_extension = suffix[1:] if force_extension is not None: @@ -2327,14 +2325,14 @@ class PBXNativeTarget(XCTarget): # this function is intended as an aid to GetBuildPhaseByType. Loop # over the entire list of phases and assert if more than one of the # desired type is found. - assert the_phase == None + assert the_phase is None the_phase = phase return the_phase def HeadersPhase(self): headers_phase = self.GetBuildPhaseByType(PBXHeadersBuildPhase) - if headers_phase == None: + if headers_phase is None: headers_phase = PBXHeadersBuildPhase() # The headers phase should come before the resources, sources, and @@ -2355,7 +2353,7 @@ class PBXNativeTarget(XCTarget): def ResourcesPhase(self): resources_phase = self.GetBuildPhaseByType(PBXResourcesBuildPhase) - if resources_phase == None: + if resources_phase is None: resources_phase = PBXResourcesBuildPhase() # The resources phase should come before the sources and frameworks @@ -2375,7 +2373,7 @@ class PBXNativeTarget(XCTarget): def SourcesPhase(self): sources_phase = self.GetBuildPhaseByType(PBXSourcesBuildPhase) - if sources_phase == None: + if sources_phase is None: sources_phase = PBXSourcesBuildPhase() self.AppendProperty('buildPhases', sources_phase) @@ -2383,7 +2381,7 @@ class PBXNativeTarget(XCTarget): def FrameworksPhase(self): frameworks_phase = self.GetBuildPhaseByType(PBXFrameworksBuildPhase) - if frameworks_phase == None: + if frameworks_phase is None: frameworks_phase = PBXFrameworksBuildPhase() self.AppendProperty('buildPhases', frameworks_phase) @@ -2492,7 +2490,7 @@ class PBXProject(XCContainerPortal): main_group = self._properties['mainGroup'] group = main_group.GetChildByName(name) - if group == None: + if group is None: group = PBXGroup({'name': name}) main_group.AppendChild(group) @@ -2696,7 +2694,7 @@ class PBXProject(XCContainerPortal): continue other_fileref = target._properties['productReference'] - if product_group.GetChildByRemoteObject(other_fileref) == None: + if product_group.GetChildByRemoteObject(other_fileref) is None: # Xcode sets remoteInfo to the name of the target and not the name # of its product, despite this proxy being a reference to the product. container_item = PBXContainerItemProxy({ diff --git a/tools/gyp/test/actions-bare/gyptest-bare.py b/tools/gyp/test/actions-bare/gyptest-bare.py deleted file mode 100755 index b0c10938d1..0000000000 --- a/tools/gyp/test/actions-bare/gyptest-bare.py +++ /dev/null @@ -1,23 +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. - -""" -Verifies actions which are not depended on by other targets get executed. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('bare.gyp', chdir='src') -test.relocate('src', 'relocate/src') -test.build('bare.gyp', chdir='relocate/src') - -file_content = 'Hello from bare.py\n' - -test.built_file_must_match('out.txt', file_content, chdir='relocate/src') - -test.pass_test() diff --git a/tools/gyp/test/actions-bare/src/bare.gyp b/tools/gyp/test/actions-bare/src/bare.gyp deleted file mode 100644 index 3d28f099d4..0000000000 --- a/tools/gyp/test/actions-bare/src/bare.gyp +++ /dev/null @@ -1,25 +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. - -{ - 'targets': [ - { - 'target_name': 'bare', - 'type': 'none', - 'actions': [ - { - 'action_name': 'action1', - 'inputs': [ - 'bare.py', - ], - 'outputs': [ - '<(PRODUCT_DIR)/out.txt', - ], - 'action': ['python', 'bare.py', '<(PRODUCT_DIR)/out.txt'], - 'msvs_cygwin_shell': 0, - }, - ], - }, - ], -} diff --git a/tools/gyp/test/actions-bare/src/bare.py b/tools/gyp/test/actions-bare/src/bare.py deleted file mode 100755 index 12307500f2..0000000000 --- a/tools/gyp/test/actions-bare/src/bare.py +++ /dev/null @@ -1,11 +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 - -f = open(sys.argv[1], 'wb') -f.write('Hello from bare.py\n') -f.close() diff --git a/tools/gyp/test/actions-multiple/gyptest-all.py b/tools/gyp/test/actions-multiple/gyptest-all.py deleted file mode 100755 index 7b94fef408..0000000000 --- a/tools/gyp/test/actions-multiple/gyptest-all.py +++ /dev/null @@ -1,42 +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. - -""" -Verifies two actions can be attached to the same input files. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('actions.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - -# Test that two actions can be attached to the same inputs. -test.build('actions.gyp', test.ALL, chdir='relocate/src') -test.must_contain('relocate/src/output1.txt', 'hello there') -test.must_contain('relocate/src/output2.txt', 'hello there') -test.must_contain('relocate/src/output3.txt', 'hello there') -test.must_contain('relocate/src/output4.txt', 'hello there') - -# Test that process_outputs_as_sources works in conjuction with merged -# actions. -test.run_built_executable( - 'multiple_action_source_filter', - chdir='relocate/src', - stdout=( - '{\n' - 'bar\n' - 'car\n' - 'dar\n' - 'ear\n' - '}\n' - ), -) - - -test.pass_test() diff --git a/tools/gyp/test/actions-multiple/src/actions.gyp b/tools/gyp/test/actions-multiple/src/actions.gyp deleted file mode 100644 index 2d721ff61a..0000000000 --- a/tools/gyp/test/actions-multiple/src/actions.gyp +++ /dev/null @@ -1,165 +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. - -{ - 'variables': { - # Have a long string so that actions will exceed xp 512 character - # command limit on xp. - 'long_string': - 'abcdefghijklmnopqrstuvwxyz0123456789' - 'abcdefghijklmnopqrstuvwxyz0123456789' - 'abcdefghijklmnopqrstuvwxyz0123456789' - 'abcdefghijklmnopqrstuvwxyz0123456789' - 'abcdefghijklmnopqrstuvwxyz0123456789' - 'abcdefghijklmnopqrstuvwxyz0123456789' - 'abcdefghijklmnopqrstuvwxyz0123456789' - 'abcdefghijklmnopqrstuvwxyz0123456789' - 'abcdefghijklmnopqrstuvwxyz0123456789' - 'abcdefghijklmnopqrstuvwxyz0123456789' - 'abcdefghijklmnopqrstuvwxyz0123456789' - }, - 'targets': [ - { - 'target_name': 'multiple_action_target', - 'type': 'none', - 'actions': [ - { - 'action_name': 'action1', - 'inputs': [ - 'copy.py', - 'input.txt', - ], - 'outputs': [ - 'output1.txt', - ], - 'action': [ - 'python', '<@(_inputs)', '<(_outputs)', '<(long_string)', - ], - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - }, - { - 'action_name': 'action2', - 'inputs': [ - 'copy.py', - 'input.txt', - ], - 'outputs': [ - 'output2.txt', - ], - 'action': [ - 'python', '<@(_inputs)', '<(_outputs)', '<(long_string)', - ], - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - }, - { - 'action_name': 'action3', - 'inputs': [ - 'copy.py', - 'input.txt', - ], - 'outputs': [ - 'output3.txt', - ], - 'action': [ - 'python', '<@(_inputs)', '<(_outputs)', '<(long_string)', - ], - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - }, - { - 'action_name': 'action4', - 'inputs': [ - 'copy.py', - 'input.txt', - ], - 'outputs': [ - 'output4.txt', - ], - 'action': [ - 'python', '<@(_inputs)', '<(_outputs)', '<(long_string)', - ], - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - }, - ], - }, - { - 'target_name': 'multiple_action_source_filter', - 'type': 'executable', - 'sources': [ - 'main.c', - # TODO(bradnelson): add foo.c here once this issue is fixed: - # http://code.google.com/p/gyp/issues/detail?id=175 - ], - 'actions': [ - { - 'action_name': 'action1', - 'inputs': [ - 'foo.c', - 'filter.py', - ], - 'outputs': [ - '<(INTERMEDIATE_DIR)/output1.c', - ], - 'process_outputs_as_sources': 1, - 'action': [ - 'python', 'filter.py', 'foo', 'bar', 'foo.c', '<@(_outputs)', - ], - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - }, - { - 'action_name': 'action2', - 'inputs': [ - 'foo.c', - 'filter.py', - ], - 'outputs': [ - '<(INTERMEDIATE_DIR)/output2.c', - ], - 'process_outputs_as_sources': 1, - 'action': [ - 'python', 'filter.py', 'foo', 'car', 'foo.c', '<@(_outputs)', - ], - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - }, - { - 'action_name': 'action3', - 'inputs': [ - 'foo.c', - 'filter.py', - ], - 'outputs': [ - '<(INTERMEDIATE_DIR)/output3.c', - ], - 'process_outputs_as_sources': 1, - 'action': [ - 'python', 'filter.py', 'foo', 'dar', 'foo.c', '<@(_outputs)', - ], - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - }, - { - 'action_name': 'action4', - 'inputs': [ - 'foo.c', - 'filter.py', - ], - 'outputs': [ - '<(INTERMEDIATE_DIR)/output4.c', - ], - 'process_outputs_as_sources': 1, - 'action': [ - 'python', 'filter.py', 'foo', 'ear', 'foo.c', '<@(_outputs)', - ], - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - }, - ], - }, - ], -} diff --git a/tools/gyp/test/actions-multiple/src/copy.py b/tools/gyp/test/actions-multiple/src/copy.py deleted file mode 100755 index 0774679380..0000000000 --- a/tools/gyp/test/actions-multiple/src/copy.py +++ /dev/null @@ -1,9 +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. - -import shutil -import sys - -shutil.copyfile(sys.argv[1], sys.argv[2]) diff --git a/tools/gyp/test/actions-multiple/src/filter.py b/tools/gyp/test/actions-multiple/src/filter.py deleted file mode 100755 index f61a5fa59a..0000000000 --- a/tools/gyp/test/actions-multiple/src/filter.py +++ /dev/null @@ -1,12 +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. - - -import sys - -data = open(sys.argv[3], 'r').read() -fh = open(sys.argv[4], 'w') -fh.write(data.replace(sys.argv[1], sys.argv[2])) -fh.close() diff --git a/tools/gyp/test/actions-multiple/src/foo.c b/tools/gyp/test/actions-multiple/src/foo.c deleted file mode 100644 index 23c4ef7f26..0000000000 --- a/tools/gyp/test/actions-multiple/src/foo.c +++ /dev/null @@ -1,11 +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. - */ - -#include - -void foo(void) { - printf("foo\n"); -} diff --git a/tools/gyp/test/actions-multiple/src/input.txt b/tools/gyp/test/actions-multiple/src/input.txt deleted file mode 100644 index c7c7da3c64..0000000000 --- a/tools/gyp/test/actions-multiple/src/input.txt +++ /dev/null @@ -1 +0,0 @@ -hello there diff --git a/tools/gyp/test/actions-multiple/src/main.c b/tools/gyp/test/actions-multiple/src/main.c deleted file mode 100644 index 0a420b9034..0000000000 --- a/tools/gyp/test/actions-multiple/src/main.c +++ /dev/null @@ -1,22 +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. - */ - -#include - -void bar(void); -void car(void); -void dar(void); -void ear(void); - -int main() { - printf("{\n"); - bar(); - car(); - dar(); - ear(); - printf("}\n"); - return 0; -} diff --git a/tools/gyp/test/actions-subdir/gyptest-action.py b/tools/gyp/test/actions-subdir/gyptest-action.py deleted file mode 100755 index 09cfef1893..0000000000 --- a/tools/gyp/test/actions-subdir/gyptest-action.py +++ /dev/null @@ -1,26 +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. - -""" -Test actions that output to PRODUCT_DIR. -""" - -import TestGyp - -# TODO fix this for xcode: http://code.google.com/p/gyp/issues/detail?id=88 -test = TestGyp.TestGyp(formats=['!xcode']) - -test.run_gyp('none.gyp', chdir='src') - -test.build('none.gyp', test.ALL, chdir='src') - -file_content = 'Hello from make-file.py\n' -subdir_file_content = 'Hello from make-subdir-file.py\n' - -test.built_file_must_match('file.out', file_content, chdir='src') -test.built_file_must_match('subdir_file.out', subdir_file_content, chdir='src') - -test.pass_test() diff --git a/tools/gyp/test/actions-subdir/src/make-file.py b/tools/gyp/test/actions-subdir/src/make-file.py deleted file mode 100755 index 74e55811d2..0000000000 --- a/tools/gyp/test/actions-subdir/src/make-file.py +++ /dev/null @@ -1,11 +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 - -contents = 'Hello from make-file.py\n' - -open(sys.argv[1], 'wb').write(contents) diff --git a/tools/gyp/test/actions-subdir/src/none.gyp b/tools/gyp/test/actions-subdir/src/none.gyp deleted file mode 100644 index 23f8d25a53..0000000000 --- a/tools/gyp/test/actions-subdir/src/none.gyp +++ /dev/null @@ -1,31 +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. - -{ - 'targets': [ - { - 'target_name': 'file', - 'type': 'none', - 'msvs_cygwin_shell': 0, - 'actions': [ - { - 'action_name': 'make-file', - 'inputs': [ - 'make-file.py', - ], - 'outputs': [ - '<(PRODUCT_DIR)/file.out', - ], - 'action': [ - 'python', '<(_inputs)', '<@(_outputs)', - ], - 'process_outputs_as_sources': 1, - } - ], - 'dependencies': [ - 'subdir/subdir.gyp:subdir_file', - ], - }, - ], -} diff --git a/tools/gyp/test/actions-subdir/src/subdir/make-subdir-file.py b/tools/gyp/test/actions-subdir/src/subdir/make-subdir-file.py deleted file mode 100755 index 80ce19ae0e..0000000000 --- a/tools/gyp/test/actions-subdir/src/subdir/make-subdir-file.py +++ /dev/null @@ -1,11 +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 - -contents = 'Hello from make-subdir-file.py\n' - -open(sys.argv[1], 'wb').write(contents) diff --git a/tools/gyp/test/actions-subdir/src/subdir/subdir.gyp b/tools/gyp/test/actions-subdir/src/subdir/subdir.gyp deleted file mode 100644 index 0315d4eb83..0000000000 --- a/tools/gyp/test/actions-subdir/src/subdir/subdir.gyp +++ /dev/null @@ -1,28 +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. - -{ - 'targets': [ - { - 'target_name': 'subdir_file', - 'type': 'none', - 'msvs_cygwin_shell': 0, - 'actions': [ - { - 'action_name': 'make-subdir-file', - 'inputs': [ - 'make-subdir-file.py', - ], - 'outputs': [ - '<(PRODUCT_DIR)/subdir_file.out', - ], - 'action': [ - 'python', '<(_inputs)', '<@(_outputs)', - ], - 'process_outputs_as_sources': 1, - } - ], - }, - ], -} diff --git a/tools/gyp/test/actions/gyptest-all.py b/tools/gyp/test/actions/gyptest-all.py deleted file mode 100755 index ad04f1f281..0000000000 --- a/tools/gyp/test/actions/gyptest-all.py +++ /dev/null @@ -1,101 +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. - -""" -Verifies simple actions when using an explicit build target of 'all'. -""" - -import glob -import os -import TestGyp - -test = TestGyp.TestGyp(workdir='workarea_all') - -test.run_gyp('actions.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - -# Some gyp files use an action that mentions an output but never -# writes it as a means to making the action run on every build. That -# doesn't mesh well with ninja's semantics. TODO(evan): figure out -# how to work always-run actions in to ninja. -if test.format == 'ninja': - test.build('actions.gyp', test.ALL, chdir='relocate/src') -else: - # Test that an "always run" action increases a counter on multiple - # invocations, and that a dependent action updates in step. - test.build('actions.gyp', test.ALL, chdir='relocate/src') - test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '1') - test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '1') - test.build('actions.gyp', test.ALL, chdir='relocate/src') - test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2') - test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2') - - # The "always run" action only counts to 2, but the dependent target - # will count forever if it's allowed to run. This verifies that the - # dependent target only runs when the "always run" action generates - # new output, not just because the "always run" ran. - test.build('actions.gyp', test.ALL, chdir='relocate/src') - test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2') - test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2') - -expect = """\ -Hello from program.c -Hello from make-prog1.py -Hello from make-prog2.py -""" - -if test.format == 'xcode': - chdir = 'relocate/src/subdir1' -else: - chdir = 'relocate/src' -test.run_built_executable('program', chdir=chdir, stdout=expect) - - -test.must_match('relocate/src/subdir2/file.out', "Hello from make-file.py\n") - - -expect = "Hello from generate_main.py\n" - -if test.format == 'xcode': - chdir = 'relocate/src/subdir3' -else: - chdir = 'relocate/src' -test.run_built_executable('null_input', chdir=chdir, stdout=expect) - - -# Clean out files which may have been created if test.ALL was run. -def clean_dep_files(): - for file in (glob.glob('relocate/src/dep_*.txt') + - glob.glob('relocate/src/deps_all_done_*.txt')): - if os.path.exists(file): - os.remove(file) - -# Confirm our clean. -clean_dep_files() -test.must_not_exist('relocate/src/dep_1.txt') -test.must_not_exist('relocate/src/deps_all_done_first_123.txt') - -# Make sure all deps finish before an action is run on a 'None' target. -# If using the Make builder, add -j to make things more difficult. -arguments = [] -if test.format == 'make': - arguments = ['-j'] -test.build('actions.gyp', 'action_with_dependencies_123', chdir='relocate/src', - arguments=arguments) -test.must_exist('relocate/src/deps_all_done_first_123.txt') - -# Try again with a target that has deps in reverse. Output files from -# previous tests deleted. Confirm this execution did NOT run the ALL -# target which would mess up our dep tests. -clean_dep_files() -test.build('actions.gyp', 'action_with_dependencies_321', chdir='relocate/src', - arguments=arguments) -test.must_exist('relocate/src/deps_all_done_first_321.txt') -test.must_not_exist('relocate/src/deps_all_done_first_123.txt') - - -test.pass_test() diff --git a/tools/gyp/test/actions/gyptest-default.py b/tools/gyp/test/actions/gyptest-default.py deleted file mode 100755 index b5bf7e99d9..0000000000 --- a/tools/gyp/test/actions/gyptest-default.py +++ /dev/null @@ -1,68 +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. - -""" -Verifies simple actions when using the default build target. -""" - -import TestGyp - -test = TestGyp.TestGyp(workdir='workarea_default') - -test.run_gyp('actions.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - -# Some gyp files use an action that mentions an output but never -# writes it as a means to making the action run on every build. That -# doesn't mesh well with ninja's semantics. TODO(evan): figure out -# how to work always-run actions in to ninja. -if test.format == 'ninja': - test.build('actions.gyp', test.ALL, chdir='relocate/src') -else: - # Test that an "always run" action increases a counter on multiple - # invocations, and that a dependent action updates in step. - test.build('actions.gyp', chdir='relocate/src') - test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '1') - test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '1') - test.build('actions.gyp', chdir='relocate/src') - test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2') - test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2') - - # The "always run" action only counts to 2, but the dependent target - # will count forever if it's allowed to run. This verifies that the - # dependent target only runs when the "always run" action generates - # new output, not just because the "always run" ran. - test.build('actions.gyp', test.ALL, chdir='relocate/src') - test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2') - test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2') - -expect = """\ -Hello from program.c -Hello from make-prog1.py -Hello from make-prog2.py -""" - -if test.format == 'xcode': - chdir = 'relocate/src/subdir1' -else: - chdir = 'relocate/src' -test.run_built_executable('program', chdir=chdir, stdout=expect) - - -test.must_match('relocate/src/subdir2/file.out', "Hello from make-file.py\n") - - -expect = "Hello from generate_main.py\n" - -if test.format == 'xcode': - chdir = 'relocate/src/subdir3' -else: - chdir = 'relocate/src' -test.run_built_executable('null_input', chdir=chdir, stdout=expect) - - -test.pass_test() diff --git a/tools/gyp/test/actions/gyptest-errors.py b/tools/gyp/test/actions/gyptest-errors.py deleted file mode 100755 index e1ef883e1e..0000000000 --- a/tools/gyp/test/actions/gyptest-errors.py +++ /dev/null @@ -1,24 +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. - -""" -Verifies behavior for different action configuration errors: -exit status of 1, and the expected error message must be in stderr. -""" - -import TestGyp - -test = TestGyp.TestGyp(workdir='workarea_errors') - - -test.run_gyp('action_missing_name.gyp', chdir='src', status=1, stderr=None) -expect = [ - "Anonymous action in target broken_actions2. An action must have an 'action_name' field.", -] -test.must_contain_all_lines(test.stderr(), expect) - - -test.pass_test() diff --git a/tools/gyp/test/actions/src/action_missing_name.gyp b/tools/gyp/test/actions/src/action_missing_name.gyp deleted file mode 100644 index 00424c35a1..0000000000 --- a/tools/gyp/test/actions/src/action_missing_name.gyp +++ /dev/null @@ -1,24 +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. - -{ - 'targets': [ - { - 'target_name': 'broken_actions2', - 'type': 'none', - 'actions': [ - { - 'inputs': [ - 'no_name.input', - ], - 'action': [ - 'python', - '-c', - 'print \'missing name\'', - ], - }, - ], - }, - ], -} diff --git a/tools/gyp/test/actions/src/actions.gyp b/tools/gyp/test/actions/src/actions.gyp deleted file mode 100644 index 5d2db1955e..0000000000 --- a/tools/gyp/test/actions/src/actions.gyp +++ /dev/null @@ -1,114 +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. - -{ - 'targets': [ - { - 'target_name': 'pull_in_all_actions', - 'type': 'none', - 'dependencies': [ - 'subdir1/executable.gyp:*', - 'subdir2/none.gyp:*', - 'subdir3/null_input.gyp:*', - ], - }, - { - 'target_name': 'depend_on_always_run_action', - 'type': 'none', - 'dependencies': [ 'subdir1/executable.gyp:counter' ], - 'actions': [ - { - 'action_name': 'use_always_run_output', - 'inputs': [ - 'subdir1/actions-out/action-counter.txt', - 'subdir1/counter.py', - ], - 'outputs': [ - 'subdir1/actions-out/action-counter_2.txt', - ], - 'action': [ - 'python', 'subdir1/counter.py', '<(_outputs)', - ], - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - }, - ], - }, - - # Three deps which don't finish immediately. - # Each one has a small delay then creates a file. - # Delays are 1.0, 1.1, and 2.0 seconds. - { - 'target_name': 'dep_1', - 'type': 'none', - 'actions': [{ - 'inputs': [ 'actions.gyp' ], - 'outputs': [ 'dep_1.txt' ], - 'action_name': 'dep_1', - 'action': [ 'python', '-c', - 'import time; time.sleep(1); open(\'dep_1.txt\', \'w\')' ], - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - }], - }, - { - 'target_name': 'dep_2', - 'type': 'none', - 'actions': [{ - 'inputs': [ 'actions.gyp' ], - 'outputs': [ 'dep_2.txt' ], - 'action_name': 'dep_2', - 'action': [ 'python', '-c', - 'import time; time.sleep(1.1); open(\'dep_2.txt\', \'w\')' ], - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - }], - }, - { - 'target_name': 'dep_3', - 'type': 'none', - 'actions': [{ - 'inputs': [ 'actions.gyp' ], - 'outputs': [ 'dep_3.txt' ], - 'action_name': 'dep_3', - 'action': [ 'python', '-c', - 'import time; time.sleep(2.0); open(\'dep_3.txt\', \'w\')' ], - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - }], - }, - - # An action which assumes the deps have completed. - # Does NOT list the output files of it's deps as inputs. - # On success create the file deps_all_done_first.txt. - { - 'target_name': 'action_with_dependencies_123', - 'type': 'none', - 'dependencies': [ 'dep_1', 'dep_2', 'dep_3' ], - 'actions': [{ - 'inputs': [ 'actions.gyp' ], - 'outputs': [ 'deps_all_done_first_123.txt' ], - 'action_name': 'action_with_dependencies_123', - 'action': [ 'python', 'confirm-dep-files.py', '<(_outputs)' ], - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - }], - }, - # Same as above but with deps in reverse. - { - 'target_name': 'action_with_dependencies_321', - 'type': 'none', - 'dependencies': [ 'dep_3', 'dep_2', 'dep_1' ], - 'actions': [{ - 'inputs': [ 'actions.gyp' ], - 'outputs': [ 'deps_all_done_first_321.txt' ], - 'action_name': 'action_with_dependencies_321', - 'action': [ 'python', 'confirm-dep-files.py', '<(_outputs)' ], - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - }], - }, - - ], -} diff --git a/tools/gyp/test/actions/src/confirm-dep-files.py b/tools/gyp/test/actions/src/confirm-dep-files.py deleted file mode 100755 index 3b8463057d..0000000000 --- a/tools/gyp/test/actions/src/confirm-dep-files.py +++ /dev/null @@ -1,21 +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. - -"""Confirms presence of files generated by our targets we depend on. -If they exist, create a new file. - -Note target's input files are explicitly NOT defined in the gyp file -so they can't easily be passed to this script as args. -""" - -import os -import sys - -outfile = sys.argv[1] # Example value we expect: deps_all_done_first_123.txt -if (os.path.exists("dep_1.txt") and - os.path.exists("dep_2.txt") and - os.path.exists("dep_3.txt")): - open(outfile, "w") diff --git a/tools/gyp/test/actions/src/subdir1/counter.py b/tools/gyp/test/actions/src/subdir1/counter.py deleted file mode 100755 index 3612d7d2bf..0000000000 --- a/tools/gyp/test/actions/src/subdir1/counter.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2010 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 -import time - -output = sys.argv[1] -persistoutput = "%s.persist" % sys.argv[1] - -count = 0 -try: - count = open(persistoutput, 'r').read() -except: - pass -count = int(count) + 1 - -if len(sys.argv) > 2: - max_count = int(sys.argv[2]) - if count > max_count: - count = max_count - -oldcount = 0 -try: - oldcount = open(output, 'r').read() -except: - pass - -# Save the count in a file that is undeclared, and thus hidden, to gyp. We need -# to do this because, prior to running commands, scons deletes any declared -# outputs, so we would lose our count if we just wrote to the given output file. -# (The other option is to use Precious() in the scons generator, but that seems -# too heavy-handed just to support this somewhat unrealistic test case, and -# might lead to unintended side-effects). -open(persistoutput, 'w').write('%d' % (count)) - -# Only write the given output file if the count has changed. -if int(oldcount) != count: - open(output, 'w').write('%d' % (count)) - # Sleep so the next run changes the file time sufficiently to make the build - # detect the file as changed. - time.sleep(1) - -sys.exit(0) diff --git a/tools/gyp/test/actions/src/subdir1/executable.gyp b/tools/gyp/test/actions/src/subdir1/executable.gyp deleted file mode 100644 index 6a1ce4f91e..0000000000 --- a/tools/gyp/test/actions/src/subdir1/executable.gyp +++ /dev/null @@ -1,74 +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. - -{ - 'targets': [ - { - 'target_name': 'program', - 'type': 'executable', - 'msvs_cygwin_shell': 0, - 'sources': [ - 'program.c', - ], - 'actions': [ - { - 'action_name': 'make-prog1', - 'inputs': [ - 'make-prog1.py', - ], - 'outputs': [ - '<(INTERMEDIATE_DIR)/prog1.c', - ], - 'action': [ - 'python', '<(_inputs)', '<@(_outputs)', - ], - 'process_outputs_as_sources': 1, - }, - { - 'action_name': 'make-prog2', - 'inputs': [ - 'make-prog2.py', - ], - 'outputs': [ - 'actions-out/prog2.c', - ], - 'action': [ - 'python', '<(_inputs)', '<@(_outputs)', - ], - 'process_outputs_as_sources': 1, - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - }, - ], - }, - { - 'target_name': 'counter', - 'type': 'none', - 'actions': [ - { - # This action should always run, regardless of whether or not it's - # inputs or the command-line change. We do this by creating a dummy - # first output, which is always missing, thus causing the build to - # always try to recreate it. Actual output files should be listed - # after the dummy one, and dependent targets should list the real - # output(s) in their inputs - # (see '../actions.gyp:depend_on_always_run_action'). - 'action_name': 'action_counter', - 'inputs': [ - 'counter.py', - ], - 'outputs': [ - 'actions-out/action-counter.txt.always', - 'actions-out/action-counter.txt', - ], - 'action': [ - 'python', '<(_inputs)', 'actions-out/action-counter.txt', '2', - ], - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - }, - ], - }, - ], -} diff --git a/tools/gyp/test/actions/src/subdir1/make-prog1.py b/tools/gyp/test/actions/src/subdir1/make-prog1.py deleted file mode 100755 index 7ea1d8a2d4..0000000000 --- a/tools/gyp/test/actions/src/subdir1/make-prog1.py +++ /dev/null @@ -1,20 +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 - -contents = r""" -#include - -void prog1(void) -{ - printf("Hello from make-prog1.py\n"); -} -""" - -open(sys.argv[1], 'w').write(contents) - -sys.exit(0) diff --git a/tools/gyp/test/actions/src/subdir1/make-prog2.py b/tools/gyp/test/actions/src/subdir1/make-prog2.py deleted file mode 100755 index 0bfe4973c2..0000000000 --- a/tools/gyp/test/actions/src/subdir1/make-prog2.py +++ /dev/null @@ -1,20 +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 - -contents = r""" -#include - -void prog2(void) -{ - printf("Hello from make-prog2.py\n"); -} -""" - -open(sys.argv[1], 'w').write(contents) - -sys.exit(0) diff --git a/tools/gyp/test/actions/src/subdir1/program.c b/tools/gyp/test/actions/src/subdir1/program.c deleted file mode 100644 index d5f661d905..0000000000 --- a/tools/gyp/test/actions/src/subdir1/program.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -extern void prog1(void); -extern void prog2(void); - -int main(int argc, char *argv[]) -{ - printf("Hello from program.c\n"); - prog1(); - prog2(); - return 0; -} diff --git a/tools/gyp/test/actions/src/subdir2/make-file.py b/tools/gyp/test/actions/src/subdir2/make-file.py deleted file mode 100755 index fff0653144..0000000000 --- a/tools/gyp/test/actions/src/subdir2/make-file.py +++ /dev/null @@ -1,11 +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 - -contents = "Hello from make-file.py\n" - -open(sys.argv[1], 'wb').write(contents) diff --git a/tools/gyp/test/actions/src/subdir2/none.gyp b/tools/gyp/test/actions/src/subdir2/none.gyp deleted file mode 100644 index 2caa97d55c..0000000000 --- a/tools/gyp/test/actions/src/subdir2/none.gyp +++ /dev/null @@ -1,33 +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. - -{ - 'targets': [ - { - 'target_name': 'file', - 'type': 'none', - 'msvs_cygwin_shell': 0, - 'actions': [ - { - 'action_name': 'make-file', - 'inputs': [ - 'make-file.py', - ], - 'outputs': [ - 'file.out', - # TODO: enhance testing infrastructure to test this - # without having to hard-code the intermediate dir paths. - #'<(INTERMEDIATE_DIR)/file.out', - ], - 'action': [ - 'python', '<(_inputs)', '<@(_outputs)', - ], - 'process_outputs_as_sources': 1, - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - } - ], - }, - ], -} diff --git a/tools/gyp/test/actions/src/subdir3/generate_main.py b/tools/gyp/test/actions/src/subdir3/generate_main.py deleted file mode 100755 index b90b3aa6d1..0000000000 --- a/tools/gyp/test/actions/src/subdir3/generate_main.py +++ /dev/null @@ -1,21 +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 - -contents = """ -#include - -int main(int argc, char *argv[]) -{ - printf("Hello from generate_main.py\\n"); - return 0; -} -""" - -open(sys.argv[1], 'w').write(contents) - -sys.exit(0) diff --git a/tools/gyp/test/actions/src/subdir3/null_input.gyp b/tools/gyp/test/actions/src/subdir3/null_input.gyp deleted file mode 100644 index 9b0bea5fdb..0000000000 --- a/tools/gyp/test/actions/src/subdir3/null_input.gyp +++ /dev/null @@ -1,29 +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. - -{ - 'targets': [ - { - 'target_name': 'null_input', - 'type': 'executable', - 'msvs_cygwin_shell': 0, - 'actions': [ - { - 'action_name': 'generate_main', - 'process_outputs_as_sources': 1, - 'inputs': [], - 'outputs': [ - '<(INTERMEDIATE_DIR)/main.c', - ], - 'action': [ - # TODO: we can't just use <(_outputs) here?! - 'python', 'generate_main.py', '<(INTERMEDIATE_DIR)/main.c', - ], - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - }, - ], - }, - ], -} diff --git a/tools/gyp/test/additional-targets/gyptest-additional.py b/tools/gyp/test/additional-targets/gyptest-additional.py deleted file mode 100755 index af35b33de6..0000000000 --- a/tools/gyp/test/additional-targets/gyptest-additional.py +++ /dev/null @@ -1,55 +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. - -""" -Verifies simple actions when using an explicit build target of 'all'. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('all.gyp', chdir='src') -test.relocate('src', 'relocate/src') - -# Build all. -test.build('all.gyp', chdir='relocate/src') - -if test.format=='xcode': - chdir = 'relocate/src/dir1' -else: - chdir = 'relocate/src' - -# Output is as expected. -file_content = 'Hello from emit.py\n' -test.built_file_must_match('out2.txt', file_content, chdir=chdir) - -test.built_file_must_not_exist('out.txt', chdir='relocate/src') -test.built_file_must_not_exist('foolib1', - type=test.SHARED_LIB, - chdir=chdir) - -# TODO(mmoss) Make consistent with scons, with 'dir1' before 'out/Default'? -if test.format in ('make', 'ninja'): - chdir='relocate/src' -else: - chdir='relocate/src/dir1' - -# Build the action explicitly. -test.build('actions.gyp', 'action1_target', chdir=chdir) - -# Check that things got run. -file_content = 'Hello from emit.py\n' -test.built_file_must_exist('out.txt', chdir=chdir) - -# Build the shared library explicitly. -test.build('actions.gyp', 'foolib1', chdir=chdir) - -test.built_file_must_exist('foolib1', - type=test.SHARED_LIB, - chdir=chdir) - -test.pass_test() diff --git a/tools/gyp/test/additional-targets/src/all.gyp b/tools/gyp/test/additional-targets/src/all.gyp deleted file mode 100644 index 21c83080aa..0000000000 --- a/tools/gyp/test/additional-targets/src/all.gyp +++ /dev/null @@ -1,13 +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. - -{ - 'targets': [ - { - 'target_name': 'all_targets', - 'type': 'none', - 'dependencies': ['dir1/actions.gyp:*'], - }, - ], -} diff --git a/tools/gyp/test/additional-targets/src/dir1/actions.gyp b/tools/gyp/test/additional-targets/src/dir1/actions.gyp deleted file mode 100644 index 5089c80913..0000000000 --- a/tools/gyp/test/additional-targets/src/dir1/actions.gyp +++ /dev/null @@ -1,56 +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. - -{ - 'targets': [ - { - 'target_name': 'action1_target', - 'type': 'none', - 'suppress_wildcard': 1, - 'actions': [ - { - 'action_name': 'action1', - 'inputs': [ - 'emit.py', - ], - 'outputs': [ - '<(PRODUCT_DIR)/out.txt', - ], - 'action': ['python', 'emit.py', '<(PRODUCT_DIR)/out.txt'], - 'msvs_cygwin_shell': 0, - }, - ], - }, - { - 'target_name': 'action2_target', - 'type': 'none', - 'actions': [ - { - 'action_name': 'action2', - 'inputs': [ - 'emit.py', - ], - 'outputs': [ - '<(PRODUCT_DIR)/out2.txt', - ], - 'action': ['python', 'emit.py', '<(PRODUCT_DIR)/out2.txt'], - 'msvs_cygwin_shell': 0, - }, - ], - }, - { - 'target_name': 'foolib1', - 'type': 'shared_library', - 'suppress_wildcard': 1, - 'sources': ['lib1.c'], - }, - ], - 'conditions': [ - ['OS=="linux"', { - 'target_defaults': { - 'cflags': ['-fPIC'], - }, - }], - ], -} diff --git a/tools/gyp/test/additional-targets/src/dir1/emit.py b/tools/gyp/test/additional-targets/src/dir1/emit.py deleted file mode 100755 index fd3138738e..0000000000 --- a/tools/gyp/test/additional-targets/src/dir1/emit.py +++ /dev/null @@ -1,11 +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 - -f = open(sys.argv[1], 'wb') -f.write('Hello from emit.py\n') -f.close() diff --git a/tools/gyp/test/additional-targets/src/dir1/lib1.c b/tools/gyp/test/additional-targets/src/dir1/lib1.c deleted file mode 100644 index df4cb10f79..0000000000 --- a/tools/gyp/test/additional-targets/src/dir1/lib1.c +++ /dev/null @@ -1,6 +0,0 @@ -#ifdef _WIN32 -__declspec(dllexport) -#endif -int func1(void) { - return 42; -} diff --git a/tools/gyp/test/assembly/gyptest-assembly.py b/tools/gyp/test/assembly/gyptest-assembly.py deleted file mode 100755 index 09d612b945..0000000000 --- a/tools/gyp/test/assembly/gyptest-assembly.py +++ /dev/null @@ -1,31 +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. - -""" -Verifies that .hpp files are ignored when included in the source list on all -platforms. -""" - -import sys -import TestGyp - -# TODO(bradnelson): get this working for windows. -test = TestGyp.TestGyp(formats=['make', 'ninja', 'scons', 'xcode']) - -test.run_gyp('assembly.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - -test.build('assembly.gyp', test.ALL, chdir='relocate/src') - -expect = """\ -Hello from program.c -Got 42. -""" -test.run_built_executable('program', chdir='relocate/src', stdout=expect) - - -test.pass_test() diff --git a/tools/gyp/test/assembly/src/as.bat b/tools/gyp/test/assembly/src/as.bat deleted file mode 100644 index 0a47382cb7..0000000000 --- a/tools/gyp/test/assembly/src/as.bat +++ /dev/null @@ -1,4 +0,0 @@ -@echo off -:: Mock windows assembler. -cl /c %1 /Fo"%2" - diff --git a/tools/gyp/test/assembly/src/assembly.gyp b/tools/gyp/test/assembly/src/assembly.gyp deleted file mode 100644 index 872dd5ec0c..0000000000 --- a/tools/gyp/test/assembly/src/assembly.gyp +++ /dev/null @@ -1,59 +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. - -{ - 'target_defaults': { - 'conditions': [ - ['OS=="win"', { - 'defines': ['PLATFORM_WIN'], - }], - ['OS=="mac"', { - 'defines': ['PLATFORM_MAC'], - }], - ['OS=="linux"', { - 'defines': ['PLATFORM_LINUX'], - }], - ], - }, - 'targets': [ - { - 'target_name': 'program', - 'type': 'executable', - 'dependencies': ['lib1'], - 'sources': [ - 'program.c', - ], - }, - { - 'target_name': 'lib1', - 'type': 'static_library', - 'sources': [ - 'lib1.S', - ], - }, - ], - 'conditions': [ - ['OS=="win"', { - 'target_defaults': { - 'rules': [ - { - 'rule_name': 'assembler', - 'msvs_cygwin_shell': 0, - 'extension': 'S', - 'inputs': [ - 'as.bat', - ], - 'outputs': [ - '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj', - ], - 'action': - ['as.bat', 'lib1.c', '<(_outputs)'], - 'message': 'Building assembly file <(RULE_INPUT_PATH)', - 'process_outputs_as_sources': 1, - }, - ], - }, - },], - ], -} diff --git a/tools/gyp/test/assembly/src/lib1.S b/tools/gyp/test/assembly/src/lib1.S deleted file mode 100644 index e7102bf249..0000000000 --- a/tools/gyp/test/assembly/src/lib1.S +++ /dev/null @@ -1,10 +0,0 @@ -#if PLATFORM_WINDOWS || PLATFORM_MAC -# define IDENTIFIER(n) _##n -#else /* Linux */ -# define IDENTIFIER(n) n -#endif - -.globl IDENTIFIER(lib1_function) -IDENTIFIER(lib1_function): - movl $42, %eax - ret diff --git a/tools/gyp/test/assembly/src/lib1.c b/tools/gyp/test/assembly/src/lib1.c deleted file mode 100644 index be21ecd5f6..0000000000 --- a/tools/gyp/test/assembly/src/lib1.c +++ /dev/null @@ -1,3 +0,0 @@ -int lib1_function(void) { - return 42; -} diff --git a/tools/gyp/test/assembly/src/program.c b/tools/gyp/test/assembly/src/program.c deleted file mode 100644 index ecce3b0bbb..0000000000 --- a/tools/gyp/test/assembly/src/program.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -extern int lib1_function(void); - -int main(int argc, char *argv[]) -{ - fprintf(stdout, "Hello from program.c\n"); - fflush(stdout); - fprintf(stdout, "Got %d.\n", lib1_function()); - fflush(stdout); - return 0; -} diff --git a/tools/gyp/test/builddir/gyptest-all.py b/tools/gyp/test/builddir/gyptest-all.py deleted file mode 100755 index 885d680bd0..0000000000 --- a/tools/gyp/test/builddir/gyptest-all.py +++ /dev/null @@ -1,77 +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. - -""" -Verify the settings that cause a set of programs to be created in -a specific build directory, and that no intermediate built files -get created outside of that build directory hierarchy even when -referred to with deeply-nested ../../.. paths. -""" - -import TestGyp - -# TODO(mmoss): Make only supports (theoretically) a single, global build -# directory (through GYP_GENERATOR_FLAGS 'output_dir'), rather than -# gyp-file-specific settings (e.g. the stuff in builddir.gypi) that the other -# generators support, so this doesn't work yet for make. -# TODO(mmoss) Make also has the issue that the top-level Makefile is written to -# the "--depth" location, which is one level above 'src', but then this test -# moves 'src' somewhere else, leaving the Makefile behind, so make can't find -# its sources. I'm not sure if make is wrong for writing outside the current -# directory, or if the test is wrong for assuming everything generated is under -# the current directory. -test = TestGyp.TestGyp(formats=['!make', '!ninja']) - -test.run_gyp('prog1.gyp', '--depth=..', chdir='src') - -test.relocate('src', 'relocate/src') - -test.subdir('relocate/builddir') - -# Make sure that all the built ../../etc. files only get put under builddir, -# by making all of relocate read-only and then making only builddir writable. -test.writable('relocate', False) -test.writable('relocate/builddir', True) - -# Suppress the test infrastructure's setting SYMROOT on the command line. -test.build('prog1.gyp', test.ALL, SYMROOT=None, chdir='relocate/src') - -expect1 = """\ -Hello from prog1.c -Hello from func1.c -""" - -expect2 = """\ -Hello from subdir2/prog2.c -Hello from func2.c -""" - -expect3 = """\ -Hello from subdir2/subdir3/prog3.c -Hello from func3.c -""" - -expect4 = """\ -Hello from subdir2/subdir3/subdir4/prog4.c -Hello from func4.c -""" - -expect5 = """\ -Hello from subdir2/subdir3/subdir4/subdir5/prog5.c -Hello from func5.c -""" - -def run_builddir(prog, expect): - dir = 'relocate/builddir/Default/' - test.run(program=test.workpath(dir + prog), stdout=expect) - -run_builddir('prog1', expect1) -run_builddir('prog2', expect2) -run_builddir('prog3', expect3) -run_builddir('prog4', expect4) -run_builddir('prog5', expect5) - -test.pass_test() diff --git a/tools/gyp/test/builddir/gyptest-default.py b/tools/gyp/test/builddir/gyptest-default.py deleted file mode 100755 index 8c6302618f..0000000000 --- a/tools/gyp/test/builddir/gyptest-default.py +++ /dev/null @@ -1,77 +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. - -""" -Verify the settings that cause a set of programs to be created in -a specific build directory, and that no intermediate built files -get created outside of that build directory hierarchy even when -referred to with deeply-nested ../../.. paths. -""" - -import TestGyp - -# TODO(mmoss): Make only supports (theoretically) a single, global build -# directory (through GYP_GENERATOR_FLAGS 'output_dir'), rather than -# gyp-file-specific settings (e.g. the stuff in builddir.gypi) that the other -# generators support, so this doesn't work yet for make. -# TODO(mmoss) Make also has the issue that the top-level Makefile is written to -# the "--depth" location, which is one level above 'src', but then this test -# moves 'src' somewhere else, leaving the Makefile behind, so make can't find -# its sources. I'm not sure if make is wrong for writing outside the current -# directory, or if the test is wrong for assuming everything generated is under -# the current directory. -test = TestGyp.TestGyp(formats=['!make', '!ninja']) - -test.run_gyp('prog1.gyp', '--depth=..', chdir='src') - -test.relocate('src', 'relocate/src') - -test.subdir('relocate/builddir') - -# Make sure that all the built ../../etc. files only get put under builddir, -# by making all of relocate read-only and then making only builddir writable. -test.writable('relocate', False) -test.writable('relocate/builddir', True) - -# Suppress the test infrastructure's setting SYMROOT on the command line. -test.build('prog1.gyp', SYMROOT=None, chdir='relocate/src') - -expect1 = """\ -Hello from prog1.c -Hello from func1.c -""" - -expect2 = """\ -Hello from subdir2/prog2.c -Hello from func2.c -""" - -expect3 = """\ -Hello from subdir2/subdir3/prog3.c -Hello from func3.c -""" - -expect4 = """\ -Hello from subdir2/subdir3/subdir4/prog4.c -Hello from func4.c -""" - -expect5 = """\ -Hello from subdir2/subdir3/subdir4/subdir5/prog5.c -Hello from func5.c -""" - -def run_builddir(prog, expect): - dir = 'relocate/builddir/Default/' - test.run(program=test.workpath(dir + prog), stdout=expect) - -run_builddir('prog1', expect1) -run_builddir('prog2', expect2) -run_builddir('prog3', expect3) -run_builddir('prog4', expect4) -run_builddir('prog5', expect5) - -test.pass_test() diff --git a/tools/gyp/test/builddir/src/builddir.gypi b/tools/gyp/test/builddir/src/builddir.gypi deleted file mode 100644 index e3c61475b5..0000000000 --- a/tools/gyp/test/builddir/src/builddir.gypi +++ /dev/null @@ -1,21 +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. - -{ - 'target_defaults': { - 'configurations': { - 'Default': { - 'msvs_configuration_attributes': { - 'OutputDirectory': '<(DEPTH)\\builddir\Default', - }, - }, - }, - }, - 'scons_settings': { - 'sconsbuild_dir': '<(DEPTH)/builddir', - }, - 'xcode_settings': { - 'SYMROOT': '<(DEPTH)/builddir', - }, -} diff --git a/tools/gyp/test/builddir/src/func1.c b/tools/gyp/test/builddir/src/func1.c deleted file mode 100644 index b8e6a06951..0000000000 --- a/tools/gyp/test/builddir/src/func1.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -void func1(void) -{ - printf("Hello from func1.c\n"); -} diff --git a/tools/gyp/test/builddir/src/func2.c b/tools/gyp/test/builddir/src/func2.c deleted file mode 100644 index 14aabac475..0000000000 --- a/tools/gyp/test/builddir/src/func2.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -void func2(void) -{ - printf("Hello from func2.c\n"); -} diff --git a/tools/gyp/test/builddir/src/func3.c b/tools/gyp/test/builddir/src/func3.c deleted file mode 100644 index 3b4edeae6d..0000000000 --- a/tools/gyp/test/builddir/src/func3.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -void func3(void) -{ - printf("Hello from func3.c\n"); -} diff --git a/tools/gyp/test/builddir/src/func4.c b/tools/gyp/test/builddir/src/func4.c deleted file mode 100644 index 732891b79a..0000000000 --- a/tools/gyp/test/builddir/src/func4.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -void func4(void) -{ - printf("Hello from func4.c\n"); -} diff --git a/tools/gyp/test/builddir/src/func5.c b/tools/gyp/test/builddir/src/func5.c deleted file mode 100644 index 18fdfabbbe..0000000000 --- a/tools/gyp/test/builddir/src/func5.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -void func5(void) -{ - printf("Hello from func5.c\n"); -} diff --git a/tools/gyp/test/builddir/src/prog1.c b/tools/gyp/test/builddir/src/prog1.c deleted file mode 100644 index 674ca747b7..0000000000 --- a/tools/gyp/test/builddir/src/prog1.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -extern void func1(void); - -int main(int argc, char *argv[]) -{ - printf("Hello from prog1.c\n"); - func1(); - return 0; -} diff --git a/tools/gyp/test/builddir/src/prog1.gyp b/tools/gyp/test/builddir/src/prog1.gyp deleted file mode 100644 index 5b96f035ec..0000000000 --- a/tools/gyp/test/builddir/src/prog1.gyp +++ /dev/null @@ -1,30 +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. - -{ - 'includes': [ - 'builddir.gypi', - ], - 'targets': [ - { - 'target_name': 'pull_in_all', - 'type': 'none', - 'dependencies': [ - 'prog1', - 'subdir2/prog2.gyp:prog2', - 'subdir2/subdir3/prog3.gyp:prog3', - 'subdir2/subdir3/subdir4/prog4.gyp:prog4', - 'subdir2/subdir3/subdir4/subdir5/prog5.gyp:prog5', - ], - }, - { - 'target_name': 'prog1', - 'type': 'executable', - 'sources': [ - 'prog1.c', - 'func1.c', - ], - }, - ], -} diff --git a/tools/gyp/test/builddir/src/subdir2/prog2.c b/tools/gyp/test/builddir/src/subdir2/prog2.c deleted file mode 100644 index bbdf4f0603..0000000000 --- a/tools/gyp/test/builddir/src/subdir2/prog2.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -extern void func2(void); - -int main(int argc, char *argv[]) -{ - printf("Hello from subdir2/prog2.c\n"); - func2(); - return 0; -} diff --git a/tools/gyp/test/builddir/src/subdir2/prog2.gyp b/tools/gyp/test/builddir/src/subdir2/prog2.gyp deleted file mode 100644 index 96299b646d..0000000000 --- a/tools/gyp/test/builddir/src/subdir2/prog2.gyp +++ /dev/null @@ -1,19 +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. - -{ - 'includes': [ - '../builddir.gypi', - ], - 'targets': [ - { - 'target_name': 'prog2', - 'type': 'executable', - 'sources': [ - 'prog2.c', - '../func2.c', - ], - }, - ], -} diff --git a/tools/gyp/test/builddir/src/subdir2/subdir3/prog3.c b/tools/gyp/test/builddir/src/subdir2/subdir3/prog3.c deleted file mode 100644 index 10c530b23f..0000000000 --- a/tools/gyp/test/builddir/src/subdir2/subdir3/prog3.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -extern void func3(void); - -int main(int argc, char *argv[]) -{ - printf("Hello from subdir2/subdir3/prog3.c\n"); - func3(); - return 0; -} diff --git a/tools/gyp/test/builddir/src/subdir2/subdir3/prog3.gyp b/tools/gyp/test/builddir/src/subdir2/subdir3/prog3.gyp deleted file mode 100644 index d7df43c7bd..0000000000 --- a/tools/gyp/test/builddir/src/subdir2/subdir3/prog3.gyp +++ /dev/null @@ -1,19 +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. - -{ - 'includes': [ - '../../builddir.gypi', - ], - 'targets': [ - { - 'target_name': 'prog3', - 'type': 'executable', - 'sources': [ - 'prog3.c', - '../../func3.c', - ], - }, - ], -} diff --git a/tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.c b/tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.c deleted file mode 100644 index dcba9a9d4a..0000000000 --- a/tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -extern void func4(void); - -int main(int argc, char *argv[]) -{ - printf("Hello from subdir2/subdir3/subdir4/prog4.c\n"); - func4(); - return 0; -} diff --git a/tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.gyp b/tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.gyp deleted file mode 100644 index 862a8a18cd..0000000000 --- a/tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.gyp +++ /dev/null @@ -1,19 +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. - -{ - 'includes': [ - '../../../builddir.gypi', - ], - 'targets': [ - { - 'target_name': 'prog4', - 'type': 'executable', - 'sources': [ - 'prog4.c', - '../../../func4.c', - ], - }, - ], -} diff --git a/tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.c b/tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.c deleted file mode 100644 index 69132e5763..0000000000 --- a/tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -extern void func5(void); - -int main(int argc, char *argv[]) -{ - printf("Hello from subdir2/subdir3/subdir4/subdir5/prog5.c\n"); - func5(); - return 0; -} diff --git a/tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.gyp b/tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.gyp deleted file mode 100644 index fe1c9cbf50..0000000000 --- a/tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.gyp +++ /dev/null @@ -1,19 +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. - -{ - 'includes': [ - '../../../../builddir.gypi', - ], - 'targets': [ - { - 'target_name': 'prog5', - 'type': 'executable', - 'sources': [ - 'prog5.c', - '../../../../func5.c', - ], - }, - ], -} diff --git a/tools/gyp/test/cflags/cflags.c b/tools/gyp/test/cflags/cflags.c deleted file mode 100644 index c1e2452070..0000000000 --- a/tools/gyp/test/cflags/cflags.c +++ /dev/null @@ -1,15 +0,0 @@ -/* Copyright (c) 2010 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. */ - -#include - -int main(int argc, char *argv[]) -{ -#ifdef __OPTIMIZE__ - printf("Using an optimization flag\n"); -#else - printf("Using no optimization flag\n"); -#endif - return 0; -} diff --git a/tools/gyp/test/cflags/cflags.gyp b/tools/gyp/test/cflags/cflags.gyp deleted file mode 100644 index 9003fb1679..0000000000 --- a/tools/gyp/test/cflags/cflags.gyp +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (c) 2010 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. - -{ - 'targets': [ - { - 'target_name': 'cflags', - 'type': 'executable', - 'opt': '-Os', - 'sources': [ - 'cflags.c', - ], - }, - ], -} diff --git a/tools/gyp/test/cflags/gyptest-cflags.py b/tools/gyp/test/cflags/gyptest-cflags.py deleted file mode 100755 index acc424a2c4..0000000000 --- a/tools/gyp/test/cflags/gyptest-cflags.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2010 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. - -""" -Verifies build of an executable with C++ define specified by a gyp define, and -the use of the environment during regeneration when the gyp file changes. -""" - -import os -import TestGyp - -env_stack = [] - - -def PushEnv(): - env_copy = os.environ.copy() - env_stack.append(env_copy) - -def PopEnv(): - os.eniron=env_stack.pop() - -# Regenerating build files when a gyp file changes is currently only supported -# by the make generator. -test = TestGyp.TestGyp(formats=['make']) - -try: - PushEnv() - os.environ['CFLAGS'] = '-O0' - test.run_gyp('cflags.gyp') -finally: - # We clear the environ after calling gyp. When the auto-regeneration happens, - # the same define should be reused anyway. Reset to empty string first in - # case the platform doesn't support unsetenv. - PopEnv() - -test.build('cflags.gyp') - -expect = """\ -Using no optimization flag -""" -test.run_built_executable('cflags', stdout=expect) - -test.sleep() - -try: - PushEnv() - os.environ['CFLAGS'] = '-O2' - test.run_gyp('cflags.gyp') -finally: - # We clear the environ after calling gyp. When the auto-regeneration happens, - # the same define should be reused anyway. Reset to empty string first in - # case the platform doesn't support unsetenv. - PopEnv() - -test.build('cflags.gyp') - -expect = """\ -Using an optimization flag -""" -test.run_built_executable('cflags', stdout=expect) - -test.pass_test() diff --git a/tools/gyp/test/compilable/gyptest-headers.py b/tools/gyp/test/compilable/gyptest-headers.py deleted file mode 100755 index 91760216fb..0000000000 --- a/tools/gyp/test/compilable/gyptest-headers.py +++ /dev/null @@ -1,29 +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. - -""" -Verifies that .hpp files are ignored when included in the source list on all -platforms. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('headers.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - -test.build('headers.gyp', test.ALL, chdir='relocate/src') - -expect = """\ -Hello from program.c -Hello from lib1.c -""" -test.run_built_executable('program', chdir='relocate/src', stdout=expect) - - -test.pass_test() diff --git a/tools/gyp/test/compilable/src/headers.gyp b/tools/gyp/test/compilable/src/headers.gyp deleted file mode 100644 index b6c2a8857b..0000000000 --- a/tools/gyp/test/compilable/src/headers.gyp +++ /dev/null @@ -1,26 +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. - -{ - 'targets': [ - { - 'target_name': 'program', - 'type': 'executable', - 'dependencies': [ - 'lib1' - ], - 'sources': [ - 'program.cpp', - ], - }, - { - 'target_name': 'lib1', - 'type': 'static_library', - 'sources': [ - 'lib1.hpp', - 'lib1.cpp', - ], - }, - ], -} diff --git a/tools/gyp/test/compilable/src/lib1.cpp b/tools/gyp/test/compilable/src/lib1.cpp deleted file mode 100644 index 51bc31a40b..0000000000 --- a/tools/gyp/test/compilable/src/lib1.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include "lib1.hpp" - -void lib1_function(void) { - fprintf(stdout, "Hello from lib1.c\n"); - fflush(stdout); -} diff --git a/tools/gyp/test/compilable/src/lib1.hpp b/tools/gyp/test/compilable/src/lib1.hpp deleted file mode 100644 index 72e63e8acd..0000000000 --- a/tools/gyp/test/compilable/src/lib1.hpp +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _lib1_hpp -#define _lib1_hpp - -extern void lib1_function(void); - -#endif diff --git a/tools/gyp/test/compilable/src/program.cpp b/tools/gyp/test/compilable/src/program.cpp deleted file mode 100644 index 81420bad43..0000000000 --- a/tools/gyp/test/compilable/src/program.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include "lib1.hpp" - -int main(int argc, char *argv[]) { - fprintf(stdout, "Hello from program.c\n"); - fflush(stdout); - lib1_function(); - return 0; -} diff --git a/tools/gyp/test/configurations/basics/configurations.c b/tools/gyp/test/configurations/basics/configurations.c deleted file mode 100644 index 6c1f900169..0000000000 --- a/tools/gyp/test/configurations/basics/configurations.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ -#ifdef FOO - printf("Foo configuration\n"); -#endif -#ifdef DEBUG - printf("Debug configuration\n"); -#endif -#ifdef RELEASE - printf("Release configuration\n"); -#endif - return 0; -} diff --git a/tools/gyp/test/configurations/basics/configurations.gyp b/tools/gyp/test/configurations/basics/configurations.gyp deleted file mode 100644 index 93f1d8d5c7..0000000000 --- a/tools/gyp/test/configurations/basics/configurations.gyp +++ /dev/null @@ -1,32 +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. - -{ - 'targets': [ - { - 'target_name': 'configurations', - 'type': 'executable', - 'sources': [ - 'configurations.c', - ], - 'configurations': { - 'Debug': { - 'defines': [ - 'DEBUG', - ], - }, - 'Release': { - 'defines': [ - 'RELEASE', - ], - }, - 'Foo': { - 'defines': [ - 'FOO', - ], - }, - } - }, - ], -} diff --git a/tools/gyp/test/configurations/basics/gyptest-configurations.py b/tools/gyp/test/configurations/basics/gyptest-configurations.py deleted file mode 100755 index 27cd2e87d2..0000000000 --- a/tools/gyp/test/configurations/basics/gyptest-configurations.py +++ /dev/null @@ -1,29 +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. - -""" -Verifies build of an executable in three different configurations. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('configurations.gyp') - -test.set_configuration('Release') -test.build('configurations.gyp') -test.run_built_executable('configurations', stdout="Release configuration\n") - -test.set_configuration('Debug') -test.build('configurations.gyp') -test.run_built_executable('configurations', stdout="Debug configuration\n") - -test.set_configuration('Foo') -test.build('configurations.gyp') -test.run_built_executable('configurations', stdout="Foo configuration\n") - -test.pass_test() diff --git a/tools/gyp/test/configurations/inheritance/configurations.c b/tools/gyp/test/configurations/inheritance/configurations.c deleted file mode 100644 index 2d5565eeb5..0000000000 --- a/tools/gyp/test/configurations/inheritance/configurations.c +++ /dev/null @@ -1,21 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ -#ifdef BASE - printf("Base configuration\n"); -#endif -#ifdef COMMON - printf("Common configuration\n"); -#endif -#ifdef COMMON2 - printf("Common2 configuration\n"); -#endif -#ifdef DEBUG - printf("Debug configuration\n"); -#endif -#ifdef RELEASE - printf("Release configuration\n"); -#endif - return 0; -} diff --git a/tools/gyp/test/configurations/inheritance/configurations.gyp b/tools/gyp/test/configurations/inheritance/configurations.gyp deleted file mode 100644 index 9441376b4d..0000000000 --- a/tools/gyp/test/configurations/inheritance/configurations.gyp +++ /dev/null @@ -1,40 +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. - -{ - 'target_defaults': { - 'configurations': { - 'Base': { - 'abstract': 1, - 'defines': ['BASE'], - }, - 'Common': { - 'abstract': 1, - 'inherit_from': ['Base'], - 'defines': ['COMMON'], - }, - 'Common2': { - 'abstract': 1, - 'defines': ['COMMON2'], - }, - 'Debug': { - 'inherit_from': ['Common', 'Common2'], - 'defines': ['DEBUG'], - }, - 'Release': { - 'inherit_from': ['Common', 'Common2'], - 'defines': ['RELEASE'], - }, - }, - }, - 'targets': [ - { - 'target_name': 'configurations', - 'type': 'executable', - 'sources': [ - 'configurations.c', - ], - }, - ], -} diff --git a/tools/gyp/test/configurations/inheritance/gyptest-inheritance.py b/tools/gyp/test/configurations/inheritance/gyptest-inheritance.py deleted file mode 100755 index 22c73a3754..0000000000 --- a/tools/gyp/test/configurations/inheritance/gyptest-inheritance.py +++ /dev/null @@ -1,33 +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. - -""" -Verifies build of an executable in three different configurations. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('configurations.gyp') - -test.set_configuration('Release') -test.build('configurations.gyp') -test.run_built_executable('configurations', - stdout=('Base configuration\n' - 'Common configuration\n' - 'Common2 configuration\n' - 'Release configuration\n')) - -test.set_configuration('Debug') -test.build('configurations.gyp') -test.run_built_executable('configurations', - stdout=('Base configuration\n' - 'Common configuration\n' - 'Common2 configuration\n' - 'Debug configuration\n')) - -test.pass_test() diff --git a/tools/gyp/test/configurations/invalid/actions.gyp b/tools/gyp/test/configurations/invalid/actions.gyp deleted file mode 100644 index a6e42089eb..0000000000 --- a/tools/gyp/test/configurations/invalid/actions.gyp +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2010 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. - -{ - 'targets': [ - { - 'target_name': 'configurations', - 'type': 'none', - 'configurations': { - 'Debug': { - 'actions': [ - ], - }, - } - }, - ], -} diff --git a/tools/gyp/test/configurations/invalid/all_dependent_settings.gyp b/tools/gyp/test/configurations/invalid/all_dependent_settings.gyp deleted file mode 100644 index b16a245df5..0000000000 --- a/tools/gyp/test/configurations/invalid/all_dependent_settings.gyp +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2010 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. - -{ - 'targets': [ - { - 'target_name': 'configurations', - 'type': 'none', - 'configurations': { - 'Debug': { - 'all_dependent_settings': [ - ], - }, - } - }, - ], -} diff --git a/tools/gyp/test/configurations/invalid/configurations.gyp b/tools/gyp/test/configurations/invalid/configurations.gyp deleted file mode 100644 index 2cfc960049..0000000000 --- a/tools/gyp/test/configurations/invalid/configurations.gyp +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2010 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. - -{ - 'targets': [ - { - 'target_name': 'configurations', - 'type': 'none', - 'configurations': { - 'Debug': { - 'configurations': [ - ], - }, - } - }, - ], -} diff --git a/tools/gyp/test/configurations/invalid/dependencies.gyp b/tools/gyp/test/configurations/invalid/dependencies.gyp deleted file mode 100644 index 74633f3f11..0000000000 --- a/tools/gyp/test/configurations/invalid/dependencies.gyp +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2010 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. - -{ - 'targets': [ - { - 'target_name': 'configurations', - 'type': 'none', - 'configurations': { - 'Debug': { - 'dependencies': [ - ], - }, - } - }, - ], -} diff --git a/tools/gyp/test/configurations/invalid/direct_dependent_settings.gyp b/tools/gyp/test/configurations/invalid/direct_dependent_settings.gyp deleted file mode 100644 index 8a0f2e95ea..0000000000 --- a/tools/gyp/test/configurations/invalid/direct_dependent_settings.gyp +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2010 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. - -{ - 'targets': [ - { - 'target_name': 'configurations', - 'type': 'none', - 'configurations': { - 'Debug': { - 'direct_dependent_settings': [ - ], - }, - } - }, - ], -} diff --git a/tools/gyp/test/configurations/invalid/gyptest-configurations.py b/tools/gyp/test/configurations/invalid/gyptest-configurations.py deleted file mode 100755 index d76cdedb0c..0000000000 --- a/tools/gyp/test/configurations/invalid/gyptest-configurations.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2010 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. - -""" -Verifies build of an executable in three different configurations. -""" - -import TestGyp - -# Keys that do not belong inside a configuration dictionary. -invalid_configuration_keys = [ - 'actions', - 'all_dependent_settings', - 'configurations', - 'dependencies', - 'direct_dependent_settings', - 'libraries', - 'link_settings', - 'sources', - 'target_name', - 'type', -] - -test = TestGyp.TestGyp() - -if test.format == 'scons': - test.skip_test('TODO: http://code.google.com/p/gyp/issues/detail?id=176\n') - -for test_key in invalid_configuration_keys: - test.run_gyp('%s.gyp' % test_key, status=1, stderr=None) - expect = ['%s not allowed in the Debug configuration, found in target ' - '%s.gyp:configurations#target' % (test_key, test_key)] - test.must_contain_all_lines(test.stderr(), expect) - -test.pass_test() diff --git a/tools/gyp/test/configurations/invalid/libraries.gyp b/tools/gyp/test/configurations/invalid/libraries.gyp deleted file mode 100644 index c4014ed406..0000000000 --- a/tools/gyp/test/configurations/invalid/libraries.gyp +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2010 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. - -{ - 'targets': [ - { - 'target_name': 'configurations', - 'type': 'none', - 'configurations': { - 'Debug': { - 'libraries': [ - ], - }, - } - }, - ], -} diff --git a/tools/gyp/test/configurations/invalid/link_settings.gyp b/tools/gyp/test/configurations/invalid/link_settings.gyp deleted file mode 100644 index 2f0e1c46f5..0000000000 --- a/tools/gyp/test/configurations/invalid/link_settings.gyp +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2010 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. - -{ - 'targets': [ - { - 'target_name': 'configurations', - 'type': 'none', - 'configurations': { - 'Debug': { - 'link_settings': [ - ], - }, - } - }, - ], -} diff --git a/tools/gyp/test/configurations/invalid/sources.gyp b/tools/gyp/test/configurations/invalid/sources.gyp deleted file mode 100644 index b38cca0381..0000000000 --- a/tools/gyp/test/configurations/invalid/sources.gyp +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2010 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. - -{ - 'targets': [ - { - 'target_name': 'configurations', - 'type': 'none', - 'configurations': { - 'Debug': { - 'sources': [ - ], - }, - } - }, - ], -} diff --git a/tools/gyp/test/configurations/invalid/target_name.gyp b/tools/gyp/test/configurations/invalid/target_name.gyp deleted file mode 100644 index 83baad95d6..0000000000 --- a/tools/gyp/test/configurations/invalid/target_name.gyp +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2010 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. - -{ - 'targets': [ - { - 'target_name': 'configurations', - 'type': 'none', - 'configurations': { - 'Debug': { - 'target_name': [ - ], - }, - } - }, - ], -} diff --git a/tools/gyp/test/configurations/invalid/type.gyp b/tools/gyp/test/configurations/invalid/type.gyp deleted file mode 100644 index bc55898b89..0000000000 --- a/tools/gyp/test/configurations/invalid/type.gyp +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2010 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. - -{ - 'targets': [ - { - 'target_name': 'configurations', - 'type': 'none', - 'configurations': { - 'Debug': { - 'type': [ - ], - }, - } - }, - ], -} diff --git a/tools/gyp/test/configurations/target_platform/configurations.gyp b/tools/gyp/test/configurations/target_platform/configurations.gyp deleted file mode 100644 index d15429f4e5..0000000000 --- a/tools/gyp/test/configurations/target_platform/configurations.gyp +++ /dev/null @@ -1,58 +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. - -{ - 'target_defaults': { - 'configurations': { - 'Debug_Win32': { - 'msvs_configuration_platform': 'Win32', - }, - 'Debug_x64': { - 'msvs_configuration_platform': 'x64', - }, - }, - }, - 'targets': [ - { - 'target_name': 'left', - 'type': 'static_library', - 'sources': [ - 'left.c', - ], - 'configurations': { - 'Debug_Win32': { - 'msvs_target_platform': 'x64', - }, - }, - }, - { - 'target_name': 'right', - 'type': 'static_library', - 'sources': [ - 'right.c', - ], - }, - { - 'target_name': 'front_left', - 'type': 'executable', - 'dependencies': ['left'], - 'sources': [ - 'front.c', - ], - 'configurations': { - 'Debug_Win32': { - 'msvs_target_platform': 'x64', - }, - }, - }, - { - 'target_name': 'front_right', - 'type': 'executable', - 'dependencies': ['right'], - 'sources': [ - 'front.c', - ], - }, - ], -} diff --git a/tools/gyp/test/configurations/target_platform/front.c b/tools/gyp/test/configurations/target_platform/front.c deleted file mode 100644 index 12b1d0aa3b..0000000000 --- a/tools/gyp/test/configurations/target_platform/front.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -const char *message(void); - -int main(int argc, char *argv[]) { - printf("%s\n", message()); - return 0; -} diff --git a/tools/gyp/test/configurations/target_platform/gyptest-target_platform.py b/tools/gyp/test/configurations/target_platform/gyptest-target_platform.py deleted file mode 100755 index ae4e9e5a2d..0000000000 --- a/tools/gyp/test/configurations/target_platform/gyptest-target_platform.py +++ /dev/null @@ -1,40 +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. - -""" -Tests the msvs specific msvs_target_platform option. -""" - -import TestGyp -import TestCommon - - -def RunX64(exe, stdout): - try: - test.run_built_executable(exe, stdout=stdout) - except WindowsError, e: - # Assume the exe is 64-bit if it can't load on 32-bit systems. - # Both versions of the error are required because different versions - # of python seem to return different errors for invalid exe type. - if e.errno != 193 and '[Error 193]' not in str(e): - raise - - -test = TestGyp.TestGyp(formats=['msvs']) - -test.run_gyp('configurations.gyp') - -test.set_configuration('Debug|x64') -test.build('configurations.gyp', rebuild=True) -RunX64('front_left', stdout=('left\n')) -RunX64('front_right', stdout=('right\n')) - -test.set_configuration('Debug|Win32') -test.build('configurations.gyp', rebuild=True) -RunX64('front_left', stdout=('left\n')) -test.run_built_executable('front_right', stdout=('right\n')) - -test.pass_test() diff --git a/tools/gyp/test/configurations/target_platform/left.c b/tools/gyp/test/configurations/target_platform/left.c deleted file mode 100644 index 1ce2ea1227..0000000000 --- a/tools/gyp/test/configurations/target_platform/left.c +++ /dev/null @@ -1,3 +0,0 @@ -const char *message(void) { - return "left"; -} diff --git a/tools/gyp/test/configurations/target_platform/right.c b/tools/gyp/test/configurations/target_platform/right.c deleted file mode 100644 index b1578492fe..0000000000 --- a/tools/gyp/test/configurations/target_platform/right.c +++ /dev/null @@ -1,3 +0,0 @@ -const char *message(void) { - return "right"; -} diff --git a/tools/gyp/test/configurations/x64/configurations.c b/tools/gyp/test/configurations/x64/configurations.c deleted file mode 100644 index 72c97e31da..0000000000 --- a/tools/gyp/test/configurations/x64/configurations.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -int main(int argc, char *argv[]) { - if (sizeof(void*) == 4) { - printf("Running Win32\n"); - } else if (sizeof(void*) == 8) { - printf("Running x64\n"); - } else { - printf("Unexpected platform\n"); - } - return 0; -} diff --git a/tools/gyp/test/configurations/x64/configurations.gyp b/tools/gyp/test/configurations/x64/configurations.gyp deleted file mode 100644 index 06ffa3758b..0000000000 --- a/tools/gyp/test/configurations/x64/configurations.gyp +++ /dev/null @@ -1,26 +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. - -{ - 'target_defaults': { - 'configurations': { - 'Debug': { - 'msvs_configuration_platform': 'Win32', - }, - 'Debug_x64': { - 'inherit_from': ['Debug'], - 'msvs_configuration_platform': 'x64', - }, - }, - }, - 'targets': [ - { - 'target_name': 'configurations', - 'type': 'executable', - 'sources': [ - 'configurations.c', - ], - }, - ], -} diff --git a/tools/gyp/test/configurations/x64/gyptest-x86.py b/tools/gyp/test/configurations/x64/gyptest-x86.py deleted file mode 100755 index 254ea6fbc0..0000000000 --- a/tools/gyp/test/configurations/x64/gyptest-x86.py +++ /dev/null @@ -1,29 +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. - -""" -Verifies build of an executable in three different configurations. -""" - -import TestGyp - -test = TestGyp.TestGyp(formats=['msvs']) - -test.run_gyp('configurations.gyp') - -for platform in ['Win32', 'x64']: - test.set_configuration('Debug|%s' % platform) - test.build('configurations.gyp', rebuild=True) - try: - test.run_built_executable('configurations', - stdout=('Running %s\n' % platform)) - except WindowsError, e: - # Assume the exe is 64-bit if it can't load on 32-bit systems. - if platform == 'x64' and (e.errno == 193 or '[Error 193]' in str(e)): - continue - raise - -test.pass_test() diff --git a/tools/gyp/test/copies/gyptest-all.py b/tools/gyp/test/copies/gyptest-all.py deleted file mode 100755 index 8542ab7b92..0000000000 --- a/tools/gyp/test/copies/gyptest-all.py +++ /dev/null @@ -1,40 +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. - -""" -Verifies file copies using an explicit build target of 'all'. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('copies.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - -test.build('copies.gyp', test.ALL, chdir='relocate/src') - -test.must_match(['relocate', 'src', 'copies-out', 'file1'], 'file1 contents\n') - -test.built_file_must_match('copies-out/file2', - 'file2 contents\n', - chdir='relocate/src') - -test.built_file_must_match('copies-out/directory/file3', - 'file3 contents\n', - chdir='relocate/src') -test.built_file_must_match('copies-out/directory/file4', - 'file4 contents\n', - chdir='relocate/src') -test.built_file_must_match('copies-out/directory/subdir/file5', - 'file5 contents\n', - chdir='relocate/src') -test.built_file_must_match('copies-out/subdir/file6', - 'file6 contents\n', - chdir='relocate/src') - -test.pass_test() diff --git a/tools/gyp/test/copies/gyptest-default.py b/tools/gyp/test/copies/gyptest-default.py deleted file mode 100755 index a5d1bf9c3c..0000000000 --- a/tools/gyp/test/copies/gyptest-default.py +++ /dev/null @@ -1,40 +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. - -""" -Verifies file copies using the build tool default. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('copies.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - -test.build('copies.gyp', chdir='relocate/src') - -test.must_match(['relocate', 'src', 'copies-out', 'file1'], 'file1 contents\n') - -test.built_file_must_match('copies-out/file2', - 'file2 contents\n', - chdir='relocate/src') - -test.built_file_must_match('copies-out/directory/file3', - 'file3 contents\n', - chdir='relocate/src') -test.built_file_must_match('copies-out/directory/file4', - 'file4 contents\n', - chdir='relocate/src') -test.built_file_must_match('copies-out/directory/subdir/file5', - 'file5 contents\n', - chdir='relocate/src') -test.built_file_must_match('copies-out/subdir/file6', - 'file6 contents\n', - chdir='relocate/src') - -test.pass_test() diff --git a/tools/gyp/test/copies/gyptest-slash.py b/tools/gyp/test/copies/gyptest-slash.py deleted file mode 100755 index 81a4f42a32..0000000000 --- a/tools/gyp/test/copies/gyptest-slash.py +++ /dev/null @@ -1,38 +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. - -""" -Verifies file copies with a trailing slash in the destination directory. -""" - -import TestGyp - -test = TestGyp.TestGyp() -test.run_gyp('copies-slash.gyp', chdir='src') -test.relocate('src', 'relocate/src') -test.build('copies-slash.gyp', chdir='relocate/src') - -test.built_file_must_match('copies-out-slash/directory/file3', - 'file3 contents\n', - chdir='relocate/src') -test.built_file_must_match('copies-out-slash/directory/file4', - 'file4 contents\n', - chdir='relocate/src') -test.built_file_must_match('copies-out-slash/directory/subdir/file5', - 'file5 contents\n', - chdir='relocate/src') - -test.built_file_must_match('copies-out-slash-2/directory/file3', - 'file3 contents\n', - chdir='relocate/src') -test.built_file_must_match('copies-out-slash-2/directory/file4', - 'file4 contents\n', - chdir='relocate/src') -test.built_file_must_match('copies-out-slash-2/directory/subdir/file5', - 'file5 contents\n', - chdir='relocate/src') - -test.pass_test() diff --git a/tools/gyp/test/copies/src/copies-slash.gyp b/tools/gyp/test/copies/src/copies-slash.gyp deleted file mode 100644 index 9bf54bd181..0000000000 --- a/tools/gyp/test/copies/src/copies-slash.gyp +++ /dev/null @@ -1,36 +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. - -{ - 'targets': [ - # A trailing slash on the destination directory should be ignored. - { - 'target_name': 'copies_recursive_trailing_slash', - 'type': 'none', - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)/copies-out-slash/', - 'files': [ - 'directory/', - ], - }, - ], - }, - # Even if the source directory is below <(PRODUCT_DIR). - { - 'target_name': 'copies_recursive_trailing_slash_in_product_dir', - 'type': 'none', - 'dependencies': [ ':copies_recursive_trailing_slash' ], - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)/copies-out-slash-2/', - 'files': [ - '<(PRODUCT_DIR)/copies-out-slash/directory/', - ], - }, - ], - }, - ], -} - diff --git a/tools/gyp/test/copies/src/copies.gyp b/tools/gyp/test/copies/src/copies.gyp deleted file mode 100644 index ce2e0cabca..0000000000 --- a/tools/gyp/test/copies/src/copies.gyp +++ /dev/null @@ -1,70 +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. - -{ - 'targets': [ - { - 'target_name': 'copies1', - 'type': 'none', - 'copies': [ - { - 'destination': 'copies-out', - 'files': [ - 'file1', - ], - }, - ], - }, - { - 'target_name': 'copies2', - 'type': 'none', - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)/copies-out', - 'files': [ - 'file2', - ], - }, - ], - }, - # Copy a directory tree. - { - 'target_name': 'copies_recursive', - 'type': 'none', - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)/copies-out', - 'files': [ - 'directory/', - ], - }, - ], - }, - # Copy a directory from deeper in the tree (this should not reproduce the - # entire directory path in the destination, only the final directory). - { - 'target_name': 'copies_recursive_depth', - 'type': 'none', - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)/copies-out', - 'files': [ - 'parentdir/subdir/', - ], - }, - ], - }, - # Verify that a null 'files' list doesn't gag the generators. - { - 'target_name': 'copies_null', - 'type': 'none', - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)/copies-null', - 'files': [], - }, - ], - }, - ], -} diff --git a/tools/gyp/test/copies/src/directory/file3 b/tools/gyp/test/copies/src/directory/file3 deleted file mode 100644 index 43f16f3522..0000000000 --- a/tools/gyp/test/copies/src/directory/file3 +++ /dev/null @@ -1 +0,0 @@ -file3 contents diff --git a/tools/gyp/test/copies/src/directory/file4 b/tools/gyp/test/copies/src/directory/file4 deleted file mode 100644 index 5f7270a084..0000000000 --- a/tools/gyp/test/copies/src/directory/file4 +++ /dev/null @@ -1 +0,0 @@ -file4 contents diff --git a/tools/gyp/test/copies/src/directory/subdir/file5 b/tools/gyp/test/copies/src/directory/subdir/file5 deleted file mode 100644 index 41f47186bd..0000000000 --- a/tools/gyp/test/copies/src/directory/subdir/file5 +++ /dev/null @@ -1 +0,0 @@ -file5 contents diff --git a/tools/gyp/test/copies/src/file1 b/tools/gyp/test/copies/src/file1 deleted file mode 100644 index 84d55c5759..0000000000 --- a/tools/gyp/test/copies/src/file1 +++ /dev/null @@ -1 +0,0 @@ -file1 contents diff --git a/tools/gyp/test/copies/src/file2 b/tools/gyp/test/copies/src/file2 deleted file mode 100644 index af1b8ae35d..0000000000 --- a/tools/gyp/test/copies/src/file2 +++ /dev/null @@ -1 +0,0 @@ -file2 contents diff --git a/tools/gyp/test/copies/src/parentdir/subdir/file6 b/tools/gyp/test/copies/src/parentdir/subdir/file6 deleted file mode 100644 index f5d5757348..0000000000 --- a/tools/gyp/test/copies/src/parentdir/subdir/file6 +++ /dev/null @@ -1 +0,0 @@ -file6 contents diff --git a/tools/gyp/test/cxxflags/cxxflags.cc b/tools/gyp/test/cxxflags/cxxflags.cc deleted file mode 100644 index c1e2452070..0000000000 --- a/tools/gyp/test/cxxflags/cxxflags.cc +++ /dev/null @@ -1,15 +0,0 @@ -/* Copyright (c) 2010 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. */ - -#include - -int main(int argc, char *argv[]) -{ -#ifdef __OPTIMIZE__ - printf("Using an optimization flag\n"); -#else - printf("Using no optimization flag\n"); -#endif - return 0; -} diff --git a/tools/gyp/test/cxxflags/cxxflags.gyp b/tools/gyp/test/cxxflags/cxxflags.gyp deleted file mode 100644 index 24d883aaed..0000000000 --- a/tools/gyp/test/cxxflags/cxxflags.gyp +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (c) 2010 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. - -{ - 'targets': [ - { - 'target_name': 'cxxflags', - 'type': 'executable', - 'opt': '-Os', - 'sources': [ - 'cxxflags.cc', - ], - }, - ], -} diff --git a/tools/gyp/test/cxxflags/gyptest-cxxflags.py b/tools/gyp/test/cxxflags/gyptest-cxxflags.py deleted file mode 100755 index 2e5a6d9474..0000000000 --- a/tools/gyp/test/cxxflags/gyptest-cxxflags.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2010 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. - -""" -Verifies build of an executable with C++ define specified by a gyp define, and -the use of the environment during regeneration when the gyp file changes. -""" - -import os -import TestGyp - -env_stack = [] - - -def PushEnv(): - env_copy = os.environ.copy() - env_stack.append(env_copy) - -def PopEnv(): - os.eniron=env_stack.pop() - -# Regenerating build files when a gyp file changes is currently only supported -# by the make generator. -test = TestGyp.TestGyp(formats=['make']) - -try: - PushEnv() - os.environ['CXXFLAGS'] = '-O0' - test.run_gyp('cxxflags.gyp') -finally: - # We clear the environ after calling gyp. When the auto-regeneration happens, - # the same define should be reused anyway. Reset to empty string first in - # case the platform doesn't support unsetenv. - PopEnv() - -test.build('cxxflags.gyp') - -expect = """\ -Using no optimization flag -""" -test.run_built_executable('cxxflags', stdout=expect) - -test.sleep() - -try: - PushEnv() - os.environ['CXXFLAGS'] = '-O2' - test.run_gyp('cxxflags.gyp') -finally: - # We clear the environ after calling gyp. When the auto-regeneration happens, - # the same define should be reused anyway. Reset to empty string first in - # case the platform doesn't support unsetenv. - PopEnv() - -test.build('cxxflags.gyp') - -expect = """\ -Using an optimization flag -""" -test.run_built_executable('cxxflags', stdout=expect) - -test.pass_test() diff --git a/tools/gyp/test/defines-escaping/defines-escaping.c b/tools/gyp/test/defines-escaping/defines-escaping.c deleted file mode 100644 index 440757222e..0000000000 --- a/tools/gyp/test/defines-escaping/defines-escaping.c +++ /dev/null @@ -1,11 +0,0 @@ -/* Copyright (c) 2010 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. */ - -#include - -int main(int argc, char *argv[]) -{ - printf(TEST_FORMAT, TEST_ARGS); - return 0; -} diff --git a/tools/gyp/test/defines-escaping/defines-escaping.gyp b/tools/gyp/test/defines-escaping/defines-escaping.gyp deleted file mode 100644 index 6f0f3fde41..0000000000 --- a/tools/gyp/test/defines-escaping/defines-escaping.gyp +++ /dev/null @@ -1,19 +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. - -{ - 'targets': [ - { - 'target_name': 'defines_escaping', - 'type': 'executable', - 'sources': [ - 'defines-escaping.c', - ], - 'defines': [ - 'TEST_FORMAT="<(test_format)"', - 'TEST_ARGS=<(test_args)', - ], - }, - ], -} diff --git a/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py b/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py deleted file mode 100755 index eb18a3d369..0000000000 --- a/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py +++ /dev/null @@ -1,184 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2010 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. - -""" -Verifies build of an executable with C++ define specified by a gyp define using -various special characters such as quotes, commas, etc. -""" - -import os -import TestGyp - -test = TestGyp.TestGyp() - -# Tests string literals, percents, and backslash escapes. -try: - os.environ['GYP_DEFINES'] = ( - r"""test_format='\n%s\n' """ - r"""test_args='"Simple test of %s with a literal"'""") - test.run_gyp('defines-escaping.gyp') -finally: - del os.environ['GYP_DEFINES'] - -test.build('defines-escaping.gyp') - -expect = """ -Simple test of %s with a literal -""" -test.run_built_executable('defines_escaping', stdout=expect) - - -# Test multiple comma-and-space-separated string literals. -try: - os.environ['GYP_DEFINES'] = \ - r"""test_format='\n%s and %s\n' test_args='"foo", "bar"'""" - test.run_gyp('defines-escaping.gyp') -finally: - del os.environ['GYP_DEFINES'] - -test.sleep() -test.touch('defines-escaping.c') -test.build('defines-escaping.gyp') - -expect = """ -foo and bar -""" -test.run_built_executable('defines_escaping', stdout=expect) - - -# Test string literals containing quotes. -try: - os.environ['GYP_DEFINES'] = ( - r"""test_format='\n%s %s %s %s %s\n' """ - r"""test_args='"\"These,\"",""" - r""" "\"words,\"",""" - r""" "\"are,\"",""" - r""" "\"in,\"",""" - r""" "\"quotes.\""'""") - test.run_gyp('defines-escaping.gyp') -finally: - del os.environ['GYP_DEFINES'] - -test.sleep() -test.touch('defines-escaping.c') -test.build('defines-escaping.gyp') - -expect = """ -"These," "words," "are," "in," "quotes." -""" -test.run_built_executable('defines_escaping', stdout=expect) - - -# Test string literals containing single quotes. -try: - os.environ['GYP_DEFINES'] = ( - r"""test_format='\n%s %s %s %s %s\n' """ - r"""test_args="\"'These,'\",""" - r""" \"'words,'\",""" - r""" \"'are,'\",""" - r""" \"'in,'\",""" - r""" \"'quotes.'\"" """) - test.run_gyp('defines-escaping.gyp') -finally: - del os.environ['GYP_DEFINES'] - -test.sleep() -test.touch('defines-escaping.c') -test.build('defines-escaping.gyp') - -expect = """ -'These,' 'words,' 'are,' 'in,' 'quotes.' -""" -test.run_built_executable('defines_escaping', stdout=expect) - - -# Test string literals containing different numbers of backslashes before quotes -# (to exercise Windows' quoting behaviour). -try: - os.environ['GYP_DEFINES'] = ( - r"""test_format='\n%s\n%s\n%s\n' """ - r"""test_args='"\\\"1 visible slash\\\"",""" - r""" "\\\\\"2 visible slashes\\\\\"",""" - r""" "\\\\\\\"3 visible slashes\\\\\\\""'""") - test.run_gyp('defines-escaping.gyp') -finally: - del os.environ['GYP_DEFINES'] - -test.sleep() -test.touch('defines-escaping.c') -test.build('defines-escaping.gyp') - -expect = r""" -\"1 visible slash\" -\\"2 visible slashes\\" -\\\"3 visible slashes\\\" -""" -test.run_built_executable('defines_escaping', stdout=expect) - - -# Test that various scary sequences are passed unfettered. -try: - os.environ['GYP_DEFINES'] = ( - r"""test_format='\n%s\n' """ - r"""test_args='"$foo, " `foo`;"'""") - test.run_gyp('defines-escaping.gyp') -finally: - del os.environ['GYP_DEFINES'] - -test.sleep() -test.touch('defines-escaping.c') -test.build('defines-escaping.gyp') - -expect = """ -$foo, " `foo`; -""" -test.run_built_executable('defines_escaping', stdout=expect) - - -# VisualStudio 2010 can't handle passing %PATH% -if not (test.format == 'msvs' and test.uses_msbuild): - try: - os.environ['GYP_DEFINES'] = ( - """test_format='%s' """ - """test_args='"%PATH%"'""") - test.run_gyp('defines-escaping.gyp') - finally: - del os.environ['GYP_DEFINES'] - - test.sleep() - test.touch('defines-escaping.c') - test.build('defines-escaping.gyp') - - expect = "%PATH%" - test.run_built_executable('defines_escaping', stdout=expect) - - -# Test commas and semi-colons preceded by backslashes (to exercise Windows' -# quoting behaviour). -try: - os.environ['GYP_DEFINES'] = ( - r"""test_format='\n%s\n%s\n' """ - r"""test_args='"\\, \\\\;",""" - # Same thing again, but enclosed in visible quotes. - r""" "\"\\, \\\\;\""'""") - test.run_gyp('defines-escaping.gyp') -finally: - del os.environ['GYP_DEFINES'] - -test.sleep() -test.touch('defines-escaping.c') -test.build('defines-escaping.gyp') - -expect = r""" -\, \\; -"\, \\;" -""" -test.run_built_executable('defines_escaping', stdout=expect) - -# We deliberately do not test having an odd number of quotes in a string -# literal because that isn't feasible in MSVS. - -test.pass_test() diff --git a/tools/gyp/test/defines/defines-env.gyp b/tools/gyp/test/defines/defines-env.gyp deleted file mode 100644 index 1781546ae0..0000000000 --- a/tools/gyp/test/defines/defines-env.gyp +++ /dev/null @@ -1,22 +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. - -{ - 'variables': { - 'value%': '5', - }, - 'targets': [ - { - 'target_name': 'defines', - 'type': 'executable', - 'sources': [ - 'defines.c', - ], - 'defines': [ - 'VALUE=<(value)', - ], - }, - ], -} - diff --git a/tools/gyp/test/defines/defines.c b/tools/gyp/test/defines/defines.c deleted file mode 100644 index 47215490b1..0000000000 --- a/tools/gyp/test/defines/defines.c +++ /dev/null @@ -1,18 +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. */ - -#include - -int main(int argc, char *argv[]) -{ -#ifdef FOO - printf("FOO is defined\n"); -#endif - printf("VALUE is %d\n", VALUE); - -#ifdef PAREN_VALUE - printf("2*PAREN_VALUE is %d\n", 2*PAREN_VALUE); -#endif - return 0; -} diff --git a/tools/gyp/test/defines/defines.gyp b/tools/gyp/test/defines/defines.gyp deleted file mode 100644 index 25d8c41f9a..0000000000 --- a/tools/gyp/test/defines/defines.gyp +++ /dev/null @@ -1,37 +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. - -{ - 'targets': [ - { - 'target_name': 'defines', - 'type': 'executable', - 'sources': [ - 'defines.c', - ], - 'defines': [ - 'FOO', - 'VALUE=1', - 'PAREN_VALUE=(1+2+3)', - ], - }, - ], - 'conditions': [ - ['OS=="fakeos"', { - 'targets': [ - { - 'target_name': 'fakeosprogram', - 'type': 'executable', - 'sources': [ - 'defines.c', - ], - 'defines': [ - 'FOO', - 'VALUE=1', - ], - }, - ], - }], - ], -} diff --git a/tools/gyp/test/defines/gyptest-define-override.py b/tools/gyp/test/defines/gyptest-define-override.py deleted file mode 100755 index 82e325af2c..0000000000 --- a/tools/gyp/test/defines/gyptest-define-override.py +++ /dev/null @@ -1,34 +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. - -""" -Verifies that a default gyp define can be overridden. -""" - -import os -import TestGyp - -test = TestGyp.TestGyp() - -# Command-line define -test.run_gyp('defines.gyp', '-D', 'OS=fakeos') -test.build('defines.gyp') -test.built_file_must_exist('fakeosprogram', type=test.EXECUTABLE) -# Clean up the exe so subsequent tests don't find an old exe. -os.remove(test.built_file_path('fakeosprogram', type=test.EXECUTABLE)) - -# Without "OS" override, fokeosprogram shouldn't be built. -test.run_gyp('defines.gyp') -test.build('defines.gyp') -test.built_file_must_not_exist('fakeosprogram', type=test.EXECUTABLE) - -# Environment define -os.environ['GYP_DEFINES'] = 'OS=fakeos' -test.run_gyp('defines.gyp') -test.build('defines.gyp') -test.built_file_must_exist('fakeosprogram', type=test.EXECUTABLE) - -test.pass_test() diff --git a/tools/gyp/test/defines/gyptest-defines-env-regyp.py b/tools/gyp/test/defines/gyptest-defines-env-regyp.py deleted file mode 100755 index 57ca42b2fc..0000000000 --- a/tools/gyp/test/defines/gyptest-defines-env-regyp.py +++ /dev/null @@ -1,50 +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. - -""" -Verifies build of an executable with C++ define specified by a gyp define, and -the use of the environment during regeneration when the gyp file changes. -""" - -import os -import TestGyp - -# Regenerating build files when a gyp file changes is currently only supported -# by the make generator. -test = TestGyp.TestGyp(formats=['make']) - -try: - os.environ['GYP_DEFINES'] = 'value=50' - test.run_gyp('defines.gyp') -finally: - # We clear the environ after calling gyp. When the auto-regeneration happens, - # the same define should be reused anyway. Reset to empty string first in - # case the platform doesn't support unsetenv. - os.environ['GYP_DEFINES'] = '' - del os.environ['GYP_DEFINES'] - -test.build('defines.gyp') - -expect = """\ -FOO is defined -VALUE is 1 -2*PAREN_VALUE is 12 -""" -test.run_built_executable('defines', stdout=expect) - -# Sleep so that the changed gyp file will have a newer timestamp than the -# previously generated build files. -test.sleep() -test.write('defines.gyp', test.read('defines-env.gyp')) - -test.build('defines.gyp', test.ALL) - -expect = """\ -VALUE is 50 -""" -test.run_built_executable('defines', stdout=expect) - -test.pass_test() diff --git a/tools/gyp/test/defines/gyptest-defines-env.py b/tools/gyp/test/defines/gyptest-defines-env.py deleted file mode 100755 index 6b4e7175a6..0000000000 --- a/tools/gyp/test/defines/gyptest-defines-env.py +++ /dev/null @@ -1,85 +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. - -""" -Verifies build of an executable with C++ define specified by a gyp define. -""" - -import os -import TestGyp - -test = TestGyp.TestGyp() - -# With the value only given in environment, it should be used. -try: - os.environ['GYP_DEFINES'] = 'value=10' - test.run_gyp('defines-env.gyp') -finally: - del os.environ['GYP_DEFINES'] - -test.build('defines-env.gyp') - -expect = """\ -VALUE is 10 -""" -test.run_built_executable('defines', stdout=expect) - - -# With the value given in both command line and environment, -# command line should take precedence. -try: - os.environ['GYP_DEFINES'] = 'value=20' - test.run_gyp('defines-env.gyp', '-Dvalue=25') -finally: - del os.environ['GYP_DEFINES'] - -test.sleep() -test.touch('defines.c') -test.build('defines-env.gyp') - -expect = """\ -VALUE is 25 -""" -test.run_built_executable('defines', stdout=expect) - - -# With the value only given in environment, it should be ignored if -# --ignore-environment is specified. -try: - os.environ['GYP_DEFINES'] = 'value=30' - test.run_gyp('defines-env.gyp', '--ignore-environment') -finally: - del os.environ['GYP_DEFINES'] - -test.sleep() -test.touch('defines.c') -test.build('defines-env.gyp') - -expect = """\ -VALUE is 5 -""" -test.run_built_executable('defines', stdout=expect) - - -# With the value given in both command line and environment, and -# --ignore-environment also specified, command line should still be used. -try: - os.environ['GYP_DEFINES'] = 'value=40' - test.run_gyp('defines-env.gyp', '--ignore-environment', '-Dvalue=45') -finally: - del os.environ['GYP_DEFINES'] - -test.sleep() -test.touch('defines.c') -test.build('defines-env.gyp') - -expect = """\ -VALUE is 45 -""" -test.run_built_executable('defines', stdout=expect) - - -test.pass_test() diff --git a/tools/gyp/test/defines/gyptest-defines.py b/tools/gyp/test/defines/gyptest-defines.py deleted file mode 100755 index 0b6d64b855..0000000000 --- a/tools/gyp/test/defines/gyptest-defines.py +++ /dev/null @@ -1,26 +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. - -""" -Verifies build of an executable with C++ defines. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('defines.gyp') - -test.build('defines.gyp') - -expect = """\ -FOO is defined -VALUE is 1 -2*PAREN_VALUE is 12 -""" -test.run_built_executable('defines', stdout=expect) - -test.pass_test() diff --git a/tools/gyp/test/dependencies/a.c b/tools/gyp/test/dependencies/a.c deleted file mode 100755 index 3bba111d24..0000000000 --- a/tools/gyp/test/dependencies/a.c +++ /dev/null @@ -1,9 +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. */ - -extern int funcB(); - -int funcA() { - return funcB(); -} diff --git a/tools/gyp/test/dependencies/b/b.c b/tools/gyp/test/dependencies/b/b.c deleted file mode 100755 index b5e771bcc7..0000000000 --- a/tools/gyp/test/dependencies/b/b.c +++ /dev/null @@ -1,3 +0,0 @@ -int funcB() { - return 2; -} diff --git a/tools/gyp/test/dependencies/b/b.gyp b/tools/gyp/test/dependencies/b/b.gyp deleted file mode 100755 index 893dc64d65..0000000000 --- a/tools/gyp/test/dependencies/b/b.gyp +++ /dev/null @@ -1,22 +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. - -{ - 'targets': [ - { - 'target_name': 'b', - 'type': 'static_library', - 'sources': [ - 'b.c', - ], - }, - { - 'target_name': 'b3', - 'type': 'static_library', - 'sources': [ - 'b3.c', - ], - }, - ], -} diff --git a/tools/gyp/test/dependencies/b/b3.c b/tools/gyp/test/dependencies/b/b3.c deleted file mode 100755 index 287f67ff31..0000000000 --- a/tools/gyp/test/dependencies/b/b3.c +++ /dev/null @@ -1,9 +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. - */ - -int funcB() { - return 3; -} diff --git a/tools/gyp/test/dependencies/c/c.c b/tools/gyp/test/dependencies/c/c.c deleted file mode 100644 index 4949daf3ee..0000000000 --- a/tools/gyp/test/dependencies/c/c.c +++ /dev/null @@ -1,4 +0,0 @@ -int funcC() { - return 3 - // Intentional syntax error. This file should never be compiled, so this - // shouldn't be a problem. diff --git a/tools/gyp/test/dependencies/c/c.gyp b/tools/gyp/test/dependencies/c/c.gyp deleted file mode 100644 index eabebea9ef..0000000000 --- a/tools/gyp/test/dependencies/c/c.gyp +++ /dev/null @@ -1,22 +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. - -{ - 'targets': [ - { - 'target_name': 'c_unused', - 'type': 'static_library', - 'sources': [ - 'c.c', - ], - }, - { - 'target_name': 'd', - 'type': 'static_library', - 'sources': [ - 'd.c', - ], - }, - ], -} diff --git a/tools/gyp/test/dependencies/c/d.c b/tools/gyp/test/dependencies/c/d.c deleted file mode 100644 index 05465fc1af..0000000000 --- a/tools/gyp/test/dependencies/c/d.c +++ /dev/null @@ -1,3 +0,0 @@ -int funcD() { - return 4; -} diff --git a/tools/gyp/test/dependencies/extra_targets.gyp b/tools/gyp/test/dependencies/extra_targets.gyp deleted file mode 100644 index c1a26de422..0000000000 --- a/tools/gyp/test/dependencies/extra_targets.gyp +++ /dev/null @@ -1,18 +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. - -{ - 'targets': [ - { - 'target_name': 'a', - 'type': 'static_library', - 'sources': [ - 'a.c', - ], - # This only depends on the "d" target; other targets in c.gyp - # should not become part of the build (unlike with 'c/c.gyp:*'). - 'dependencies': ['c/c.gyp:d'], - }, - ], -} diff --git a/tools/gyp/test/dependencies/gyptest-extra-targets.py b/tools/gyp/test/dependencies/gyptest-extra-targets.py deleted file mode 100755 index 3752f7445d..0000000000 --- a/tools/gyp/test/dependencies/gyptest-extra-targets.py +++ /dev/null @@ -1,21 +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. - -""" -Verify that dependencies don't pull unused targets into the build. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('extra_targets.gyp') - -# This should fail if it tries to build 'c_unused' since 'c/c.c' has a syntax -# error and won't compile. -test.build('extra_targets.gyp', test.ALL) - -test.pass_test() diff --git a/tools/gyp/test/dependencies/gyptest-lib-only.py b/tools/gyp/test/dependencies/gyptest-lib-only.py deleted file mode 100755 index 02159f5f15..0000000000 --- a/tools/gyp/test/dependencies/gyptest-lib-only.py +++ /dev/null @@ -1,39 +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. - -""" -Verify that a link time only dependency will get pulled into the set of built -targets, even if no executable uses it. -""" - -import TestGyp - -import sys - -test = TestGyp.TestGyp() - -test.run_gyp('lib_only.gyp') - -test.build('lib_only.gyp', test.ALL) - -test.built_file_must_exist('a', type=test.STATIC_LIB) - -# TODO(bradnelson/mark): -# On linux and windows a library target will at least pull its link dependencies -# into the generated sln/_main.scons, since not doing so confuses users. -# This is not currently implemented on mac, which has the opposite behavior. -if sys.platform == 'darwin': - if test.format == 'xcode': - test.built_file_must_not_exist('b', type=test.STATIC_LIB) - else: - assert test.format in ('make', 'ninja') - test.built_file_must_exist('b', type=test.STATIC_LIB) -else: - # Make puts the resulting library in a directory matching the input gyp file; - # for the 'b' library, that is in the 'b' subdirectory. - test.built_file_must_exist('b', type=test.STATIC_LIB, subdir='b') - -test.pass_test() diff --git a/tools/gyp/test/dependencies/gyptest-none-traversal.py b/tools/gyp/test/dependencies/gyptest-none-traversal.py deleted file mode 100755 index c09063dad3..0000000000 --- a/tools/gyp/test/dependencies/gyptest-none-traversal.py +++ /dev/null @@ -1,25 +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. - -""" -Verify that static library dependencies don't traverse none targets, unless -explicitly specified. -""" - -import TestGyp - -import sys - -test = TestGyp.TestGyp() - -test.run_gyp('none_traversal.gyp') - -test.build('none_traversal.gyp', test.ALL) - -test.run_built_executable('needs_chain', stdout="2\n") -test.run_built_executable('doesnt_need_chain', stdout="3\n") - -test.pass_test() diff --git a/tools/gyp/test/dependencies/lib_only.gyp b/tools/gyp/test/dependencies/lib_only.gyp deleted file mode 100755 index f6c84dea64..0000000000 --- a/tools/gyp/test/dependencies/lib_only.gyp +++ /dev/null @@ -1,16 +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. - -{ - 'targets': [ - { - 'target_name': 'a', - 'type': 'static_library', - 'sources': [ - 'a.c', - ], - 'dependencies': ['b/b.gyp:b'], - }, - ], -} diff --git a/tools/gyp/test/dependencies/main.c b/tools/gyp/test/dependencies/main.c deleted file mode 100644 index 185bd482f2..0000000000 --- a/tools/gyp/test/dependencies/main.c +++ /dev/null @@ -1,14 +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. - */ - -#include - -extern int funcA(); - -int main() { - printf("%d\n", funcA()); - return 0; -} diff --git a/tools/gyp/test/dependencies/none_traversal.gyp b/tools/gyp/test/dependencies/none_traversal.gyp deleted file mode 100755 index 3d8ab30aff..0000000000 --- a/tools/gyp/test/dependencies/none_traversal.gyp +++ /dev/null @@ -1,46 +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. - -{ - 'targets': [ - { - 'target_name': 'needs_chain', - 'type': 'executable', - 'sources': [ - 'a.c', - 'main.c', - ], - 'dependencies': ['chain'], - }, - { - 'target_name': 'chain', - 'type': 'none', - 'dependencies': ['b/b.gyp:b'], - }, - { - 'target_name': 'doesnt_need_chain', - 'type': 'executable', - 'sources': [ - 'main.c', - ], - 'dependencies': ['no_chain', 'other_chain'], - }, - { - 'target_name': 'no_chain', - 'type': 'none', - 'sources': [ - ], - 'dependencies': ['b/b.gyp:b'], - 'dependencies_traverse': 0, - }, - { - 'target_name': 'other_chain', - 'type': 'static_library', - 'sources': [ - 'a.c', - ], - 'dependencies': ['b/b.gyp:b3'], - }, - ], -} diff --git a/tools/gyp/test/dependency-copy/gyptest-copy.py b/tools/gyp/test/dependency-copy/gyptest-copy.py deleted file mode 100755 index 5ba7c73d41..0000000000 --- a/tools/gyp/test/dependency-copy/gyptest-copy.py +++ /dev/null @@ -1,26 +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. - -""" -Verifies dependencies do the copy step. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('copies.gyp', chdir='src') - -test.build('copies.gyp', 'proj2', chdir='src') - -test.run_built_executable('proj1', - chdir='src', - stdout="Hello from file1.c\n") -test.run_built_executable('proj2', - chdir='src', - stdout="Hello from file2.c\n") - -test.pass_test() diff --git a/tools/gyp/test/dependency-copy/src/copies.gyp b/tools/gyp/test/dependency-copy/src/copies.gyp deleted file mode 100644 index 4176b18787..0000000000 --- a/tools/gyp/test/dependency-copy/src/copies.gyp +++ /dev/null @@ -1,25 +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. - -{ - 'targets': [ - { - 'target_name': 'proj1', - 'type': 'executable', - 'sources': [ - 'file1.c', - ], - }, - { - 'target_name': 'proj2', - 'type': 'executable', - 'sources': [ - 'file2.c', - ], - 'dependencies': [ - 'proj1', - ] - }, - ], -} diff --git a/tools/gyp/test/dependency-copy/src/file1.c b/tools/gyp/test/dependency-copy/src/file1.c deleted file mode 100644 index 3caf5d6345..0000000000 --- a/tools/gyp/test/dependency-copy/src/file1.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - printf("Hello from file1.c\n"); - return 0; -} diff --git a/tools/gyp/test/dependency-copy/src/file2.c b/tools/gyp/test/dependency-copy/src/file2.c deleted file mode 100644 index ed45cc012d..0000000000 --- a/tools/gyp/test/dependency-copy/src/file2.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - printf("Hello from file2.c\n"); - return 0; -} diff --git a/tools/gyp/test/exclusion/exclusion.gyp b/tools/gyp/test/exclusion/exclusion.gyp deleted file mode 100644 index 1232dabaef..0000000000 --- a/tools/gyp/test/exclusion/exclusion.gyp +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (c) 2010 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. - -{ - 'targets': [ - { - 'target_name': 'hello', - 'type': 'executable', - 'sources': [ - 'hello.c', - 'bogus.c', - 'also/not/real.c', - 'also/not/real2.c', - ], - 'sources!': [ - 'bogus.c', - 'also/not/real.c', - 'also/not/real2.c', - ], - }, - ], -} diff --git a/tools/gyp/test/exclusion/gyptest-exclusion.py b/tools/gyp/test/exclusion/gyptest-exclusion.py deleted file mode 100755 index 1fc32bf871..0000000000 --- a/tools/gyp/test/exclusion/gyptest-exclusion.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2010 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. - -""" -Verifies that exclusions (e.g. sources!) are respected. Excluded sources -that do not exist should not prevent the build from succeeding. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('exclusion.gyp') -test.build('exclusion.gyp') - -# executables -test.built_file_must_exist('hello' + test._exe, test.EXECUTABLE, bare=True) - -test.pass_test() diff --git a/tools/gyp/test/exclusion/hello.c b/tools/gyp/test/exclusion/hello.c deleted file mode 100644 index 30e8d5416d..0000000000 --- a/tools/gyp/test/exclusion/hello.c +++ /dev/null @@ -1,15 +0,0 @@ -/* Copyright (c) 2010 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. */ - -#include - -int func1(void) { - return 42; -} - -int main(int argc, char *argv[]) { - printf("Hello, world!\n"); - printf("%d\n", func1()); - return 0; -} diff --git a/tools/gyp/test/generator-output/actions/actions.gyp b/tools/gyp/test/generator-output/actions/actions.gyp deleted file mode 100644 index dded59aff3..0000000000 --- a/tools/gyp/test/generator-output/actions/actions.gyp +++ /dev/null @@ -1,16 +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. - -{ - 'targets': [ - { - 'target_name': 'pull_in_all_actions', - 'type': 'none', - 'dependencies': [ - 'subdir1/executable.gyp:*', - 'subdir2/none.gyp:*', - ], - }, - ], -} diff --git a/tools/gyp/test/generator-output/actions/build/README.txt b/tools/gyp/test/generator-output/actions/build/README.txt deleted file mode 100644 index 1b052c9a24..0000000000 --- a/tools/gyp/test/generator-output/actions/build/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -A place-holder for this Xcode build output directory, so that the -test script can verify that .xcodeproj files are not created in -their normal location by making the src/ read-only, and then -selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/actions/subdir1/actions-out/README.txt b/tools/gyp/test/generator-output/actions/subdir1/actions-out/README.txt deleted file mode 100644 index 1b052c9a24..0000000000 --- a/tools/gyp/test/generator-output/actions/subdir1/actions-out/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -A place-holder for this Xcode build output directory, so that the -test script can verify that .xcodeproj files are not created in -their normal location by making the src/ read-only, and then -selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/actions/subdir1/build/README.txt b/tools/gyp/test/generator-output/actions/subdir1/build/README.txt deleted file mode 100644 index 1b052c9a24..0000000000 --- a/tools/gyp/test/generator-output/actions/subdir1/build/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -A place-holder for this Xcode build output directory, so that the -test script can verify that .xcodeproj files are not created in -their normal location by making the src/ read-only, and then -selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/actions/subdir1/executable.gyp b/tools/gyp/test/generator-output/actions/subdir1/executable.gyp deleted file mode 100644 index 6bdd60a1fb..0000000000 --- a/tools/gyp/test/generator-output/actions/subdir1/executable.gyp +++ /dev/null @@ -1,44 +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. - -{ - 'targets': [ - { - 'target_name': 'program', - 'type': 'executable', - 'msvs_cygwin_shell': 0, - 'sources': [ - 'program.c', - ], - 'actions': [ - { - 'action_name': 'make-prog1', - 'inputs': [ - 'make-prog1.py', - ], - 'outputs': [ - '<(INTERMEDIATE_DIR)/prog1.c', - ], - 'action': [ - 'python', '<(_inputs)', '<@(_outputs)', - ], - 'process_outputs_as_sources': 1, - }, - { - 'action_name': 'make-prog2', - 'inputs': [ - 'make-prog2.py', - ], - 'outputs': [ - 'actions-out/prog2.c', - ], - 'action': [ - 'python', '<(_inputs)', '<@(_outputs)', - ], - 'process_outputs_as_sources': 1, - }, - ], - }, - ], -} diff --git a/tools/gyp/test/generator-output/actions/subdir1/make-prog1.py b/tools/gyp/test/generator-output/actions/subdir1/make-prog1.py deleted file mode 100755 index 7ea1d8a2d4..0000000000 --- a/tools/gyp/test/generator-output/actions/subdir1/make-prog1.py +++ /dev/null @@ -1,20 +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 - -contents = r""" -#include - -void prog1(void) -{ - printf("Hello from make-prog1.py\n"); -} -""" - -open(sys.argv[1], 'w').write(contents) - -sys.exit(0) diff --git a/tools/gyp/test/generator-output/actions/subdir1/make-prog2.py b/tools/gyp/test/generator-output/actions/subdir1/make-prog2.py deleted file mode 100755 index 0bfe4973c2..0000000000 --- a/tools/gyp/test/generator-output/actions/subdir1/make-prog2.py +++ /dev/null @@ -1,20 +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 - -contents = r""" -#include - -void prog2(void) -{ - printf("Hello from make-prog2.py\n"); -} -""" - -open(sys.argv[1], 'w').write(contents) - -sys.exit(0) diff --git a/tools/gyp/test/generator-output/actions/subdir1/program.c b/tools/gyp/test/generator-output/actions/subdir1/program.c deleted file mode 100644 index d5f661d905..0000000000 --- a/tools/gyp/test/generator-output/actions/subdir1/program.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -extern void prog1(void); -extern void prog2(void); - -int main(int argc, char *argv[]) -{ - printf("Hello from program.c\n"); - prog1(); - prog2(); - return 0; -} diff --git a/tools/gyp/test/generator-output/actions/subdir2/actions-out/README.txt b/tools/gyp/test/generator-output/actions/subdir2/actions-out/README.txt deleted file mode 100644 index 1b052c9a24..0000000000 --- a/tools/gyp/test/generator-output/actions/subdir2/actions-out/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -A place-holder for this Xcode build output directory, so that the -test script can verify that .xcodeproj files are not created in -their normal location by making the src/ read-only, and then -selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/actions/subdir2/build/README.txt b/tools/gyp/test/generator-output/actions/subdir2/build/README.txt deleted file mode 100644 index 1b052c9a24..0000000000 --- a/tools/gyp/test/generator-output/actions/subdir2/build/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -A place-holder for this Xcode build output directory, so that the -test script can verify that .xcodeproj files are not created in -their normal location by making the src/ read-only, and then -selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/actions/subdir2/make-file.py b/tools/gyp/test/generator-output/actions/subdir2/make-file.py deleted file mode 100755 index fff0653144..0000000000 --- a/tools/gyp/test/generator-output/actions/subdir2/make-file.py +++ /dev/null @@ -1,11 +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 - -contents = "Hello from make-file.py\n" - -open(sys.argv[1], 'wb').write(contents) diff --git a/tools/gyp/test/generator-output/actions/subdir2/none.gyp b/tools/gyp/test/generator-output/actions/subdir2/none.gyp deleted file mode 100644 index f98f52753d..0000000000 --- a/tools/gyp/test/generator-output/actions/subdir2/none.gyp +++ /dev/null @@ -1,31 +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. - -{ - 'targets': [ - { - 'target_name': 'file', - 'type': 'none', - 'msvs_cygwin_shell': 0, - 'actions': [ - { - 'action_name': 'make-file', - 'inputs': [ - 'make-file.py', - ], - 'outputs': [ - 'actions-out/file.out', - # TODO: enhance testing infrastructure to test this - # without having to hard-code the intermediate dir paths. - #'<(INTERMEDIATE_DIR)/file.out', - ], - 'action': [ - 'python', '<(_inputs)', '<@(_outputs)', - ], - 'process_outputs_as_sources': 1, - } - ], - }, - ], -} diff --git a/tools/gyp/test/generator-output/copies/build/README.txt b/tools/gyp/test/generator-output/copies/build/README.txt deleted file mode 100644 index 90ef886193..0000000000 --- a/tools/gyp/test/generator-output/copies/build/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -A place-holder for this Xcode build output directory, so that the -test script can verify that .xcodeproj files are not created in -their normal location by making the src/ read-only, and then -selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/copies/copies-out/README.txt b/tools/gyp/test/generator-output/copies/copies-out/README.txt deleted file mode 100644 index 90ef886193..0000000000 --- a/tools/gyp/test/generator-output/copies/copies-out/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -A place-holder for this Xcode build output directory, so that the -test script can verify that .xcodeproj files are not created in -their normal location by making the src/ read-only, and then -selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/copies/copies.gyp b/tools/gyp/test/generator-output/copies/copies.gyp deleted file mode 100644 index 479a3d9b6e..0000000000 --- a/tools/gyp/test/generator-output/copies/copies.gyp +++ /dev/null @@ -1,50 +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. - -{ - 'targets': [ - { - 'target_name': 'pull_in_subdir', - 'type': 'none', - 'dependencies': [ - 'subdir/subdir.gyp:*', - ], - }, - { - 'target_name': 'copies1', - 'type': 'none', - 'copies': [ - { - 'destination': 'copies-out', - 'files': [ - 'file1', - ], - }, - ], - }, - { - 'target_name': 'copies2', - 'type': 'none', - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)/copies-out', - 'files': [ - 'file2', - ], - }, - ], - }, - # Verify that a null 'files' list doesn't gag the generators. - { - 'target_name': 'copies_null', - 'type': 'none', - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)/copies-null', - 'files': [], - }, - ], - }, - ], -} diff --git a/tools/gyp/test/generator-output/copies/file1 b/tools/gyp/test/generator-output/copies/file1 deleted file mode 100644 index 84d55c5759..0000000000 --- a/tools/gyp/test/generator-output/copies/file1 +++ /dev/null @@ -1 +0,0 @@ -file1 contents diff --git a/tools/gyp/test/generator-output/copies/file2 b/tools/gyp/test/generator-output/copies/file2 deleted file mode 100644 index af1b8ae35d..0000000000 --- a/tools/gyp/test/generator-output/copies/file2 +++ /dev/null @@ -1 +0,0 @@ -file2 contents diff --git a/tools/gyp/test/generator-output/copies/subdir/build/README.txt b/tools/gyp/test/generator-output/copies/subdir/build/README.txt deleted file mode 100644 index 90ef886193..0000000000 --- a/tools/gyp/test/generator-output/copies/subdir/build/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -A place-holder for this Xcode build output directory, so that the -test script can verify that .xcodeproj files are not created in -their normal location by making the src/ read-only, and then -selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/copies/subdir/copies-out/README.txt b/tools/gyp/test/generator-output/copies/subdir/copies-out/README.txt deleted file mode 100644 index 90ef886193..0000000000 --- a/tools/gyp/test/generator-output/copies/subdir/copies-out/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -A place-holder for this Xcode build output directory, so that the -test script can verify that .xcodeproj files are not created in -their normal location by making the src/ read-only, and then -selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/copies/subdir/file3 b/tools/gyp/test/generator-output/copies/subdir/file3 deleted file mode 100644 index 43f16f3522..0000000000 --- a/tools/gyp/test/generator-output/copies/subdir/file3 +++ /dev/null @@ -1 +0,0 @@ -file3 contents diff --git a/tools/gyp/test/generator-output/copies/subdir/file4 b/tools/gyp/test/generator-output/copies/subdir/file4 deleted file mode 100644 index 5f7270a084..0000000000 --- a/tools/gyp/test/generator-output/copies/subdir/file4 +++ /dev/null @@ -1 +0,0 @@ -file4 contents diff --git a/tools/gyp/test/generator-output/copies/subdir/subdir.gyp b/tools/gyp/test/generator-output/copies/subdir/subdir.gyp deleted file mode 100644 index af031d283a..0000000000 --- a/tools/gyp/test/generator-output/copies/subdir/subdir.gyp +++ /dev/null @@ -1,32 +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. - -{ - 'targets': [ - { - 'target_name': 'copies3', - 'type': 'none', - 'copies': [ - { - 'destination': 'copies-out', - 'files': [ - 'file3', - ], - }, - ], - }, - { - 'target_name': 'copies4', - 'type': 'none', - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)/copies-out', - 'files': [ - 'file4', - ], - }, - ], - }, - ], -} diff --git a/tools/gyp/test/generator-output/gyptest-actions.py b/tools/gyp/test/generator-output/gyptest-actions.py deleted file mode 100755 index 6e62720c2b..0000000000 --- a/tools/gyp/test/generator-output/gyptest-actions.py +++ /dev/null @@ -1,58 +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. - -""" -Verifies --generator-output= behavior when using actions. -""" - -import TestGyp - -# Ninja doesn't support --generator-output. -test = TestGyp.TestGyp(formats=['!ninja']) - -# All the generated files should go under 'gypfiles'. The source directory -# ('actions') should be untouched. -test.writable(test.workpath('actions'), False) -test.run_gyp('actions.gyp', - '--generator-output=' + test.workpath('gypfiles'), - chdir='actions') - -test.writable(test.workpath('actions'), True) - -test.relocate('actions', 'relocate/actions') -test.relocate('gypfiles', 'relocate/gypfiles') - -test.writable(test.workpath('relocate/actions'), False) - -# Some of the action outputs use "pure" relative paths (i.e. without prefixes -# like <(INTERMEDIATE_DIR) or <(PROGRAM_DIR)). Even though we are building under -# 'gypfiles', such outputs will still be created relative to the original .gyp -# sources. Projects probably wouldn't normally do this, since it kind of defeats -# the purpose of '--generator-output', but it is supported behaviour. -test.writable(test.workpath('relocate/actions/build'), True) -test.writable(test.workpath('relocate/actions/subdir1/build'), True) -test.writable(test.workpath('relocate/actions/subdir1/actions-out'), True) -test.writable(test.workpath('relocate/actions/subdir2/build'), True) -test.writable(test.workpath('relocate/actions/subdir2/actions-out'), True) - -test.build('actions.gyp', test.ALL, chdir='relocate/gypfiles') - -expect = """\ -Hello from program.c -Hello from make-prog1.py -Hello from make-prog2.py -""" - -if test.format == 'xcode': - chdir = 'relocate/actions/subdir1' -else: - chdir = 'relocate/gypfiles' -test.run_built_executable('program', chdir=chdir, stdout=expect) - -test.must_match('relocate/actions/subdir2/actions-out/file.out', - "Hello from make-file.py\n") - -test.pass_test() diff --git a/tools/gyp/test/generator-output/gyptest-copies.py b/tools/gyp/test/generator-output/gyptest-copies.py deleted file mode 100755 index 83ba013f0f..0000000000 --- a/tools/gyp/test/generator-output/gyptest-copies.py +++ /dev/null @@ -1,59 +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. - -""" -Verifies file copies with --generator-output using an explicit build -target of 'all'. -""" - -import TestGyp - -# Ninja doesn't support --generator-output. -test = TestGyp.TestGyp(formats=['!ninja']) - -test.writable(test.workpath('copies'), False) - -test.run_gyp('copies.gyp', - '--generator-output=' + test.workpath('gypfiles'), - chdir='copies') - -test.writable(test.workpath('copies'), True) - -test.relocate('copies', 'relocate/copies') -test.relocate('gypfiles', 'relocate/gypfiles') - -test.writable(test.workpath('relocate/copies'), False) - -test.writable(test.workpath('relocate/copies/build'), True) -test.writable(test.workpath('relocate/copies/copies-out'), True) -test.writable(test.workpath('relocate/copies/subdir/build'), True) -test.writable(test.workpath('relocate/copies/subdir/copies-out'), True) - -test.build('copies.gyp', test.ALL, chdir='relocate/gypfiles') - -test.must_match(['relocate', 'copies', 'copies-out', 'file1'], - "file1 contents\n") - -if test.format == 'xcode': - chdir = 'relocate/copies/build' -elif test.format == 'make': - chdir = 'relocate/gypfiles/out' -else: - chdir = 'relocate/gypfiles' -test.must_match([chdir, 'Default', 'copies-out', 'file2'], "file2 contents\n") - -test.must_match(['relocate', 'copies', 'subdir', 'copies-out', 'file3'], - "file3 contents\n") - -if test.format == 'xcode': - chdir = 'relocate/copies/subdir/build' -elif test.format == 'make': - chdir = 'relocate/gypfiles/out' -else: - chdir = 'relocate/gypfiles' -test.must_match([chdir, 'Default', 'copies-out', 'file4'], "file4 contents\n") - -test.pass_test() diff --git a/tools/gyp/test/generator-output/gyptest-relocate.py b/tools/gyp/test/generator-output/gyptest-relocate.py deleted file mode 100755 index 31a98ea1c2..0000000000 --- a/tools/gyp/test/generator-output/gyptest-relocate.py +++ /dev/null @@ -1,60 +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. - -""" -Verifies that a project hierarchy created with the --generator-output= -option can be built even when it's relocated to a different path. -""" - -import TestGyp - -# Ninja doesn't support --generator-output. -test = TestGyp.TestGyp(formats=['!ninja']) - -test.writable(test.workpath('src'), False) - -test.run_gyp('prog1.gyp', - '-Dset_symroot=1', - '--generator-output=' + test.workpath('gypfiles'), - chdir='src') - -test.writable(test.workpath('src'), True) - -test.relocate('src', 'relocate/src') -test.relocate('gypfiles', 'relocate/gypfiles') - -test.writable(test.workpath('relocate/src'), False) - -test.writable(test.workpath('relocate/src/build'), True) -test.writable(test.workpath('relocate/src/subdir2/build'), True) -test.writable(test.workpath('relocate/src/subdir3/build'), True) - -test.build('prog1.gyp', test.ALL, chdir='relocate/gypfiles') - -chdir = 'relocate/gypfiles' - -expect = """\ -Hello from %s -Hello from inc.h -Hello from inc1/include1.h -Hello from inc2/include2.h -Hello from inc3/include3.h -Hello from subdir2/deeper/deeper.h -""" - -if test.format == 'xcode': - chdir = 'relocate/src' -test.run_built_executable('prog1', chdir=chdir, stdout=expect % 'prog1.c') - -if test.format == 'xcode': - chdir = 'relocate/src/subdir2' -test.run_built_executable('prog2', chdir=chdir, stdout=expect % 'prog2.c') - -if test.format == 'xcode': - chdir = 'relocate/src/subdir3' -test.run_built_executable('prog3', chdir=chdir, stdout=expect % 'prog3.c') - -test.pass_test() diff --git a/tools/gyp/test/generator-output/gyptest-rules.py b/tools/gyp/test/generator-output/gyptest-rules.py deleted file mode 100755 index 678416a2fc..0000000000 --- a/tools/gyp/test/generator-output/gyptest-rules.py +++ /dev/null @@ -1,58 +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. - -""" -Verifies --generator-output= behavior when using rules. -""" - -import TestGyp - -test = TestGyp.TestGyp(formats=['!ninja']) - -test.writable(test.workpath('rules'), False) - -test.run_gyp('rules.gyp', - '--generator-output=' + test.workpath('gypfiles'), - chdir='rules') - -test.writable(test.workpath('rules'), True) - -test.relocate('rules', 'relocate/rules') -test.relocate('gypfiles', 'relocate/gypfiles') - -test.writable(test.workpath('relocate/rules'), False) - -test.writable(test.workpath('relocate/rules/build'), True) -test.writable(test.workpath('relocate/rules/subdir1/build'), True) -test.writable(test.workpath('relocate/rules/subdir2/build'), True) -test.writable(test.workpath('relocate/rules/subdir2/rules-out'), True) - -test.build('rules.gyp', test.ALL, chdir='relocate/gypfiles') - -expect = """\ -Hello from program.c -Hello from function1.in1 -Hello from function2.in1 -Hello from define3.in0 -Hello from define4.in0 -""" - -if test.format == 'xcode': - chdir = 'relocate/rules/subdir1' -else: - chdir = 'relocate/gypfiles' -test.run_built_executable('program', chdir=chdir, stdout=expect) - -test.must_match('relocate/rules/subdir2/rules-out/file1.out', - "Hello from file1.in0\n") -test.must_match('relocate/rules/subdir2/rules-out/file2.out', - "Hello from file2.in0\n") -test.must_match('relocate/rules/subdir2/rules-out/file3.out', - "Hello from file3.in1\n") -test.must_match('relocate/rules/subdir2/rules-out/file4.out', - "Hello from file4.in1\n") - -test.pass_test() diff --git a/tools/gyp/test/generator-output/gyptest-subdir2-deep.py b/tools/gyp/test/generator-output/gyptest-subdir2-deep.py deleted file mode 100755 index cb5ea15bf1..0000000000 --- a/tools/gyp/test/generator-output/gyptest-subdir2-deep.py +++ /dev/null @@ -1,36 +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. - -""" -Verifies building a target from a .gyp file a few subdirectories -deep when the --generator-output= option is used to put the build -configuration files in a separate directory tree. -""" - -import TestGyp - -test = TestGyp.TestGyp(formats=['!ninja']) - -test.writable(test.workpath('src'), False) - -test.writable(test.workpath('src/subdir2/deeper/build'), True) - -test.run_gyp('deeper.gyp', - '-Dset_symroot=1', - '--generator-output=' + test.workpath('gypfiles'), - chdir='src/subdir2/deeper') - -test.build('deeper.gyp', test.ALL, chdir='gypfiles') - -chdir = 'gypfiles' - -if test.format == 'xcode': - chdir = 'src/subdir2/deeper' -test.run_built_executable('deeper', - chdir=chdir, - stdout="Hello from deeper.c\n") - -test.pass_test() diff --git a/tools/gyp/test/generator-output/gyptest-top-all.py b/tools/gyp/test/generator-output/gyptest-top-all.py deleted file mode 100755 index 4841f9b6b0..0000000000 --- a/tools/gyp/test/generator-output/gyptest-top-all.py +++ /dev/null @@ -1,53 +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. - -""" -Verifies building a project hierarchy created when the --generator-output= -option is used to put the build configuration files in a separate -directory tree. -""" - -import TestGyp - -test = TestGyp.TestGyp(formats=['!ninja']) - -test.writable(test.workpath('src'), False) - -test.run_gyp('prog1.gyp', - '-Dset_symroot=1', - '--generator-output=' + test.workpath('gypfiles'), - chdir='src') - -test.writable(test.workpath('src/build'), True) -test.writable(test.workpath('src/subdir2/build'), True) -test.writable(test.workpath('src/subdir3/build'), True) - -test.build('prog1.gyp', test.ALL, chdir='gypfiles') - -chdir = 'gypfiles' - -expect = """\ -Hello from %s -Hello from inc.h -Hello from inc1/include1.h -Hello from inc2/include2.h -Hello from inc3/include3.h -Hello from subdir2/deeper/deeper.h -""" - -if test.format == 'xcode': - chdir = 'src' -test.run_built_executable('prog1', chdir=chdir, stdout=expect % 'prog1.c') - -if test.format == 'xcode': - chdir = 'src/subdir2' -test.run_built_executable('prog2', chdir=chdir, stdout=expect % 'prog2.c') - -if test.format == 'xcode': - chdir = 'src/subdir3' -test.run_built_executable('prog3', chdir=chdir, stdout=expect % 'prog3.c') - -test.pass_test() diff --git a/tools/gyp/test/generator-output/rules/build/README.txt b/tools/gyp/test/generator-output/rules/build/README.txt deleted file mode 100644 index 1b052c9a24..0000000000 --- a/tools/gyp/test/generator-output/rules/build/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -A place-holder for this Xcode build output directory, so that the -test script can verify that .xcodeproj files are not created in -their normal location by making the src/ read-only, and then -selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/rules/copy-file.py b/tools/gyp/test/generator-output/rules/copy-file.py deleted file mode 100755 index 938c336adb..0000000000 --- a/tools/gyp/test/generator-output/rules/copy-file.py +++ /dev/null @@ -1,12 +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 - -contents = open(sys.argv[1], 'r').read() -open(sys.argv[2], 'wb').write(contents) - -sys.exit(0) diff --git a/tools/gyp/test/generator-output/rules/rules.gyp b/tools/gyp/test/generator-output/rules/rules.gyp deleted file mode 100644 index dded59aff3..0000000000 --- a/tools/gyp/test/generator-output/rules/rules.gyp +++ /dev/null @@ -1,16 +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. - -{ - 'targets': [ - { - 'target_name': 'pull_in_all_actions', - 'type': 'none', - 'dependencies': [ - 'subdir1/executable.gyp:*', - 'subdir2/none.gyp:*', - ], - }, - ], -} diff --git a/tools/gyp/test/generator-output/rules/subdir1/build/README.txt b/tools/gyp/test/generator-output/rules/subdir1/build/README.txt deleted file mode 100644 index 1b052c9a24..0000000000 --- a/tools/gyp/test/generator-output/rules/subdir1/build/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -A place-holder for this Xcode build output directory, so that the -test script can verify that .xcodeproj files are not created in -their normal location by making the src/ read-only, and then -selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/rules/subdir1/define3.in0 b/tools/gyp/test/generator-output/rules/subdir1/define3.in0 deleted file mode 100644 index cc29c643f3..0000000000 --- a/tools/gyp/test/generator-output/rules/subdir1/define3.in0 +++ /dev/null @@ -1 +0,0 @@ -#define STRING3 "Hello from define3.in0\n" diff --git a/tools/gyp/test/generator-output/rules/subdir1/define4.in0 b/tools/gyp/test/generator-output/rules/subdir1/define4.in0 deleted file mode 100644 index c9b0467b32..0000000000 --- a/tools/gyp/test/generator-output/rules/subdir1/define4.in0 +++ /dev/null @@ -1 +0,0 @@ -#define STRING4 "Hello from define4.in0\n" diff --git a/tools/gyp/test/generator-output/rules/subdir1/executable.gyp b/tools/gyp/test/generator-output/rules/subdir1/executable.gyp deleted file mode 100644 index 2fd89a0d52..0000000000 --- a/tools/gyp/test/generator-output/rules/subdir1/executable.gyp +++ /dev/null @@ -1,59 +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. - -{ - 'targets': [ - { - 'target_name': 'program', - 'type': 'executable', - 'msvs_cygwin_shell': 0, - 'sources': [ - 'program.c', - 'function1.in1', - 'function2.in1', - 'define3.in0', - 'define4.in0', - ], - 'include_dirs': [ - '<(INTERMEDIATE_DIR)', - ], - 'rules': [ - { - 'rule_name': 'copy_file_0', - 'extension': 'in0', - 'inputs': [ - '../copy-file.py', - ], - 'outputs': [ - # TODO: fix SCons and Make to support generated files not - # in a variable-named path like <(INTERMEDIATE_DIR) - #'<(RULE_INPUT_ROOT).c', - '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).h', - ], - 'action': [ - 'python', '<(_inputs)', '<(RULE_INPUT_PATH)', '<@(_outputs)', - ], - 'process_outputs_as_sources': 0, - }, - { - 'rule_name': 'copy_file_1', - 'extension': 'in1', - 'inputs': [ - '../copy-file.py', - ], - 'outputs': [ - # TODO: fix SCons and Make to support generated files not - # in a variable-named path like <(INTERMEDIATE_DIR) - #'<(RULE_INPUT_ROOT).c', - '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).c', - ], - 'action': [ - 'python', '<(_inputs)', '<(RULE_INPUT_PATH)', '<@(_outputs)', - ], - 'process_outputs_as_sources': 1, - }, - ], - }, - ], -} diff --git a/tools/gyp/test/generator-output/rules/subdir1/function1.in1 b/tools/gyp/test/generator-output/rules/subdir1/function1.in1 deleted file mode 100644 index 545e7ca16b..0000000000 --- a/tools/gyp/test/generator-output/rules/subdir1/function1.in1 +++ /dev/null @@ -1,6 +0,0 @@ -#include - -void function1(void) -{ - printf("Hello from function1.in1\n"); -} diff --git a/tools/gyp/test/generator-output/rules/subdir1/function2.in1 b/tools/gyp/test/generator-output/rules/subdir1/function2.in1 deleted file mode 100644 index 6bad43f9cf..0000000000 --- a/tools/gyp/test/generator-output/rules/subdir1/function2.in1 +++ /dev/null @@ -1,6 +0,0 @@ -#include - -void function2(void) -{ - printf("Hello from function2.in1\n"); -} diff --git a/tools/gyp/test/generator-output/rules/subdir1/program.c b/tools/gyp/test/generator-output/rules/subdir1/program.c deleted file mode 100644 index 27fd31ed4e..0000000000 --- a/tools/gyp/test/generator-output/rules/subdir1/program.c +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include "define3.h" -#include "define4.h" - -extern void function1(void); -extern void function2(void); -extern void function3(void); -extern void function4(void); - -int main(int argc, char *argv[]) -{ - printf("Hello from program.c\n"); - function1(); - function2(); - printf("%s", STRING3); - printf("%s", STRING4); - return 0; -} diff --git a/tools/gyp/test/generator-output/rules/subdir2/build/README.txt b/tools/gyp/test/generator-output/rules/subdir2/build/README.txt deleted file mode 100644 index 1b052c9a24..0000000000 --- a/tools/gyp/test/generator-output/rules/subdir2/build/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -A place-holder for this Xcode build output directory, so that the -test script can verify that .xcodeproj files are not created in -their normal location by making the src/ read-only, and then -selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/rules/subdir2/file1.in0 b/tools/gyp/test/generator-output/rules/subdir2/file1.in0 deleted file mode 100644 index 7aca64f4ce..0000000000 --- a/tools/gyp/test/generator-output/rules/subdir2/file1.in0 +++ /dev/null @@ -1 +0,0 @@ -Hello from file1.in0 diff --git a/tools/gyp/test/generator-output/rules/subdir2/file2.in0 b/tools/gyp/test/generator-output/rules/subdir2/file2.in0 deleted file mode 100644 index 80a281a2a9..0000000000 --- a/tools/gyp/test/generator-output/rules/subdir2/file2.in0 +++ /dev/null @@ -1 +0,0 @@ -Hello from file2.in0 diff --git a/tools/gyp/test/generator-output/rules/subdir2/file3.in1 b/tools/gyp/test/generator-output/rules/subdir2/file3.in1 deleted file mode 100644 index 60ae2e7931..0000000000 --- a/tools/gyp/test/generator-output/rules/subdir2/file3.in1 +++ /dev/null @@ -1 +0,0 @@ -Hello from file3.in1 diff --git a/tools/gyp/test/generator-output/rules/subdir2/file4.in1 b/tools/gyp/test/generator-output/rules/subdir2/file4.in1 deleted file mode 100644 index 5a3c30720e..0000000000 --- a/tools/gyp/test/generator-output/rules/subdir2/file4.in1 +++ /dev/null @@ -1 +0,0 @@ -Hello from file4.in1 diff --git a/tools/gyp/test/generator-output/rules/subdir2/none.gyp b/tools/gyp/test/generator-output/rules/subdir2/none.gyp deleted file mode 100644 index 664cbd9cb7..0000000000 --- a/tools/gyp/test/generator-output/rules/subdir2/none.gyp +++ /dev/null @@ -1,49 +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. - -{ - 'targets': [ - { - 'target_name': 'files', - 'type': 'none', - 'msvs_cygwin_shell': 0, - 'sources': [ - 'file1.in0', - 'file2.in0', - 'file3.in1', - 'file4.in1', - ], - 'rules': [ - { - 'rule_name': 'copy_file_0', - 'extension': 'in0', - 'inputs': [ - '../copy-file.py', - ], - 'outputs': [ - 'rules-out/<(RULE_INPUT_ROOT).out', - ], - 'action': [ - 'python', '<(_inputs)', '<(RULE_INPUT_PATH)', '<@(_outputs)', - ], - 'process_outputs_as_sources': 0, - }, - { - 'rule_name': 'copy_file_1', - 'extension': 'in1', - 'inputs': [ - '../copy-file.py', - ], - 'outputs': [ - 'rules-out/<(RULE_INPUT_ROOT).out', - ], - 'action': [ - 'python', '<(_inputs)', '<(RULE_INPUT_PATH)', '<@(_outputs)', - ], - 'process_outputs_as_sources': 1, - }, - ], - }, - ], -} diff --git a/tools/gyp/test/generator-output/rules/subdir2/rules-out/README.txt b/tools/gyp/test/generator-output/rules/subdir2/rules-out/README.txt deleted file mode 100644 index 1b052c9a24..0000000000 --- a/tools/gyp/test/generator-output/rules/subdir2/rules-out/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -A place-holder for this Xcode build output directory, so that the -test script can verify that .xcodeproj files are not created in -their normal location by making the src/ read-only, and then -selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/src/build/README.txt b/tools/gyp/test/generator-output/src/build/README.txt deleted file mode 100644 index 90ef886193..0000000000 --- a/tools/gyp/test/generator-output/src/build/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -A place-holder for this Xcode build output directory, so that the -test script can verify that .xcodeproj files are not created in -their normal location by making the src/ read-only, and then -selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/src/inc.h b/tools/gyp/test/generator-output/src/inc.h deleted file mode 100644 index 57aa1a5a74..0000000000 --- a/tools/gyp/test/generator-output/src/inc.h +++ /dev/null @@ -1 +0,0 @@ -#define INC_STRING "inc.h" diff --git a/tools/gyp/test/generator-output/src/inc1/include1.h b/tools/gyp/test/generator-output/src/inc1/include1.h deleted file mode 100644 index 1d59065fc9..0000000000 --- a/tools/gyp/test/generator-output/src/inc1/include1.h +++ /dev/null @@ -1 +0,0 @@ -#define INCLUDE1_STRING "inc1/include1.h" diff --git a/tools/gyp/test/generator-output/src/prog1.c b/tools/gyp/test/generator-output/src/prog1.c deleted file mode 100644 index 656f81d5fe..0000000000 --- a/tools/gyp/test/generator-output/src/prog1.c +++ /dev/null @@ -1,18 +0,0 @@ -#include - -#include "inc.h" -#include "include1.h" -#include "include2.h" -#include "include3.h" -#include "deeper.h" - -int main(int argc, char *argv[]) -{ - printf("Hello from prog1.c\n"); - printf("Hello from %s\n", INC_STRING); - printf("Hello from %s\n", INCLUDE1_STRING); - printf("Hello from %s\n", INCLUDE2_STRING); - printf("Hello from %s\n", INCLUDE3_STRING); - printf("Hello from %s\n", DEEPER_STRING); - return 0; -} diff --git a/tools/gyp/test/generator-output/src/prog1.gyp b/tools/gyp/test/generator-output/src/prog1.gyp deleted file mode 100644 index d50e6fb0a7..0000000000 --- a/tools/gyp/test/generator-output/src/prog1.gyp +++ /dev/null @@ -1,28 +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. - -{ - 'includes': [ - 'symroot.gypi', - ], - 'targets': [ - { - 'target_name': 'prog1', - 'type': 'executable', - 'dependencies': [ - 'subdir2/prog2.gyp:prog2', - ], - 'include_dirs': [ - '.', - 'inc1', - 'subdir2/inc2', - 'subdir3/inc3', - 'subdir2/deeper', - ], - 'sources': [ - 'prog1.c', - ], - }, - ], -} diff --git a/tools/gyp/test/generator-output/src/subdir2/build/README.txt b/tools/gyp/test/generator-output/src/subdir2/build/README.txt deleted file mode 100644 index 90ef886193..0000000000 --- a/tools/gyp/test/generator-output/src/subdir2/build/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -A place-holder for this Xcode build output directory, so that the -test script can verify that .xcodeproj files are not created in -their normal location by making the src/ read-only, and then -selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/src/subdir2/deeper/build/README.txt b/tools/gyp/test/generator-output/src/subdir2/deeper/build/README.txt deleted file mode 100644 index 90ef886193..0000000000 --- a/tools/gyp/test/generator-output/src/subdir2/deeper/build/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -A place-holder for this Xcode build output directory, so that the -test script can verify that .xcodeproj files are not created in -their normal location by making the src/ read-only, and then -selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/src/subdir2/deeper/deeper.c b/tools/gyp/test/generator-output/src/subdir2/deeper/deeper.c deleted file mode 100644 index 56c49d1f78..0000000000 --- a/tools/gyp/test/generator-output/src/subdir2/deeper/deeper.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - printf("Hello from deeper.c\n"); - return 0; -} diff --git a/tools/gyp/test/generator-output/src/subdir2/deeper/deeper.gyp b/tools/gyp/test/generator-output/src/subdir2/deeper/deeper.gyp deleted file mode 100644 index 8648770872..0000000000 --- a/tools/gyp/test/generator-output/src/subdir2/deeper/deeper.gyp +++ /dev/null @@ -1,18 +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. - -{ - 'includes': [ - '../../symroot.gypi', - ], - 'targets': [ - { - 'target_name': 'deeper', - 'type': 'executable', - 'sources': [ - 'deeper.c', - ], - }, - ], -} diff --git a/tools/gyp/test/generator-output/src/subdir2/deeper/deeper.h b/tools/gyp/test/generator-output/src/subdir2/deeper/deeper.h deleted file mode 100644 index f6484a0fe5..0000000000 --- a/tools/gyp/test/generator-output/src/subdir2/deeper/deeper.h +++ /dev/null @@ -1 +0,0 @@ -#define DEEPER_STRING "subdir2/deeper/deeper.h" diff --git a/tools/gyp/test/generator-output/src/subdir2/inc2/include2.h b/tools/gyp/test/generator-output/src/subdir2/inc2/include2.h deleted file mode 100644 index 1ccfa5dea7..0000000000 --- a/tools/gyp/test/generator-output/src/subdir2/inc2/include2.h +++ /dev/null @@ -1 +0,0 @@ -#define INCLUDE2_STRING "inc2/include2.h" diff --git a/tools/gyp/test/generator-output/src/subdir2/prog2.c b/tools/gyp/test/generator-output/src/subdir2/prog2.c deleted file mode 100644 index 38d6c84d11..0000000000 --- a/tools/gyp/test/generator-output/src/subdir2/prog2.c +++ /dev/null @@ -1,18 +0,0 @@ -#include - -#include "inc.h" -#include "include1.h" -#include "include2.h" -#include "include3.h" -#include "deeper.h" - -int main(int argc, char *argv[]) -{ - printf("Hello from prog2.c\n"); - printf("Hello from %s\n", INC_STRING); - printf("Hello from %s\n", INCLUDE1_STRING); - printf("Hello from %s\n", INCLUDE2_STRING); - printf("Hello from %s\n", INCLUDE3_STRING); - printf("Hello from %s\n", DEEPER_STRING); - return 0; -} diff --git a/tools/gyp/test/generator-output/src/subdir2/prog2.gyp b/tools/gyp/test/generator-output/src/subdir2/prog2.gyp deleted file mode 100644 index 7176ed8be7..0000000000 --- a/tools/gyp/test/generator-output/src/subdir2/prog2.gyp +++ /dev/null @@ -1,28 +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. - -{ - 'includes': [ - '../symroot.gypi', - ], - 'targets': [ - { - 'target_name': 'prog2', - 'type': 'executable', - 'include_dirs': [ - '..', - '../inc1', - 'inc2', - '../subdir3/inc3', - 'deeper', - ], - 'dependencies': [ - '../subdir3/prog3.gyp:prog3', - ], - 'sources': [ - 'prog2.c', - ], - }, - ], -} diff --git a/tools/gyp/test/generator-output/src/subdir3/build/README.txt b/tools/gyp/test/generator-output/src/subdir3/build/README.txt deleted file mode 100644 index 90ef886193..0000000000 --- a/tools/gyp/test/generator-output/src/subdir3/build/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -A place-holder for this Xcode build output directory, so that the -test script can verify that .xcodeproj files are not created in -their normal location by making the src/ read-only, and then -selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/src/subdir3/inc3/include3.h b/tools/gyp/test/generator-output/src/subdir3/inc3/include3.h deleted file mode 100644 index bf53bf1f00..0000000000 --- a/tools/gyp/test/generator-output/src/subdir3/inc3/include3.h +++ /dev/null @@ -1 +0,0 @@ -#define INCLUDE3_STRING "inc3/include3.h" diff --git a/tools/gyp/test/generator-output/src/subdir3/prog3.c b/tools/gyp/test/generator-output/src/subdir3/prog3.c deleted file mode 100644 index 7848b45abd..0000000000 --- a/tools/gyp/test/generator-output/src/subdir3/prog3.c +++ /dev/null @@ -1,18 +0,0 @@ -#include - -#include "inc.h" -#include "include1.h" -#include "include2.h" -#include "include3.h" -#include "deeper.h" - -int main(int argc, char *argv[]) -{ - printf("Hello from prog3.c\n"); - printf("Hello from %s\n", INC_STRING); - printf("Hello from %s\n", INCLUDE1_STRING); - printf("Hello from %s\n", INCLUDE2_STRING); - printf("Hello from %s\n", INCLUDE3_STRING); - printf("Hello from %s\n", DEEPER_STRING); - return 0; -} diff --git a/tools/gyp/test/generator-output/src/subdir3/prog3.gyp b/tools/gyp/test/generator-output/src/subdir3/prog3.gyp deleted file mode 100644 index 46c5e000a2..0000000000 --- a/tools/gyp/test/generator-output/src/subdir3/prog3.gyp +++ /dev/null @@ -1,25 +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. - -{ - 'includes': [ - '../symroot.gypi', - ], - 'targets': [ - { - 'target_name': 'prog3', - 'type': 'executable', - 'include_dirs': [ - '..', - '../inc1', - '../subdir2/inc2', - 'inc3', - '../subdir2/deeper', - ], - 'sources': [ - 'prog3.c', - ], - }, - ], -} diff --git a/tools/gyp/test/generator-output/src/symroot.gypi b/tools/gyp/test/generator-output/src/symroot.gypi deleted file mode 100644 index 519916427c..0000000000 --- a/tools/gyp/test/generator-output/src/symroot.gypi +++ /dev/null @@ -1,16 +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. - -{ - 'variables': { - 'set_symroot%': 0, - }, - 'conditions': [ - ['set_symroot == 1', { - 'xcode_settings': { - 'SYMROOT': '<(DEPTH)/build', - }, - }], - ], -} diff --git a/tools/gyp/test/hard_dependency/gyptest-exported-hard-dependency.py b/tools/gyp/test/hard_dependency/gyptest-exported-hard-dependency.py deleted file mode 100755 index ba51528800..0000000000 --- a/tools/gyp/test/hard_dependency/gyptest-exported-hard-dependency.py +++ /dev/null @@ -1,37 +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. - -""" -Verify that a hard_dependency that is exported is pulled in as a dependency -for a target if the target is a static library and if the generator will -remove dependencies between static libraries. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -if test.format == 'dump_dependency_json': - test.skip_test('Skipping test; dependency JSON does not adjust ' \ - 'static libraries.\n') - -test.run_gyp('hard_dependency.gyp', chdir='src') - -chdir = 'relocate/src' -test.relocate('src', chdir) - -test.build('hard_dependency.gyp', 'c', chdir=chdir) - -# The 'a' static library should be built, as it has actions with side-effects -# that are necessary to compile 'c'. Even though 'c' does not directly depend -# on 'a', because 'a' is a hard_dependency that 'b' exports, 'c' should import -# it as a hard_dependency and ensure it is built before building 'c'. -test.built_file_must_exist('a', type=test.STATIC_LIB, chdir=chdir) -test.built_file_must_not_exist('b', type=test.STATIC_LIB, chdir=chdir) -test.built_file_must_exist('c', type=test.STATIC_LIB, chdir=chdir) -test.built_file_must_not_exist('d', type=test.STATIC_LIB, chdir=chdir) - -test.pass_test() diff --git a/tools/gyp/test/hard_dependency/gyptest-no-exported-hard-dependency.py b/tools/gyp/test/hard_dependency/gyptest-no-exported-hard-dependency.py deleted file mode 100755 index 10774ca2a0..0000000000 --- a/tools/gyp/test/hard_dependency/gyptest-no-exported-hard-dependency.py +++ /dev/null @@ -1,36 +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. - -""" -Verify that a hard_dependency that is not exported is not pulled in as a -dependency for a target if the target does not explicitly specify a dependency -and none of its dependencies export the hard_dependency. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -if test.format == 'dump_dependency_json': - test.skip_test('Skipping test; dependency JSON does not adjust ' \ - 'static libaries.\n') - -test.run_gyp('hard_dependency.gyp', chdir='src') - -chdir = 'relocate/src' -test.relocate('src', chdir) - -test.build('hard_dependency.gyp', 'd', chdir=chdir) - -# Because 'c' does not export a hard_dependency, only the target 'd' should -# be built. This is because the 'd' target does not need the generated headers -# in order to be compiled. -test.built_file_must_not_exist('a', type=test.STATIC_LIB, chdir=chdir) -test.built_file_must_not_exist('b', type=test.STATIC_LIB, chdir=chdir) -test.built_file_must_not_exist('c', type=test.STATIC_LIB, chdir=chdir) -test.built_file_must_exist('d', type=test.STATIC_LIB, chdir=chdir) - -test.pass_test() diff --git a/tools/gyp/test/hard_dependency/src/a.c b/tools/gyp/test/hard_dependency/src/a.c deleted file mode 100644 index 0fa0223c97..0000000000 --- a/tools/gyp/test/hard_dependency/src/a.c +++ /dev/null @@ -1,9 +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. */ - -#include "a.h" - -int funcA() { - return 42; -} diff --git a/tools/gyp/test/hard_dependency/src/a.h b/tools/gyp/test/hard_dependency/src/a.h deleted file mode 100644 index 854a06504a..0000000000 --- a/tools/gyp/test/hard_dependency/src/a.h +++ /dev/null @@ -1,12 +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. */ - -#ifndef A_H_ -#define A_H_ - -#include "generated.h" - -int funcA(); - -#endif // A_H_ diff --git a/tools/gyp/test/hard_dependency/src/b.c b/tools/gyp/test/hard_dependency/src/b.c deleted file mode 100644 index 0baace929e..0000000000 --- a/tools/gyp/test/hard_dependency/src/b.c +++ /dev/null @@ -1,9 +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. */ - -#include "a.h" - -int funcB() { - return funcA(); -} diff --git a/tools/gyp/test/hard_dependency/src/b.h b/tools/gyp/test/hard_dependency/src/b.h deleted file mode 100644 index 22b48cefe2..0000000000 --- a/tools/gyp/test/hard_dependency/src/b.h +++ /dev/null @@ -1,12 +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. */ - -#ifndef B_H_ -#define B_H_ - -#include "a.h" - -int funcB(); - -#endif // B_H_ diff --git a/tools/gyp/test/hard_dependency/src/c.c b/tools/gyp/test/hard_dependency/src/c.c deleted file mode 100644 index b0e0fb17d6..0000000000 --- a/tools/gyp/test/hard_dependency/src/c.c +++ /dev/null @@ -1,9 +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. */ - -#include "c.h" - -int funcC() { - return funcB(); -} diff --git a/tools/gyp/test/hard_dependency/src/c.h b/tools/gyp/test/hard_dependency/src/c.h deleted file mode 100644 index f4ea7fefa2..0000000000 --- a/tools/gyp/test/hard_dependency/src/c.h +++ /dev/null @@ -1,10 +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. */ - -#ifndef C_H_ -#define C_H_ - -int funcC(); - -#endif // C_H_ diff --git a/tools/gyp/test/hard_dependency/src/d.c b/tools/gyp/test/hard_dependency/src/d.c deleted file mode 100644 index d016c3ce71..0000000000 --- a/tools/gyp/test/hard_dependency/src/d.c +++ /dev/null @@ -1,9 +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. */ - -#include "c.h" - -int funcD() { - return funcC(); -} diff --git a/tools/gyp/test/hard_dependency/src/emit.py b/tools/gyp/test/hard_dependency/src/emit.py deleted file mode 100755 index 2df74b79a1..0000000000 --- a/tools/gyp/test/hard_dependency/src/emit.py +++ /dev/null @@ -1,11 +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. - -import sys - -f = open(sys.argv[1], 'wb') -f.write('/* Hello World */\n') -f.close() diff --git a/tools/gyp/test/hard_dependency/src/hard_dependency.gyp b/tools/gyp/test/hard_dependency/src/hard_dependency.gyp deleted file mode 100644 index 4479c5f045..0000000000 --- a/tools/gyp/test/hard_dependency/src/hard_dependency.gyp +++ /dev/null @@ -1,78 +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. - -{ - 'targets': [ - { - 'target_name': 'a', - 'type': 'static_library', - 'sources': [ - 'a.c', - 'a.h', - ], - 'hard_dependency': 1, - 'actions': [ - { - 'action_name': 'generate_headers', - 'inputs': [ - 'emit.py' - ], - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/generated.h' - ], - 'action': [ - 'python', - 'emit.py', - '<(SHARED_INTERMEDIATE_DIR)/generated.h', - ], - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - }, - ], - 'include_dirs': [ - '<(SHARED_INTERMEDIATE_DIR)', - ], - 'direct_dependent_settings': { - 'include_dirs': [ - '<(SHARED_INTERMEDIATE_DIR)', - ], - }, - }, - { - 'target_name': 'b', - 'type': 'static_library', - 'sources': [ - 'b.c', - 'b.h', - ], - 'dependencies': [ - 'a', - ], - 'export_dependent_settings': [ - 'a', - ], - }, - { - 'target_name': 'c', - 'type': 'static_library', - 'sources': [ - 'c.c', - 'c.h', - ], - 'dependencies': [ - 'b', - ], - }, - { - 'target_name': 'd', - 'type': 'static_library', - 'sources': [ - 'd.c', - ], - 'dependencies': [ - 'c', - ], - } - ], -} diff --git a/tools/gyp/test/hello/gyptest-all.py b/tools/gyp/test/hello/gyptest-all.py deleted file mode 100755 index 1739b6886e..0000000000 --- a/tools/gyp/test/hello/gyptest-all.py +++ /dev/null @@ -1,24 +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. - -""" -Verifies simplest-possible build of a "Hello, world!" program -using an explicit build target of 'all'. -""" - -import TestGyp - -test = TestGyp.TestGyp(workdir='workarea_all') - -test.run_gyp('hello.gyp') - -test.build('hello.gyp', test.ALL) - -test.run_built_executable('hello', stdout="Hello, world!\n") - -test.up_to_date('hello.gyp', test.ALL) - -test.pass_test() diff --git a/tools/gyp/test/hello/gyptest-default.py b/tools/gyp/test/hello/gyptest-default.py deleted file mode 100755 index 22377e7ac5..0000000000 --- a/tools/gyp/test/hello/gyptest-default.py +++ /dev/null @@ -1,24 +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. - -""" -Verifies simplest-possible build of a "Hello, world!" program -using the default build target. -""" - -import TestGyp - -test = TestGyp.TestGyp(workdir='workarea_default') - -test.run_gyp('hello.gyp') - -test.build('hello.gyp') - -test.run_built_executable('hello', stdout="Hello, world!\n") - -test.up_to_date('hello.gyp', test.DEFAULT) - -test.pass_test() diff --git a/tools/gyp/test/hello/gyptest-disable-regyp.py b/tools/gyp/test/hello/gyptest-disable-regyp.py deleted file mode 100755 index 1e4b306674..0000000000 --- a/tools/gyp/test/hello/gyptest-disable-regyp.py +++ /dev/null @@ -1,32 +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. - -""" -Verifies that Makefiles don't get rebuilt when a source gyp file changes and -the disable_regeneration generator flag is set. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('hello.gyp', '-Gauto_regeneration=0') - -test.build('hello.gyp', test.ALL) - -test.run_built_executable('hello', stdout="Hello, world!\n") - -# Sleep so that the changed gyp file will have a newer timestamp than the -# previously generated build files. -test.sleep() -test.write('hello.gyp', test.read('hello2.gyp')) - -test.build('hello.gyp', test.ALL) - -# Should still be the old executable, as regeneration was disabled. -test.run_built_executable('hello', stdout="Hello, world!\n") - -test.pass_test() diff --git a/tools/gyp/test/hello/gyptest-regyp.py b/tools/gyp/test/hello/gyptest-regyp.py deleted file mode 100755 index 827c7235ce..0000000000 --- a/tools/gyp/test/hello/gyptest-regyp.py +++ /dev/null @@ -1,32 +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. - -""" -Verifies that Makefiles get rebuilt when a source gyp file changes. -""" - -import TestGyp - -# Regenerating build files when a gyp file changes is currently only supported -# by the make generator. -test = TestGyp.TestGyp(formats=['make']) - -test.run_gyp('hello.gyp') - -test.build('hello.gyp', test.ALL) - -test.run_built_executable('hello', stdout="Hello, world!\n") - -# Sleep so that the changed gyp file will have a newer timestamp than the -# previously generated build files. -test.sleep() -test.write('hello.gyp', test.read('hello2.gyp')) - -test.build('hello.gyp', test.ALL) - -test.run_built_executable('hello', stdout="Hello, two!\n") - -test.pass_test() diff --git a/tools/gyp/test/hello/gyptest-target.py b/tools/gyp/test/hello/gyptest-target.py deleted file mode 100755 index 1abaf7057b..0000000000 --- a/tools/gyp/test/hello/gyptest-target.py +++ /dev/null @@ -1,24 +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. - -""" -Verifies simplest-possible build of a "Hello, world!" program -using an explicit build target of 'hello'. -""" - -import TestGyp - -test = TestGyp.TestGyp(workdir='workarea_target') - -test.run_gyp('hello.gyp') - -test.build('hello.gyp', 'hello') - -test.run_built_executable('hello', stdout="Hello, world!\n") - -test.up_to_date('hello.gyp', 'hello') - -test.pass_test() diff --git a/tools/gyp/test/hello/hello.c b/tools/gyp/test/hello/hello.c deleted file mode 100644 index 8dbecc0492..0000000000 --- a/tools/gyp/test/hello/hello.c +++ /dev/null @@ -1,11 +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. */ - -#include - -int main(int argc, char *argv[]) -{ - printf("Hello, world!\n"); - return 0; -} diff --git a/tools/gyp/test/hello/hello.gyp b/tools/gyp/test/hello/hello.gyp deleted file mode 100644 index 1974d51ccd..0000000000 --- a/tools/gyp/test/hello/hello.gyp +++ /dev/null @@ -1,15 +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. - -{ - 'targets': [ - { - 'target_name': 'hello', - 'type': 'executable', - 'sources': [ - 'hello.c', - ], - }, - ], -} diff --git a/tools/gyp/test/hello/hello2.c b/tools/gyp/test/hello/hello2.c deleted file mode 100644 index 19ef3fbd5c..0000000000 --- a/tools/gyp/test/hello/hello2.c +++ /dev/null @@ -1,11 +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. */ - -#include - -int main(int argc, char *argv[]) -{ - printf("Hello, two!\n"); - return 0; -} diff --git a/tools/gyp/test/hello/hello2.gyp b/tools/gyp/test/hello/hello2.gyp deleted file mode 100644 index 25b08caf3c..0000000000 --- a/tools/gyp/test/hello/hello2.gyp +++ /dev/null @@ -1,15 +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. - -{ - 'targets': [ - { - 'target_name': 'hello', - 'type': 'executable', - 'sources': [ - 'hello2.c', - ], - }, - ], -} diff --git a/tools/gyp/test/home_dot_gyp/gyptest-home-includes-regyp.py b/tools/gyp/test/home_dot_gyp/gyptest-home-includes-regyp.py deleted file mode 100755 index 59573414ae..0000000000 --- a/tools/gyp/test/home_dot_gyp/gyptest-home-includes-regyp.py +++ /dev/null @@ -1,44 +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. - -""" -Verifies inclusion of $HOME/.gyp/include.gypi works properly with relocation -and with regeneration. -""" - -import os -import TestGyp - -# Regenerating build files when a gyp file changes is currently only supported -# by the make generator. -test = TestGyp.TestGyp(formats=['make']) - -os.environ['HOME'] = os.path.abspath('home') - -test.run_gyp('all.gyp', chdir='src') - -# After relocating, we should still be able to build (build file shouldn't -# contain relative reference to ~/.gyp/include.gypi) -test.relocate('src', 'relocate/src') - -test.build('all.gyp', test.ALL, chdir='relocate/src') - -test.run_built_executable('printfoo', - chdir='relocate/src', - stdout='FOO is fromhome\n') - -# Building should notice any changes to ~/.gyp/include.gypi and regyp. -test.sleep() - -test.write('home/.gyp/include.gypi', test.read('home2/.gyp/include.gypi')) - -test.build('all.gyp', test.ALL, chdir='relocate/src') - -test.run_built_executable('printfoo', - chdir='relocate/src', - stdout='FOO is fromhome2\n') - -test.pass_test() diff --git a/tools/gyp/test/home_dot_gyp/gyptest-home-includes.py b/tools/gyp/test/home_dot_gyp/gyptest-home-includes.py deleted file mode 100755 index 8ad52556be..0000000000 --- a/tools/gyp/test/home_dot_gyp/gyptest-home-includes.py +++ /dev/null @@ -1,30 +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. - -""" -Verifies inclusion of $HOME/.gyp/include.gypi works. -""" - -import os -import TestGyp - -test = TestGyp.TestGyp() - -os.environ['HOME'] = os.path.abspath('home') - -test.run_gyp('all.gyp', chdir='src') - -# After relocating, we should still be able to build (build file shouldn't -# contain relative reference to ~/.gyp/include.gypi) -test.relocate('src', 'relocate/src') - -test.build('all.gyp', test.ALL, chdir='relocate/src') - -test.run_built_executable('printfoo', - chdir='relocate/src', - stdout='FOO is fromhome\n') - -test.pass_test() diff --git a/tools/gyp/test/home_dot_gyp/home/.gyp/include.gypi b/tools/gyp/test/home_dot_gyp/home/.gyp/include.gypi deleted file mode 100644 index fcfb39befd..0000000000 --- a/tools/gyp/test/home_dot_gyp/home/.gyp/include.gypi +++ /dev/null @@ -1,5 +0,0 @@ -{ - 'variables': { - 'foo': '"fromhome"', - }, -} diff --git a/tools/gyp/test/home_dot_gyp/home2/.gyp/include.gypi b/tools/gyp/test/home_dot_gyp/home2/.gyp/include.gypi deleted file mode 100644 index f0d84b31ad..0000000000 --- a/tools/gyp/test/home_dot_gyp/home2/.gyp/include.gypi +++ /dev/null @@ -1,5 +0,0 @@ -{ - 'variables': { - 'foo': '"fromhome2"', - }, -} diff --git a/tools/gyp/test/home_dot_gyp/src/all.gyp b/tools/gyp/test/home_dot_gyp/src/all.gyp deleted file mode 100644 index 14b6aea285..0000000000 --- a/tools/gyp/test/home_dot_gyp/src/all.gyp +++ /dev/null @@ -1,22 +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. - -{ - 'variables': { - 'foo%': '"fromdefault"', - }, - 'targets': [ - { - 'target_name': 'printfoo', - 'type': 'executable', - 'sources': [ - 'printfoo.c', - ], - 'defines': [ - 'FOO=<(foo)', - ], - }, - ], -} - diff --git a/tools/gyp/test/home_dot_gyp/src/printfoo.c b/tools/gyp/test/home_dot_gyp/src/printfoo.c deleted file mode 100644 index 92d2cbacb7..0000000000 --- a/tools/gyp/test/home_dot_gyp/src/printfoo.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - printf("FOO is %s\n", FOO); - return 0; -} diff --git a/tools/gyp/test/include_dirs/gyptest-all.py b/tools/gyp/test/include_dirs/gyptest-all.py deleted file mode 100755 index 94a1338d49..0000000000 --- a/tools/gyp/test/include_dirs/gyptest-all.py +++ /dev/null @@ -1,46 +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. - -""" -Verifies use of include_dirs when using an explicit build target of 'all'. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -if test.format == 'scons': - test.skip_test('TODO: http://code.google.com/p/gyp/issues/detail?id=176\n') - -test.run_gyp('includes.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - -test.build('includes.gyp', test.ALL, chdir='relocate/src') - -expect = """\ -Hello from includes.c -Hello from inc.h -Hello from include1.h -Hello from subdir/inc2/include2.h -Hello from shadow2/shadow.h -""" -test.run_built_executable('includes', stdout=expect, chdir='relocate/src') - -if test.format == 'xcode': - chdir='relocate/src/subdir' -else: - chdir='relocate/src' - -expect = """\ -Hello from subdir/subdir_includes.c -Hello from subdir/inc.h -Hello from include1.h -Hello from subdir/inc2/include2.h -""" -test.run_built_executable('subdir_includes', stdout=expect, chdir=chdir) - -test.pass_test() diff --git a/tools/gyp/test/include_dirs/gyptest-default.py b/tools/gyp/test/include_dirs/gyptest-default.py deleted file mode 100755 index 42acd1f962..0000000000 --- a/tools/gyp/test/include_dirs/gyptest-default.py +++ /dev/null @@ -1,46 +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. - -""" -Verifies use of include_dirs when using the default build target. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -if test.format == 'scons': - test.skip_test('TODO: http://code.google.com/p/gyp/issues/detail?id=176\n') - -test.run_gyp('includes.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - -test.build('includes.gyp', test.ALL, chdir='relocate/src') - -expect = """\ -Hello from includes.c -Hello from inc.h -Hello from include1.h -Hello from subdir/inc2/include2.h -Hello from shadow2/shadow.h -""" -test.run_built_executable('includes', stdout=expect, chdir='relocate/src') - -if test.format == 'xcode': - chdir='relocate/src/subdir' -else: - chdir='relocate/src' - -expect = """\ -Hello from subdir/subdir_includes.c -Hello from subdir/inc.h -Hello from include1.h -Hello from subdir/inc2/include2.h -""" -test.run_built_executable('subdir_includes', stdout=expect, chdir=chdir) - -test.pass_test() diff --git a/tools/gyp/test/include_dirs/src/inc.h b/tools/gyp/test/include_dirs/src/inc.h deleted file mode 100644 index 0398d6915f..0000000000 --- a/tools/gyp/test/include_dirs/src/inc.h +++ /dev/null @@ -1 +0,0 @@ -#define INC_STRING "inc.h" diff --git a/tools/gyp/test/include_dirs/src/inc1/include1.h b/tools/gyp/test/include_dirs/src/inc1/include1.h deleted file mode 100644 index 43356b5f47..0000000000 --- a/tools/gyp/test/include_dirs/src/inc1/include1.h +++ /dev/null @@ -1 +0,0 @@ -#define INCLUDE1_STRING "include1.h" diff --git a/tools/gyp/test/include_dirs/src/includes.c b/tools/gyp/test/include_dirs/src/includes.c deleted file mode 100644 index e2afbd3ed8..0000000000 --- a/tools/gyp/test/include_dirs/src/includes.c +++ /dev/null @@ -1,19 +0,0 @@ -#include - -#include "inc.h" -#include "include1.h" -#include "include2.h" -#include "shadow.h" - -int main(int argc, char *argv[]) -{ - printf("Hello from includes.c\n"); - printf("Hello from %s\n", INC_STRING); - printf("Hello from %s\n", INCLUDE1_STRING); - printf("Hello from %s\n", INCLUDE2_STRING); - /* Test that include_dirs happen first: The gyp file has a -Ishadow1 - cflag and an include_dir of shadow2. Including shadow.h should get - the shadow.h from the include_dir. */ - printf("Hello from %s\n", SHADOW_STRING); - return 0; -} diff --git a/tools/gyp/test/include_dirs/src/includes.gyp b/tools/gyp/test/include_dirs/src/includes.gyp deleted file mode 100644 index 3592690208..0000000000 --- a/tools/gyp/test/include_dirs/src/includes.gyp +++ /dev/null @@ -1,27 +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. - -{ - 'targets': [ - { - 'target_name': 'includes', - 'type': 'executable', - 'dependencies': [ - 'subdir/subdir_includes.gyp:subdir_includes', - ], - 'cflags': [ - '-Ishadow1', - ], - 'include_dirs': [ - '.', - 'inc1', - 'shadow2', - 'subdir/inc2', - ], - 'sources': [ - 'includes.c', - ], - }, - ], -} diff --git a/tools/gyp/test/include_dirs/src/shadow1/shadow.h b/tools/gyp/test/include_dirs/src/shadow1/shadow.h deleted file mode 100644 index 80f6de20b8..0000000000 --- a/tools/gyp/test/include_dirs/src/shadow1/shadow.h +++ /dev/null @@ -1 +0,0 @@ -#define SHADOW_STRING "shadow1/shadow.h" diff --git a/tools/gyp/test/include_dirs/src/shadow2/shadow.h b/tools/gyp/test/include_dirs/src/shadow2/shadow.h deleted file mode 100644 index fad5ccd085..0000000000 --- a/tools/gyp/test/include_dirs/src/shadow2/shadow.h +++ /dev/null @@ -1 +0,0 @@ -#define SHADOW_STRING "shadow2/shadow.h" diff --git a/tools/gyp/test/include_dirs/src/subdir/inc.h b/tools/gyp/test/include_dirs/src/subdir/inc.h deleted file mode 100644 index 0a68d7b36a..0000000000 --- a/tools/gyp/test/include_dirs/src/subdir/inc.h +++ /dev/null @@ -1 +0,0 @@ -#define INC_STRING "subdir/inc.h" diff --git a/tools/gyp/test/include_dirs/src/subdir/inc2/include2.h b/tools/gyp/test/include_dirs/src/subdir/inc2/include2.h deleted file mode 100644 index 721577effb..0000000000 --- a/tools/gyp/test/include_dirs/src/subdir/inc2/include2.h +++ /dev/null @@ -1 +0,0 @@ -#define INCLUDE2_STRING "subdir/inc2/include2.h" diff --git a/tools/gyp/test/include_dirs/src/subdir/subdir_includes.c b/tools/gyp/test/include_dirs/src/subdir/subdir_includes.c deleted file mode 100644 index 727f682205..0000000000 --- a/tools/gyp/test/include_dirs/src/subdir/subdir_includes.c +++ /dev/null @@ -1,14 +0,0 @@ -#include - -#include "inc.h" -#include "include1.h" -#include "include2.h" - -int main(int argc, char *argv[]) -{ - printf("Hello from subdir/subdir_includes.c\n"); - printf("Hello from %s\n", INC_STRING); - printf("Hello from %s\n", INCLUDE1_STRING); - printf("Hello from %s\n", INCLUDE2_STRING); - return 0; -} diff --git a/tools/gyp/test/include_dirs/src/subdir/subdir_includes.gyp b/tools/gyp/test/include_dirs/src/subdir/subdir_includes.gyp deleted file mode 100644 index 257d052c3c..0000000000 --- a/tools/gyp/test/include_dirs/src/subdir/subdir_includes.gyp +++ /dev/null @@ -1,20 +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. - -{ - 'targets': [ - { - 'target_name': 'subdir_includes', - 'type': 'executable', - 'include_dirs': [ - '.', - '../inc1', - 'inc2', - ], - 'sources': [ - 'subdir_includes.c', - ], - }, - ], -} diff --git a/tools/gyp/test/intermediate_dir/gyptest-intermediate-dir.py b/tools/gyp/test/intermediate_dir/gyptest-intermediate-dir.py deleted file mode 100755 index b4fd16f468..0000000000 --- a/tools/gyp/test/intermediate_dir/gyptest-intermediate-dir.py +++ /dev/null @@ -1,45 +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. - -""" -Verifies that targets have independent INTERMEDIATE_DIRs. -""" - -import TestGyp - -import os -import sys - -test = TestGyp.TestGyp() - -test.run_gyp('test.gyp', chdir='src') -test.build('test.gyp', 'target1', chdir='src') -# Check stuff exists. -intermediate_file1 = test.read('src/outfile.txt') -test.must_contain(intermediate_file1, 'target1') - -shared_intermediate_file1 = test.read('src/shared_outfile.txt') -test.must_contain(shared_intermediate_file1, 'shared_target1') - -test.run_gyp('test2.gyp', chdir='src') -test.build('test2.gyp', 'target2', chdir='src') -# Check INTERMEDIATE_DIR file didn't get overwritten but SHARED_INTERMEDIAT_DIR -# file did. -intermediate_file2 = test.read('src/outfile.txt') -test.must_contain(intermediate_file1, 'target1') -test.must_contain(intermediate_file2, 'target2') - -shared_intermediate_file2 = test.read('src/shared_outfile.txt') -if shared_intermediate_file1 != shared_intermediate_file2: - test.fail_test(shared_intermediate_file1 + ' != ' + shared_intermediate_file2) - -# These sometimes fail flakily with the xcode generator due to the shared file -# still containing 'target1'. Maybe the xcode build runs actions asynchronously? -# Asserting that the intermediate file names are identical is good enough. -#test.must_contain(shared_intermediate_file1, 'shared_target2') -#test.must_contain(shared_intermediate_file2, 'shared_target2') - -test.pass_test() diff --git a/tools/gyp/test/intermediate_dir/src/script.py b/tools/gyp/test/intermediate_dir/src/script.py deleted file mode 100755 index fa828a06b9..0000000000 --- a/tools/gyp/test/intermediate_dir/src/script.py +++ /dev/null @@ -1,24 +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. - -# Takes 3 arguments. Writes the 1st argument to the file in the 2nd argument, -# and writes the absolute path to the file in the 2nd argument to the file in -# the 3rd argument. - -import os -import shlex -import sys - -if len(sys.argv) == 3 and ' ' in sys.argv[2]: - sys.argv[2], fourth = shlex.split(sys.argv[2]) - sys.argv.append(fourth) - -#print >>sys.stderr, sys.argv - -with open(sys.argv[2], 'w') as f: - f.write(sys.argv[1]) - -with open(sys.argv[3], 'w') as f: - f.write(os.path.abspath(sys.argv[2])) diff --git a/tools/gyp/test/intermediate_dir/src/test.gyp b/tools/gyp/test/intermediate_dir/src/test.gyp deleted file mode 100644 index 9cd07c9e34..0000000000 --- a/tools/gyp/test/intermediate_dir/src/test.gyp +++ /dev/null @@ -1,40 +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. - -{ - 'targets': [ - { - 'target_name': 'target1', - 'type': 'none', - 'actions': [ - { - 'action_name': 'intermediate', - 'inputs': [], - 'outputs': [ - '<(INTERMEDIATE_DIR)/intermediate_out.txt', - 'outfile.txt', - ], - 'action': [ - 'python', 'script.py', 'target1', '<(_outputs)', - ], - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - }, - { - 'action_name': 'shared_intermediate', - 'inputs': [], - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/intermediate_out.txt', - 'shared_outfile.txt', - ], - 'action': [ - 'python', 'script.py', 'shared_target1', '<(_outputs)', - ], - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - }, - ], - }, - ], -} diff --git a/tools/gyp/test/intermediate_dir/src/test2.gyp b/tools/gyp/test/intermediate_dir/src/test2.gyp deleted file mode 100644 index 07ed9a03e6..0000000000 --- a/tools/gyp/test/intermediate_dir/src/test2.gyp +++ /dev/null @@ -1,40 +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. - -{ - 'targets': [ - { - 'target_name': 'target2', - 'type': 'none', - 'actions': [ - { - 'action_name': 'intermediate', - 'inputs': [], - 'outputs': [ - '<(INTERMEDIATE_DIR)/intermediate_out.txt', - 'outfile.txt', - ], - 'action': [ - 'python', 'script.py', 'target2', '<(_outputs)', - ], - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - }, - { - 'action_name': 'shared_intermediate', - 'inputs': [], - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/intermediate_out.txt', - 'shared_outfile.txt', - ], - 'action': [ - 'python', 'script.py', 'shared_target2', '<(_outputs)', - ], - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - }, - ], - }, - ], -} diff --git a/tools/gyp/test/lib/README.txt b/tools/gyp/test/lib/README.txt deleted file mode 100644 index b3d724574e..0000000000 --- a/tools/gyp/test/lib/README.txt +++ /dev/null @@ -1,17 +0,0 @@ -Supporting modules for GYP testing. - - TestCmd.py - TestCommon.py - - Modules for generic testing of command-line utilities, - specifically including the ability to copy a test configuration - to temporary directories (with default cleanup on exit) as part - of running test scripts that invoke commands, compare actual - against expected output, etc. - - Our copies of these come from the SCons project, - http://www.scons.org/. - - TestGyp.py - - Modules for GYP-specific tests, of course. diff --git a/tools/gyp/test/lib/TestCmd.py b/tools/gyp/test/lib/TestCmd.py deleted file mode 100644 index 45d901ca29..0000000000 --- a/tools/gyp/test/lib/TestCmd.py +++ /dev/null @@ -1,1594 +0,0 @@ -""" -TestCmd.py: a testing framework for commands and scripts. - -The TestCmd module provides a framework for portable automated testing -of executable commands and scripts (in any language, not just Python), -especially commands and scripts that require file system interaction. - -In addition to running tests and evaluating conditions, the TestCmd -module manages and cleans up one or more temporary workspace -directories, and provides methods for creating files and directories in -those workspace directories from in-line data, here-documents), allowing -tests to be completely self-contained. - -A TestCmd environment object is created via the usual invocation: - - import TestCmd - test = TestCmd.TestCmd() - -There are a bunch of keyword arguments available at instantiation: - - test = TestCmd.TestCmd(description = 'string', - program = 'program_or_script_to_test', - interpreter = 'script_interpreter', - workdir = 'prefix', - subdir = 'subdir', - verbose = Boolean, - match = default_match_function, - diff = default_diff_function, - combine = Boolean) - -There are a bunch of methods that let you do different things: - - test.verbose_set(1) - - test.description_set('string') - - test.program_set('program_or_script_to_test') - - test.interpreter_set('script_interpreter') - test.interpreter_set(['script_interpreter', 'arg']) - - test.workdir_set('prefix') - test.workdir_set('') - - test.workpath('file') - test.workpath('subdir', 'file') - - test.subdir('subdir', ...) - - test.rmdir('subdir', ...) - - test.write('file', "contents\n") - test.write(['subdir', 'file'], "contents\n") - - test.read('file') - test.read(['subdir', 'file']) - test.read('file', mode) - test.read(['subdir', 'file'], mode) - - test.writable('dir', 1) - test.writable('dir', None) - - test.preserve(condition, ...) - - test.cleanup(condition) - - test.command_args(program = 'program_or_script_to_run', - interpreter = 'script_interpreter', - arguments = 'arguments to pass to program') - - test.run(program = 'program_or_script_to_run', - interpreter = 'script_interpreter', - arguments = 'arguments to pass to program', - chdir = 'directory_to_chdir_to', - stdin = 'input to feed to the program\n') - universal_newlines = True) - - p = test.start(program = 'program_or_script_to_run', - interpreter = 'script_interpreter', - arguments = 'arguments to pass to program', - universal_newlines = None) - - test.finish(self, p) - - test.pass_test() - test.pass_test(condition) - test.pass_test(condition, function) - - test.fail_test() - test.fail_test(condition) - test.fail_test(condition, function) - test.fail_test(condition, function, skip) - - test.no_result() - test.no_result(condition) - test.no_result(condition, function) - test.no_result(condition, function, skip) - - test.stdout() - test.stdout(run) - - test.stderr() - test.stderr(run) - - test.symlink(target, link) - - test.banner(string) - test.banner(string, width) - - test.diff(actual, expected) - - test.match(actual, expected) - - test.match_exact("actual 1\nactual 2\n", "expected 1\nexpected 2\n") - test.match_exact(["actual 1\n", "actual 2\n"], - ["expected 1\n", "expected 2\n"]) - - test.match_re("actual 1\nactual 2\n", regex_string) - test.match_re(["actual 1\n", "actual 2\n"], list_of_regexes) - - test.match_re_dotall("actual 1\nactual 2\n", regex_string) - test.match_re_dotall(["actual 1\n", "actual 2\n"], list_of_regexes) - - test.tempdir() - test.tempdir('temporary-directory') - - test.sleep() - test.sleep(seconds) - - test.where_is('foo') - test.where_is('foo', 'PATH1:PATH2') - test.where_is('foo', 'PATH1;PATH2', '.suffix3;.suffix4') - - test.unlink('file') - test.unlink('subdir', 'file') - -The TestCmd module provides pass_test(), fail_test(), and no_result() -unbound functions that report test results for use with the Aegis change -management system. These methods terminate the test immediately, -reporting PASSED, FAILED, or NO RESULT respectively, and exiting with -status 0 (success), 1 or 2 respectively. This allows for a distinction -between an actual failed test and a test that could not be properly -evaluated because of an external condition (such as a full file system -or incorrect permissions). - - import TestCmd - - TestCmd.pass_test() - TestCmd.pass_test(condition) - TestCmd.pass_test(condition, function) - - TestCmd.fail_test() - TestCmd.fail_test(condition) - TestCmd.fail_test(condition, function) - TestCmd.fail_test(condition, function, skip) - - TestCmd.no_result() - TestCmd.no_result(condition) - TestCmd.no_result(condition, function) - TestCmd.no_result(condition, function, skip) - -The TestCmd module also provides unbound functions that handle matching -in the same way as the match_*() methods described above. - - import TestCmd - - test = TestCmd.TestCmd(match = TestCmd.match_exact) - - test = TestCmd.TestCmd(match = TestCmd.match_re) - - test = TestCmd.TestCmd(match = TestCmd.match_re_dotall) - -The TestCmd module provides unbound functions that can be used for the -"diff" argument to TestCmd.TestCmd instantiation: - - import TestCmd - - test = TestCmd.TestCmd(match = TestCmd.match_re, - diff = TestCmd.diff_re) - - test = TestCmd.TestCmd(diff = TestCmd.simple_diff) - -The "diff" argument can also be used with standard difflib functions: - - import difflib - - test = TestCmd.TestCmd(diff = difflib.context_diff) - - test = TestCmd.TestCmd(diff = difflib.unified_diff) - -Lastly, the where_is() method also exists in an unbound function -version. - - import TestCmd - - TestCmd.where_is('foo') - TestCmd.where_is('foo', 'PATH1:PATH2') - TestCmd.where_is('foo', 'PATH1;PATH2', '.suffix3;.suffix4') -""" - -# Copyright 2000-2010 Steven Knight -# This module is free software, and you may redistribute it and/or modify -# it under the same terms as Python itself, so long as this copyright message -# and disclaimer are retained in their original form. -# -# IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, -# SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF -# THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -# DAMAGE. -# -# THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -# PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, -# AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, -# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - -__author__ = "Steven Knight " -__revision__ = "TestCmd.py 0.37.D001 2010/01/11 16:55:50 knight" -__version__ = "0.37" - -import errno -import os -import os.path -import re -import shutil -import stat -import string -import sys -import tempfile -import time -import traceback -import types -import UserList - -__all__ = [ - 'diff_re', - 'fail_test', - 'no_result', - 'pass_test', - 'match_exact', - 'match_re', - 'match_re_dotall', - 'python_executable', - 'TestCmd' -] - -try: - import difflib -except ImportError: - __all__.append('simple_diff') - -def is_List(e): - return type(e) is types.ListType \ - or isinstance(e, UserList.UserList) - -try: - from UserString import UserString -except ImportError: - class UserString: - pass - -if hasattr(types, 'UnicodeType'): - def is_String(e): - return type(e) is types.StringType \ - or type(e) is types.UnicodeType \ - or isinstance(e, UserString) -else: - def is_String(e): - return type(e) is types.StringType or isinstance(e, UserString) - -tempfile.template = 'testcmd.' -if os.name in ('posix', 'nt'): - tempfile.template = 'testcmd.' + str(os.getpid()) + '.' -else: - tempfile.template = 'testcmd.' - -re_space = re.compile('\s') - -_Cleanup = [] - -_chain_to_exitfunc = None - -def _clean(): - global _Cleanup - cleanlist = filter(None, _Cleanup) - del _Cleanup[:] - cleanlist.reverse() - for test in cleanlist: - test.cleanup() - if _chain_to_exitfunc: - _chain_to_exitfunc() - -try: - import atexit -except ImportError: - # TODO(1.5): atexit requires python 2.0, so chain sys.exitfunc - try: - _chain_to_exitfunc = sys.exitfunc - except AttributeError: - pass - sys.exitfunc = _clean -else: - atexit.register(_clean) - -try: - zip -except NameError: - def zip(*lists): - result = [] - for i in xrange(min(map(len, lists))): - result.append(tuple(map(lambda l, i=i: l[i], lists))) - return result - -class Collector: - def __init__(self, top): - self.entries = [top] - def __call__(self, arg, dirname, names): - pathjoin = lambda n, d=dirname: os.path.join(d, n) - self.entries.extend(map(pathjoin, names)) - -def _caller(tblist, skip): - string = "" - arr = [] - for file, line, name, text in tblist: - if file[-10:] == "TestCmd.py": - break - arr = [(file, line, name, text)] + arr - atfrom = "at" - for file, line, name, text in arr[skip:]: - if name in ("?", ""): - name = "" - else: - name = " (" + name + ")" - string = string + ("%s line %d of %s%s\n" % (atfrom, line, file, name)) - atfrom = "\tfrom" - return string - -def fail_test(self = None, condition = 1, function = None, skip = 0): - """Cause the test to fail. - - By default, the fail_test() method reports that the test FAILED - and exits with a status of 1. If a condition argument is supplied, - the test fails only if the condition is true. - """ - if not condition: - return - if not function is None: - function() - of = "" - desc = "" - sep = " " - if not self is None: - if self.program: - of = " of " + self.program - sep = "\n\t" - if self.description: - desc = " [" + self.description + "]" - sep = "\n\t" - - at = _caller(traceback.extract_stack(), skip) - sys.stderr.write("FAILED test" + of + desc + sep + at) - - sys.exit(1) - -def no_result(self = None, condition = 1, function = None, skip = 0): - """Causes a test to exit with no valid result. - - By default, the no_result() method reports NO RESULT for the test - and exits with a status of 2. If a condition argument is supplied, - the test fails only if the condition is true. - """ - if not condition: - return - if not function is None: - function() - of = "" - desc = "" - sep = " " - if not self is None: - if self.program: - of = " of " + self.program - sep = "\n\t" - if self.description: - desc = " [" + self.description + "]" - sep = "\n\t" - - at = _caller(traceback.extract_stack(), skip) - sys.stderr.write("NO RESULT for test" + of + desc + sep + at) - - sys.exit(2) - -def pass_test(self = None, condition = 1, function = None): - """Causes a test to pass. - - By default, the pass_test() method reports PASSED for the test - and exits with a status of 0. If a condition argument is supplied, - the test passes only if the condition is true. - """ - if not condition: - return - if not function is None: - function() - sys.stderr.write("PASSED\n") - sys.exit(0) - -def match_exact(lines = None, matches = None): - """ - """ - if not is_List(lines): - lines = string.split(lines, "\n") - if not is_List(matches): - matches = string.split(matches, "\n") - if len(lines) != len(matches): - return - for i in range(len(lines)): - if lines[i] != matches[i]: - return - return 1 - -def match_re(lines = None, res = None): - """ - """ - if not is_List(lines): - lines = string.split(lines, "\n") - if not is_List(res): - res = string.split(res, "\n") - if len(lines) != len(res): - return - for i in range(len(lines)): - s = "^" + res[i] + "$" - try: - expr = re.compile(s) - except re.error, e: - msg = "Regular expression error in %s: %s" - raise re.error, msg % (repr(s), e[0]) - if not expr.search(lines[i]): - return - return 1 - -def match_re_dotall(lines = None, res = None): - """ - """ - if not type(lines) is type(""): - lines = string.join(lines, "\n") - if not type(res) is type(""): - res = string.join(res, "\n") - s = "^" + res + "$" - try: - expr = re.compile(s, re.DOTALL) - except re.error, e: - msg = "Regular expression error in %s: %s" - raise re.error, msg % (repr(s), e[0]) - if expr.match(lines): - return 1 - -try: - import difflib -except ImportError: - pass -else: - def simple_diff(a, b, fromfile='', tofile='', - fromfiledate='', tofiledate='', n=3, lineterm='\n'): - """ - A function with the same calling signature as difflib.context_diff - (diff -c) and difflib.unified_diff (diff -u) but which prints - output like the simple, unadorned 'diff" command. - """ - sm = difflib.SequenceMatcher(None, a, b) - def comma(x1, x2): - return x1+1 == x2 and str(x2) or '%s,%s' % (x1+1, x2) - result = [] - for op, a1, a2, b1, b2 in sm.get_opcodes(): - if op == 'delete': - result.append("%sd%d" % (comma(a1, a2), b1)) - result.extend(map(lambda l: '< ' + l, a[a1:a2])) - elif op == 'insert': - result.append("%da%s" % (a1, comma(b1, b2))) - result.extend(map(lambda l: '> ' + l, b[b1:b2])) - elif op == 'replace': - result.append("%sc%s" % (comma(a1, a2), comma(b1, b2))) - result.extend(map(lambda l: '< ' + l, a[a1:a2])) - result.append('---') - result.extend(map(lambda l: '> ' + l, b[b1:b2])) - return result - -def diff_re(a, b, fromfile='', tofile='', - fromfiledate='', tofiledate='', n=3, lineterm='\n'): - """ - A simple "diff" of two sets of lines when the expected lines - are regular expressions. This is a really dumb thing that - just compares each line in turn, so it doesn't look for - chunks of matching lines and the like--but at least it lets - you know exactly which line first didn't compare correctl... - """ - result = [] - diff = len(a) - len(b) - if diff < 0: - a = a + ['']*(-diff) - elif diff > 0: - b = b + ['']*diff - i = 0 - for aline, bline in zip(a, b): - s = "^" + aline + "$" - try: - expr = re.compile(s) - except re.error, e: - msg = "Regular expression error in %s: %s" - raise re.error, msg % (repr(s), e[0]) - if not expr.search(bline): - result.append("%sc%s" % (i+1, i+1)) - result.append('< ' + repr(a[i])) - result.append('---') - result.append('> ' + repr(b[i])) - i = i+1 - return result - -if os.name == 'java': - - python_executable = os.path.join(sys.prefix, 'jython') - -else: - - python_executable = sys.executable - -if sys.platform == 'win32': - - default_sleep_seconds = 2 - - def where_is(file, path=None, pathext=None): - if path is None: - path = os.environ['PATH'] - if is_String(path): - path = string.split(path, os.pathsep) - if pathext is None: - pathext = os.environ['PATHEXT'] - if is_String(pathext): - pathext = string.split(pathext, os.pathsep) - for ext in pathext: - if string.lower(ext) == string.lower(file[-len(ext):]): - pathext = [''] - break - for dir in path: - f = os.path.join(dir, file) - for ext in pathext: - fext = f + ext - if os.path.isfile(fext): - return fext - return None - -else: - - def where_is(file, path=None, pathext=None): - if path is None: - path = os.environ['PATH'] - if is_String(path): - path = string.split(path, os.pathsep) - for dir in path: - f = os.path.join(dir, file) - if os.path.isfile(f): - try: - st = os.stat(f) - except OSError: - continue - if stat.S_IMODE(st[stat.ST_MODE]) & 0111: - return f - return None - - default_sleep_seconds = 1 - - - -try: - import subprocess -except ImportError: - # The subprocess module doesn't exist in this version of Python, - # so we're going to cobble up something that looks just enough - # like its API for our purposes below. - import new - - subprocess = new.module('subprocess') - - subprocess.PIPE = 'PIPE' - subprocess.STDOUT = 'STDOUT' - subprocess.mswindows = (sys.platform == 'win32') - - try: - import popen2 - popen2.Popen3 - except AttributeError: - class Popen3: - universal_newlines = 1 - def __init__(self, command, **kw): - if sys.platform == 'win32' and command[0] == '"': - command = '"' + command + '"' - (stdin, stdout, stderr) = os.popen3(' ' + command) - self.stdin = stdin - self.stdout = stdout - self.stderr = stderr - def close_output(self): - self.stdout.close() - self.resultcode = self.stderr.close() - def wait(self): - resultcode = self.resultcode - if os.WIFEXITED(resultcode): - return os.WEXITSTATUS(resultcode) - elif os.WIFSIGNALED(resultcode): - return os.WTERMSIG(resultcode) - else: - return None - - else: - try: - popen2.Popen4 - except AttributeError: - # A cribbed Popen4 class, with some retrofitted code from - # the Python 1.5 Popen3 class methods to do certain things - # by hand. - class Popen4(popen2.Popen3): - childerr = None - - def __init__(self, cmd, bufsize=-1): - p2cread, p2cwrite = os.pipe() - c2pread, c2pwrite = os.pipe() - self.pid = os.fork() - if self.pid == 0: - # Child - os.dup2(p2cread, 0) - os.dup2(c2pwrite, 1) - os.dup2(c2pwrite, 2) - for i in range(3, popen2.MAXFD): - try: - os.close(i) - except: pass - try: - os.execvp(cmd[0], cmd) - finally: - os._exit(1) - # Shouldn't come here, I guess - os._exit(1) - os.close(p2cread) - self.tochild = os.fdopen(p2cwrite, 'w', bufsize) - os.close(c2pwrite) - self.fromchild = os.fdopen(c2pread, 'r', bufsize) - popen2._active.append(self) - - popen2.Popen4 = Popen4 - - class Popen3(popen2.Popen3, popen2.Popen4): - universal_newlines = 1 - def __init__(self, command, **kw): - if kw.get('stderr') == 'STDOUT': - apply(popen2.Popen4.__init__, (self, command, 1)) - else: - apply(popen2.Popen3.__init__, (self, command, 1)) - self.stdin = self.tochild - self.stdout = self.fromchild - self.stderr = self.childerr - def wait(self, *args, **kw): - resultcode = apply(popen2.Popen3.wait, (self,)+args, kw) - if os.WIFEXITED(resultcode): - return os.WEXITSTATUS(resultcode) - elif os.WIFSIGNALED(resultcode): - return os.WTERMSIG(resultcode) - else: - return None - - subprocess.Popen = Popen3 - - - -# From Josiah Carlson, -# ASPN : Python Cookbook : Module to allow Asynchronous subprocess use on Windows and Posix platforms -# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440554 - -PIPE = subprocess.PIPE - -if subprocess.mswindows: - from win32file import ReadFile, WriteFile - from win32pipe import PeekNamedPipe - import msvcrt -else: - import select - import fcntl - - try: fcntl.F_GETFL - except AttributeError: fcntl.F_GETFL = 3 - - try: fcntl.F_SETFL - except AttributeError: fcntl.F_SETFL = 4 - -class Popen(subprocess.Popen): - def recv(self, maxsize=None): - return self._recv('stdout', maxsize) - - def recv_err(self, maxsize=None): - return self._recv('stderr', maxsize) - - def send_recv(self, input='', maxsize=None): - return self.send(input), self.recv(maxsize), self.recv_err(maxsize) - - def get_conn_maxsize(self, which, maxsize): - if maxsize is None: - maxsize = 1024 - elif maxsize < 1: - maxsize = 1 - return getattr(self, which), maxsize - - def _close(self, which): - getattr(self, which).close() - setattr(self, which, None) - - if subprocess.mswindows: - def send(self, input): - if not self.stdin: - return None - - try: - x = msvcrt.get_osfhandle(self.stdin.fileno()) - (errCode, written) = WriteFile(x, input) - except ValueError: - return self._close('stdin') - except (subprocess.pywintypes.error, Exception), why: - if why[0] in (109, errno.ESHUTDOWN): - return self._close('stdin') - raise - - return written - - def _recv(self, which, maxsize): - conn, maxsize = self.get_conn_maxsize(which, maxsize) - if conn is None: - return None - - try: - x = msvcrt.get_osfhandle(conn.fileno()) - (read, nAvail, nMessage) = PeekNamedPipe(x, 0) - if maxsize < nAvail: - nAvail = maxsize - if nAvail > 0: - (errCode, read) = ReadFile(x, nAvail, None) - except ValueError: - return self._close(which) - except (subprocess.pywintypes.error, Exception), why: - if why[0] in (109, errno.ESHUTDOWN): - return self._close(which) - raise - - #if self.universal_newlines: - # read = self._translate_newlines(read) - return read - - else: - def send(self, input): - if not self.stdin: - return None - - if not select.select([], [self.stdin], [], 0)[1]: - return 0 - - try: - written = os.write(self.stdin.fileno(), input) - except OSError, why: - if why[0] == errno.EPIPE: #broken pipe - return self._close('stdin') - raise - - return written - - def _recv(self, which, maxsize): - conn, maxsize = self.get_conn_maxsize(which, maxsize) - if conn is None: - return None - - try: - flags = fcntl.fcntl(conn, fcntl.F_GETFL) - except TypeError: - flags = None - else: - if not conn.closed: - fcntl.fcntl(conn, fcntl.F_SETFL, flags| os.O_NONBLOCK) - - try: - if not select.select([conn], [], [], 0)[0]: - return '' - - r = conn.read(maxsize) - if not r: - return self._close(which) - - #if self.universal_newlines: - # r = self._translate_newlines(r) - return r - finally: - if not conn.closed and not flags is None: - fcntl.fcntl(conn, fcntl.F_SETFL, flags) - -disconnect_message = "Other end disconnected!" - -def recv_some(p, t=.1, e=1, tr=5, stderr=0): - if tr < 1: - tr = 1 - x = time.time()+t - y = [] - r = '' - pr = p.recv - if stderr: - pr = p.recv_err - while time.time() < x or r: - r = pr() - if r is None: - if e: - raise Exception(disconnect_message) - else: - break - elif r: - y.append(r) - else: - time.sleep(max((x-time.time())/tr, 0)) - return ''.join(y) - -# TODO(3.0: rewrite to use memoryview() -def send_all(p, data): - while len(data): - sent = p.send(data) - if sent is None: - raise Exception(disconnect_message) - data = buffer(data, sent) - - - -try: - object -except NameError: - class object: - pass - - - -class TestCmd(object): - """Class TestCmd - """ - - def __init__(self, description = None, - program = None, - interpreter = None, - workdir = None, - subdir = None, - verbose = None, - match = None, - diff = None, - combine = 0, - universal_newlines = 1): - self._cwd = os.getcwd() - self.description_set(description) - self.program_set(program) - self.interpreter_set(interpreter) - if verbose is None: - try: - verbose = max( 0, int(os.environ.get('TESTCMD_VERBOSE', 0)) ) - except ValueError: - verbose = 0 - self.verbose_set(verbose) - self.combine = combine - self.universal_newlines = universal_newlines - if match is not None: - self.match_function = match - else: - self.match_function = match_re - if diff is not None: - self.diff_function = diff - else: - try: - difflib - except NameError: - pass - else: - self.diff_function = simple_diff - #self.diff_function = difflib.context_diff - #self.diff_function = difflib.unified_diff - self._dirlist = [] - self._preserve = {'pass_test': 0, 'fail_test': 0, 'no_result': 0} - if os.environ.has_key('PRESERVE') and not os.environ['PRESERVE'] is '': - self._preserve['pass_test'] = os.environ['PRESERVE'] - self._preserve['fail_test'] = os.environ['PRESERVE'] - self._preserve['no_result'] = os.environ['PRESERVE'] - else: - try: - self._preserve['pass_test'] = os.environ['PRESERVE_PASS'] - except KeyError: - pass - try: - self._preserve['fail_test'] = os.environ['PRESERVE_FAIL'] - except KeyError: - pass - try: - self._preserve['no_result'] = os.environ['PRESERVE_NO_RESULT'] - except KeyError: - pass - self._stdout = [] - self._stderr = [] - self.status = None - self.condition = 'no_result' - self.workdir_set(workdir) - self.subdir(subdir) - - def __del__(self): - self.cleanup() - - def __repr__(self): - return "%x" % id(self) - - banner_char = '=' - banner_width = 80 - - def banner(self, s, width=None): - if width is None: - width = self.banner_width - return s + self.banner_char * (width - len(s)) - - if os.name == 'posix': - - def escape(self, arg): - "escape shell special characters" - slash = '\\' - special = '"$' - - arg = string.replace(arg, slash, slash+slash) - for c in special: - arg = string.replace(arg, c, slash+c) - - if re_space.search(arg): - arg = '"' + arg + '"' - return arg - - else: - - # Windows does not allow special characters in file names - # anyway, so no need for an escape function, we will just quote - # the arg. - def escape(self, arg): - if re_space.search(arg): - arg = '"' + arg + '"' - return arg - - def canonicalize(self, path): - if is_List(path): - path = apply(os.path.join, tuple(path)) - if not os.path.isabs(path): - path = os.path.join(self.workdir, path) - return path - - def chmod(self, path, mode): - """Changes permissions on the specified file or directory - path name.""" - path = self.canonicalize(path) - os.chmod(path, mode) - - def cleanup(self, condition = None): - """Removes any temporary working directories for the specified - TestCmd environment. If the environment variable PRESERVE was - set when the TestCmd environment was created, temporary working - directories are not removed. If any of the environment variables - PRESERVE_PASS, PRESERVE_FAIL, or PRESERVE_NO_RESULT were set - when the TestCmd environment was created, then temporary working - directories are not removed if the test passed, failed, or had - no result, respectively. Temporary working directories are also - preserved for conditions specified via the preserve method. - - Typically, this method is not called directly, but is used when - the script exits to clean up temporary working directories as - appropriate for the exit status. - """ - if not self._dirlist: - return - os.chdir(self._cwd) - self.workdir = None - if condition is None: - condition = self.condition - if self._preserve[condition]: - for dir in self._dirlist: - print "Preserved directory", dir - else: - list = self._dirlist[:] - list.reverse() - for dir in list: - self.writable(dir, 1) - shutil.rmtree(dir, ignore_errors = 1) - self._dirlist = [] - - try: - global _Cleanup - _Cleanup.remove(self) - except (AttributeError, ValueError): - pass - - def command_args(self, program = None, - interpreter = None, - arguments = None): - if program: - if type(program) == type('') and not os.path.isabs(program): - program = os.path.join(self._cwd, program) - else: - program = self.program - if not interpreter: - interpreter = self.interpreter - if not type(program) in [type([]), type(())]: - program = [program] - cmd = list(program) - if interpreter: - if not type(interpreter) in [type([]), type(())]: - interpreter = [interpreter] - cmd = list(interpreter) + cmd - if arguments: - if type(arguments) == type(''): - arguments = string.split(arguments) - cmd.extend(arguments) - return cmd - - def description_set(self, description): - """Set the description of the functionality being tested. - """ - self.description = description - - try: - difflib - except NameError: - def diff(self, a, b, name, *args, **kw): - print self.banner('Expected %s' % name) - print a - print self.banner('Actual %s' % name) - print b - else: - def diff(self, a, b, name, *args, **kw): - print self.banner(name) - args = (a.splitlines(), b.splitlines()) + args - lines = apply(self.diff_function, args, kw) - for l in lines: - print l - - def fail_test(self, condition = 1, function = None, skip = 0): - """Cause the test to fail. - """ - if not condition: - return - self.condition = 'fail_test' - fail_test(self = self, - condition = condition, - function = function, - skip = skip) - - def interpreter_set(self, interpreter): - """Set the program to be used to interpret the program - under test as a script. - """ - self.interpreter = interpreter - - def match(self, lines, matches): - """Compare actual and expected file contents. - """ - return self.match_function(lines, matches) - - def match_exact(self, lines, matches): - """Compare actual and expected file contents. - """ - return match_exact(lines, matches) - - def match_re(self, lines, res): - """Compare actual and expected file contents. - """ - return match_re(lines, res) - - def match_re_dotall(self, lines, res): - """Compare actual and expected file contents. - """ - return match_re_dotall(lines, res) - - def no_result(self, condition = 1, function = None, skip = 0): - """Report that the test could not be run. - """ - if not condition: - return - self.condition = 'no_result' - no_result(self = self, - condition = condition, - function = function, - skip = skip) - - def pass_test(self, condition = 1, function = None): - """Cause the test to pass. - """ - if not condition: - return - self.condition = 'pass_test' - pass_test(self = self, condition = condition, function = function) - - def preserve(self, *conditions): - """Arrange for the temporary working directories for the - specified TestCmd environment to be preserved for one or more - conditions. If no conditions are specified, arranges for - the temporary working directories to be preserved for all - conditions. - """ - if conditions is (): - conditions = ('pass_test', 'fail_test', 'no_result') - for cond in conditions: - self._preserve[cond] = 1 - - def program_set(self, program): - """Set the executable program or script to be tested. - """ - if program and not os.path.isabs(program): - program = os.path.join(self._cwd, program) - self.program = program - - def read(self, file, mode = 'rb'): - """Reads and returns the contents of the specified file name. - The file name may be a list, in which case the elements are - concatenated with the os.path.join() method. The file is - assumed to be under the temporary working directory unless it - is an absolute path name. The I/O mode for the file may - be specified; it must begin with an 'r'. The default is - 'rb' (binary read). - """ - file = self.canonicalize(file) - if mode[0] != 'r': - raise ValueError, "mode must begin with 'r'" - with open(file, mode) as f: - result = f.read() - return result - - def rmdir(self, dir): - """Removes the specified dir name. - The dir name may be a list, in which case the elements are - concatenated with the os.path.join() method. The dir is - assumed to be under the temporary working directory unless it - is an absolute path name. - The dir must be empty. - """ - dir = self.canonicalize(dir) - os.rmdir(dir) - - def start(self, program = None, - interpreter = None, - arguments = None, - universal_newlines = None, - **kw): - """ - Starts a program or script for the test environment. - - The specified program will have the original directory - prepended unless it is enclosed in a [list]. - """ - cmd = self.command_args(program, interpreter, arguments) - cmd_string = string.join(map(self.escape, cmd), ' ') - if self.verbose: - sys.stderr.write(cmd_string + "\n") - if universal_newlines is None: - universal_newlines = self.universal_newlines - - # On Windows, if we make stdin a pipe when we plan to send - # no input, and the test program exits before - # Popen calls msvcrt.open_osfhandle, that call will fail. - # So don't use a pipe for stdin if we don't need one. - stdin = kw.get('stdin', None) - if stdin is not None: - stdin = subprocess.PIPE - - combine = kw.get('combine', self.combine) - if combine: - stderr_value = subprocess.STDOUT - else: - stderr_value = subprocess.PIPE - - return Popen(cmd, - stdin=stdin, - stdout=subprocess.PIPE, - stderr=stderr_value, - universal_newlines=universal_newlines) - - def finish(self, popen, **kw): - """ - Finishes and waits for the process being run under control of - the specified popen argument, recording the exit status, - standard output and error output. - """ - popen.stdin.close() - self.status = popen.wait() - if not self.status: - self.status = 0 - self._stdout.append(popen.stdout.read()) - if popen.stderr: - stderr = popen.stderr.read() - else: - stderr = '' - self._stderr.append(stderr) - - def run(self, program = None, - interpreter = None, - arguments = None, - chdir = None, - stdin = None, - universal_newlines = None): - """Runs a test of the program or script for the test - environment. Standard output and error output are saved for - future retrieval via the stdout() and stderr() methods. - - The specified program will have the original directory - prepended unless it is enclosed in a [list]. - """ - if chdir: - oldcwd = os.getcwd() - if not os.path.isabs(chdir): - chdir = os.path.join(self.workpath(chdir)) - if self.verbose: - sys.stderr.write("chdir(" + chdir + ")\n") - os.chdir(chdir) - p = self.start(program, - interpreter, - arguments, - universal_newlines, - stdin=stdin) - if stdin: - if is_List(stdin): - for line in stdin: - p.stdin.write(line) - else: - p.stdin.write(stdin) - p.stdin.close() - - out = p.stdout.read() - if p.stderr is None: - err = '' - else: - err = p.stderr.read() - try: - close_output = p.close_output - except AttributeError: - p.stdout.close() - if not p.stderr is None: - p.stderr.close() - else: - close_output() - - self._stdout.append(out) - self._stderr.append(err) - - self.status = p.wait() - if not self.status: - self.status = 0 - - if chdir: - os.chdir(oldcwd) - if self.verbose >= 2: - write = sys.stdout.write - write('============ STATUS: %d\n' % self.status) - out = self.stdout() - if out or self.verbose >= 3: - write('============ BEGIN STDOUT (len=%d):\n' % len(out)) - write(out) - write('============ END STDOUT\n') - err = self.stderr() - if err or self.verbose >= 3: - write('============ BEGIN STDERR (len=%d)\n' % len(err)) - write(err) - write('============ END STDERR\n') - - def sleep(self, seconds = default_sleep_seconds): - """Sleeps at least the specified number of seconds. If no - number is specified, sleeps at least the minimum number of - seconds necessary to advance file time stamps on the current - system. Sleeping more seconds is all right. - """ - time.sleep(seconds) - - def stderr(self, run = None): - """Returns the error output from the specified run number. - If there is no specified run number, then returns the error - output of the last run. If the run number is less than zero, - then returns the error output from that many runs back from the - current run. - """ - if not run: - run = len(self._stderr) - elif run < 0: - run = len(self._stderr) + run - run = run - 1 - return self._stderr[run] - - def stdout(self, run = None): - """Returns the standard output from the specified run number. - If there is no specified run number, then returns the standard - output of the last run. If the run number is less than zero, - then returns the standard output from that many runs back from - the current run. - """ - if not run: - run = len(self._stdout) - elif run < 0: - run = len(self._stdout) + run - run = run - 1 - return self._stdout[run] - - def subdir(self, *subdirs): - """Create new subdirectories under the temporary working - directory, one for each argument. An argument may be a list, - in which case the list elements are concatenated using the - os.path.join() method. Subdirectories multiple levels deep - must be created using a separate argument for each level: - - test.subdir('sub', ['sub', 'dir'], ['sub', 'dir', 'ectory']) - - Returns the number of subdirectories actually created. - """ - count = 0 - for sub in subdirs: - if sub is None: - continue - if is_List(sub): - sub = apply(os.path.join, tuple(sub)) - new = os.path.join(self.workdir, sub) - try: - os.mkdir(new) - except OSError: - pass - else: - count = count + 1 - return count - - def symlink(self, target, link): - """Creates a symlink to the specified target. - The link name may be a list, in which case the elements are - concatenated with the os.path.join() method. The link is - assumed to be under the temporary working directory unless it - is an absolute path name. The target is *not* assumed to be - under the temporary working directory. - """ - link = self.canonicalize(link) - os.symlink(target, link) - - def tempdir(self, path=None): - """Creates a temporary directory. - A unique directory name is generated if no path name is specified. - The directory is created, and will be removed when the TestCmd - object is destroyed. - """ - if path is None: - try: - path = tempfile.mktemp(prefix=tempfile.template) - except TypeError: - path = tempfile.mktemp() - os.mkdir(path) - - # Symlinks in the path will report things - # differently from os.getcwd(), so chdir there - # and back to fetch the canonical path. - cwd = os.getcwd() - try: - os.chdir(path) - path = os.getcwd() - finally: - os.chdir(cwd) - - # Uppercase the drive letter since the case of drive - # letters is pretty much random on win32: - drive,rest = os.path.splitdrive(path) - if drive: - path = string.upper(drive) + rest - - # - self._dirlist.append(path) - global _Cleanup - try: - _Cleanup.index(self) - except ValueError: - _Cleanup.append(self) - - return path - - def touch(self, path, mtime=None): - """Updates the modification time on the specified file or - directory path name. The default is to update to the - current time if no explicit modification time is specified. - """ - path = self.canonicalize(path) - atime = os.path.getatime(path) - if mtime is None: - mtime = time.time() - os.utime(path, (atime, mtime)) - - def unlink(self, file): - """Unlinks the specified file name. - The file name may be a list, in which case the elements are - concatenated with the os.path.join() method. The file is - assumed to be under the temporary working directory unless it - is an absolute path name. - """ - file = self.canonicalize(file) - os.unlink(file) - - def verbose_set(self, verbose): - """Set the verbose level. - """ - self.verbose = verbose - - def where_is(self, file, path=None, pathext=None): - """Find an executable file. - """ - if is_List(file): - file = apply(os.path.join, tuple(file)) - if not os.path.isabs(file): - file = where_is(file, path, pathext) - return file - - def workdir_set(self, path): - """Creates a temporary working directory with the specified - path name. If the path is a null string (''), a unique - directory name is created. - """ - if (path != None): - if path == '': - path = None - path = self.tempdir(path) - self.workdir = path - - def workpath(self, *args): - """Returns the absolute path name to a subdirectory or file - within the current temporary working directory. Concatenates - the temporary working directory name with the specified - arguments using the os.path.join() method. - """ - return apply(os.path.join, (self.workdir,) + tuple(args)) - - def readable(self, top, read=1): - """Make the specified directory tree readable (read == 1) - or not (read == None). - - This method has no effect on Windows systems, which use a - completely different mechanism to control file readability. - """ - - if sys.platform == 'win32': - return - - if read: - def do_chmod(fname): - try: st = os.stat(fname) - except OSError: pass - else: os.chmod(fname, stat.S_IMODE(st[stat.ST_MODE]|stat.S_IREAD)) - else: - def do_chmod(fname): - try: st = os.stat(fname) - except OSError: pass - else: os.chmod(fname, stat.S_IMODE(st[stat.ST_MODE]&~stat.S_IREAD)) - - if os.path.isfile(top): - # If it's a file, that's easy, just chmod it. - do_chmod(top) - elif read: - # It's a directory and we're trying to turn on read - # permission, so it's also pretty easy, just chmod the - # directory and then chmod every entry on our walk down the - # tree. Because os.path.walk() is top-down, we'll enable - # read permission on any directories that have it disabled - # before os.path.walk() tries to list their contents. - do_chmod(top) - - def chmod_entries(arg, dirname, names, do_chmod=do_chmod): - for n in names: - do_chmod(os.path.join(dirname, n)) - - os.path.walk(top, chmod_entries, None) - else: - # It's a directory and we're trying to turn off read - # permission, which means we have to chmod the directoreis - # in the tree bottom-up, lest disabling read permission from - # the top down get in the way of being able to get at lower - # parts of the tree. But os.path.walk() visits things top - # down, so we just use an object to collect a list of all - # of the entries in the tree, reverse the list, and then - # chmod the reversed (bottom-up) list. - col = Collector(top) - os.path.walk(top, col, None) - col.entries.reverse() - for d in col.entries: do_chmod(d) - - def writable(self, top, write=1): - """Make the specified directory tree writable (write == 1) - or not (write == None). - """ - - if sys.platform == 'win32': - - if write: - def do_chmod(fname): - try: os.chmod(fname, stat.S_IWRITE) - except OSError: pass - else: - def do_chmod(fname): - try: os.chmod(fname, stat.S_IREAD) - except OSError: pass - - else: - - if write: - def do_chmod(fname): - try: st = os.stat(fname) - except OSError: pass - else: os.chmod(fname, stat.S_IMODE(st[stat.ST_MODE]|0200)) - else: - def do_chmod(fname): - try: st = os.stat(fname) - except OSError: pass - else: os.chmod(fname, stat.S_IMODE(st[stat.ST_MODE]&~0200)) - - if os.path.isfile(top): - do_chmod(top) - else: - col = Collector(top) - os.path.walk(top, col, None) - for d in col.entries: do_chmod(d) - - def executable(self, top, execute=1): - """Make the specified directory tree executable (execute == 1) - or not (execute == None). - - This method has no effect on Windows systems, which use a - completely different mechanism to control file executability. - """ - - if sys.platform == 'win32': - return - - if execute: - def do_chmod(fname): - try: st = os.stat(fname) - except OSError: pass - else: os.chmod(fname, stat.S_IMODE(st[stat.ST_MODE]|stat.S_IEXEC)) - else: - def do_chmod(fname): - try: st = os.stat(fname) - except OSError: pass - else: os.chmod(fname, stat.S_IMODE(st[stat.ST_MODE]&~stat.S_IEXEC)) - - if os.path.isfile(top): - # If it's a file, that's easy, just chmod it. - do_chmod(top) - elif execute: - # It's a directory and we're trying to turn on execute - # permission, so it's also pretty easy, just chmod the - # directory and then chmod every entry on our walk down the - # tree. Because os.path.walk() is top-down, we'll enable - # execute permission on any directories that have it disabled - # before os.path.walk() tries to list their contents. - do_chmod(top) - - def chmod_entries(arg, dirname, names, do_chmod=do_chmod): - for n in names: - do_chmod(os.path.join(dirname, n)) - - os.path.walk(top, chmod_entries, None) - else: - # It's a directory and we're trying to turn off execute - # permission, which means we have to chmod the directories - # in the tree bottom-up, lest disabling execute permission from - # the top down get in the way of being able to get at lower - # parts of the tree. But os.path.walk() visits things top - # down, so we just use an object to collect a list of all - # of the entries in the tree, reverse the list, and then - # chmod the reversed (bottom-up) list. - col = Collector(top) - os.path.walk(top, col, None) - col.entries.reverse() - for d in col.entries: do_chmod(d) - - def write(self, file, content, mode = 'wb'): - """Writes the specified content text (second argument) to the - specified file name (first argument). The file name may be - a list, in which case the elements are concatenated with the - os.path.join() method. The file is created under the temporary - working directory. Any subdirectories in the path must already - exist. The I/O mode for the file may be specified; it must - begin with a 'w'. The default is 'wb' (binary write). - """ - file = self.canonicalize(file) - if mode[0] != 'w': - raise ValueError, "mode must begin with 'w'" - with open(file, mode) as f: - f.write(content) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/tools/gyp/test/lib/TestCommon.py b/tools/gyp/test/lib/TestCommon.py deleted file mode 100644 index 4aa7185a2f..0000000000 --- a/tools/gyp/test/lib/TestCommon.py +++ /dev/null @@ -1,581 +0,0 @@ -""" -TestCommon.py: a testing framework for commands and scripts - with commonly useful error handling - -The TestCommon module provides a simple, high-level interface for writing -tests of executable commands and scripts, especially commands and scripts -that interact with the file system. All methods throw exceptions and -exit on failure, with useful error messages. This makes a number of -explicit checks unnecessary, making the test scripts themselves simpler -to write and easier to read. - -The TestCommon class is a subclass of the TestCmd class. In essence, -TestCommon is a wrapper that handles common TestCmd error conditions in -useful ways. You can use TestCommon directly, or subclass it for your -program and add additional (or override) methods to tailor it to your -program's specific needs. Alternatively, the TestCommon class serves -as a useful example of how to define your own TestCmd subclass. - -As a subclass of TestCmd, TestCommon provides access to all of the -variables and methods from the TestCmd module. Consequently, you can -use any variable or method documented in the TestCmd module without -having to explicitly import TestCmd. - -A TestCommon environment object is created via the usual invocation: - - import TestCommon - test = TestCommon.TestCommon() - -You can use all of the TestCmd keyword arguments when instantiating a -TestCommon object; see the TestCmd documentation for details. - -Here is an overview of the methods and keyword arguments that are -provided by the TestCommon class: - - test.must_be_writable('file1', ['file2', ...]) - - test.must_contain('file', 'required text\n') - - test.must_contain_all_lines(output, lines, ['title', find]) - - test.must_contain_any_line(output, lines, ['title', find]) - - test.must_exist('file1', ['file2', ...]) - - test.must_match('file', "expected contents\n") - - test.must_not_be_writable('file1', ['file2', ...]) - - test.must_not_contain('file', 'banned text\n') - - test.must_not_contain_any_line(output, lines, ['title', find]) - - test.must_not_exist('file1', ['file2', ...]) - - test.run(options = "options to be prepended to arguments", - stdout = "expected standard output from the program", - stderr = "expected error output from the program", - status = expected_status, - match = match_function) - -The TestCommon module also provides the following variables - - TestCommon.python_executable - TestCommon.exe_suffix - TestCommon.obj_suffix - TestCommon.shobj_prefix - TestCommon.shobj_suffix - TestCommon.lib_prefix - TestCommon.lib_suffix - TestCommon.dll_prefix - TestCommon.dll_suffix - -""" - -# Copyright 2000-2010 Steven Knight -# This module is free software, and you may redistribute it and/or modify -# it under the same terms as Python itself, so long as this copyright message -# and disclaimer are retained in their original form. -# -# IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, -# SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF -# THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -# DAMAGE. -# -# THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -# PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, -# AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, -# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - -__author__ = "Steven Knight " -__revision__ = "TestCommon.py 0.37.D001 2010/01/11 16:55:50 knight" -__version__ = "0.37" - -import copy -import os -import os.path -import stat -import string -import sys -import types -import UserList - -from TestCmd import * -from TestCmd import __all__ - -__all__.extend([ 'TestCommon', - 'exe_suffix', - 'obj_suffix', - 'shobj_prefix', - 'shobj_suffix', - 'lib_prefix', - 'lib_suffix', - 'dll_prefix', - 'dll_suffix', - ]) - -# Variables that describe the prefixes and suffixes on this system. -if sys.platform == 'win32': - exe_suffix = '.exe' - obj_suffix = '.obj' - shobj_suffix = '.obj' - shobj_prefix = '' - lib_prefix = '' - lib_suffix = '.lib' - dll_prefix = '' - dll_suffix = '.dll' -elif sys.platform == 'cygwin': - exe_suffix = '.exe' - obj_suffix = '.o' - shobj_suffix = '.os' - shobj_prefix = '' - lib_prefix = 'lib' - lib_suffix = '.a' - dll_prefix = '' - dll_suffix = '.dll' -elif string.find(sys.platform, 'irix') != -1: - exe_suffix = '' - obj_suffix = '.o' - shobj_suffix = '.o' - shobj_prefix = '' - lib_prefix = 'lib' - lib_suffix = '.a' - dll_prefix = 'lib' - dll_suffix = '.so' -elif string.find(sys.platform, 'darwin') != -1: - exe_suffix = '' - obj_suffix = '.o' - shobj_suffix = '.os' - shobj_prefix = '' - lib_prefix = 'lib' - lib_suffix = '.a' - dll_prefix = 'lib' - dll_suffix = '.dylib' -elif string.find(sys.platform, 'sunos') != -1: - exe_suffix = '' - obj_suffix = '.o' - shobj_suffix = '.os' - shobj_prefix = 'so_' - lib_prefix = 'lib' - lib_suffix = '.a' - dll_prefix = 'lib' - dll_suffix = '.dylib' -else: - exe_suffix = '' - obj_suffix = '.o' - shobj_suffix = '.os' - shobj_prefix = '' - lib_prefix = 'lib' - lib_suffix = '.a' - dll_prefix = 'lib' - dll_suffix = '.so' - -def is_List(e): - return type(e) is types.ListType \ - or isinstance(e, UserList.UserList) - -def is_writable(f): - mode = os.stat(f)[stat.ST_MODE] - return mode & stat.S_IWUSR - -def separate_files(flist): - existing = [] - missing = [] - for f in flist: - if os.path.exists(f): - existing.append(f) - else: - missing.append(f) - return existing, missing - -if os.name == 'posix': - def _failed(self, status = 0): - if self.status is None or status is None: - return None - return _status(self) != status - def _status(self): - return self.status -elif os.name == 'nt': - def _failed(self, status = 0): - return not (self.status is None or status is None) and \ - self.status != status - def _status(self): - return self.status - -class TestCommon(TestCmd): - - # Additional methods from the Perl Test::Cmd::Common module - # that we may wish to add in the future: - # - # $test->subdir('subdir', ...); - # - # $test->copy('src_file', 'dst_file'); - - def __init__(self, **kw): - """Initialize a new TestCommon instance. This involves just - calling the base class initialization, and then changing directory - to the workdir. - """ - apply(TestCmd.__init__, [self], kw) - os.chdir(self.workdir) - - def must_be_writable(self, *files): - """Ensures that the specified file(s) exist and are writable. - An individual file can be specified as a list of directory names, - in which case the pathname will be constructed by concatenating - them. Exits FAILED if any of the files does not exist or is - not writable. - """ - files = map(lambda x: is_List(x) and apply(os.path.join, x) or x, files) - existing, missing = separate_files(files) - unwritable = filter(lambda x, iw=is_writable: not iw(x), existing) - if missing: - print "Missing files: `%s'" % string.join(missing, "', `") - if unwritable: - print "Unwritable files: `%s'" % string.join(unwritable, "', `") - self.fail_test(missing + unwritable) - - def must_contain(self, file, required, mode = 'rb'): - """Ensures that the specified file contains the required text. - """ - file_contents = self.read(file, mode) - contains = (string.find(file_contents, required) != -1) - if not contains: - print "File `%s' does not contain required string." % file - print self.banner('Required string ') - print required - print self.banner('%s contents ' % file) - print file_contents - self.fail_test(not contains) - - def must_contain_all_lines(self, output, lines, title=None, find=None): - """Ensures that the specified output string (first argument) - contains all of the specified lines (second argument). - - An optional third argument can be used to describe the type - of output being searched, and only shows up in failure output. - - An optional fourth argument can be used to supply a different - function, of the form "find(line, output), to use when searching - for lines in the output. - """ - if find is None: - find = lambda o, l: string.find(o, l) != -1 - missing = [] - for line in lines: - if not find(output, line): - missing.append(line) - - if missing: - if title is None: - title = 'output' - sys.stdout.write("Missing expected lines from %s:\n" % title) - for line in missing: - sys.stdout.write(' ' + repr(line) + '\n') - sys.stdout.write(self.banner(title + ' ')) - sys.stdout.write(output) - self.fail_test() - - def must_contain_any_line(self, output, lines, title=None, find=None): - """Ensures that the specified output string (first argument) - contains at least one of the specified lines (second argument). - - An optional third argument can be used to describe the type - of output being searched, and only shows up in failure output. - - An optional fourth argument can be used to supply a different - function, of the form "find(line, output), to use when searching - for lines in the output. - """ - if find is None: - find = lambda o, l: string.find(o, l) != -1 - for line in lines: - if find(output, line): - return - - if title is None: - title = 'output' - sys.stdout.write("Missing any expected line from %s:\n" % title) - for line in lines: - sys.stdout.write(' ' + repr(line) + '\n') - sys.stdout.write(self.banner(title + ' ')) - sys.stdout.write(output) - self.fail_test() - - def must_contain_lines(self, lines, output, title=None): - # Deprecated; retain for backwards compatibility. - return self.must_contain_all_lines(output, lines, title) - - def must_exist(self, *files): - """Ensures that the specified file(s) must exist. An individual - file be specified as a list of directory names, in which case the - pathname will be constructed by concatenating them. Exits FAILED - if any of the files does not exist. - """ - files = map(lambda x: is_List(x) and apply(os.path.join, x) or x, files) - missing = filter(lambda x: not os.path.exists(x), files) - if missing: - print "Missing files: `%s'" % string.join(missing, "', `") - self.fail_test(missing) - - def must_match(self, file, expect, mode = 'rb'): - """Matches the contents of the specified file (first argument) - against the expected contents (second argument). The expected - contents are a list of lines or a string which will be split - on newlines. - """ - file_contents = self.read(file, mode) - try: - self.fail_test(not self.match(file_contents, expect)) - except KeyboardInterrupt: - raise - except: - print "Unexpected contents of `%s'" % file - self.diff(expect, file_contents, 'contents ') - raise - - def must_not_contain(self, file, banned, mode = 'rb'): - """Ensures that the specified file doesn't contain the banned text. - """ - file_contents = self.read(file, mode) - contains = (string.find(file_contents, banned) != -1) - if contains: - print "File `%s' contains banned string." % file - print self.banner('Banned string ') - print banned - print self.banner('%s contents ' % file) - print file_contents - self.fail_test(contains) - - def must_not_contain_any_line(self, output, lines, title=None, find=None): - """Ensures that the specified output string (first argument) - does not contain any of the specified lines (second argument). - - An optional third argument can be used to describe the type - of output being searched, and only shows up in failure output. - - An optional fourth argument can be used to supply a different - function, of the form "find(line, output), to use when searching - for lines in the output. - """ - if find is None: - find = lambda o, l: string.find(o, l) != -1 - unexpected = [] - for line in lines: - if find(output, line): - unexpected.append(line) - - if unexpected: - if title is None: - title = 'output' - sys.stdout.write("Unexpected lines in %s:\n" % title) - for line in unexpected: - sys.stdout.write(' ' + repr(line) + '\n') - sys.stdout.write(self.banner(title + ' ')) - sys.stdout.write(output) - self.fail_test() - - def must_not_contain_lines(self, lines, output, title=None): - return self.must_not_contain_any_line(output, lines, title) - - def must_not_exist(self, *files): - """Ensures that the specified file(s) must not exist. - An individual file be specified as a list of directory names, in - which case the pathname will be constructed by concatenating them. - Exits FAILED if any of the files exists. - """ - files = map(lambda x: is_List(x) and apply(os.path.join, x) or x, files) - existing = filter(os.path.exists, files) - if existing: - print "Unexpected files exist: `%s'" % string.join(existing, "', `") - self.fail_test(existing) - - - def must_not_be_writable(self, *files): - """Ensures that the specified file(s) exist and are not writable. - An individual file can be specified as a list of directory names, - in which case the pathname will be constructed by concatenating - them. Exits FAILED if any of the files does not exist or is - writable. - """ - files = map(lambda x: is_List(x) and apply(os.path.join, x) or x, files) - existing, missing = separate_files(files) - writable = filter(is_writable, existing) - if missing: - print "Missing files: `%s'" % string.join(missing, "', `") - if writable: - print "Writable files: `%s'" % string.join(writable, "', `") - self.fail_test(missing + writable) - - def _complete(self, actual_stdout, expected_stdout, - actual_stderr, expected_stderr, status, match): - """ - Post-processes running a subcommand, checking for failure - status and displaying output appropriately. - """ - if _failed(self, status): - expect = '' - if status != 0: - expect = " (expected %s)" % str(status) - print "%s returned %s%s" % (self.program, str(_status(self)), expect) - print self.banner('STDOUT ') - print actual_stdout - print self.banner('STDERR ') - print actual_stderr - self.fail_test() - if not expected_stdout is None and not match(actual_stdout, expected_stdout): - self.diff(expected_stdout, actual_stdout, 'STDOUT ') - if actual_stderr: - print self.banner('STDERR ') - print actual_stderr - self.fail_test() - if not expected_stderr is None and not match(actual_stderr, expected_stderr): - print self.banner('STDOUT ') - print actual_stdout - self.diff(expected_stderr, actual_stderr, 'STDERR ') - self.fail_test() - - def start(self, program = None, - interpreter = None, - arguments = None, - universal_newlines = None, - **kw): - """ - Starts a program or script for the test environment. - - This handles the "options" keyword argument and exceptions. - """ - try: - options = kw['options'] - del kw['options'] - except KeyError: - pass - else: - if options: - if arguments is None: - arguments = options - else: - arguments = options + " " + arguments - try: - return apply(TestCmd.start, - (self, program, interpreter, arguments, universal_newlines), - kw) - except KeyboardInterrupt: - raise - except Exception, e: - print self.banner('STDOUT ') - try: - print self.stdout() - except IndexError: - pass - print self.banner('STDERR ') - try: - print self.stderr() - except IndexError: - pass - cmd_args = self.command_args(program, interpreter, arguments) - sys.stderr.write('Exception trying to execute: %s\n' % cmd_args) - raise e - - def finish(self, popen, stdout = None, stderr = '', status = 0, **kw): - """ - Finishes and waits for the process being run under control of - the specified popen argument. Additional arguments are similar - to those of the run() method: - - stdout The expected standard output from - the command. A value of None means - don't test standard output. - - stderr The expected error output from - the command. A value of None means - don't test error output. - - status The expected exit status from the - command. A value of None means don't - test exit status. - """ - apply(TestCmd.finish, (self, popen,), kw) - match = kw.get('match', self.match) - self._complete(self.stdout(), stdout, - self.stderr(), stderr, status, match) - - def run(self, options = None, arguments = None, - stdout = None, stderr = '', status = 0, **kw): - """Runs the program under test, checking that the test succeeded. - - The arguments are the same as the base TestCmd.run() method, - with the addition of: - - options Extra options that get appended to the beginning - of the arguments. - - stdout The expected standard output from - the command. A value of None means - don't test standard output. - - stderr The expected error output from - the command. A value of None means - don't test error output. - - status The expected exit status from the - command. A value of None means don't - test exit status. - - By default, this expects a successful exit (status = 0), does - not test standard output (stdout = None), and expects that error - output is empty (stderr = ""). - """ - if options: - if arguments is None: - arguments = options - else: - arguments = options + " " + arguments - kw['arguments'] = arguments - try: - match = kw['match'] - del kw['match'] - except KeyError: - match = self.match - apply(TestCmd.run, [self], kw) - self._complete(self.stdout(), stdout, - self.stderr(), stderr, status, match) - - def skip_test(self, message="Skipping test.\n"): - """Skips a test. - - Proper test-skipping behavior is dependent on the external - TESTCOMMON_PASS_SKIPS environment variable. If set, we treat - the skip as a PASS (exit 0), and otherwise treat it as NO RESULT. - In either case, we print the specified message as an indication - that the substance of the test was skipped. - - (This was originally added to support development under Aegis. - Technically, skipping a test is a NO RESULT, but Aegis would - treat that as a test failure and prevent the change from going to - the next step. Since we ddn't want to force anyone using Aegis - to have to install absolutely every tool used by the tests, we - would actually report to Aegis that a skipped test has PASSED - so that the workflow isn't held up.) - """ - if message: - sys.stdout.write(message) - sys.stdout.flush() - pass_skips = os.environ.get('TESTCOMMON_PASS_SKIPS') - if pass_skips in [None, 0, '0']: - # skip=1 means skip this function when showing where this - # result came from. They only care about the line where the - # script called test.skip_test(), not the line number where - # we call test.no_result(). - self.no_result(skip=1) - else: - # We're under the development directory for this change, - # so this is an Aegis invocation; pass the test (exit 0). - self.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/tools/gyp/test/lib/TestGyp.py b/tools/gyp/test/lib/TestGyp.py deleted file mode 100644 index 7fbb56bfac..0000000000 --- a/tools/gyp/test/lib/TestGyp.py +++ /dev/null @@ -1,808 +0,0 @@ -# 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. - -""" -TestGyp.py: a testing framework for GYP integration tests. -""" - -import os -import re -import shutil -import stat -import sys -import tempfile - -import TestCommon -from TestCommon import __all__ - -__all__.extend([ - 'TestGyp', -]) - - -class TestGypBase(TestCommon.TestCommon): - """ - Class for controlling end-to-end tests of gyp generators. - - Instantiating this class will create a temporary directory and - arrange for its destruction (via the TestCmd superclass) and - copy all of the non-gyptest files in the directory hierarchy of the - executing script. - - The default behavior is to test the 'gyp' or 'gyp.bat' file in the - current directory. An alternative may be specified explicitly on - instantiation, or by setting the TESTGYP_GYP environment variable. - - This class should be subclassed for each supported gyp generator - (format). Various abstract methods below define calling signatures - used by the test scripts to invoke builds on the generated build - configuration and to run executables generated by those builds. - """ - - build_tool = None - build_tool_list = [] - - _exe = TestCommon.exe_suffix - _obj = TestCommon.obj_suffix - shobj_ = TestCommon.shobj_prefix - _shobj = TestCommon.shobj_suffix - lib_ = TestCommon.lib_prefix - _lib = TestCommon.lib_suffix - dll_ = TestCommon.dll_prefix - _dll = TestCommon.dll_suffix - - # Constants to represent different targets. - ALL = '__all__' - DEFAULT = '__default__' - - # Constants for different target types. - EXECUTABLE = '__executable__' - STATIC_LIB = '__static_lib__' - SHARED_LIB = '__shared_lib__' - - def __init__(self, gyp=None, *args, **kw): - self.origin_cwd = os.path.abspath(os.path.dirname(sys.argv[0])) - - if not gyp: - gyp = os.environ.get('TESTGYP_GYP') - if not gyp: - if sys.platform == 'win32': - gyp = 'gyp.bat' - else: - gyp = 'gyp' - self.gyp = os.path.abspath(gyp) - - self.initialize_build_tool() - - if not kw.has_key('match'): - kw['match'] = TestCommon.match_exact - - # Put test output in out/testworkarea by default. - # Use temporary names so there are no collisions. - workdir = os.path.join('out', kw.get('workdir', 'testworkarea')) - # Create work area if it doesn't already exist. - try: - os.makedirs(workdir) - except OSError: - pass - kw['workdir'] = tempfile.mktemp(prefix='testgyp.', dir=workdir) - - formats = kw.get('formats', []) - if kw.has_key('formats'): - del kw['formats'] - - super(TestGypBase, self).__init__(*args, **kw) - - excluded_formats = set([f for f in formats if f[0] == '!']) - included_formats = set(formats) - excluded_formats - if ('!'+self.format in excluded_formats or - included_formats and self.format not in included_formats): - msg = 'Invalid test for %r format; skipping test.\n' - self.skip_test(msg % self.format) - - self.copy_test_configuration(self.origin_cwd, self.workdir) - self.set_configuration(None) - - # Set $HOME so that gyp doesn't read the user's actual - # ~/.gyp/include.gypi file, which may contain variables - # and other settings that would change the output. - os.environ['HOME'] = self.workpath() - # Clear $GYP_DEFINES for the same reason. - if 'GYP_DEFINES' in os.environ: - del os.environ['GYP_DEFINES'] - - def built_file_must_exist(self, name, type=None, **kw): - """ - Fails the test if the specified built file name does not exist. - """ - return self.must_exist(self.built_file_path(name, type, **kw)) - - def built_file_must_not_exist(self, name, type=None, **kw): - """ - Fails the test if the specified built file name exists. - """ - return self.must_not_exist(self.built_file_path(name, type, **kw)) - - def built_file_must_match(self, name, contents, **kw): - """ - Fails the test if the contents of the specified built file name - do not match the specified contents. - """ - return self.must_match(self.built_file_path(name, **kw), contents) - - def built_file_must_not_match(self, name, contents, **kw): - """ - Fails the test if the contents of the specified built file name - match the specified contents. - """ - return self.must_not_match(self.built_file_path(name, **kw), contents) - - def copy_test_configuration(self, source_dir, dest_dir): - """ - Copies the test configuration from the specified source_dir - (the directory in which the test script lives) to the - specified dest_dir (a temporary working directory). - - This ignores all files and directories that begin with - the string 'gyptest', and all '.svn' subdirectories. - """ - for root, dirs, files in os.walk(source_dir): - if '.svn' in dirs: - dirs.remove('.svn') - dirs = [ d for d in dirs if not d.startswith('gyptest') ] - files = [ f for f in files if not f.startswith('gyptest') ] - for dirname in dirs: - source = os.path.join(root, dirname) - destination = source.replace(source_dir, dest_dir) - os.mkdir(destination) - if sys.platform != 'win32': - shutil.copystat(source, destination) - for filename in files: - source = os.path.join(root, filename) - destination = source.replace(source_dir, dest_dir) - shutil.copy2(source, destination) - - def initialize_build_tool(self): - """ - Initializes the .build_tool attribute. - - Searches the .build_tool_list for an executable name on the user's - $PATH. The first tool on the list is used as-is if nothing is found - on the current $PATH. - """ - for build_tool in self.build_tool_list: - if not build_tool: - continue - if os.path.isabs(build_tool): - self.build_tool = build_tool - return - build_tool = self.where_is(build_tool) - if build_tool: - self.build_tool = build_tool - return - - if self.build_tool_list: - self.build_tool = self.build_tool_list[0] - - def relocate(self, source, destination): - """ - Renames (relocates) the specified source (usually a directory) - to the specified destination, creating the destination directory - first if necessary. - - Note: Don't use this as a generic "rename" operation. In the - future, "relocating" parts of a GYP tree may affect the state of - the test to modify the behavior of later method calls. - """ - destination_dir = os.path.dirname(destination) - if not os.path.exists(destination_dir): - self.subdir(destination_dir) - os.rename(source, destination) - - def report_not_up_to_date(self): - """ - Reports that a build is not up-to-date. - - This provides common reporting for formats that have complicated - conditions for checking whether a build is up-to-date. Formats - that expect exact output from the command (make, scons) can - just set stdout= when they call the run_build() method. - """ - print "Build is not up-to-date:" - print self.banner('STDOUT ') - print self.stdout() - stderr = self.stderr() - if stderr: - print self.banner('STDERR ') - print stderr - - def run_gyp(self, gyp_file, *args, **kw): - """ - Runs gyp against the specified gyp_file with the specified args. - """ - # TODO: --depth=. works around Chromium-specific tree climbing. - depth = '.' - if 'depth' in kw: - depth = kw['depth'] - del kw['depth'] - args = ('--depth='+depth, '--format='+self.format, gyp_file) + args - return self.run(program=self.gyp, arguments=args, **kw) - - def run(self, *args, **kw): - """ - Executes a program by calling the superclass .run() method. - - This exists to provide a common place to filter out keyword - arguments implemented in this layer, without having to update - the tool-specific subclasses or clutter the tests themselves - with platform-specific code. - """ - if kw.has_key('SYMROOT'): - del kw['SYMROOT'] - super(TestGypBase, self).run(*args, **kw) - - def set_configuration(self, configuration): - """ - Sets the configuration, to be used for invoking the build - tool and testing potential built output. - """ - self.configuration = configuration - - def configuration_dirname(self): - if self.configuration: - return self.configuration.split('|')[0] - else: - return 'Default' - - def configuration_buildname(self): - if self.configuration: - return self.configuration - else: - return 'Default' - - # - # Abstract methods to be defined by format-specific subclasses. - # - - def build(self, gyp_file, target=None, **kw): - """ - Runs a build of the specified target against the configuration - generated from the specified gyp_file. - - A 'target' argument of None or the special value TestGyp.DEFAULT - specifies the default argument for the underlying build tool. - A 'target' argument of TestGyp.ALL specifies the 'all' target - (if any) of the underlying build tool. - """ - raise NotImplementedError - - def built_file_path(self, name, type=None, **kw): - """ - Returns a path to the specified file name, of the specified type. - """ - raise NotImplementedError - - def built_file_basename(self, name, type=None, **kw): - """ - Returns the base name of the specified file name, of the specified type. - - A bare=True keyword argument specifies that prefixes and suffixes shouldn't - be applied. - """ - if not kw.get('bare'): - if type == self.EXECUTABLE: - name = name + self._exe - elif type == self.STATIC_LIB: - name = self.lib_ + name + self._lib - elif type == self.SHARED_LIB: - name = self.dll_ + name + self._dll - return name - - def run_built_executable(self, name, *args, **kw): - """ - Runs an executable program built from a gyp-generated configuration. - - The specified name should be independent of any particular generator. - Subclasses should find the output executable in the appropriate - output build directory, tack on any necessary executable suffix, etc. - """ - raise NotImplementedError - - def up_to_date(self, gyp_file, target=None, **kw): - """ - Verifies that a build of the specified target is up to date. - - The subclass should implement this by calling build() - (or a reasonable equivalent), checking whatever conditions - will tell it the build was an "up to date" null build, and - failing if it isn't. - """ - raise NotImplementedError - - -class TestGypGypd(TestGypBase): - """ - Subclass for testing the GYP 'gypd' generator (spit out the - internal data structure as pretty-printed Python). - """ - format = 'gypd' - - -class TestGypMake(TestGypBase): - """ - Subclass for testing the GYP Make generator. - """ - format = 'make' - build_tool_list = ['make'] - ALL = 'all' - def build(self, gyp_file, target=None, **kw): - """ - Runs a Make build using the Makefiles generated from the specified - gyp_file. - """ - arguments = kw.get('arguments', [])[:] - if self.configuration: - arguments.append('BUILDTYPE=' + self.configuration) - if target not in (None, self.DEFAULT): - arguments.append(target) - # Sub-directory builds provide per-gyp Makefiles (i.e. - # Makefile.gyp_filename), so use that if there is no Makefile. - chdir = kw.get('chdir', '') - if not os.path.exists(os.path.join(chdir, 'Makefile')): - print "NO Makefile in " + os.path.join(chdir, 'Makefile') - arguments.insert(0, '-f') - arguments.insert(1, os.path.splitext(gyp_file)[0] + '.Makefile') - kw['arguments'] = arguments - return self.run(program=self.build_tool, **kw) - def up_to_date(self, gyp_file, target=None, **kw): - """ - Verifies that a build of the specified Make target is up to date. - """ - if target in (None, self.DEFAULT): - message_target = 'all' - else: - message_target = target - kw['stdout'] = "make: Nothing to be done for `%s'.\n" % message_target - return self.build(gyp_file, target, **kw) - def run_built_executable(self, name, *args, **kw): - """ - Runs an executable built by Make. - """ - configuration = self.configuration_dirname() - libdir = os.path.join('out', configuration, 'lib') - # TODO(piman): when everything is cross-compile safe, remove lib.target - os.environ['LD_LIBRARY_PATH'] = libdir + '.host:' + libdir + '.target' - # Enclosing the name in a list avoids prepending the original dir. - program = [self.built_file_path(name, type=self.EXECUTABLE, **kw)] - return self.run(program=program, *args, **kw) - def built_file_path(self, name, type=None, **kw): - """ - Returns a path to the specified file name, of the specified type, - as built by Make. - - Built files are in the subdirectory 'out/{configuration}'. - The default is 'out/Default'. - - A chdir= keyword argument specifies the source directory - relative to which the output subdirectory can be found. - - "type" values of STATIC_LIB or SHARED_LIB append the necessary - prefixes and suffixes to a platform-independent library base name. - - A subdir= keyword argument specifies a library subdirectory within - the default 'obj.target'. - """ - result = [] - chdir = kw.get('chdir') - if chdir: - result.append(chdir) - configuration = self.configuration_dirname() - result.extend(['out', configuration]) - if type == self.STATIC_LIB and sys.platform != 'darwin': - result.append('obj.target') - elif type == self.SHARED_LIB and sys.platform != 'darwin': - result.append('lib.target') - subdir = kw.get('subdir') - if subdir: - result.append(subdir) - result.append(self.built_file_basename(name, type, **kw)) - return self.workpath(*result) - - -class TestGypNinja(TestGypBase): - """ - Subclass for testing the GYP Ninja generator. - """ - format = 'ninja' - build_tool_list = ['ninja'] - ALL = 'all' - DEFAULT = 'all' - - def run_gyp(self, gyp_file, *args, **kw): - TestGypBase.run_gyp(self, gyp_file, *args, **kw) - - def build(self, gyp_file, target=None, **kw): - arguments = kw.get('arguments', [])[:] - - # Add a -C output/path to the command line. - arguments.append('-C') - arguments.append(os.path.join('out', self.configuration_dirname())) - - if target is None: - target = 'all' - arguments.append(target) - - kw['arguments'] = arguments - return self.run(program=self.build_tool, **kw) - - def run_built_executable(self, name, *args, **kw): - # Enclosing the name in a list avoids prepending the original dir. - program = [self.built_file_path(name, type=self.EXECUTABLE, **kw)] - if sys.platform == 'darwin': - libdir = os.path.join('out', 'Default') - if self.configuration: - libdir = os.path.join('out', self.configuration) - os.environ['DYLD_LIBRARY_PATH'] = libdir - return self.run(program=program, *args, **kw) - - def built_file_path(self, name, type=None, **kw): - result = [] - chdir = kw.get('chdir') - if chdir: - result.append(chdir) - result.append('out') - result.append(self.configuration_dirname()) - if type == self.STATIC_LIB: - if sys.platform != 'darwin': - result.append('obj') - elif type == self.SHARED_LIB: - if sys.platform != 'darwin': - result.append('lib') - subdir = kw.get('subdir') - if subdir: - result.append(subdir) - result.append(self.built_file_basename(name, type, **kw)) - return self.workpath(*result) - - def up_to_date(self, gyp_file, target=None, **kw): - result = self.build(gyp_file, target, **kw) - if not result: - stdout = self.stdout() - if 'ninja: no work to do' not in stdout: - self.report_not_up_to_date() - self.fail_test() - return result - - -class TestGypMSVS(TestGypBase): - """ - Subclass for testing the GYP Visual Studio generator. - """ - format = 'msvs' - - u = r'=== Build: 0 succeeded, 0 failed, (\d+) up-to-date, 0 skipped ===' - up_to_date_re = re.compile(u, re.M) - - # Initial None element will indicate to our .initialize_build_tool() - # method below that 'devenv' was not found on %PATH%. - # - # Note: we must use devenv.com to be able to capture build output. - # Directly executing devenv.exe only sends output to BuildLog.htm. - build_tool_list = [None, 'devenv.com'] - - def initialize_build_tool(self): - """ Initializes the Visual Studio .build_tool and .uses_msbuild parameters. - - We use the value specified by GYP_MSVS_VERSION. If not specified, we - search %PATH% and %PATHEXT% for a devenv.{exe,bat,...} executable. - Failing that, we search for likely deployment paths. - """ - super(TestGypMSVS, self).initialize_build_tool() - possible_roots = ['C:\\Program Files (x86)', 'C:\\Program Files', - 'E:\\Program Files (x86)', 'E:\\Program Files'] - possible_paths = { - '2010': r'Microsoft Visual Studio 10.0\Common7\IDE\devenv.com', - '2008': r'Microsoft Visual Studio 9.0\Common7\IDE\devenv.com', - '2005': r'Microsoft Visual Studio 8\Common7\IDE\devenv.com'} - msvs_version = os.environ.get('GYP_MSVS_VERSION', 'auto') - if msvs_version in possible_paths: - # Check that the path to the specified GYP_MSVS_VERSION exists. - path = possible_paths[msvs_version] - for r in possible_roots: - bt = os.path.join(r, path) - if os.path.exists(bt): - self.build_tool = bt - self.uses_msbuild = msvs_version >= '2010' - return - else: - print ('Warning: Environment variable GYP_MSVS_VERSION specifies "%s" ' - 'but corresponding "%s" was not found.' % (msvs_version, path)) - if self.build_tool: - # We found 'devenv' on the path, use that and try to guess the version. - for version, path in possible_paths.iteritems(): - if self.build_tool.find(path) >= 0: - self.uses_msbuild = version >= '2010' - return - else: - # If not, assume not MSBuild. - self.uses_msbuild = False - return - # Neither GYP_MSVS_VERSION nor the path help us out. Iterate through - # the choices looking for a match. - for version, path in possible_paths.iteritems(): - for r in possible_roots: - bt = os.path.join(r, path) - if os.path.exists(bt): - self.build_tool = bt - self.uses_msbuild = msvs_version >= '2010' - return - print 'Error: could not find devenv' - sys.exit(1) - def build(self, gyp_file, target=None, rebuild=False, **kw): - """ - Runs a Visual Studio build using the configuration generated - from the specified gyp_file. - """ - configuration = self.configuration_buildname() - if rebuild: - build = '/Rebuild' - else: - build = '/Build' - arguments = kw.get('arguments', [])[:] - arguments.extend([gyp_file.replace('.gyp', '.sln'), - build, configuration]) - # Note: the Visual Studio generator doesn't add an explicit 'all' - # target, so we just treat it the same as the default. - if target not in (None, self.ALL, self.DEFAULT): - arguments.extend(['/Project', target]) - if self.configuration: - arguments.extend(['/ProjectConfig', self.configuration]) - kw['arguments'] = arguments - return self.run(program=self.build_tool, **kw) - def up_to_date(self, gyp_file, target=None, **kw): - """ - Verifies that a build of the specified Visual Studio target is up to date. - - Beware that VS2010 will behave strangely if you build under - C:\USERS\yourname\AppData\Local. It will cause needless work. The ouptut - will be "1 succeeded and 0 up to date". MSBuild tracing reveals that: - "Project 'C:\Users\...\AppData\Local\...vcxproj' not up to date because - 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 10.0\VC\BIN\1033\CLUI.DLL' - was modified at 02/21/2011 17:03:30, which is newer than '' which was - modified at 01/01/0001 00:00:00. - - The workaround is to specify a workdir when instantiating the test, e.g. - test = TestGyp.TestGyp(workdir='workarea') - """ - result = self.build(gyp_file, target, **kw) - if not result: - stdout = self.stdout() - - m = self.up_to_date_re.search(stdout) - up_to_date = m and m.group(1) == '1' - if not up_to_date: - self.report_not_up_to_date() - self.fail_test() - return result - def run_built_executable(self, name, *args, **kw): - """ - Runs an executable built by Visual Studio. - """ - configuration = self.configuration_dirname() - # Enclosing the name in a list avoids prepending the original dir. - program = [self.built_file_path(name, type=self.EXECUTABLE, **kw)] - return self.run(program=program, *args, **kw) - def built_file_path(self, name, type=None, **kw): - """ - Returns a path to the specified file name, of the specified type, - as built by Visual Studio. - - Built files are in a subdirectory that matches the configuration - name. The default is 'Default'. - - A chdir= keyword argument specifies the source directory - relative to which the output subdirectory can be found. - - "type" values of STATIC_LIB or SHARED_LIB append the necessary - prefixes and suffixes to a platform-independent library base name. - """ - result = [] - chdir = kw.get('chdir') - if chdir: - result.append(chdir) - result.append(self.configuration_dirname()) - if type == self.STATIC_LIB: - result.append('lib') - result.append(self.built_file_basename(name, type, **kw)) - return self.workpath(*result) - - -class TestGypSCons(TestGypBase): - """ - Subclass for testing the GYP SCons generator. - """ - format = 'scons' - build_tool_list = ['scons', 'scons.py'] - ALL = 'all' - def build(self, gyp_file, target=None, **kw): - """ - Runs a scons build using the SCons configuration generated from the - specified gyp_file. - """ - arguments = kw.get('arguments', [])[:] - dirname = os.path.dirname(gyp_file) - if dirname: - arguments.extend(['-C', dirname]) - if self.configuration: - arguments.append('--mode=' + self.configuration) - if target not in (None, self.DEFAULT): - arguments.append(target) - kw['arguments'] = arguments - return self.run(program=self.build_tool, **kw) - def up_to_date(self, gyp_file, target=None, **kw): - """ - Verifies that a build of the specified SCons target is up to date. - """ - if target in (None, self.DEFAULT): - up_to_date_targets = 'all' - else: - up_to_date_targets = target - up_to_date_lines = [] - for arg in up_to_date_targets.split(): - up_to_date_lines.append("scons: `%s' is up to date.\n" % arg) - kw['stdout'] = ''.join(up_to_date_lines) - arguments = kw.get('arguments', [])[:] - arguments.append('-Q') - kw['arguments'] = arguments - return self.build(gyp_file, target, **kw) - def run_built_executable(self, name, *args, **kw): - """ - Runs an executable built by scons. - """ - configuration = self.configuration_dirname() - os.environ['LD_LIBRARY_PATH'] = os.path.join(configuration, 'lib') - # Enclosing the name in a list avoids prepending the original dir. - program = [self.built_file_path(name, type=self.EXECUTABLE, **kw)] - return self.run(program=program, *args, **kw) - def built_file_path(self, name, type=None, **kw): - """ - Returns a path to the specified file name, of the specified type, - as built by Scons. - - Built files are in a subdirectory that matches the configuration - name. The default is 'Default'. - - A chdir= keyword argument specifies the source directory - relative to which the output subdirectory can be found. - - "type" values of STATIC_LIB or SHARED_LIB append the necessary - prefixes and suffixes to a platform-independent library base name. - """ - result = [] - chdir = kw.get('chdir') - if chdir: - result.append(chdir) - result.append(self.configuration_dirname()) - if type in (self.STATIC_LIB, self.SHARED_LIB): - result.append('lib') - result.append(self.built_file_basename(name, type, **kw)) - return self.workpath(*result) - - -class TestGypXcode(TestGypBase): - """ - Subclass for testing the GYP Xcode generator. - """ - format = 'xcode' - build_tool_list = ['xcodebuild'] - - phase_script_execution = ("\n" - "PhaseScriptExecution /\\S+/Script-[0-9A-F]+\\.sh\n" - " cd /\\S+\n" - " /bin/sh -c /\\S+/Script-[0-9A-F]+\\.sh\n" - "(make: Nothing to be done for `all'\\.\n)?") - - strip_up_to_date_expressions = [ - # Various actions or rules can run even when the overall build target - # is up to date. Strip those phases' GYP-generated output. - re.compile(phase_script_execution, re.S), - - # The message from distcc_pump can trail the "BUILD SUCCEEDED" - # message, so strip that, too. - re.compile('__________Shutting down distcc-pump include server\n', re.S), - ] - - up_to_date_endings = ( - 'Checking Dependencies...\n** BUILD SUCCEEDED **\n', # Xcode 3.0/3.1 - 'Check dependencies\n** BUILD SUCCEEDED **\n\n', # Xcode 3.2 - ) - - def build(self, gyp_file, target=None, **kw): - """ - Runs an xcodebuild using the .xcodeproj generated from the specified - gyp_file. - """ - # Be sure we're working with a copy of 'arguments' since we modify it. - # The caller may not be expecting it to be modified. - arguments = kw.get('arguments', [])[:] - arguments.extend(['-project', gyp_file.replace('.gyp', '.xcodeproj')]) - if target == self.ALL: - arguments.append('-alltargets',) - elif target not in (None, self.DEFAULT): - arguments.extend(['-target', target]) - if self.configuration: - arguments.extend(['-configuration', self.configuration]) - symroot = kw.get('SYMROOT', '$SRCROOT/build') - if symroot: - arguments.append('SYMROOT='+symroot) - kw['arguments'] = arguments - return self.run(program=self.build_tool, **kw) - def up_to_date(self, gyp_file, target=None, **kw): - """ - Verifies that a build of the specified Xcode target is up to date. - """ - result = self.build(gyp_file, target, **kw) - if not result: - output = self.stdout() - for expression in self.strip_up_to_date_expressions: - output = expression.sub('', output) - if not output.endswith(self.up_to_date_endings): - self.report_not_up_to_date() - self.fail_test() - return result - def run_built_executable(self, name, *args, **kw): - """ - Runs an executable built by xcodebuild. - """ - configuration = self.configuration_dirname() - os.environ['DYLD_LIBRARY_PATH'] = os.path.join('build', configuration) - # Enclosing the name in a list avoids prepending the original dir. - program = [self.built_file_path(name, type=self.EXECUTABLE, **kw)] - return self.run(program=program, *args, **kw) - def built_file_path(self, name, type=None, **kw): - """ - Returns a path to the specified file name, of the specified type, - as built by Xcode. - - Built files are in the subdirectory 'build/{configuration}'. - The default is 'build/Default'. - - A chdir= keyword argument specifies the source directory - relative to which the output subdirectory can be found. - - "type" values of STATIC_LIB or SHARED_LIB append the necessary - prefixes and suffixes to a platform-independent library base name. - """ - result = [] - chdir = kw.get('chdir') - if chdir: - result.append(chdir) - configuration = self.configuration_dirname() - result.extend(['build', configuration]) - result.append(self.built_file_basename(name, type, **kw)) - return self.workpath(*result) - - -format_class_list = [ - TestGypGypd, - TestGypMake, - TestGypMSVS, - TestGypNinja, - TestGypSCons, - TestGypXcode, -] - -def TestGyp(*args, **kw): - """ - Returns an appropriate TestGyp* instance for a specified GYP format. - """ - format = kw.get('format') - if format: - del kw['format'] - else: - format = os.environ.get('TESTGYP_FORMAT') - for format_class in format_class_list: - if format == format_class.format: - return format_class(*args, **kw) - raise Exception, "unknown format %r" % format diff --git a/tools/gyp/test/library/gyptest-shared-obj-install-path.py b/tools/gyp/test/library/gyptest-shared-obj-install-path.py deleted file mode 100755 index 2cf1a28458..0000000000 --- a/tools/gyp/test/library/gyptest-shared-obj-install-path.py +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2010 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. - -""" -Verifies that .so files that are order only dependencies are specified by -their install location rather than by their alias. -""" - -# Python 2.5 needs this for the with statement. -from __future__ import with_statement - -import os -import TestGyp - -test = TestGyp.TestGyp(formats=['make']) - -test.run_gyp('shared_dependency.gyp', - chdir='src') -test.relocate('src', 'relocate/src') - -test.build('shared_dependency.gyp', test.ALL, chdir='relocate/src') - -with open('relocate/src/Makefile') as makefile: - make_contents = makefile.read() - -# If we remove the code to generate lib1, Make should still be able -# to build lib2 since lib1.so already exists. -make_contents = make_contents.replace('include lib1.target.mk', '') -with open('relocate/src/Makefile', 'w') as makefile: - makefile.write(make_contents) - -test.build('shared_dependency.gyp', test.ALL, chdir='relocate/src') - -test.pass_test() diff --git a/tools/gyp/test/library/gyptest-shared.py b/tools/gyp/test/library/gyptest-shared.py deleted file mode 100755 index a1d2985d91..0000000000 --- a/tools/gyp/test/library/gyptest-shared.py +++ /dev/null @@ -1,84 +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. - -""" -Verifies simple build of a "Hello, world!" program with shared libraries, -including verifying that libraries are rebuilt correctly when functions -move between libraries. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('library.gyp', - '-Dlibrary=shared_library', - '-Dmoveable_function=lib1', - chdir='src') - -test.relocate('src', 'relocate/src') - -test.build('library.gyp', test.ALL, chdir='relocate/src') - -expect = """\ -Hello from program.c -Hello from lib1.c -Hello from lib2.c -Hello from lib1_moveable.c -""" -test.run_built_executable('program', chdir='relocate/src', stdout=expect) - - -test.run_gyp('library.gyp', - '-Dlibrary=shared_library', - '-Dmoveable_function=lib2', - chdir='relocate/src') - -# Update program.c to force a rebuild. -test.sleep() -contents = test.read('relocate/src/program.c') -contents = contents.replace('Hello', 'Hello again') -test.write('relocate/src/program.c', contents) - -test.build('library.gyp', test.ALL, chdir='relocate/src') - -expect = """\ -Hello again from program.c -Hello from lib1.c -Hello from lib2.c -Hello from lib2_moveable.c -""" -test.run_built_executable('program', chdir='relocate/src', stdout=expect) - - -test.run_gyp('library.gyp', - '-Dlibrary=shared_library', - '-Dmoveable_function=lib1', - chdir='relocate/src') - -# Update program.c to force a rebuild. -test.sleep() -contents = test.read('relocate/src/program.c') -contents = contents.replace('again', 'again again') -test.write('relocate/src/program.c', contents) - -# TODO(sgk): we have to force a rebuild of lib2 so that it weeds out -# the "moved" module. This should be done in gyp by adding a dependency -# on the generated .vcproj file itself. -test.touch('relocate/src/lib2.c') - -test.build('library.gyp', test.ALL, chdir='relocate/src') - -expect = """\ -Hello again again from program.c -Hello from lib1.c -Hello from lib2.c -Hello from lib1_moveable.c -""" -test.run_built_executable('program', chdir='relocate/src', stdout=expect) - - -test.pass_test() diff --git a/tools/gyp/test/library/gyptest-static.py b/tools/gyp/test/library/gyptest-static.py deleted file mode 100755 index 4bc71c4962..0000000000 --- a/tools/gyp/test/library/gyptest-static.py +++ /dev/null @@ -1,84 +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. - -""" -Verifies simple build of a "Hello, world!" program with static libraries, -including verifying that libraries are rebuilt correctly when functions -move between libraries. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('library.gyp', - '-Dlibrary=static_library', - '-Dmoveable_function=lib1', - chdir='src') - -test.relocate('src', 'relocate/src') - -test.build('library.gyp', test.ALL, chdir='relocate/src') - -expect = """\ -Hello from program.c -Hello from lib1.c -Hello from lib2.c -Hello from lib1_moveable.c -""" -test.run_built_executable('program', chdir='relocate/src', stdout=expect) - - -test.run_gyp('library.gyp', - '-Dlibrary=static_library', - '-Dmoveable_function=lib2', - chdir='relocate/src') - -# Update program.c to force a rebuild. -test.sleep() -contents = test.read('relocate/src/program.c') -contents = contents.replace('Hello', 'Hello again') -test.write('relocate/src/program.c', contents) - -test.build('library.gyp', test.ALL, chdir='relocate/src') - -expect = """\ -Hello again from program.c -Hello from lib1.c -Hello from lib2.c -Hello from lib2_moveable.c -""" -test.run_built_executable('program', chdir='relocate/src', stdout=expect) - - -test.run_gyp('library.gyp', - '-Dlibrary=static_library', - '-Dmoveable_function=lib1', - chdir='relocate/src') - -# Update program.c and lib2.c to force a rebuild. -test.sleep() -contents = test.read('relocate/src/program.c') -contents = contents.replace('again', 'again again') -test.write('relocate/src/program.c', contents) - -# TODO(sgk): we have to force a rebuild of lib2 so that it weeds out -# the "moved" module. This should be done in gyp by adding a dependency -# on the generated .vcproj file itself. -test.touch('relocate/src/lib2.c') - -test.build('library.gyp', test.ALL, chdir='relocate/src') - -expect = """\ -Hello again again from program.c -Hello from lib1.c -Hello from lib2.c -Hello from lib1_moveable.c -""" -test.run_built_executable('program', chdir='relocate/src', stdout=expect) - - -test.pass_test() diff --git a/tools/gyp/test/library/src/lib1.c b/tools/gyp/test/library/src/lib1.c deleted file mode 100644 index 3866b1b845..0000000000 --- a/tools/gyp/test/library/src/lib1.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -#ifdef _WIN32 -__declspec(dllexport) -#endif -void lib1_function(void) -{ - fprintf(stdout, "Hello from lib1.c\n"); - fflush(stdout); -} diff --git a/tools/gyp/test/library/src/lib1_moveable.c b/tools/gyp/test/library/src/lib1_moveable.c deleted file mode 100644 index 5d3cc1d9aa..0000000000 --- a/tools/gyp/test/library/src/lib1_moveable.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -#ifdef _WIN32 -__declspec(dllexport) -#endif -void moveable_function(void) -{ - fprintf(stdout, "Hello from lib1_moveable.c\n"); - fflush(stdout); -} diff --git a/tools/gyp/test/library/src/lib2.c b/tools/gyp/test/library/src/lib2.c deleted file mode 100644 index 21dda72653..0000000000 --- a/tools/gyp/test/library/src/lib2.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -#ifdef _WIN32 -__declspec(dllexport) -#endif -void lib2_function(void) -{ - fprintf(stdout, "Hello from lib2.c\n"); - fflush(stdout); -} diff --git a/tools/gyp/test/library/src/lib2_moveable.c b/tools/gyp/test/library/src/lib2_moveable.c deleted file mode 100644 index f645071d1e..0000000000 --- a/tools/gyp/test/library/src/lib2_moveable.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -#ifdef _WIN32 -__declspec(dllexport) -#endif -void moveable_function(void) -{ - fprintf(stdout, "Hello from lib2_moveable.c\n"); - fflush(stdout); -} diff --git a/tools/gyp/test/library/src/library.gyp b/tools/gyp/test/library/src/library.gyp deleted file mode 100644 index bc35516426..0000000000 --- a/tools/gyp/test/library/src/library.gyp +++ /dev/null @@ -1,58 +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. - -{ - 'variables': { - 'moveable_function%': 0, - }, - 'targets': [ - { - 'target_name': 'program', - 'type': 'executable', - 'dependencies': [ - 'lib1', - 'lib2', - ], - 'sources': [ - 'program.c', - ], - }, - { - 'target_name': 'lib1', - 'type': '<(library)', - 'sources': [ - 'lib1.c', - ], - 'conditions': [ - ['moveable_function=="lib1"', { - 'sources': [ - 'lib1_moveable.c', - ], - }], - ], - }, - { - 'target_name': 'lib2', - 'type': '<(library)', - 'sources': [ - 'lib2.c', - ], - 'conditions': [ - ['moveable_function=="lib2"', { - 'sources': [ - 'lib2_moveable.c', - ], - }], - ], - }, - ], - 'conditions': [ - ['OS=="linux"', { - 'target_defaults': { - # Support 64-bit shared libs (also works fine for 32-bit). - 'cflags': ['-fPIC'], - }, - }], - ], -} diff --git a/tools/gyp/test/library/src/program.c b/tools/gyp/test/library/src/program.c deleted file mode 100644 index d7712cced4..0000000000 --- a/tools/gyp/test/library/src/program.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - -extern void lib1_function(void); -extern void lib2_function(void); -extern void moveable_function(void); - -int main(int argc, char *argv[]) -{ - fprintf(stdout, "Hello from program.c\n"); - fflush(stdout); - lib1_function(); - lib2_function(); - moveable_function(); - return 0; -} diff --git a/tools/gyp/test/library/src/shared_dependency.gyp b/tools/gyp/test/library/src/shared_dependency.gyp deleted file mode 100644 index 7d29f5de59..0000000000 --- a/tools/gyp/test/library/src/shared_dependency.gyp +++ /dev/null @@ -1,33 +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. - -{ - 'targets': [ - { - 'target_name': 'lib1', - 'type': 'shared_library', - 'sources': [ - 'lib1.c', - ], - }, - { - 'target_name': 'lib2', - 'type': 'shared_library', - 'sources': [ - 'lib2.c', - ], - 'dependencies': [ - 'lib1', - ], - }, - ], - 'conditions': [ - ['OS=="linux"', { - 'target_defaults': { - # Support 64-bit shared libs (also works fine for 32-bit). - 'cflags': ['-fPIC'], - }, - }], - ], -} diff --git a/tools/gyp/test/link-objects/base.c b/tools/gyp/test/link-objects/base.c deleted file mode 100644 index 2bc29a1b18..0000000000 --- a/tools/gyp/test/link-objects/base.c +++ /dev/null @@ -1,6 +0,0 @@ -void extra(); - -int main(int argc, char** argv) { - extra(); - return 0; -} diff --git a/tools/gyp/test/link-objects/extra.c b/tools/gyp/test/link-objects/extra.c deleted file mode 100644 index 1d7ee09b10..0000000000 --- a/tools/gyp/test/link-objects/extra.c +++ /dev/null @@ -1,5 +0,0 @@ -#include - -void extra() { - printf("PASS\n"); -} diff --git a/tools/gyp/test/link-objects/gyptest-all.py b/tools/gyp/test/link-objects/gyptest-all.py deleted file mode 100755 index 45bd6e1891..0000000000 --- a/tools/gyp/test/link-objects/gyptest-all.py +++ /dev/null @@ -1,28 +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. - -""" -Put an object file on the sources list. -Expect the result to link ok. -""" - -import TestGyp - -import sys - -if sys.platform != 'darwin': - # Currently only works under the linux make build. - test = TestGyp.TestGyp(formats=['make']) - - test.run_gyp('link-objects.gyp') - - test.build('link-objects.gyp', test.ALL) - - test.run_built_executable('link-objects', stdout="PASS\n") - - test.up_to_date('link-objects.gyp', test.ALL) - - test.pass_test() diff --git a/tools/gyp/test/link-objects/link-objects.gyp b/tools/gyp/test/link-objects/link-objects.gyp deleted file mode 100644 index ab72855531..0000000000 --- a/tools/gyp/test/link-objects/link-objects.gyp +++ /dev/null @@ -1,24 +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. - -{ - 'targets': [ - { - 'target_name': 'link-objects', - 'type': 'executable', - 'actions': [ - { - 'action_name': 'build extra object', - 'inputs': ['extra.c'], - 'outputs': ['extra.o'], - 'action': ['gcc', '-o', 'extra.o', '-c', 'extra.c'], - 'process_outputs_as_sources': 1, - }, - ], - 'sources': [ - 'base.c', - ], - }, - ], -} diff --git a/tools/gyp/test/mac/action-envvars/action/action.gyp b/tools/gyp/test/mac/action-envvars/action/action.gyp deleted file mode 100644 index d9d65745ca..0000000000 --- a/tools/gyp/test/mac/action-envvars/action/action.gyp +++ /dev/null @@ -1,34 +0,0 @@ -# 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. -{ - 'targets': [ - { - 'target_name': 'action', - 'type': 'none', - 'actions': [ - { - 'inputs': [ ], - 'outputs': [ - '<(PRODUCT_DIR)/result', - '<(SHARED_INTERMEDIATE_DIR)/tempfile', - ], - 'action_name': 'Test action', - 'action': ['./action.sh', '<(SHARED_INTERMEDIATE_DIR)/tempfile' ], - }, - { - 'inputs': [ - '<(SHARED_INTERMEDIATE_DIR)/tempfile', - ], - 'outputs': [ - '<(PRODUCT_DIR)/other_result', - ], - 'action_name': 'Other test action', - 'action': ['cp', '<(SHARED_INTERMEDIATE_DIR)/tempfile', - '<(PRODUCT_DIR)/other_result' ], - }, - ], - }, - ], -} - diff --git a/tools/gyp/test/mac/action-envvars/action/action.sh b/tools/gyp/test/mac/action-envvars/action/action.sh deleted file mode 100755 index 48d5f6bf86..0000000000 --- a/tools/gyp/test/mac/action-envvars/action/action.sh +++ /dev/null @@ -1,8 +0,0 @@ -# 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. - -set -e - -echo 'Test output' > "${BUILT_PRODUCTS_DIR}/result" -echo 'Other output' > "$1" diff --git a/tools/gyp/test/mac/app-bundle/TestApp/English.lproj/InfoPlist.strings b/tools/gyp/test/mac/app-bundle/TestApp/English.lproj/InfoPlist.strings deleted file mode 100644 index 452e7fabf9..0000000000 --- a/tools/gyp/test/mac/app-bundle/TestApp/English.lproj/InfoPlist.strings +++ /dev/null @@ -1,3 +0,0 @@ -/* Localized versions of Info.plist keys */ - -NSHumanReadableCopyright = "Copyright ©2011 Google Inc." diff --git a/tools/gyp/test/mac/app-bundle/TestApp/English.lproj/MainMenu.xib b/tools/gyp/test/mac/app-bundle/TestApp/English.lproj/MainMenu.xib deleted file mode 100644 index 4524596787..0000000000 --- a/tools/gyp/test/mac/app-bundle/TestApp/English.lproj/MainMenu.xib +++ /dev/null @@ -1,4119 +0,0 @@ - - - - 1060 - 10A324 - 719 - 1015 - 418.00 - - com.apple.InterfaceBuilder.CocoaPlugin - 719 - - - YES - - - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - - - YES - - YES - - - YES - - - - YES - - NSApplication - - - FirstResponder - - - NSApplication - - - AMainMenu - - YES - - - TestApp - - 1048576 - 2147483647 - - NSImage - NSMenuCheckmark - - - NSImage - NSMenuMixedState - - submenuAction: - - TestApp - - YES - - - About TestApp - - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Preferences… - , - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Services - - 1048576 - 2147483647 - - - submenuAction: - - Services - - YES - - _NSServicesMenu - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Hide TestApp - h - 1048576 - 2147483647 - - - - - - Hide Others - h - 1572864 - 2147483647 - - - - - - Show All - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Quit TestApp - q - 1048576 - 2147483647 - - - - - _NSAppleMenu - - - - - File - - 1048576 - 2147483647 - - - submenuAction: - - File - - YES - - - New - n - 1048576 - 2147483647 - - - - - - Open… - o - 1048576 - 2147483647 - - - - - - Open Recent - - 1048576 - 2147483647 - - - submenuAction: - - Open Recent - - YES - - - Clear Menu - - 1048576 - 2147483647 - - - - - _NSRecentDocumentsMenu - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Close - w - 1048576 - 2147483647 - - - - - - Save - s - 1048576 - 2147483647 - - - - - - Save As… - S - 1179648 - 2147483647 - - - - - - Revert to Saved - - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Page Setup... - P - 1179648 - 2147483647 - - - - - - - Print… - p - 1048576 - 2147483647 - - - - - - - - - Edit - - 1048576 - 2147483647 - - - submenuAction: - - Edit - - YES - - - Undo - z - 1048576 - 2147483647 - - - - - - Redo - Z - 1179648 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Cut - x - 1048576 - 2147483647 - - - - - - Copy - c - 1048576 - 2147483647 - - - - - - Paste - v - 1048576 - 2147483647 - - - - - - Paste and Match Style - V - 1572864 - 2147483647 - - - - - - Delete - - 1048576 - 2147483647 - - - - - - Select All - a - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Find - - 1048576 - 2147483647 - - - submenuAction: - - Find - - YES - - - Find… - f - 1048576 - 2147483647 - - - 1 - - - - Find Next - g - 1048576 - 2147483647 - - - 2 - - - - Find Previous - G - 1179648 - 2147483647 - - - 3 - - - - Use Selection for Find - e - 1048576 - 2147483647 - - - 7 - - - - Jump to Selection - j - 1048576 - 2147483647 - - - - - - - - - Spelling and Grammar - - 1048576 - 2147483647 - - - submenuAction: - - Spelling and Grammar - - YES - - - Show Spelling and Grammar - : - 1048576 - 2147483647 - - - - - - Check Document Now - ; - 1048576 - 2147483647 - - - - - - YES - YES - - - 2147483647 - - - - - - Check Spelling While Typing - - 1048576 - 2147483647 - - - - - - Check Grammar With Spelling - - 1048576 - 2147483647 - - - - - - Correct Spelling Automatically - - 2147483647 - - - - - - - - - Substitutions - - 1048576 - 2147483647 - - - submenuAction: - - Substitutions - - YES - - - Show Substitutions - - 2147483647 - - - - - - YES - YES - - - 2147483647 - - - - - - Smart Copy/Paste - f - 1048576 - 2147483647 - - - 1 - - - - Smart Quotes - g - 1048576 - 2147483647 - - - 2 - - - - Smart Dashes - - 2147483647 - - - - - - Smart Links - G - 1179648 - 2147483647 - - - 3 - - - - Text Replacement - - 2147483647 - - - - - - - - - Transformations - - 2147483647 - - - submenuAction: - - Transformations - - YES - - - Make Upper Case - - 2147483647 - - - - - - Make Lower Case - - 2147483647 - - - - - - Capitalize - - 2147483647 - - - - - - - - - Speech - - 1048576 - 2147483647 - - - submenuAction: - - Speech - - YES - - - Start Speaking - - 1048576 - 2147483647 - - - - - - Stop Speaking - - 1048576 - 2147483647 - - - - - - - - - - - - Format - - 2147483647 - - - submenuAction: - - Format - - YES - - - Font - - 2147483647 - - - submenuAction: - - Font - - YES - - - Show Fonts - t - 1048576 - 2147483647 - - - - - - Bold - b - 1048576 - 2147483647 - - - 2 - - - - Italic - i - 1048576 - 2147483647 - - - 1 - - - - Underline - u - 1048576 - 2147483647 - - - - - - YES - YES - - - 2147483647 - - - - - - Bigger - + - 1048576 - 2147483647 - - - 3 - - - - Smaller - - - 1048576 - 2147483647 - - - 4 - - - - YES - YES - - - 2147483647 - - - - - - Kern - - 2147483647 - - - submenuAction: - - Kern - - YES - - - Use Default - - 2147483647 - - - - - - Use None - - 2147483647 - - - - - - Tighten - - 2147483647 - - - - - - Loosen - - 2147483647 - - - - - - - - - Ligature - - 2147483647 - - - submenuAction: - - Ligature - - YES - - - Use Default - - 2147483647 - - - - - - Use None - - 2147483647 - - - - - - Use All - - 2147483647 - - - - - - - - - Baseline - - 2147483647 - - - submenuAction: - - Baseline - - YES - - - Use Default - - 2147483647 - - - - - - Superscript - - 2147483647 - - - - - - Subscript - - 2147483647 - - - - - - Raise - - 2147483647 - - - - - - Lower - - 2147483647 - - - - - - - - - YES - YES - - - 2147483647 - - - - - - Show Colors - C - 1048576 - 2147483647 - - - - - - YES - YES - - - 2147483647 - - - - - - Copy Style - c - 1572864 - 2147483647 - - - - - - Paste Style - v - 1572864 - 2147483647 - - - - - _NSFontMenu - - - - - Text - - 2147483647 - - - submenuAction: - - Text - - YES - - - Align Left - { - 1048576 - 2147483647 - - - - - - Center - | - 1048576 - 2147483647 - - - - - - Justify - - 2147483647 - - - - - - Align Right - } - 1048576 - 2147483647 - - - - - - YES - YES - - - 2147483647 - - - - - - Writing Direction - - 2147483647 - - - submenuAction: - - Writing Direction - - YES - - - YES - Paragraph - - 2147483647 - - - - - - CURlZmF1bHQ - - 2147483647 - - - - - - CUxlZnQgdG8gUmlnaHQ - - 2147483647 - - - - - - CVJpZ2h0IHRvIExlZnQ - - 2147483647 - - - - - - YES - YES - - - 2147483647 - - - - - - YES - Selection - - 2147483647 - - - - - - CURlZmF1bHQ - - 2147483647 - - - - - - CUxlZnQgdG8gUmlnaHQ - - 2147483647 - - - - - - CVJpZ2h0IHRvIExlZnQ - - 2147483647 - - - - - - - - - YES - YES - - - 2147483647 - - - - - - Show Ruler - - 2147483647 - - - - - - Copy Ruler - c - 1310720 - 2147483647 - - - - - - Paste Ruler - v - 1310720 - 2147483647 - - - - - - - - - - - - View - - 1048576 - 2147483647 - - - submenuAction: - - View - - YES - - - Show Toolbar - t - 1572864 - 2147483647 - - - - - - Customize Toolbar… - - 1048576 - 2147483647 - - - - - - - - - Window - - 1048576 - 2147483647 - - - submenuAction: - - Window - - YES - - - Minimize - m - 1048576 - 2147483647 - - - - - - Zoom - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Bring All to Front - - 1048576 - 2147483647 - - - - - _NSWindowsMenu - - - - - Help - - 2147483647 - - - submenuAction: - - Help - - YES - - - TestApp Help - ? - 1048576 - 2147483647 - - - - - _NSHelpMenu - - - - _NSMainMenu - - - 15 - 2 - {{335, 390}, {480, 360}} - 1954021376 - TestApp - NSWindow - - {1.79769e+308, 1.79769e+308} - - - 256 - {480, 360} - - - {{0, 0}, {1920, 1178}} - {1.79769e+308, 1.79769e+308} - - - TestAppAppDelegate - - - NSFontManager - - - - - YES - - - performMiniaturize: - - - - 37 - - - - arrangeInFront: - - - - 39 - - - - print: - - - - 86 - - - - runPageLayout: - - - - 87 - - - - clearRecentDocuments: - - - - 127 - - - - orderFrontStandardAboutPanel: - - - - 142 - - - - performClose: - - - - 193 - - - - toggleContinuousSpellChecking: - - - - 222 - - - - undo: - - - - 223 - - - - copy: - - - - 224 - - - - checkSpelling: - - - - 225 - - - - paste: - - - - 226 - - - - stopSpeaking: - - - - 227 - - - - cut: - - - - 228 - - - - showGuessPanel: - - - - 230 - - - - redo: - - - - 231 - - - - selectAll: - - - - 232 - - - - startSpeaking: - - - - 233 - - - - delete: - - - - 235 - - - - performZoom: - - - - 240 - - - - performFindPanelAction: - - - - 241 - - - - centerSelectionInVisibleArea: - - - - 245 - - - - toggleGrammarChecking: - - - - 347 - - - - toggleSmartInsertDelete: - - - - 355 - - - - toggleAutomaticQuoteSubstitution: - - - - 356 - - - - toggleAutomaticLinkDetection: - - - - 357 - - - - saveDocument: - - - - 362 - - - - saveDocumentAs: - - - - 363 - - - - revertDocumentToSaved: - - - - 364 - - - - runToolbarCustomizationPalette: - - - - 365 - - - - toggleToolbarShown: - - - - 366 - - - - hide: - - - - 367 - - - - hideOtherApplications: - - - - 368 - - - - unhideAllApplications: - - - - 370 - - - - newDocument: - - - - 373 - - - - openDocument: - - - - 374 - - - - addFontTrait: - - - - 421 - - - - addFontTrait: - - - - 422 - - - - modifyFont: - - - - 423 - - - - orderFrontFontPanel: - - - - 424 - - - - modifyFont: - - - - 425 - - - - raiseBaseline: - - - - 426 - - - - lowerBaseline: - - - - 427 - - - - copyFont: - - - - 428 - - - - subscript: - - - - 429 - - - - superscript: - - - - 430 - - - - tightenKerning: - - - - 431 - - - - underline: - - - - 432 - - - - orderFrontColorPanel: - - - - 433 - - - - useAllLigatures: - - - - 434 - - - - loosenKerning: - - - - 435 - - - - pasteFont: - - - - 436 - - - - unscript: - - - - 437 - - - - useStandardKerning: - - - - 438 - - - - useStandardLigatures: - - - - 439 - - - - turnOffLigatures: - - - - 440 - - - - turnOffKerning: - - - - 441 - - - - terminate: - - - - 449 - - - - toggleAutomaticSpellingCorrection: - - - - 456 - - - - orderFrontSubstitutionsPanel: - - - - 458 - - - - toggleAutomaticDashSubstitution: - - - - 461 - - - - toggleAutomaticTextReplacement: - - - - 463 - - - - uppercaseWord: - - - - 464 - - - - capitalizeWord: - - - - 467 - - - - lowercaseWord: - - - - 468 - - - - pasteAsPlainText: - - - - 486 - - - - performFindPanelAction: - - - - 487 - - - - performFindPanelAction: - - - - 488 - - - - performFindPanelAction: - - - - 489 - - - - showHelp: - - - - 493 - - - - delegate - - - - 495 - - - - alignCenter: - - - - 518 - - - - pasteRuler: - - - - 519 - - - - toggleRuler: - - - - 520 - - - - alignRight: - - - - 521 - - - - copyRuler: - - - - 522 - - - - alignJustified: - - - - 523 - - - - alignLeft: - - - - 524 - - - - makeBaseWritingDirectionNatural: - - - - 525 - - - - makeBaseWritingDirectionLeftToRight: - - - - 526 - - - - makeBaseWritingDirectionRightToLeft: - - - - 527 - - - - makeTextWritingDirectionNatural: - - - - 528 - - - - makeTextWritingDirectionLeftToRight: - - - - 529 - - - - makeTextWritingDirectionRightToLeft: - - - - 530 - - - - window - - - - 532 - - - - - YES - - 0 - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - -3 - - - Application - - - 29 - - - YES - - - - - - - - - - - - 19 - - - YES - - - - - - 56 - - - YES - - - - - - 217 - - - YES - - - - - - 83 - - - YES - - - - - - 81 - - - YES - - - - - - - - - - - - - - - - 75 - - - - - 80 - - - - - 78 - - - - - 72 - - - - - 82 - - - - - 124 - - - YES - - - - - - 77 - - - - - 73 - - - - - 79 - - - - - 112 - - - - - 74 - - - - - 125 - - - YES - - - - - - 126 - - - - - 205 - - - YES - - - - - - - - - - - - - - - - - - - - 202 - - - - - 198 - - - - - 207 - - - - - 214 - - - - - 199 - - - - - 203 - - - - - 197 - - - - - 206 - - - - - 215 - - - - - 218 - - - YES - - - - - - 216 - - - YES - - - - - - 200 - - - YES - - - - - - - - - - - 219 - - - - - 201 - - - - - 204 - - - - - 220 - - - YES - - - - - - - - - - 213 - - - - - 210 - - - - - 221 - - - - - 208 - - - - - 209 - - - - - 57 - - - YES - - - - - - - - - - - - - - - - 58 - - - - - 134 - - - - - 150 - - - - - 136 - - - - - 144 - - - - - 129 - - - - - 143 - - - - - 236 - - - - - 131 - - - YES - - - - - - 149 - - - - - 145 - - - - - 130 - - - - - 24 - - - YES - - - - - - - - - 92 - - - - - 5 - - - - - 239 - - - - - 23 - - - - - 295 - - - YES - - - - - - 296 - - - YES - - - - - - - 297 - - - - - 298 - - - - - 211 - - - YES - - - - - - 212 - - - YES - - - - - - - 195 - - - - - 196 - - - - - 346 - - - - - 348 - - - YES - - - - - - 349 - - - YES - - - - - - - - - - - - 350 - - - - - 351 - - - - - 354 - - - - - 371 - - - YES - - - - - - 372 - - - - - 375 - - - YES - - - - - - 376 - - - YES - - - - - - - 377 - - - YES - - - - - - 388 - - - YES - - - - - - - - - - - - - - - - - - - - - 389 - - - - - 390 - - - - - 391 - - - - - 392 - - - - - 393 - - - - - 394 - - - - - 395 - - - - - 396 - - - - - 397 - - - YES - - - - - - 398 - - - YES - - - - - - 399 - - - YES - - - - - - 400 - - - - - 401 - - - - - 402 - - - - - 403 - - - - - 404 - - - - - 405 - - - YES - - - - - - - - - - 406 - - - - - 407 - - - - - 408 - - - - - 409 - - - - - 410 - - - - - 411 - - - YES - - - - - - - - 412 - - - - - 413 - - - - - 414 - - - - - 415 - - - YES - - - - - - - - - 416 - - - - - 417 - - - - - 418 - - - - - 419 - - - - - 420 - - - - - 450 - - - YES - - - - - - 451 - - - YES - - - - - - - - 452 - - - - - 453 - - - - - 454 - - - - - 457 - - - - - 459 - - - - - 460 - - - - - 462 - - - - - 465 - - - - - 466 - - - - - 485 - - - - - 490 - - - YES - - - - - - 491 - - - YES - - - - - - 492 - - - - - 494 - - - - - 496 - - - YES - - - - - - 497 - - - YES - - - - - - - - - - - - - - - 498 - - - - - 499 - - - - - 500 - - - - - 501 - - - - - 502 - - - - - 503 - - - YES - - - - - - 504 - - - - - 505 - - - - - 506 - - - - - 507 - - - - - 508 - - - YES - - - - - - - - - - - - - - 509 - - - - - 510 - - - - - 511 - - - - - 512 - - - - - 513 - - - - - 514 - - - - - 515 - - - - - 516 - - - - - 517 - - - - - - - YES - - YES - -3.IBPluginDependency - 112.IBPluginDependency - 112.ImportedFromIB2 - 124.IBPluginDependency - 124.ImportedFromIB2 - 125.IBPluginDependency - 125.ImportedFromIB2 - 125.editorWindowContentRectSynchronizationRect - 126.IBPluginDependency - 126.ImportedFromIB2 - 129.IBPluginDependency - 129.ImportedFromIB2 - 130.IBPluginDependency - 130.ImportedFromIB2 - 130.editorWindowContentRectSynchronizationRect - 131.IBPluginDependency - 131.ImportedFromIB2 - 134.IBPluginDependency - 134.ImportedFromIB2 - 136.IBPluginDependency - 136.ImportedFromIB2 - 143.IBPluginDependency - 143.ImportedFromIB2 - 144.IBPluginDependency - 144.ImportedFromIB2 - 145.IBPluginDependency - 145.ImportedFromIB2 - 149.IBPluginDependency - 149.ImportedFromIB2 - 150.IBPluginDependency - 150.ImportedFromIB2 - 19.IBPluginDependency - 19.ImportedFromIB2 - 195.IBPluginDependency - 195.ImportedFromIB2 - 196.IBPluginDependency - 196.ImportedFromIB2 - 197.IBPluginDependency - 197.ImportedFromIB2 - 198.IBPluginDependency - 198.ImportedFromIB2 - 199.IBPluginDependency - 199.ImportedFromIB2 - 200.IBEditorWindowLastContentRect - 200.IBPluginDependency - 200.ImportedFromIB2 - 200.editorWindowContentRectSynchronizationRect - 201.IBPluginDependency - 201.ImportedFromIB2 - 202.IBPluginDependency - 202.ImportedFromIB2 - 203.IBPluginDependency - 203.ImportedFromIB2 - 204.IBPluginDependency - 204.ImportedFromIB2 - 205.IBEditorWindowLastContentRect - 205.IBPluginDependency - 205.ImportedFromIB2 - 205.editorWindowContentRectSynchronizationRect - 206.IBPluginDependency - 206.ImportedFromIB2 - 207.IBPluginDependency - 207.ImportedFromIB2 - 208.IBPluginDependency - 208.ImportedFromIB2 - 209.IBPluginDependency - 209.ImportedFromIB2 - 210.IBPluginDependency - 210.ImportedFromIB2 - 211.IBPluginDependency - 211.ImportedFromIB2 - 212.IBPluginDependency - 212.ImportedFromIB2 - 212.editorWindowContentRectSynchronizationRect - 213.IBPluginDependency - 213.ImportedFromIB2 - 214.IBPluginDependency - 214.ImportedFromIB2 - 215.IBPluginDependency - 215.ImportedFromIB2 - 216.IBPluginDependency - 216.ImportedFromIB2 - 217.IBPluginDependency - 217.ImportedFromIB2 - 218.IBPluginDependency - 218.ImportedFromIB2 - 219.IBPluginDependency - 219.ImportedFromIB2 - 220.IBEditorWindowLastContentRect - 220.IBPluginDependency - 220.ImportedFromIB2 - 220.editorWindowContentRectSynchronizationRect - 221.IBPluginDependency - 221.ImportedFromIB2 - 23.IBPluginDependency - 23.ImportedFromIB2 - 236.IBPluginDependency - 236.ImportedFromIB2 - 239.IBPluginDependency - 239.ImportedFromIB2 - 24.IBEditorWindowLastContentRect - 24.IBPluginDependency - 24.ImportedFromIB2 - 24.editorWindowContentRectSynchronizationRect - 29.IBEditorWindowLastContentRect - 29.IBPluginDependency - 29.ImportedFromIB2 - 29.WindowOrigin - 29.editorWindowContentRectSynchronizationRect - 295.IBPluginDependency - 296.IBEditorWindowLastContentRect - 296.IBPluginDependency - 296.editorWindowContentRectSynchronizationRect - 297.IBPluginDependency - 298.IBPluginDependency - 346.IBPluginDependency - 346.ImportedFromIB2 - 348.IBPluginDependency - 348.ImportedFromIB2 - 349.IBEditorWindowLastContentRect - 349.IBPluginDependency - 349.ImportedFromIB2 - 349.editorWindowContentRectSynchronizationRect - 350.IBPluginDependency - 350.ImportedFromIB2 - 351.IBPluginDependency - 351.ImportedFromIB2 - 354.IBPluginDependency - 354.ImportedFromIB2 - 371.IBEditorWindowLastContentRect - 371.IBPluginDependency - 371.IBWindowTemplateEditedContentRect - 371.NSWindowTemplate.visibleAtLaunch - 371.editorWindowContentRectSynchronizationRect - 371.windowTemplate.maxSize - 372.IBPluginDependency - 375.IBPluginDependency - 376.IBEditorWindowLastContentRect - 376.IBPluginDependency - 377.IBPluginDependency - 388.IBEditorWindowLastContentRect - 388.IBPluginDependency - 389.IBPluginDependency - 390.IBPluginDependency - 391.IBPluginDependency - 392.IBPluginDependency - 393.IBPluginDependency - 394.IBPluginDependency - 395.IBPluginDependency - 396.IBPluginDependency - 397.IBPluginDependency - 398.IBPluginDependency - 399.IBPluginDependency - 400.IBPluginDependency - 401.IBPluginDependency - 402.IBPluginDependency - 403.IBPluginDependency - 404.IBPluginDependency - 405.IBPluginDependency - 406.IBPluginDependency - 407.IBPluginDependency - 408.IBPluginDependency - 409.IBPluginDependency - 410.IBPluginDependency - 411.IBPluginDependency - 412.IBPluginDependency - 413.IBPluginDependency - 414.IBPluginDependency - 415.IBPluginDependency - 416.IBPluginDependency - 417.IBPluginDependency - 418.IBPluginDependency - 419.IBPluginDependency - 450.IBPluginDependency - 451.IBEditorWindowLastContentRect - 451.IBPluginDependency - 452.IBPluginDependency - 453.IBPluginDependency - 454.IBPluginDependency - 457.IBPluginDependency - 459.IBPluginDependency - 460.IBPluginDependency - 462.IBPluginDependency - 465.IBPluginDependency - 466.IBPluginDependency - 485.IBPluginDependency - 490.IBPluginDependency - 491.IBEditorWindowLastContentRect - 491.IBPluginDependency - 492.IBPluginDependency - 496.IBPluginDependency - 497.IBEditorWindowLastContentRect - 497.IBPluginDependency - 498.IBPluginDependency - 499.IBPluginDependency - 5.IBPluginDependency - 5.ImportedFromIB2 - 500.IBPluginDependency - 501.IBPluginDependency - 502.IBPluginDependency - 503.IBPluginDependency - 504.IBPluginDependency - 505.IBPluginDependency - 506.IBPluginDependency - 507.IBPluginDependency - 508.IBEditorWindowLastContentRect - 508.IBPluginDependency - 509.IBPluginDependency - 510.IBPluginDependency - 511.IBPluginDependency - 512.IBPluginDependency - 513.IBPluginDependency - 514.IBPluginDependency - 515.IBPluginDependency - 516.IBPluginDependency - 517.IBPluginDependency - 56.IBPluginDependency - 56.ImportedFromIB2 - 57.IBEditorWindowLastContentRect - 57.IBPluginDependency - 57.ImportedFromIB2 - 57.editorWindowContentRectSynchronizationRect - 58.IBPluginDependency - 58.ImportedFromIB2 - 72.IBPluginDependency - 72.ImportedFromIB2 - 73.IBPluginDependency - 73.ImportedFromIB2 - 74.IBPluginDependency - 74.ImportedFromIB2 - 75.IBPluginDependency - 75.ImportedFromIB2 - 77.IBPluginDependency - 77.ImportedFromIB2 - 78.IBPluginDependency - 78.ImportedFromIB2 - 79.IBPluginDependency - 79.ImportedFromIB2 - 80.IBPluginDependency - 80.ImportedFromIB2 - 81.IBEditorWindowLastContentRect - 81.IBPluginDependency - 81.ImportedFromIB2 - 81.editorWindowContentRectSynchronizationRect - 82.IBPluginDependency - 82.ImportedFromIB2 - 83.IBPluginDependency - 83.ImportedFromIB2 - 92.IBPluginDependency - 92.ImportedFromIB2 - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{522, 812}, {146, 23}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{436, 809}, {64, 6}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{753, 187}, {275, 113}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {275, 83}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{547, 180}, {254, 283}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{187, 434}, {243, 243}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {167, 43}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{753, 217}, {238, 103}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {241, 103}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{654, 239}, {194, 73}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{525, 802}, {197, 73}} - {{380, 836}, {512, 20}} - com.apple.InterfaceBuilder.CocoaPlugin - - {74, 862} - {{6, 978}, {478, 20}} - com.apple.InterfaceBuilder.CocoaPlugin - {{604, 269}, {231, 43}} - com.apple.InterfaceBuilder.CocoaPlugin - {{475, 832}, {234, 43}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{746, 287}, {220, 133}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {215, 63}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{380, 496}, {480, 360}} - com.apple.InterfaceBuilder.CocoaPlugin - {{380, 496}, {480, 360}} - - {{33, 99}, {480, 360}} - {3.40282e+38, 3.40282e+38} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{591, 420}, {83, 43}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{523, 2}, {178, 283}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{753, 197}, {170, 63}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{725, 289}, {246, 23}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{674, 260}, {204, 183}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{878, 180}, {164, 173}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{286, 129}, {275, 183}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{23, 794}, {245, 183}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{452, 109}, {196, 203}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{145, 474}, {199, 203}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - - - - YES - - - YES - - - - - YES - - - YES - - - - 532 - - - - YES - - TestAppAppDelegate - NSObject - - window - NSWindow - - - IBProjectSource - TestAppAppDelegate.h - - - - - YES - - NSApplication - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSApplication.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSApplicationScripting.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSColorPanel.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSHelpManager.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSPageLayout.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSUserInterfaceItemSearching.h - - - - NSBrowser - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSBrowser.h - - - - NSControl - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSControl.h - - - - NSDocument - NSObject - - YES - - YES - printDocument: - revertDocumentToSaved: - runPageLayout: - saveDocument: - saveDocumentAs: - saveDocumentTo: - - - YES - id - id - id - id - id - id - - - - IBFrameworkSource - AppKit.framework/Headers/NSDocument.h - - - - NSDocument - - IBFrameworkSource - AppKit.framework/Headers/NSDocumentScripting.h - - - - NSDocumentController - NSObject - - YES - - YES - clearRecentDocuments: - newDocument: - openDocument: - saveAllDocuments: - - - YES - id - id - id - id - - - - IBFrameworkSource - AppKit.framework/Headers/NSDocumentController.h - - - - NSFontManager - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSFontManager.h - - - - NSFormatter - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFormatter.h - - - - NSMatrix - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSMatrix.h - - - - NSMenu - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSMenu.h - - - - NSMenuItem - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSMenuItem.h - - - - NSMovieView - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSMovieView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSAccessibility.h - - - - NSObject - - - - NSObject - - - - NSObject - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSDictionaryController.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSDragging.h - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSFontPanel.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSKeyValueBinding.h - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSNibLoading.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSOutlineView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSPasteboard.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSSavePanel.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSTableView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSToolbarItem.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSView.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSClassDescription.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObjectScripting.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSPortCoder.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptClassDescription.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptObjectSpecifiers.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptWhoseTests.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLDownload.h - - - - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSInterfaceStyle.h - - - - NSResponder - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSResponder.h - - - - NSTableView - NSControl - - - - NSText - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSText.h - - - - NSTextView - NSText - - IBFrameworkSource - AppKit.framework/Headers/NSTextView.h - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSClipView.h - - - - NSView - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSRulerView.h - - - - NSView - NSResponder - - - - NSWindow - - IBFrameworkSource - AppKit.framework/Headers/NSDrawer.h - - - - NSWindow - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSWindow.h - - - - NSWindow - - IBFrameworkSource - AppKit.framework/Headers/NSWindowScripting.h - - - - - 0 - - com.apple.InterfaceBuilder.CocoaPlugin.macosx - - - - com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 - - - YES - ../TestApp.xcodeproj - 3 - - diff --git a/tools/gyp/test/mac/app-bundle/TestApp/TestApp-Info.plist b/tools/gyp/test/mac/app-bundle/TestApp/TestApp-Info.plist deleted file mode 100644 index 98fd515200..0000000000 --- a/tools/gyp/test/mac/app-bundle/TestApp/TestApp-Info.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIconFile - - CFBundleIdentifier - com.google.${PRODUCT_NAME} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSMinimumSystemVersion - ${MACOSX_DEPLOYMENT_TARGET} - NSMainNibFile - MainMenu - NSPrincipalClass - NSApplication - - diff --git a/tools/gyp/test/mac/app-bundle/TestApp/TestAppAppDelegate.h b/tools/gyp/test/mac/app-bundle/TestApp/TestAppAppDelegate.h deleted file mode 100644 index 518645eae9..0000000000 --- a/tools/gyp/test/mac/app-bundle/TestApp/TestAppAppDelegate.h +++ /dev/null @@ -1,13 +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. - -#import - -@interface TestAppAppDelegate : NSObject { - NSWindow *window; -} - -@property (assign) IBOutlet NSWindow *window; - -@end diff --git a/tools/gyp/test/mac/app-bundle/TestApp/TestAppAppDelegate.m b/tools/gyp/test/mac/app-bundle/TestApp/TestAppAppDelegate.m deleted file mode 100644 index 9aafa42000..0000000000 --- a/tools/gyp/test/mac/app-bundle/TestApp/TestAppAppDelegate.m +++ /dev/null @@ -1,15 +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. - -#import "TestAppAppDelegate.h" - -@implementation TestAppAppDelegate - -@synthesize window; - -- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { - // Insert code here to initialize your application -} - -@end diff --git a/tools/gyp/test/mac/app-bundle/TestApp/main.m b/tools/gyp/test/mac/app-bundle/TestApp/main.m deleted file mode 100644 index df6a12d065..0000000000 --- a/tools/gyp/test/mac/app-bundle/TestApp/main.m +++ /dev/null @@ -1,10 +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. - -#import - -int main(int argc, char *argv[]) -{ - return NSApplicationMain(argc, (const char **) argv); -} diff --git a/tools/gyp/test/mac/app-bundle/empty.c b/tools/gyp/test/mac/app-bundle/empty.c deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tools/gyp/test/mac/app-bundle/test.gyp b/tools/gyp/test/mac/app-bundle/test.gyp deleted file mode 100644 index f51c7b4b67..0000000000 --- a/tools/gyp/test/mac/app-bundle/test.gyp +++ /dev/null @@ -1,39 +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. -{ - 'targets': [ - { - 'target_name': 'dep_framework', - 'product_name': 'Dependency Framework', - 'type': 'shared_library', - 'mac_bundle': 1, - 'sources': [ 'empty.c', ], - }, - { - 'target_name': 'test_app', - 'product_name': 'Test App Gyp', - 'type': 'executable', - 'mac_bundle': 1, - 'dependencies': [ 'dep_framework', ], - 'sources': [ - 'TestApp/main.m', - 'TestApp/TestApp_Prefix.pch', - 'TestApp/TestAppAppDelegate.h', - 'TestApp/TestAppAppDelegate.m', - ], - 'mac_bundle_resources': [ - 'TestApp/English.lproj/InfoPlist.strings', - 'TestApp/English.lproj/MainMenu.xib', - ], - 'link_settings': { - 'libraries': [ - '$(SDKROOT)/System/Library/Frameworks/Cocoa.framework', - ], - }, - 'xcode_settings': { - 'INFOPLIST_FILE': 'TestApp/TestApp-Info.plist', - }, - }, - ], -} diff --git a/tools/gyp/test/mac/archs/my_file.cc b/tools/gyp/test/mac/archs/my_file.cc deleted file mode 100644 index 94216a74df..0000000000 --- a/tools/gyp/test/mac/archs/my_file.cc +++ /dev/null @@ -1,4 +0,0 @@ -/* 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. */ -int x = 1; diff --git a/tools/gyp/test/mac/archs/my_main_file.cc b/tools/gyp/test/mac/archs/my_main_file.cc deleted file mode 100644 index f1fa06f276..0000000000 --- a/tools/gyp/test/mac/archs/my_main_file.cc +++ /dev/null @@ -1,9 +0,0 @@ -/* 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. */ -#include -extern int x; -int main() { - printf("hello, world %d\n", x); -} - diff --git a/tools/gyp/test/mac/archs/test-archs-x86_64.gyp b/tools/gyp/test/mac/archs/test-archs-x86_64.gyp deleted file mode 100644 index d11a896273..0000000000 --- a/tools/gyp/test/mac/archs/test-archs-x86_64.gyp +++ /dev/null @@ -1,27 +0,0 @@ -# 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. - -{ - 'targets': [ - { - 'target_name': 'lib', - 'product_name': 'Test64', - 'type': 'static_library', - 'sources': [ 'my_file.cc' ], - 'xcode_settings': { - 'ARCHS': [ 'x86_64' ], - }, - }, - { - 'target_name': 'exe', - 'product_name': 'Test64', - 'type': 'executable', - 'dependencies': [ 'lib' ], - 'sources': [ 'my_main_file.cc' ], - 'xcode_settings': { - 'ARCHS': [ 'x86_64' ], - }, - }, - ] -} diff --git a/tools/gyp/test/mac/archs/test-no-archs.gyp b/tools/gyp/test/mac/archs/test-no-archs.gyp deleted file mode 100644 index 8f3b6b47cc..0000000000 --- a/tools/gyp/test/mac/archs/test-no-archs.gyp +++ /dev/null @@ -1,21 +0,0 @@ -# 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. - -{ - 'targets': [ - { - 'target_name': 'lib', - 'product_name': 'Test', - 'type': 'static_library', - 'sources': [ 'my_file.cc' ], - }, - { - 'target_name': 'exe', - 'product_name': 'Test', - 'type': 'executable', - 'dependencies': [ 'lib' ], - 'sources': [ 'my_main_file.cc' ], - }, - ] -} diff --git a/tools/gyp/test/mac/copy-dylib/empty.c b/tools/gyp/test/mac/copy-dylib/empty.c deleted file mode 100644 index 237c8ce181..0000000000 --- a/tools/gyp/test/mac/copy-dylib/empty.c +++ /dev/null @@ -1 +0,0 @@ -int main() {} diff --git a/tools/gyp/test/mac/copy-dylib/test.gyp b/tools/gyp/test/mac/copy-dylib/test.gyp deleted file mode 100644 index 4210c51463..0000000000 --- a/tools/gyp/test/mac/copy-dylib/test.gyp +++ /dev/null @@ -1,31 +0,0 @@ -# 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. -{ - 'targets': [ - { - 'target_name': 'my_dylib', - 'type': 'shared_library', - 'sources': [ 'empty.c', ], - }, - { - 'target_name': 'test_app', - 'product_name': 'Test App', - 'type': 'executable', - 'mac_bundle': 1, - 'dependencies': [ 'my_dylib', ], - 'sources': [ - 'empty.c', - ], - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)/Test App.app/Contents/Resources', - 'files': [ - '<(PRODUCT_DIR)/libmy_dylib.dylib', - ], - }, - ], - }, - ], -} - diff --git a/tools/gyp/test/mac/debuginfo/file.c b/tools/gyp/test/mac/debuginfo/file.c deleted file mode 100644 index 9cddaf1b0b..0000000000 --- a/tools/gyp/test/mac/debuginfo/file.c +++ /dev/null @@ -1,6 +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. - -void f() {} -int main() {} diff --git a/tools/gyp/test/mac/debuginfo/test.gyp b/tools/gyp/test/mac/debuginfo/test.gyp deleted file mode 100644 index 3faf6b5c76..0000000000 --- a/tools/gyp/test/mac/debuginfo/test.gyp +++ /dev/null @@ -1,82 +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. -{ - 'targets': [ - { - 'target_name': 'nonbundle_static_library', - 'type': 'static_library', - 'sources': [ 'file.c', ], - 'xcode_settings': { - 'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym', - 'DEPLOYMENT_POSTPROCESSING': 'YES', - 'STRIP_INSTALLED_PRODUCT': 'YES', - }, - }, - { - 'target_name': 'nonbundle_shared_library', - 'type': 'shared_library', - 'sources': [ 'file.c', ], - 'xcode_settings': { - 'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym', - 'DEPLOYMENT_POSTPROCESSING': 'YES', - 'STRIP_INSTALLED_PRODUCT': 'YES', - }, - }, - { - 'target_name': 'nonbundle_loadable_module', - 'type': 'loadable_module', - 'sources': [ 'file.c', ], - 'xcode_settings': { - 'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym', - 'DEPLOYMENT_POSTPROCESSING': 'YES', - 'STRIP_INSTALLED_PRODUCT': 'YES', - }, - }, - { - 'target_name': 'nonbundle_executable', - 'type': 'executable', - 'sources': [ 'file.c', ], - 'xcode_settings': { - 'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym', - 'DEPLOYMENT_POSTPROCESSING': 'YES', - 'STRIP_INSTALLED_PRODUCT': 'YES', - }, - }, - - { - 'target_name': 'bundle_shared_library', - 'type': 'shared_library', - 'mac_bundle': 1, - 'sources': [ 'file.c', ], - 'xcode_settings': { - 'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym', - 'DEPLOYMENT_POSTPROCESSING': 'YES', - 'STRIP_INSTALLED_PRODUCT': 'YES', - }, - }, - { - 'target_name': 'bundle_loadable_module', - 'type': 'loadable_module', - 'mac_bundle': 1, - 'sources': [ 'file.c', ], - 'xcode_settings': { - 'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym', - 'DEPLOYMENT_POSTPROCESSING': 'YES', - 'STRIP_INSTALLED_PRODUCT': 'YES', - }, - }, - { - 'target_name': 'my_app', - 'product_name': 'My App', - 'type': 'executable', - 'mac_bundle': 1, - 'sources': [ 'file.c', ], - 'xcode_settings': { - 'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym', - 'DEPLOYMENT_POSTPROCESSING': 'YES', - 'STRIP_INSTALLED_PRODUCT': 'YES', - }, - }, - ], -} diff --git a/tools/gyp/test/mac/depend-on-bundle/English.lproj/InfoPlist.strings b/tools/gyp/test/mac/depend-on-bundle/English.lproj/InfoPlist.strings deleted file mode 100644 index b92732c79e..0000000000 --- a/tools/gyp/test/mac/depend-on-bundle/English.lproj/InfoPlist.strings +++ /dev/null @@ -1 +0,0 @@ -/* Localized versions of Info.plist keys */ diff --git a/tools/gyp/test/mac/depend-on-bundle/Info.plist b/tools/gyp/test/mac/depend-on-bundle/Info.plist deleted file mode 100644 index 5e05a5190c..0000000000 --- a/tools/gyp/test/mac/depend-on-bundle/Info.plist +++ /dev/null @@ -1,28 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIconFile - - CFBundleIdentifier - com.yourcompany.${PRODUCT_NAME} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - NSPrincipalClass - - - diff --git a/tools/gyp/test/mac/depend-on-bundle/bundle.c b/tools/gyp/test/mac/depend-on-bundle/bundle.c deleted file mode 100644 index d64ff8ca23..0000000000 --- a/tools/gyp/test/mac/depend-on-bundle/bundle.c +++ /dev/null @@ -1 +0,0 @@ -int f() { return 42; } diff --git a/tools/gyp/test/mac/depend-on-bundle/executable.c b/tools/gyp/test/mac/depend-on-bundle/executable.c deleted file mode 100644 index 931bce637e..0000000000 --- a/tools/gyp/test/mac/depend-on-bundle/executable.c +++ /dev/null @@ -1,4 +0,0 @@ -int f(); -int main() { - return f(); -} diff --git a/tools/gyp/test/mac/depend-on-bundle/test.gyp b/tools/gyp/test/mac/depend-on-bundle/test.gyp deleted file mode 100644 index e00b105415..0000000000 --- a/tools/gyp/test/mac/depend-on-bundle/test.gyp +++ /dev/null @@ -1,28 +0,0 @@ -# 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. -{ - 'targets': [ - { - 'target_name': 'my_bundle', - 'type': 'shared_library', - 'mac_bundle': 1, - 'sources': [ 'bundle.c' ], - 'mac_bundle_resources': [ - 'English.lproj/InfoPlist.strings', - ], - 'xcode_settings': { - 'INFOPLIST_FILE': 'Info.plist', - } - }, - { - 'target_name': 'dependent_on_bundle', - 'type': 'executable', - 'sources': [ 'executable.c' ], - 'dependencies': [ - 'my_bundle', - ], - }, - ], -} - diff --git a/tools/gyp/test/mac/framework/TestFramework/English.lproj/InfoPlist.strings b/tools/gyp/test/mac/framework/TestFramework/English.lproj/InfoPlist.strings deleted file mode 100644 index 88f65cf6ea..0000000000 --- a/tools/gyp/test/mac/framework/TestFramework/English.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/tools/gyp/test/mac/framework/TestFramework/Info.plist b/tools/gyp/test/mac/framework/TestFramework/Info.plist deleted file mode 100644 index 5e05a5190c..0000000000 --- a/tools/gyp/test/mac/framework/TestFramework/Info.plist +++ /dev/null @@ -1,28 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIconFile - - CFBundleIdentifier - com.yourcompany.${PRODUCT_NAME} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - NSPrincipalClass - - - diff --git a/tools/gyp/test/mac/framework/TestFramework/ObjCVector.h b/tools/gyp/test/mac/framework/TestFramework/ObjCVector.h deleted file mode 100644 index c2450960cd..0000000000 --- a/tools/gyp/test/mac/framework/TestFramework/ObjCVector.h +++ /dev/null @@ -1,28 +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. - -#import - -#ifdef __cplusplus -struct ObjCVectorImp; -#else -typedef struct _ObjCVectorImpT ObjCVectorImp; -#endif - -@interface ObjCVector : NSObject { - @private - ObjCVectorImp* imp_; -} - -- (id)init; - -- (void)addObject:(id)obj; -- (void)addObject:(id)obj atIndex:(NSUInteger)index; - -- (void)removeObject:(id)obj; -- (void)removeObjectAtIndex:(NSUInteger)index; - -- (id)objectAtIndex:(NSUInteger)index; - -@end diff --git a/tools/gyp/test/mac/framework/TestFramework/ObjCVector.mm b/tools/gyp/test/mac/framework/TestFramework/ObjCVector.mm deleted file mode 100644 index cbf431f28d..0000000000 --- a/tools/gyp/test/mac/framework/TestFramework/ObjCVector.mm +++ /dev/null @@ -1,63 +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. - -#import "ObjCVectorInternal.h" -#import "ObjCVector.h" - -#include - -@interface ObjCVector (Private) -- (std::vector::iterator)makeIterator:(NSUInteger)index; -@end - -@implementation ObjCVector - -- (id)init { - if ((self = [super init])) { - imp_ = new ObjCVectorImp(); - } - return self; -} - -- (void)dealloc { - delete imp_; - [super dealloc]; -} - -- (void)addObject:(id)obj { - imp_->v.push_back([obj retain]); -} - -- (void)addObject:(id)obj atIndex:(NSUInteger)index { - imp_->v.insert([self makeIterator:index], [obj retain]); -} - -- (void)removeObject:(id)obj { - for (std::vector::iterator it = imp_->v.begin(); - it != imp_->v.end(); - ++it) { - if ([*it isEqual:obj]) { - [*it autorelease]; - imp_->v.erase(it); - return; - } - } -} - -- (void)removeObjectAtIndex:(NSUInteger)index { - [imp_->v[index] autorelease]; - imp_->v.erase([self makeIterator:index]); -} - -- (id)objectAtIndex:(NSUInteger)index { - return imp_->v[index]; -} - -- (std::vector::iterator)makeIterator:(NSUInteger)index { - std::vector::iterator it = imp_->v.begin(); - it += index; - return it; -} - -@end diff --git a/tools/gyp/test/mac/framework/TestFramework/ObjCVectorInternal.h b/tools/gyp/test/mac/framework/TestFramework/ObjCVectorInternal.h deleted file mode 100644 index fb6c98258b..0000000000 --- a/tools/gyp/test/mac/framework/TestFramework/ObjCVectorInternal.h +++ /dev/null @@ -1,9 +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. - -#include - -struct ObjCVectorImp { - std::vector v; -}; diff --git a/tools/gyp/test/mac/framework/TestFramework/TestFramework_Prefix.pch b/tools/gyp/test/mac/framework/TestFramework/TestFramework_Prefix.pch deleted file mode 100644 index 394f41d957..0000000000 --- a/tools/gyp/test/mac/framework/TestFramework/TestFramework_Prefix.pch +++ /dev/null @@ -1,7 +0,0 @@ -// -// Prefix header for all source files of the 'TestFramework' target in the 'TestFramework' project. -// - -#ifdef __OBJC__ - #import -#endif diff --git a/tools/gyp/test/mac/framework/empty.c b/tools/gyp/test/mac/framework/empty.c deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tools/gyp/test/mac/framework/framework.gyp b/tools/gyp/test/mac/framework/framework.gyp deleted file mode 100644 index 7480e526c6..0000000000 --- a/tools/gyp/test/mac/framework/framework.gyp +++ /dev/null @@ -1,74 +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. -{ - 'targets': [ - { - 'target_name': 'dep_framework', - 'product_name': 'Dependency Bundle', - 'type': 'shared_library', - 'mac_bundle': 1, - 'sources': [ 'empty.c', ], - }, - { - 'target_name': 'test_framework', - 'product_name': 'Test Framework', - 'type': 'shared_library', - 'mac_bundle': 1, - 'dependencies': [ 'dep_framework', ], - 'sources': [ - 'TestFramework/ObjCVector.h', - 'TestFramework/ObjCVectorInternal.h', - 'TestFramework/ObjCVector.mm', - ], - 'mac_framework_headers': [ - 'TestFramework/ObjCVector.h', - ], - 'mac_bundle_resources': [ - 'TestFramework/English.lproj/InfoPlist.strings', - ], - 'link_settings': { - 'libraries': [ - '$(SDKROOT)/System/Library/Frameworks/Cocoa.framework', - ], - }, - 'xcode_settings': { - 'INFOPLIST_FILE': 'TestFramework/Info.plist', - 'GCC_DYNAMIC_NO_PIC': 'NO', - }, - 'copies': [ - # Test copying to a file that has envvars in its dest path. - # Needs to be in a mac_bundle target, else CONTENTS_FOLDER_PATH isn't - # set. - { - 'destination': '<(PRODUCT_DIR)/$(CONTENTS_FOLDER_PATH)/Libraries', - 'files': [ - 'empty.c', - ], - }, - ], - }, - { - 'target_name': 'copy_target', - 'type': 'none', - 'dependencies': [ 'test_framework', 'dep_framework', ], - 'copies': [ - # Test copying directories with spaces in src and dest paths. - { - 'destination': '<(PRODUCT_DIR)/Test Framework.framework/foo', - 'files': [ - '<(PRODUCT_DIR)/Dependency Bundle.framework', - ], - }, - ], - 'actions': [ - { - 'action_name': 'aektschn', - 'inputs': [], - 'outputs': ['<(PRODUCT_DIR)/touched_file'], - 'action': ['touch', '${BUILT_PRODUCTS_DIR}/action_file'], - }, - ], - }, - ], -} diff --git a/tools/gyp/test/mac/global-settings/src/dir1/dir1.gyp b/tools/gyp/test/mac/global-settings/src/dir1/dir1.gyp deleted file mode 100644 index 153e34ddd6..0000000000 --- a/tools/gyp/test/mac/global-settings/src/dir1/dir1.gyp +++ /dev/null @@ -1,11 +0,0 @@ -# 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. -{ - 'targets': [ - { - 'target_name': 'dir1_target', - 'type': 'none', - }, - ], -} diff --git a/tools/gyp/test/mac/global-settings/src/dir2/dir2.gyp b/tools/gyp/test/mac/global-settings/src/dir2/dir2.gyp deleted file mode 100644 index cda46c839b..0000000000 --- a/tools/gyp/test/mac/global-settings/src/dir2/dir2.gyp +++ /dev/null @@ -1,22 +0,0 @@ -# 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. -{ - 'targets': [ - { - 'target_name': 'dir2_target', - 'type': 'none', - 'dependencies': [ - '../dir1/dir1.gyp:dir1_target', - ], - 'actions': [ - { - 'inputs': [ ], - 'outputs': [ '<(PRODUCT_DIR)/file.txt' ], - 'action_name': 'Test action', - 'action': ['cp', 'file.txt', '${BUILT_PRODUCTS_DIR}/file.txt' ], - }, - ], - }, - ], -} diff --git a/tools/gyp/test/mac/global-settings/src/dir2/file.txt b/tools/gyp/test/mac/global-settings/src/dir2/file.txt deleted file mode 100644 index 58da2d8e9a..0000000000 --- a/tools/gyp/test/mac/global-settings/src/dir2/file.txt +++ /dev/null @@ -1 +0,0 @@ -File. diff --git a/tools/gyp/test/mac/gyptest-action-envvars.py b/tools/gyp/test/mac/gyptest-action-envvars.py deleted file mode 100644 index b4f37c43a2..0000000000 --- a/tools/gyp/test/mac/gyptest-action-envvars.py +++ /dev/null @@ -1,30 +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. - -""" -Verifies that env vars work with actions, with relative directory paths. -""" - -import TestGyp - -import sys - -if sys.platform == 'darwin': - test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) - - CHDIR = 'action-envvars' - test.run_gyp('action/action.gyp', chdir=CHDIR) - test.build('action/action.gyp', 'action', chdir=CHDIR, SYMROOT='../build') - - result_file = test.built_file_path('result', chdir=CHDIR) - test.must_exist(result_file) - test.must_contain(result_file, 'Test output') - - other_result_file = test.built_file_path('other_result', chdir=CHDIR) - test.must_exist(other_result_file) - test.must_contain(other_result_file, 'Other output') - - test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-app.py b/tools/gyp/test/mac/gyptest-app.py deleted file mode 100755 index bce48f8938..0000000000 --- a/tools/gyp/test/mac/gyptest-app.py +++ /dev/null @@ -1,44 +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. - -""" -Verifies that app bundles are built correctly. -""" - -import TestGyp - -import sys - -if sys.platform == 'darwin': - test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) - - test.run_gyp('test.gyp', chdir='app-bundle') - - test.build('test.gyp', test.ALL, chdir='app-bundle') - - # Binary - test.built_file_must_exist('Test App Gyp.app/Contents/MacOS/Test App Gyp', - chdir='app-bundle') - - # Info.plist - info_plist = test.built_file_path('Test App Gyp.app/Contents/Info.plist', - chdir='app-bundle') - test.must_exist(info_plist) - test.must_contain(info_plist, 'com.google.Test App Gyp') # Variable expansion - - # Resources - test.built_file_must_exist( - 'Test App Gyp.app/Contents/Resources/English.lproj/InfoPlist.strings', - chdir='app-bundle') - test.built_file_must_exist( - 'Test App Gyp.app/Contents/Resources/English.lproj/MainMenu.nib', - chdir='app-bundle') - - # Packaging - test.built_file_must_exist('Test App Gyp.app/Contents/PkgInfo', - chdir='app-bundle') - - test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-archs.py b/tools/gyp/test/mac/gyptest-archs.py deleted file mode 100644 index 781e9ef169..0000000000 --- a/tools/gyp/test/mac/gyptest-archs.py +++ /dev/null @@ -1,37 +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. - -""" -Tests things related to ARCHS. -""" - -import TestGyp - -import subprocess -import sys - -if sys.platform == 'darwin': - test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) - - def CheckFileType(file, expected): - proc = subprocess.Popen(['file', '-b', file], stdout=subprocess.PIPE) - o = proc.communicate()[0].strip() - assert not proc.returncode - if o != expected: - print 'File: Expected %s, got %s' % (expected, o) - test.fail_test() - - test.run_gyp('test-no-archs.gyp', chdir='archs') - test.build('test-no-archs.gyp', test.ALL, chdir='archs') - result_file = test.built_file_path('Test', chdir='archs') - test.must_exist(result_file) - CheckFileType(result_file, 'Mach-O executable i386') - - test.run_gyp('test-archs-x86_64.gyp', chdir='archs') - test.build('test-archs-x86_64.gyp', test.ALL, chdir='archs') - result_file = test.built_file_path('Test64', chdir='archs') - test.must_exist(result_file) - CheckFileType(result_file, 'Mach-O 64-bit executable x86_64') diff --git a/tools/gyp/test/mac/gyptest-copies.py b/tools/gyp/test/mac/gyptest-copies.py deleted file mode 100755 index c88065eade..0000000000 --- a/tools/gyp/test/mac/gyptest-copies.py +++ /dev/null @@ -1,49 +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. - -""" -Verifies that 'copies' with app bundles are handled correctly. -""" - -import TestGyp - -import os -import sys -import time - -if sys.platform == 'darwin': - test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) - - test.run_gyp('framework.gyp', chdir='framework') - - test.build('framework.gyp', 'copy_target', chdir='framework') - - # Check that the copy succeeded. - test.built_file_must_exist( - 'Test Framework.framework/foo/Dependency Bundle.framework', - chdir='framework') - test.built_file_must_exist( - 'Test Framework.framework/foo/Dependency Bundle.framework/Versions/A', - chdir='framework') - test.built_file_must_exist( - 'Test Framework.framework/Versions/A/Libraries/empty.c', - chdir='framework') - - - # Check that rebuilding the target a few times works. - dep_bundle = test.built_file_path('Dependency Bundle.framework', - chdir='framework') - mtime = os.path.getmtime(dep_bundle) - atime = os.path.getatime(dep_bundle) - for i in range(3): - os.utime(dep_bundle, (atime + i * 1000, mtime + i * 1000)) - test.build('framework.gyp', 'copy_target', chdir='framework') - - - # Check that actions ran. - test.built_file_must_exist('action_file', chdir='framework') - - test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-copy-dylib.py b/tools/gyp/test/mac/gyptest-copy-dylib.py deleted file mode 100644 index 253623d1c6..0000000000 --- a/tools/gyp/test/mac/gyptest-copy-dylib.py +++ /dev/null @@ -1,25 +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. - -""" -Verifies that dylibs can be copied into app bundles. -""" - -import TestGyp - -import sys - -if sys.platform == 'darwin': - test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) - - test.run_gyp('test.gyp', chdir='copy-dylib') - - test.build('test.gyp', 'test_app', chdir='copy-dylib') - - test.built_file_must_exist( - 'Test App.app/Contents/Resources/libmy_dylib.dylib', chdir='copy-dylib') - - test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-debuginfo.py b/tools/gyp/test/mac/gyptest-debuginfo.py deleted file mode 100755 index a0e9438e2a..0000000000 --- a/tools/gyp/test/mac/gyptest-debuginfo.py +++ /dev/null @@ -1,36 +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. - -""" -Tests things related to debug information generation. -""" - -import TestGyp - -import sys - -if sys.platform == 'darwin': - test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) - - test.run_gyp('test.gyp', chdir='debuginfo') - - test.build('test.gyp', test.ALL, chdir='debuginfo') - - test.built_file_must_exist('libnonbundle_shared_library.dylib.dSYM', - chdir='debuginfo') - test.built_file_must_exist('nonbundle_loadable_module.so.dSYM', - chdir='debuginfo') - test.built_file_must_exist('nonbundle_executable.dSYM', - chdir='debuginfo') - - test.built_file_must_exist('bundle_shared_library.framework.dSYM', - chdir='debuginfo') - test.built_file_must_exist('bundle_loadable_module.bundle.dSYM', - chdir='debuginfo') - test.built_file_must_exist('My App.app.dSYM', - chdir='debuginfo') - - test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-depend-on-bundle.py b/tools/gyp/test/mac/gyptest-depend-on-bundle.py deleted file mode 100644 index 5cccb03227..0000000000 --- a/tools/gyp/test/mac/gyptest-depend-on-bundle.py +++ /dev/null @@ -1,40 +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. - -""" -Verifies that a dependency on a bundle causes the whole bundle to be built. -""" - -import TestGyp - -import sys - -if sys.platform == 'darwin': - test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) - - test.run_gyp('test.gyp', chdir='depend-on-bundle') - - test.build('test.gyp', 'dependent_on_bundle', chdir='depend-on-bundle') - - # Binary itself. - test.built_file_must_exist('dependent_on_bundle', chdir='depend-on-bundle') - - # Bundle dependency. - test.built_file_must_exist( - 'my_bundle.framework/Versions/A/my_bundle', - chdir='depend-on-bundle') - test.built_file_must_exist( # package_framework - 'my_bundle.framework/my_bundle', - chdir='depend-on-bundle') - test.built_file_must_exist( # plist - 'my_bundle.framework/Versions/A/Resources/Info.plist', - chdir='depend-on-bundle') - test.built_file_must_exist( - 'my_bundle.framework/Versions/A/Resources/English.lproj/' # Resources - 'InfoPlist.strings', - chdir='depend-on-bundle') - - test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-framework.py b/tools/gyp/test/mac/gyptest-framework.py deleted file mode 100755 index e4342d8420..0000000000 --- a/tools/gyp/test/mac/gyptest-framework.py +++ /dev/null @@ -1,50 +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. - -""" -Verifies that app bundles are built correctly. -""" - -import TestGyp - -import sys - -if sys.platform == 'darwin': - test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) - - test.run_gyp('framework.gyp', chdir='framework') - - test.build('framework.gyp', 'test_framework', chdir='framework') - - # Binary - test.built_file_must_exist( - 'Test Framework.framework/Versions/A/Test Framework', - chdir='framework') - - # Info.plist - test.built_file_must_exist( - 'Test Framework.framework/Versions/A/Resources/Info.plist', - chdir='framework') - - # Resources - test.built_file_must_exist( - 'Test Framework.framework/Versions/A/Resources/English.lproj/' - 'InfoPlist.strings', - chdir='framework') - - # Symlinks created by packaging process - test.built_file_must_exist('Test Framework.framework/Versions/Current', - chdir='framework') - test.built_file_must_exist('Test Framework.framework/Resources', - chdir='framework') - test.built_file_must_exist('Test Framework.framework/Test Framework', - chdir='framework') - # PkgInfo. - test.built_file_must_not_exist( - 'Test Framework.framework/Versions/A/Resources/PkgInfo', - chdir='framework') - - test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-global-settings.py b/tools/gyp/test/mac/gyptest-global-settings.py deleted file mode 100644 index 648d32cded..0000000000 --- a/tools/gyp/test/mac/gyptest-global-settings.py +++ /dev/null @@ -1,26 +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. - -""" -Verifies that the global xcode_settings processing doesn't throw. -Regression test for http://crbug.com/109163 -""" - -import TestGyp - -import sys - -if sys.platform == 'darwin': - test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) - test.run_gyp('src/dir2/dir2.gyp', chdir='global-settings', depth='src') - # run_gyp shouldn't throw. - - # Check that BUILT_PRODUCTS_DIR was set correctly, too. - test.build('dir2/dir2.gyp', 'dir2_target', chdir='global-settings/src', - SYMROOT='../build') - test.built_file_must_exist('file.txt', chdir='global-settings/src') - - test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-infoplist-process.py b/tools/gyp/test/mac/gyptest-infoplist-process.py deleted file mode 100755 index 20874a398a..0000000000 --- a/tools/gyp/test/mac/gyptest-infoplist-process.py +++ /dev/null @@ -1,51 +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. - -""" -Verifies the Info.plist preprocessor functionality. -""" - -import TestGyp - -import sys - -if sys.platform == 'darwin': - test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) - - CHDIR = 'infoplist-process' - INFO_PLIST_PATH = 'Test.app/Contents/Info.plist' - - # First process both keys. - test.set_configuration('One') - test.run_gyp('test1.gyp', chdir=CHDIR) - test.build('test1.gyp', test.ALL, chdir=CHDIR) - info_plist = test.built_file_path(INFO_PLIST_PATH, chdir=CHDIR) - test.must_exist(info_plist) - test.must_contain(info_plist, 'Foo') - test.must_contain(info_plist, 'Bar') - - # Then process a single key. - test.set_configuration('Two') - test.run_gyp('test2.gyp', chdir=CHDIR) - test.build('test2.gyp', chdir=CHDIR) - info_plist = test.built_file_path(INFO_PLIST_PATH, chdir=CHDIR) - test.must_exist(info_plist) - test.must_contain(info_plist, 'com.google.Test') # Normal expansion works. - test.must_contain(info_plist, 'Foo (Bar)') - test.must_contain(info_plist, 'PROCESSED_KEY2') - - # Then turn off the processor. - test.set_configuration('Three') - test.run_gyp('test3.gyp', chdir=CHDIR) - test.build('test3.gyp', chdir=CHDIR) - info_plist = test.built_file_path('Test App.app/Contents/Info.plist', - chdir=CHDIR) - test.must_exist(info_plist) - test.must_contain(info_plist, 'com.google.Test') # Normal expansion works. - test.must_contain(info_plist, 'PROCESSED_KEY1') - test.must_contain(info_plist, 'PROCESSED_KEY2') - - test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-libraries.py b/tools/gyp/test/mac/gyptest-libraries.py deleted file mode 100755 index 46814d65af..0000000000 --- a/tools/gyp/test/mac/gyptest-libraries.py +++ /dev/null @@ -1,22 +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. - -""" -Verifies libraries (in link_settings) are properly found. -""" - -import TestGyp - -import sys - -if sys.platform == 'darwin': - test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) - - test.run_gyp('subdir/test.gyp', chdir='libraries') - - test.build('subdir/test.gyp', test.ALL, chdir='libraries') - - test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-loadable-module.py b/tools/gyp/test/mac/gyptest-loadable-module.py deleted file mode 100755 index e5e022c9fb..0000000000 --- a/tools/gyp/test/mac/gyptest-loadable-module.py +++ /dev/null @@ -1,45 +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. - -""" -Tests that a loadable_module target is built correctly. -""" - -import TestGyp - -import os -import sys - -if sys.platform == 'darwin': - test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) - - test.run_gyp('test.gyp', chdir='loadable-module') - test.build('test.gyp', test.ALL, chdir='loadable-module') - - # Binary. - test.built_file_must_exist( - 'test_loadable_module.plugin/Contents/MacOS/test_loadable_module', - chdir='loadable-module') - - # Info.plist. - info_plist = test.built_file_path( - 'test_loadable_module.plugin/Contents/Info.plist', - chdir='loadable-module') - test.must_exist(info_plist) - test.must_contain(info_plist, """ - CFBundleExecutable - test_loadable_module -""") - - # PkgInfo. - test.built_file_must_not_exist( - 'test_loadable_module.plugin/Contents/PkgInfo', - chdir='loadable-module') - test.built_file_must_not_exist( - 'test_loadable_module.plugin/Contents/Resources', - chdir='loadable-module') - - test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-non-strs-flattened-to-env.py b/tools/gyp/test/mac/gyptest-non-strs-flattened-to-env.py deleted file mode 100644 index 504dcd589b..0000000000 --- a/tools/gyp/test/mac/gyptest-non-strs-flattened-to-env.py +++ /dev/null @@ -1,33 +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. - -""" -Verifies that list xcode_settings are flattened before being exported to the -environment. -""" - -import TestGyp - -import sys - -if sys.platform == 'darwin': - test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) - - CHDIR = 'non-strs-flattened-to-env' - INFO_PLIST_PATH = 'Test.app/Contents/Info.plist' - - test.run_gyp('test.gyp', chdir=CHDIR) - test.build('test.gyp', test.ALL, chdir=CHDIR) - info_plist = test.built_file_path(INFO_PLIST_PATH, chdir=CHDIR) - test.must_exist(info_plist) - test.must_contain(info_plist, '''\ -\tMy Variable -\tsome expansion''') - test.must_contain(info_plist, '''\ -\tCFlags -\t-fstack-protector-all -fno-strict-aliasing -DS="A Space"''') - - test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-postbuild-copy-bundle.py b/tools/gyp/test/mac/gyptest-postbuild-copy-bundle.py deleted file mode 100644 index 0f63ad5241..0000000000 --- a/tools/gyp/test/mac/gyptest-postbuild-copy-bundle.py +++ /dev/null @@ -1,62 +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. - -""" -Verifies that a postbuild copying a dependend framework into an app bundle is -rerun if the resources in the framework change. -""" - -import TestGyp - -import os.path -import sys - -if sys.platform == 'darwin': - # TODO(thakis): Make this pass with the make generator, http://crbug.com/95529 - test = TestGyp.TestGyp(formats=['ninja', 'xcode']) - - CHDIR = 'postbuild-copy-bundle' - test.run_gyp('test.gyp', chdir=CHDIR) - - app_bundle_dir = test.built_file_path('Test app.app', chdir=CHDIR) - bundled_framework_dir = os.path.join( - app_bundle_dir, 'Contents', 'My Framework.framework', 'Resources') - final_plist_path = os.path.join(bundled_framework_dir, 'Info.plist') - final_resource_path = os.path.join(bundled_framework_dir, 'resource_file.sb') - - # Check that the dependency was built and copied into the app bundle: - test.build('test.gyp', 'test_app', chdir=CHDIR) - test.must_exist(final_resource_path) - test.must_match(final_resource_path, - 'This is included in the framework bundle.\n') - - test.must_exist(final_plist_path) - test.must_contain(final_plist_path, '''\ -\tRandomKey -\tRandomValue''') - - # Touch the dependency's bundle resource, and check that the modification - # makes it all the way into the app bundle: - test.sleep() - test.write('postbuild-copy-bundle/resource_file.sb', 'New text\n') - test.build('test.gyp', 'test_app', chdir=CHDIR) - - test.must_exist(final_resource_path) - test.must_match(final_resource_path, 'New text\n') - - # Check the same for the plist file. - test.sleep() - contents = test.read('postbuild-copy-bundle/Framework-Info.plist') - contents = contents.replace('RandomValue', 'NewRandomValue') - test.write('postbuild-copy-bundle/Framework-Info.plist', contents) - test.build('test.gyp', 'test_app', chdir=CHDIR) - - test.must_exist(final_plist_path) - test.must_contain(final_plist_path, '''\ -\tRandomKey -\tNewRandomValue''') - - test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-postbuild-defaults.py b/tools/gyp/test/mac/gyptest-postbuild-defaults.py deleted file mode 100644 index 0560904c29..0000000000 --- a/tools/gyp/test/mac/gyptest-postbuild-defaults.py +++ /dev/null @@ -1,29 +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. - -""" -Verifies that a postbuild invoking |defaults| works. -""" - -import TestGyp - -import sys - -if sys.platform == 'darwin': - test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) - - CHDIR = 'postbuild-defaults' - test.run_gyp('test.gyp', chdir=CHDIR) - test.build('test.gyp', test.ALL, chdir=CHDIR) - - result_file = test.built_file_path('result', chdir=CHDIR) - test.must_exist(result_file) - test.must_contain(result_file, '''\ -Test -${PRODUCT_NAME} -''') - - test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-postbuild-fail.py b/tools/gyp/test/mac/gyptest-postbuild-fail.py deleted file mode 100755 index dba0d6f042..0000000000 --- a/tools/gyp/test/mac/gyptest-postbuild-fail.py +++ /dev/null @@ -1,55 +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. - -""" -Verifies that a failing postbuild step lets the build fail. -""" - -import TestGyp - -import sys - -if sys.platform == 'darwin': - # set |match| to ignore build stderr output. - test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'], - match = lambda a, b: True) - - test.run_gyp('test.gyp', chdir='postbuild-fail') - - build_error_code = { - 'xcode': 1, - 'make': 2, - 'ninja': 1, - }[test.format] - - - # If a postbuild fails, all postbuilds should be re-run on the next build. - # However, even if the first postbuild fails the other postbuilds are still - # executed. - - - # Non-bundles - test.build('test.gyp', 'nonbundle', chdir='postbuild-fail', - status=build_error_code) - test.built_file_must_exist('static_touch', - chdir='postbuild-fail') - # Check for non-up-to-date-ness by checking if building again produces an - # error. - test.build('test.gyp', 'nonbundle', chdir='postbuild-fail', - status=build_error_code) - - - # Bundles - test.build('test.gyp', 'bundle', chdir='postbuild-fail', - status=build_error_code) - test.built_file_must_exist('dynamic_touch', - chdir='postbuild-fail') - # Check for non-up-to-date-ness by checking if building again produces an - # error. - test.build('test.gyp', 'bundle', chdir='postbuild-fail', - status=build_error_code) - - test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-postbuild-multiple-configurations.py b/tools/gyp/test/mac/gyptest-postbuild-multiple-configurations.py deleted file mode 100644 index 84694f36cc..0000000000 --- a/tools/gyp/test/mac/gyptest-postbuild-multiple-configurations.py +++ /dev/null @@ -1,26 +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. - -""" -Verifies that a postbuild work in projects with multiple configurations. -""" - -import TestGyp - -import sys - -if sys.platform == 'darwin': - test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) - - CHDIR = 'postbuild-multiple-configurations' - test.run_gyp('test.gyp', chdir=CHDIR) - - for configuration in ['Debug', 'Release']: - test.set_configuration(configuration) - test.build('test.gyp', test.ALL, chdir=CHDIR) - test.built_file_must_exist('postbuild-file', chdir=CHDIR) - - test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-postbuild-static-library.gyp b/tools/gyp/test/mac/gyptest-postbuild-static-library.gyp deleted file mode 100644 index 8f9a6ebcb0..0000000000 --- a/tools/gyp/test/mac/gyptest-postbuild-static-library.gyp +++ /dev/null @@ -1,28 +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. - -""" -Verifies that a postbuilds on static libraries work, and that sourceless -libraries don't cause failures at gyp time. -""" - -import TestGyp - -import sys - -if sys.platform == 'darwin': - test = TestGyp.TestGyp(formats=['make', 'xcode']) - - CHDIR = 'postbuild-static-library' - test.run_gyp('test.gyp', chdir=CHDIR) - test.build('test.gyp', 'my_lib', chdir=CHDIR) - # Building my_sourceless_lib doesn't work with make. gyp should probably - # forbid sourceless static libraries, since they're pretty pointless. - # But they shouldn't cause gyp time exceptions. - - test.built_file_must_exist('postbuild-file', chdir=CHDIR) - - test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-postbuild.py b/tools/gyp/test/mac/gyptest-postbuild.py deleted file mode 100755 index d1dcba7158..0000000000 --- a/tools/gyp/test/mac/gyptest-postbuild.py +++ /dev/null @@ -1,51 +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. - -""" -Verifies that postbuild steps work. -""" - -import TestGyp - -import sys - -if sys.platform == 'darwin': - test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) - - test.run_gyp('test.gyp', chdir='postbuilds') - - test.build('test.gyp', test.ALL, chdir='postbuilds') - - # See comment in test/subdirectory/gyptest-subdir-default.py - if test.format == 'xcode': - chdir = 'postbuilds/subdirectory' - else: - chdir = 'postbuilds' - - # Created by the postbuild scripts - test.built_file_must_exist('el.a_touch', - type=test.STATIC_LIB, - chdir='postbuilds') - test.built_file_must_exist('el.a_gyp_touch', - type=test.STATIC_LIB, - chdir='postbuilds') - test.built_file_must_exist('nest_el.a_touch', - type=test.STATIC_LIB, - chdir=chdir) - test.built_file_must_exist( - 'dyna.framework/Versions/A/dyna_touch', - chdir='postbuilds') - test.built_file_must_exist( - 'dyna.framework/Versions/A/dyna_gyp_touch', - chdir='postbuilds') - test.built_file_must_exist( - 'nest_dyna.framework/Versions/A/nest_dyna_touch', - chdir=chdir) - test.built_file_must_exist('dyna_standalone.dylib_gyp_touch', - type=test.SHARED_LIB, - chdir='postbuilds') - - test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-prefixheader.py b/tools/gyp/test/mac/gyptest-prefixheader.py deleted file mode 100755 index 768551f9b0..0000000000 --- a/tools/gyp/test/mac/gyptest-prefixheader.py +++ /dev/null @@ -1,19 +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. - -""" -Verifies that GCC_PREFIX_HEADER works. -""" - -import TestGyp - -import sys - -if sys.platform == 'darwin': - test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) - test.run_gyp('test.gyp', chdir='prefixheader') - test.build('test.gyp', test.ALL, chdir='prefixheader') - test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-rebuild.py b/tools/gyp/test/mac/gyptest-rebuild.py deleted file mode 100755 index c130bd32af..0000000000 --- a/tools/gyp/test/mac/gyptest-rebuild.py +++ /dev/null @@ -1,42 +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. - -""" -Verifies that app bundles are rebuilt correctly. -""" - -import TestGyp - -import os -import sys - -if sys.platform == 'darwin': - test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) - - CHDIR = 'rebuild' - test.run_gyp('test.gyp', chdir=CHDIR) - - test.build('test.gyp', 'test_app', chdir=CHDIR) - - # Touch a source file, rebuild, and check that the app target is up-to-date. - test.touch('rebuild/main.c') - test.build('test.gyp', 'test_app', chdir=CHDIR) - - test.up_to_date('test.gyp', 'test_app', chdir=CHDIR) - - # Xcode runs postbuilds on every build, so targets with postbuilds are - # never marked as up_to_date. - if test.format != 'xcode': - # Same for a framework bundle. - test.build('test.gyp', 'test_framework_postbuilds', chdir=CHDIR) - test.up_to_date('test.gyp', 'test_framework_postbuilds', chdir=CHDIR) - - # Test that an app bundle with a postbuild that touches the app binary needs - # to be built only once. - test.build('test.gyp', 'test_app_postbuilds', chdir=CHDIR) - test.up_to_date('test.gyp', 'test_app_postbuilds', chdir=CHDIR) - - test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-sourceless-module.gyp b/tools/gyp/test/mac/gyptest-sourceless-module.gyp deleted file mode 100644 index c3ea73a171..0000000000 --- a/tools/gyp/test/mac/gyptest-sourceless-module.gyp +++ /dev/null @@ -1,46 +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. - -""" -Verifies that bundles that have no 'sources' (pure resource containers) work. -""" - -import TestGyp - -import sys - -if sys.platform == 'darwin': - test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) - - test.run_gyp('test.gyp', chdir='sourceless-module') - - # Just needs to build without errors. - test.build('test.gyp', 'empty_bundle', chdir='sourceless-module') - test.built_file_must_not_exist( - 'empty_bundle.bundle', chdir='sourceless-module') - - # Needs to build, and contain a resource. - test.build('test.gyp', 'resource_bundle', chdir='sourceless-module') - - test.built_file_must_exist( - 'resource_bundle.bundle/Contents/Resources/foo.manifest', - chdir='sourceless-module') - test.built_file_must_not_exist( - 'resource_bundle.bundle/Contents/MacOS/resource_bundle', - chdir='sourceless-module') - - # Needs to build and cause the bundle to be built. - test.build( - 'test.gyp', 'dependent_on_resource_bundle', chdir='sourceless-module') - - test.built_file_must_exist( - 'resource_bundle.bundle/Contents/Resources/foo.manifest', - chdir='sourceless-module') - test.built_file_must_not_exist( - 'resource_bundle.bundle/Contents/MacOS/resource_bundle', - chdir='sourceless-module') - - test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-strip.py b/tools/gyp/test/mac/gyptest-strip.py deleted file mode 100755 index 7d4abc6004..0000000000 --- a/tools/gyp/test/mac/gyptest-strip.py +++ /dev/null @@ -1,54 +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. - -""" -Verifies that stripping works. -""" - -import TestGyp - -import os -import re -import subprocess -import sys -import time - -if sys.platform == 'darwin': - test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) - - test.run_gyp('test.gyp', chdir='strip') - - test.build('test.gyp', test.ALL, chdir='strip') - - # Lightweight check if stripping was done. - def OutPath(s): - return test.built_file_path(s, type=test.SHARED_LIB, chdir='strip') - - def CheckNsyms(p, n_expected): - r = re.compile(r'nsyms\s+(\d+)') - proc = subprocess.Popen(['otool', '-l', p], stdout=subprocess.PIPE) - o = proc.communicate()[0] - assert not proc.returncode - m = r.search(o, re.MULTILINE) - n = int(m.group(1)) - if n != n_expected: - print 'Stripping: Expected %d symbols, got %d' % (n_expected, n) - test.fail_test() - - # The actual numbers here are not interesting, they just need to be the same - # in both the xcode and the make build. - CheckNsyms(OutPath('no_postprocess'), 11) - CheckNsyms(OutPath('no_strip'), 11) - CheckNsyms(OutPath('strip_all'), 0) - CheckNsyms(OutPath('strip_nonglobal'), 2) - CheckNsyms(OutPath('strip_debugging'), 3) - CheckNsyms(OutPath('strip_all_custom_flags'), 0) - CheckNsyms(test.built_file_path( - 'strip_all_bundle.framework/Versions/A/strip_all_bundle', chdir='strip'), - 0) - CheckNsyms(OutPath('strip_save'), 3) - - test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-type-envvars.py b/tools/gyp/test/mac/gyptest-type-envvars.py deleted file mode 100755 index 61596bae23..0000000000 --- a/tools/gyp/test/mac/gyptest-type-envvars.py +++ /dev/null @@ -1,24 +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. - -""" -Test that MACH_O_TYPE etc are set correctly. -""" - -import TestGyp - -import sys - -if sys.platform == 'darwin': - test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) - - test.run_gyp('test.gyp', chdir='type_envvars') - - test.build('test.gyp', test.ALL, chdir='type_envvars') - - # The actual test is done by postbuild scripts during |test.build()|. - - test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-xcode-env-order.py b/tools/gyp/test/mac/gyptest-xcode-env-order.py deleted file mode 100755 index d1c8542876..0000000000 --- a/tools/gyp/test/mac/gyptest-xcode-env-order.py +++ /dev/null @@ -1,77 +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. - -""" -Verifies that dependent Xcode settings are processed correctly. -""" - -import TestGyp - -import sys - -if sys.platform == 'darwin': - test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) - - CHDIR = 'xcode-env-order' - INFO_PLIST_PATH = 'Test.app/Contents/Info.plist' - - test.run_gyp('test.gyp', chdir=CHDIR) - test.build('test.gyp', test.ALL, chdir=CHDIR) - - # Env vars in 'copies' filenames. - test.built_file_must_exist('Test-copy-brace/main.c', chdir=CHDIR) - test.built_file_must_exist('Test-copy-paren/main.c', chdir=CHDIR) - test.built_file_must_exist('Test-copy-bare/main.c', chdir=CHDIR) - - # Env vars in 'actions' filenames and inline actions - test.built_file_must_exist('action-copy-brace.txt', chdir=CHDIR) - test.built_file_must_exist('action-copy-paren.txt', chdir=CHDIR) - test.built_file_must_exist('action-copy-bare.txt', chdir=CHDIR) - - # Env vars in Info.plist. - info_plist = test.built_file_path(INFO_PLIST_PATH, chdir=CHDIR) - test.must_exist(info_plist) - - test.must_contain(info_plist, '''\ -\tBraceProcessedKey1 -\tD:/Source/Project/Test''') - test.must_contain(info_plist, '''\ -\tBraceProcessedKey2 -\t/Source/Project/Test''') - test.must_contain(info_plist, '''\ -\tBraceProcessedKey3 -\tcom.apple.product-type.application:D:/Source/Project/Test''') - - test.must_contain(info_plist, '''\ -\tParenProcessedKey1 -\tD:/Source/Project/Test''') - test.must_contain(info_plist, '''\ -\tParenProcessedKey2 -\t/Source/Project/Test''') - test.must_contain(info_plist, '''\ -\tParenProcessedKey3 -\tcom.apple.product-type.application:D:/Source/Project/Test''') - - test.must_contain(info_plist, '''\ -\tBareProcessedKey1 -\tD:/Source/Project/Test''') - test.must_contain(info_plist, '''\ -\tBareProcessedKey2 -\t/Source/Project/Test''') - # NOTE: For bare variables, $PRODUCT_TYPE is not replaced! It _is_ replaced - # if it's not right at the start of the string (e.g. ':$PRODUCT_TYPE'), so - # this looks like an Xcode bug. This bug isn't emulated (yet?), so check this - # only for Xcode. - if test.format == 'xcode': - test.must_contain(info_plist, '''\ -\tBareProcessedKey3 -\t$PRODUCT_TYPE:D:/Source/Project/Test''') - - test.must_contain(info_plist, '''\ -\tMixedProcessedKey -\t/Source/Project:Test:mh_execute''') - - test.pass_test() diff --git a/tools/gyp/test/mac/infoplist-process/Info.plist b/tools/gyp/test/mac/infoplist-process/Info.plist deleted file mode 100644 index cb65721f43..0000000000 --- a/tools/gyp/test/mac/infoplist-process/Info.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIconFile - - CFBundleIdentifier - com.google.${PRODUCT_NAME} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSMinimumSystemVersion - ${MACOSX_DEPLOYMENT_TARGET} - NSMainNibFile - MainMenu - NSPrincipalClass - NSApplication - ProcessedKey1 - PROCESSED_KEY1 - ProcessedKey2 - PROCESSED_KEY2 - - diff --git a/tools/gyp/test/mac/infoplist-process/main.c b/tools/gyp/test/mac/infoplist-process/main.c deleted file mode 100644 index 1bf4b2a11a..0000000000 --- a/tools/gyp/test/mac/infoplist-process/main.c +++ /dev/null @@ -1,7 +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. - -int main() { - return 0; -} diff --git a/tools/gyp/test/mac/infoplist-process/test1.gyp b/tools/gyp/test/mac/infoplist-process/test1.gyp deleted file mode 100644 index bc625a968b..0000000000 --- a/tools/gyp/test/mac/infoplist-process/test1.gyp +++ /dev/null @@ -1,25 +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. -{ - 'targets': [ - { - 'target_name': 'test_app', - 'product_name': 'Test', - 'type': 'executable', - 'mac_bundle': 1, - 'sources': [ - 'main.c', - ], - 'configurations': { - 'One': { - }, - }, - 'xcode_settings': { - 'INFOPLIST_FILE': 'Info.plist', - 'INFOPLIST_PREPROCESS': 'YES', - 'INFOPLIST_PREPROCESSOR_DEFINITIONS': 'PROCESSED_KEY1=Foo PROCESSED_KEY2=Bar', - }, - }, - ], -} diff --git a/tools/gyp/test/mac/infoplist-process/test2.gyp b/tools/gyp/test/mac/infoplist-process/test2.gyp deleted file mode 100644 index ecfbc9f64c..0000000000 --- a/tools/gyp/test/mac/infoplist-process/test2.gyp +++ /dev/null @@ -1,25 +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. -{ - 'targets': [ - { - 'target_name': 'test_app', - 'product_name': 'Test', - 'type': 'executable', - 'mac_bundle': 1, - 'sources': [ - 'main.c', - ], - 'configurations': { - 'Two': { - }, - }, - 'xcode_settings': { - 'INFOPLIST_FILE': 'Info.plist', - 'INFOPLIST_PREPROCESS': 'YES', - 'INFOPLIST_PREPROCESSOR_DEFINITIONS': 'PROCESSED_KEY1="Foo (Bar)"', - }, - }, - ], -} diff --git a/tools/gyp/test/mac/infoplist-process/test3.gyp b/tools/gyp/test/mac/infoplist-process/test3.gyp deleted file mode 100644 index be8fe75a53..0000000000 --- a/tools/gyp/test/mac/infoplist-process/test3.gyp +++ /dev/null @@ -1,25 +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. -{ - 'targets': [ - { - 'target_name': 'test_app', - 'product_name': 'Test App', - 'type': 'executable', - 'mac_bundle': 1, - 'sources': [ - 'main.c', - ], - 'configurations': { - 'Three': { - }, - }, - 'xcode_settings': { - 'INFOPLIST_FILE': 'Info.plist', - 'INFOPLIST_PREPROCESS': 'NO', - 'INFOPLIST_PREPROCESSOR_DEFINITIONS': 'PROCESSED_KEY1=Foo', - }, - }, - ], -} diff --git a/tools/gyp/test/mac/libraries/subdir/README.txt b/tools/gyp/test/mac/libraries/subdir/README.txt deleted file mode 100644 index 4031ded85f..0000000000 --- a/tools/gyp/test/mac/libraries/subdir/README.txt +++ /dev/null @@ -1 +0,0 @@ -Make things live in a subdirectory, to make sure that DEPTH works correctly. diff --git a/tools/gyp/test/mac/libraries/subdir/hello.cc b/tools/gyp/test/mac/libraries/subdir/hello.cc deleted file mode 100644 index a43554c8ca..0000000000 --- a/tools/gyp/test/mac/libraries/subdir/hello.cc +++ /dev/null @@ -1,10 +0,0 @@ -// 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. - -#include - -int main() { - std::cout << "Hello, world!" << std::endl; - return 0; -} diff --git a/tools/gyp/test/mac/libraries/subdir/mylib.c b/tools/gyp/test/mac/libraries/subdir/mylib.c deleted file mode 100644 index e771991e83..0000000000 --- a/tools/gyp/test/mac/libraries/subdir/mylib.c +++ /dev/null @@ -1,7 +0,0 @@ -// 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. - -int my_foo(int x) { - return x + 1; -} diff --git a/tools/gyp/test/mac/libraries/subdir/test.gyp b/tools/gyp/test/mac/libraries/subdir/test.gyp deleted file mode 100644 index 80a0269772..0000000000 --- a/tools/gyp/test/mac/libraries/subdir/test.gyp +++ /dev/null @@ -1,66 +0,0 @@ -# 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. - -{ - 'targets': [ - { - 'target_name': 'libraries-test', - 'type': 'executable', - 'sources': [ - 'hello.cc', - ], - 'link_settings': { - 'libraries': [ - 'libcrypto.dylib', - 'libfl.a', - ], - }, - }, - { - # This creates a static library and puts it in a nonstandard location for - # libraries-search-path-test. - 'target_name': 'mylib', - 'type': 'static_library', - 'sources': [ - 'mylib.c', - ], - 'postbuilds': [ - { - 'postbuild_name': 'Make a secret location', - 'action': [ - 'mkdir', - '-p', - '${SRCROOT}/../secret_location', - ], - }, - { - 'postbuild_name': 'Copy to secret location, with secret name', - 'action': [ - 'cp', - '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}', - '${SRCROOT}/../secret_location/libmysecretlib.a', - ], - }, - ], - }, - { - 'target_name': 'libraries-search-path-test', - 'type': 'executable', - 'dependencies': [ 'mylib' ], - 'sources': [ - 'hello.cc', - ], - 'xcode_settings': { - 'LIBRARY_SEARCH_PATHS': [ - '<(DEPTH)/secret_location', - ], - }, - 'link_settings': { - 'libraries': [ - 'libmysecretlib.a', - ], - }, - }, - ], -} diff --git a/tools/gyp/test/mac/loadable-module/Info.plist b/tools/gyp/test/mac/loadable-module/Info.plist deleted file mode 100644 index f6607aebd9..0000000000 --- a/tools/gyp/test/mac/loadable-module/Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - com.google.test_loadable_module - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - BRPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1.0 - CFPlugInDynamicRegisterFunction - - CFPlugInDynamicRegistration - NO - - diff --git a/tools/gyp/test/mac/loadable-module/module.c b/tools/gyp/test/mac/loadable-module/module.c deleted file mode 100644 index 9584538347..0000000000 --- a/tools/gyp/test/mac/loadable-module/module.c +++ /dev/null @@ -1,11 +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. - -int SuperFly() { - return 42; -} - -const char* SuperFoo() { - return "Hello World"; -} diff --git a/tools/gyp/test/mac/loadable-module/test.gyp b/tools/gyp/test/mac/loadable-module/test.gyp deleted file mode 100644 index 3c8a5309d2..0000000000 --- a/tools/gyp/test/mac/loadable-module/test.gyp +++ /dev/null @@ -1,18 +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. - -{ - 'targets': [ - { - 'target_name': 'test_loadable_module', - 'type': 'loadable_module', - 'mac_bundle': 1, - 'sources': [ 'module.c' ], - 'product_extension': 'plugin', - 'xcode_settings': { - 'INFOPLIST_FILE': 'Info.plist', - }, - }, - ], -} diff --git a/tools/gyp/test/mac/non-strs-flattened-to-env/Info.plist b/tools/gyp/test/mac/non-strs-flattened-to-env/Info.plist deleted file mode 100644 index 11fc4b660d..0000000000 --- a/tools/gyp/test/mac/non-strs-flattened-to-env/Info.plist +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - CFBundlePackageType - APPL - CFBundleSignature - ???? - My Variable - ${MY_VAR} - CFlags - ${OTHER_CFLAGS} - - diff --git a/tools/gyp/test/mac/non-strs-flattened-to-env/main.c b/tools/gyp/test/mac/non-strs-flattened-to-env/main.c deleted file mode 100644 index 1711567ef5..0000000000 --- a/tools/gyp/test/mac/non-strs-flattened-to-env/main.c +++ /dev/null @@ -1,7 +0,0 @@ -// 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. - -int main() { - return 0; -} diff --git a/tools/gyp/test/mac/non-strs-flattened-to-env/test.gyp b/tools/gyp/test/mac/non-strs-flattened-to-env/test.gyp deleted file mode 100644 index 58814b73f6..0000000000 --- a/tools/gyp/test/mac/non-strs-flattened-to-env/test.gyp +++ /dev/null @@ -1,24 +0,0 @@ -# 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. -{ - 'targets': [ - { - 'target_name': 'test_app', - 'product_name': 'Test', - 'type': 'executable', - 'mac_bundle': 1, - 'sources': [ 'main.c', ], - 'xcode_settings': { - 'INFOPLIST_FILE': 'Info.plist', - 'MY_VAR': 'some expansion', - 'OTHER_CFLAGS': [ - # Just some (more than one) random flags. - '-fstack-protector-all', - '-fno-strict-aliasing', - '-DS="A Space"', # Would normally be in 'defines' - ], - }, - }, - ], -} diff --git a/tools/gyp/test/mac/postbuild-copy-bundle/Framework-Info.plist b/tools/gyp/test/mac/postbuild-copy-bundle/Framework-Info.plist deleted file mode 100644 index ec36829c08..0000000000 --- a/tools/gyp/test/mac/postbuild-copy-bundle/Framework-Info.plist +++ /dev/null @@ -1,30 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIconFile - - CFBundleIdentifier - com.yourcompany.${PRODUCT_NAME} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - NSPrincipalClass - - RandomKey - RandomValue - - diff --git a/tools/gyp/test/mac/postbuild-copy-bundle/TestApp-Info.plist b/tools/gyp/test/mac/postbuild-copy-bundle/TestApp-Info.plist deleted file mode 100644 index 98fd515200..0000000000 --- a/tools/gyp/test/mac/postbuild-copy-bundle/TestApp-Info.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIconFile - - CFBundleIdentifier - com.google.${PRODUCT_NAME} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSMinimumSystemVersion - ${MACOSX_DEPLOYMENT_TARGET} - NSMainNibFile - MainMenu - NSPrincipalClass - NSApplication - - diff --git a/tools/gyp/test/mac/postbuild-copy-bundle/empty.c b/tools/gyp/test/mac/postbuild-copy-bundle/empty.c deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tools/gyp/test/mac/postbuild-copy-bundle/main.c b/tools/gyp/test/mac/postbuild-copy-bundle/main.c deleted file mode 100644 index 21c1963526..0000000000 --- a/tools/gyp/test/mac/postbuild-copy-bundle/main.c +++ /dev/null @@ -1,4 +0,0 @@ -// 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. -int main() {} diff --git a/tools/gyp/test/mac/postbuild-copy-bundle/postbuild-copy-framework.sh b/tools/gyp/test/mac/postbuild-copy-bundle/postbuild-copy-framework.sh deleted file mode 100755 index 930fec6612..0000000000 --- a/tools/gyp/test/mac/postbuild-copy-bundle/postbuild-copy-framework.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -# 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. - -set -e - -rsync -acC --delete "$1" "$2" diff --git a/tools/gyp/test/mac/postbuild-copy-bundle/resource_file.sb b/tools/gyp/test/mac/postbuild-copy-bundle/resource_file.sb deleted file mode 100644 index 42057fa235..0000000000 --- a/tools/gyp/test/mac/postbuild-copy-bundle/resource_file.sb +++ /dev/null @@ -1 +0,0 @@ -This is included in the framework bundle. diff --git a/tools/gyp/test/mac/postbuild-copy-bundle/test.gyp b/tools/gyp/test/mac/postbuild-copy-bundle/test.gyp deleted file mode 100644 index 547737ce58..0000000000 --- a/tools/gyp/test/mac/postbuild-copy-bundle/test.gyp +++ /dev/null @@ -1,43 +0,0 @@ -# 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. -{ - 'targets': [ - { - 'target_name': 'test_bundle', - 'product_name': 'My Framework', - 'type': 'shared_library', - 'mac_bundle': 1, - 'sources': [ 'empty.c', ], - 'xcode_settings': { - 'INFOPLIST_FILE': 'Framework-Info.plist', - }, - 'mac_bundle_resources': [ - 'resource_file.sb', - ], - }, - { - 'target_name': 'test_app', - 'product_name': 'Test App', - 'type': 'executable', - 'mac_bundle': 1, - 'dependencies': [ - 'test_bundle', - ], - 'sources': [ 'main.c', ], - 'xcode_settings': { - 'INFOPLIST_FILE': 'TestApp-Info.plist', - }, - 'postbuilds': [ - { - 'postbuild_name': 'Copy dependent framework into app', - 'action': [ - './postbuild-copy-framework.sh', - '${BUILT_PRODUCTS_DIR}/My Framework.framework', - '${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/', - ], - }, - ], - }, - ], -} diff --git a/tools/gyp/test/mac/postbuild-defaults/Info.plist b/tools/gyp/test/mac/postbuild-defaults/Info.plist deleted file mode 100644 index d3f54d76cd..0000000000 --- a/tools/gyp/test/mac/postbuild-defaults/Info.plist +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - CFBundlePackageType - APPL - CFBundleSignature - ???? - CFBundleName - ${PRODUCT_NAME} - - diff --git a/tools/gyp/test/mac/postbuild-defaults/main.c b/tools/gyp/test/mac/postbuild-defaults/main.c deleted file mode 100644 index 1711567ef5..0000000000 --- a/tools/gyp/test/mac/postbuild-defaults/main.c +++ /dev/null @@ -1,7 +0,0 @@ -// 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. - -int main() { - return 0; -} diff --git a/tools/gyp/test/mac/postbuild-defaults/postbuild-defaults.sh b/tools/gyp/test/mac/postbuild-defaults/postbuild-defaults.sh deleted file mode 100755 index 56af2a8329..0000000000 --- a/tools/gyp/test/mac/postbuild-defaults/postbuild-defaults.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -# 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. - -set -e - -# This is the built Info.plist in the output directory. -PLIST="${BUILT_PRODUCTS_DIR}"/Test.app/Contents/Info # No trailing .plist -echo $(defaults read "${PLIST}" "CFBundleName") > "${BUILT_PRODUCTS_DIR}/result" - -# This is the source Info.plist next to this script file. -PLIST="${SRCROOT}"/Info # No trailing .plist -echo $(defaults read "${PLIST}" "CFBundleName") \ - >> "${BUILT_PRODUCTS_DIR}/result" diff --git a/tools/gyp/test/mac/postbuild-defaults/test.gyp b/tools/gyp/test/mac/postbuild-defaults/test.gyp deleted file mode 100644 index be0a075efc..0000000000 --- a/tools/gyp/test/mac/postbuild-defaults/test.gyp +++ /dev/null @@ -1,26 +0,0 @@ -# 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. -{ - 'targets': [ - { - 'target_name': 'test_app', - 'product_name': 'Test', - 'type': 'executable', - 'mac_bundle': 1, - 'sources': [ 'main.c', ], - 'xcode_settings': { - 'INFOPLIST_FILE': 'Info.plist', - }, - 'postbuilds': [ - { - 'postbuild_name': 'Postbuild that calls defaults', - 'action': [ - './postbuild-defaults.sh', - '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}', - ], - }, - ], - }, - ], -} diff --git a/tools/gyp/test/mac/postbuild-fail/file.c b/tools/gyp/test/mac/postbuild-fail/file.c deleted file mode 100644 index 91695b10c6..0000000000 --- a/tools/gyp/test/mac/postbuild-fail/file.c +++ /dev/null @@ -1,6 +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. - -// That's right, this is copyrighted. -void f() {} diff --git a/tools/gyp/test/mac/postbuild-fail/postbuild-fail.sh b/tools/gyp/test/mac/postbuild-fail/postbuild-fail.sh deleted file mode 100755 index dc1a60d987..0000000000 --- a/tools/gyp/test/mac/postbuild-fail/postbuild-fail.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/bash -# 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. - -exit 1 diff --git a/tools/gyp/test/mac/postbuild-fail/test.gyp b/tools/gyp/test/mac/postbuild-fail/test.gyp deleted file mode 100644 index e63283db03..0000000000 --- a/tools/gyp/test/mac/postbuild-fail/test.gyp +++ /dev/null @@ -1,38 +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. -{ - 'targets': [ - { - 'target_name': 'nonbundle', - 'type': 'static_library', - 'sources': [ 'file.c', ], - 'postbuilds': [ - { - 'postbuild_name': 'Postbuild Fail', - 'action': [ './postbuild-fail.sh', ], - }, - { - 'postbuild_name': 'Runs after failing postbuild', - 'action': [ './touch-static.sh', ], - }, - ], - }, - { - 'target_name': 'bundle', - 'type': 'shared_library', - 'mac_bundle': 1, - 'sources': [ 'file.c', ], - 'postbuilds': [ - { - 'postbuild_name': 'Postbuild Fail', - 'action': [ './postbuild-fail.sh', ], - }, - { - 'postbuild_name': 'Runs after failing postbuild', - 'action': [ './touch-dynamic.sh', ], - }, - ], - }, - ], -} diff --git a/tools/gyp/test/mac/postbuild-fail/touch-dynamic.sh b/tools/gyp/test/mac/postbuild-fail/touch-dynamic.sh deleted file mode 100755 index a388a64102..0000000000 --- a/tools/gyp/test/mac/postbuild-fail/touch-dynamic.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# 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. - -set -e -touch "${BUILT_PRODUCTS_DIR}/dynamic_touch" diff --git a/tools/gyp/test/mac/postbuild-fail/touch-static.sh b/tools/gyp/test/mac/postbuild-fail/touch-static.sh deleted file mode 100755 index 97ecaa6868..0000000000 --- a/tools/gyp/test/mac/postbuild-fail/touch-static.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# 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. - -set -e -touch "${BUILT_PRODUCTS_DIR}/static_touch" diff --git a/tools/gyp/test/mac/postbuild-multiple-configurations/main.c b/tools/gyp/test/mac/postbuild-multiple-configurations/main.c deleted file mode 100644 index 21c1963526..0000000000 --- a/tools/gyp/test/mac/postbuild-multiple-configurations/main.c +++ /dev/null @@ -1,4 +0,0 @@ -// 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. -int main() {} diff --git a/tools/gyp/test/mac/postbuild-multiple-configurations/postbuild-touch-file.sh b/tools/gyp/test/mac/postbuild-multiple-configurations/postbuild-touch-file.sh deleted file mode 100755 index b6170cf7a7..0000000000 --- a/tools/gyp/test/mac/postbuild-multiple-configurations/postbuild-touch-file.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# 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. - -touch "${BUILT_PRODUCTS_DIR}/postbuild-file" diff --git a/tools/gyp/test/mac/postbuild-multiple-configurations/test.gyp b/tools/gyp/test/mac/postbuild-multiple-configurations/test.gyp deleted file mode 100644 index c350b20d68..0000000000 --- a/tools/gyp/test/mac/postbuild-multiple-configurations/test.gyp +++ /dev/null @@ -1,26 +0,0 @@ -# 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. -{ - 'target_defaults': { - 'configurations': { - 'Debug': {}, - 'Release': {}, - }, - }, - 'targets': [ - { - 'target_name': 'random_target', - 'type': 'executable', - 'sources': [ 'main.c', ], - 'postbuilds': [ - { - 'postbuild_name': 'Touch a file.', - 'action': [ - './postbuild-touch-file.sh', - ], - }, - ], - }, - ], -} diff --git a/tools/gyp/test/mac/postbuild-static-library/empty.c b/tools/gyp/test/mac/postbuild-static-library/empty.c deleted file mode 100644 index 9554336c0c..0000000000 --- a/tools/gyp/test/mac/postbuild-static-library/empty.c +++ /dev/null @@ -1,4 +0,0 @@ -// 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. -void f() {} diff --git a/tools/gyp/test/mac/postbuild-static-library/postbuild-touch-file.sh b/tools/gyp/test/mac/postbuild-static-library/postbuild-touch-file.sh deleted file mode 100755 index 37de4de4f6..0000000000 --- a/tools/gyp/test/mac/postbuild-static-library/postbuild-touch-file.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# 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. - -touch "${BUILT_PRODUCTS_DIR}/$1" diff --git a/tools/gyp/test/mac/postbuild-static-library/test.gyp b/tools/gyp/test/mac/postbuild-static-library/test.gyp deleted file mode 100644 index 9ef55a0afa..0000000000 --- a/tools/gyp/test/mac/postbuild-static-library/test.gyp +++ /dev/null @@ -1,34 +0,0 @@ -# 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. -{ - 'targets': [ - { - 'target_name': 'my_lib', - 'type': 'static_library', - 'sources': [ 'empty.c', ], - 'postbuilds': [ - { - 'postbuild_name': 'Postbuild that touches a file', - 'action': [ - './postbuild-touch-file.sh', 'postbuild-file' - ], - }, - ], - }, - - { - 'target_name': 'my_sourceless_lib', - 'type': 'static_library', - 'dependencies': [ 'my_lib' ], - 'postbuilds': [ - { - 'postbuild_name': 'Postbuild that touches a file', - 'action': [ - './postbuild-touch-file.sh', 'postbuild-file-sourceless' - ], - }, - ], - }, - ], -} diff --git a/tools/gyp/test/mac/postbuilds/file.c b/tools/gyp/test/mac/postbuilds/file.c deleted file mode 100644 index 653e71ff7e..0000000000 --- a/tools/gyp/test/mac/postbuilds/file.c +++ /dev/null @@ -1,4 +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. -void f() {} diff --git a/tools/gyp/test/mac/postbuilds/script/shared_library_postbuild.sh b/tools/gyp/test/mac/postbuilds/script/shared_library_postbuild.sh deleted file mode 100755 index c623c8bf21..0000000000 --- a/tools/gyp/test/mac/postbuilds/script/shared_library_postbuild.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# 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. - -set -e - -lib="${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" -nm ${lib} > /dev/null # Just make sure this works. - -pattern="${1}" - -if [ $pattern != "a|b" ]; then - echo "Parameter quoting is broken" - exit 1 -fi - -if [ "${2}" != "arg with spaces" ]; then - echo "Parameter space escaping is broken" - exit 1 -fi - -touch "${lib}"_touch diff --git a/tools/gyp/test/mac/postbuilds/script/static_library_postbuild.sh b/tools/gyp/test/mac/postbuilds/script/static_library_postbuild.sh deleted file mode 100755 index 2bf09b34e1..0000000000 --- a/tools/gyp/test/mac/postbuilds/script/static_library_postbuild.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# 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. - -set -e - -lib="${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME}" -nm ${lib} > /dev/null # Just make sure this works. - -pattern="${1}" - -if [ $pattern != "a|b" ]; then - echo "Parameter quote escaping is broken" - exit 1 -fi - -if [ "${2}" != "arg with spaces" ]; then - echo "Parameter space escaping is broken" - exit 1 -fi - -touch "${lib}"_touch.a diff --git a/tools/gyp/test/mac/postbuilds/subdirectory/nested_target.gyp b/tools/gyp/test/mac/postbuilds/subdirectory/nested_target.gyp deleted file mode 100644 index f7ca9a6bf0..0000000000 --- a/tools/gyp/test/mac/postbuilds/subdirectory/nested_target.gyp +++ /dev/null @@ -1,45 +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. -{ - 'targets': [ - { - 'target_name': 'nest_el', - 'type': 'static_library', - 'sources': [ '../file.c', ], - 'postbuilds': [ - { - 'postbuild_name': 'Static library postbuild', - 'variables': { - 'some_regex': 'a|b', - }, - 'action': [ - '../script/static_library_postbuild.sh', - '<(some_regex)', - 'arg with spaces', - ], - }, - ], - }, - { - 'target_name': 'nest_dyna', - 'type': 'shared_library', - 'mac_bundle': 1, - 'sources': [ '../file.c', ], - 'postbuilds': [ - { - 'postbuild_name': 'Dynamic library postbuild', - 'variables': { - 'some_regex': 'a|b', - }, - 'action': [ - '../script/shared_library_postbuild.sh', - '<(some_regex)', - 'arg with spaces', - ], - }, - ], - }, - ], -} - diff --git a/tools/gyp/test/mac/postbuilds/test.gyp b/tools/gyp/test/mac/postbuilds/test.gyp deleted file mode 100644 index a9a05cb2d6..0000000000 --- a/tools/gyp/test/mac/postbuilds/test.gyp +++ /dev/null @@ -1,79 +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. -{ - 'targets': [ - { - 'target_name': 'el', - 'type': 'static_library', - 'sources': [ 'file.c', ], - 'postbuilds': [ - { - 'postbuild_name': 'Static library postbuild', - 'variables': { - 'some_regex': 'a|b', - }, - 'action': [ - 'script/static_library_postbuild.sh', - '<(some_regex)', - 'arg with spaces', - ], - }, - { - 'postbuild_name': 'Test variable in gyp file', - 'action': [ - 'cp', - '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}', - '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}_gyp_touch.a', - ], - }, - ], - }, - { - 'target_name': 'dyna', - 'type': 'shared_library', - 'mac_bundle': 1, - 'sources': [ 'file.c', ], - 'dependencies': [ - 'subdirectory/nested_target.gyp:nest_dyna', - 'subdirectory/nested_target.gyp:nest_el', - ], - 'postbuilds': [ - { - 'postbuild_name': 'Dynamic library postbuild', - 'variables': { - 'some_regex': 'a|b', - }, - 'action': [ - 'script/shared_library_postbuild.sh', - '<(some_regex)', - 'arg with spaces', - ], - }, - { - 'postbuild_name': 'Test variable in gyp file', - 'action': [ - 'cp', - '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}', - '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}_gyp_touch', - ], - }, - ], - }, - { - 'target_name': 'dyna_standalone', - 'type': 'shared_library', - 'sources': [ 'file.c', ], - 'postbuilds': [ - { - 'postbuild_name': 'Test variable in gyp file', - 'action': [ - 'cp', - '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}', - '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}_gyp_touch.dylib', - ], - }, - ], - }, - ], -} diff --git a/tools/gyp/test/mac/prefixheader/file.c b/tools/gyp/test/mac/prefixheader/file.c deleted file mode 100644 index d0b39d1f6d..0000000000 --- a/tools/gyp/test/mac/prefixheader/file.c +++ /dev/null @@ -1 +0,0 @@ -MyInt f() { return 0; } diff --git a/tools/gyp/test/mac/prefixheader/file.cc b/tools/gyp/test/mac/prefixheader/file.cc deleted file mode 100644 index d0b39d1f6d..0000000000 --- a/tools/gyp/test/mac/prefixheader/file.cc +++ /dev/null @@ -1 +0,0 @@ -MyInt f() { return 0; } diff --git a/tools/gyp/test/mac/prefixheader/file.m b/tools/gyp/test/mac/prefixheader/file.m deleted file mode 100644 index d0b39d1f6d..0000000000 --- a/tools/gyp/test/mac/prefixheader/file.m +++ /dev/null @@ -1 +0,0 @@ -MyInt f() { return 0; } diff --git a/tools/gyp/test/mac/prefixheader/file.mm b/tools/gyp/test/mac/prefixheader/file.mm deleted file mode 100644 index d0b39d1f6d..0000000000 --- a/tools/gyp/test/mac/prefixheader/file.mm +++ /dev/null @@ -1 +0,0 @@ -MyInt f() { return 0; } diff --git a/tools/gyp/test/mac/prefixheader/header.h b/tools/gyp/test/mac/prefixheader/header.h deleted file mode 100644 index 0716e500c5..0000000000 --- a/tools/gyp/test/mac/prefixheader/header.h +++ /dev/null @@ -1 +0,0 @@ -typedef int MyInt; diff --git a/tools/gyp/test/mac/prefixheader/test.gyp b/tools/gyp/test/mac/prefixheader/test.gyp deleted file mode 100644 index 7e6b1af807..0000000000 --- a/tools/gyp/test/mac/prefixheader/test.gyp +++ /dev/null @@ -1,82 +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. -{ - 'targets': [ - { - 'target_name': 'prefix_header_c', - 'type': 'static_library', - 'sources': [ 'file.c', ], - 'xcode_settings': { - 'GCC_PREFIX_HEADER': 'header.h', - }, - }, - { - 'target_name': 'precompiled_prefix_header_c', - 'type': 'shared_library', - 'mac_bundle': 1, - 'sources': [ 'file.c', ], - 'xcode_settings': { - 'GCC_PREFIX_HEADER': 'header.h', - 'GCC_PRECOMPILE_PREFIX_HEADER': 'YES', - }, - }, - - { - 'target_name': 'prefix_header_cc', - 'type': 'static_library', - 'sources': [ 'file.cc', ], - 'xcode_settings': { - 'GCC_PREFIX_HEADER': 'header.h', - }, - }, - { - 'target_name': 'precompiled_prefix_header_cc', - 'type': 'shared_library', - 'mac_bundle': 1, - 'sources': [ 'file.cc', ], - 'xcode_settings': { - 'GCC_PREFIX_HEADER': 'header.h', - 'GCC_PRECOMPILE_PREFIX_HEADER': 'YES', - }, - }, - - { - 'target_name': 'prefix_header_m', - 'type': 'static_library', - 'sources': [ 'file.m', ], - 'xcode_settings': { - 'GCC_PREFIX_HEADER': 'header.h', - }, - }, - { - 'target_name': 'precompiled_prefix_header_m', - 'type': 'shared_library', - 'mac_bundle': 1, - 'sources': [ 'file.m', ], - 'xcode_settings': { - 'GCC_PREFIX_HEADER': 'header.h', - 'GCC_PRECOMPILE_PREFIX_HEADER': 'YES', - }, - }, - - { - 'target_name': 'prefix_header_mm', - 'type': 'static_library', - 'sources': [ 'file.mm', ], - 'xcode_settings': { - 'GCC_PREFIX_HEADER': 'header.h', - }, - }, - { - 'target_name': 'precompiled_prefix_header_mm', - 'type': 'shared_library', - 'mac_bundle': 1, - 'sources': [ 'file.mm', ], - 'xcode_settings': { - 'GCC_PREFIX_HEADER': 'header.h', - 'GCC_PRECOMPILE_PREFIX_HEADER': 'YES', - }, - }, - ], -} diff --git a/tools/gyp/test/mac/rebuild/TestApp-Info.plist b/tools/gyp/test/mac/rebuild/TestApp-Info.plist deleted file mode 100644 index 98fd515200..0000000000 --- a/tools/gyp/test/mac/rebuild/TestApp-Info.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIconFile - - CFBundleIdentifier - com.google.${PRODUCT_NAME} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSMinimumSystemVersion - ${MACOSX_DEPLOYMENT_TARGET} - NSMainNibFile - MainMenu - NSPrincipalClass - NSApplication - - diff --git a/tools/gyp/test/mac/rebuild/delay-touch.sh b/tools/gyp/test/mac/rebuild/delay-touch.sh deleted file mode 100755 index 7caf105b6e..0000000000 --- a/tools/gyp/test/mac/rebuild/delay-touch.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -set -e - -sleep 1 # mtime resolution is 1 sec on unix. -touch "$1" diff --git a/tools/gyp/test/mac/rebuild/empty.c b/tools/gyp/test/mac/rebuild/empty.c deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tools/gyp/test/mac/rebuild/main.c b/tools/gyp/test/mac/rebuild/main.c deleted file mode 100644 index 237c8ce181..0000000000 --- a/tools/gyp/test/mac/rebuild/main.c +++ /dev/null @@ -1 +0,0 @@ -int main() {} diff --git a/tools/gyp/test/mac/rebuild/test.gyp b/tools/gyp/test/mac/rebuild/test.gyp deleted file mode 100644 index 15b4e4ef2f..0000000000 --- a/tools/gyp/test/mac/rebuild/test.gyp +++ /dev/null @@ -1,56 +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. -{ - 'targets': [ - { - 'target_name': 'test_app', - 'product_name': 'Test App', - 'type': 'executable', - 'mac_bundle': 1, - 'sources': [ - 'main.c', - ], - 'xcode_settings': { - 'INFOPLIST_FILE': 'TestApp-Info.plist', - }, - }, - { - 'target_name': 'test_app_postbuilds', - 'product_name': 'Test App 2', - 'type': 'executable', - 'mac_bundle': 1, - 'sources': [ - 'main.c', - ], - 'xcode_settings': { - 'INFOPLIST_FILE': 'TestApp-Info.plist', - }, - 'postbuilds': [ - { - 'postbuild_name': 'Postbuild that touches the app binary', - 'action': [ - './delay-touch.sh', '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}', - ], - }, - ], - }, - { - 'target_name': 'test_framework_postbuilds', - 'product_name': 'Test Framework', - 'type': 'shared_library', - 'mac_bundle': 1, - 'sources': [ - 'empty.c', - ], - 'postbuilds': [ - { - 'postbuild_name': 'Postbuild that touches the framework binary', - 'action': [ - './delay-touch.sh', '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}', - ], - }, - ], - }, - ], -} diff --git a/tools/gyp/test/mac/sourceless-module/empty.c b/tools/gyp/test/mac/sourceless-module/empty.c deleted file mode 100644 index 237c8ce181..0000000000 --- a/tools/gyp/test/mac/sourceless-module/empty.c +++ /dev/null @@ -1 +0,0 @@ -int main() {} diff --git a/tools/gyp/test/mac/sourceless-module/test.gyp b/tools/gyp/test/mac/sourceless-module/test.gyp deleted file mode 100644 index 49dc2af9c6..0000000000 --- a/tools/gyp/test/mac/sourceless-module/test.gyp +++ /dev/null @@ -1,39 +0,0 @@ -# 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. -{ - 'targets': [ - { - 'target_name': 'empty_bundle', - 'type': 'loadable_module', - 'mac_bundle': 1, - }, - { - 'target_name': 'resource_bundle', - 'type': 'loadable_module', - 'mac_bundle': 1, - 'actions': [ - { - 'action_name': 'Add Resource', - 'inputs': [], - 'outputs': [ - '<(INTERMEDIATE_DIR)/app_manifest/foo.manifest', - ], - 'action': [ - 'touch', '<(INTERMEDIATE_DIR)/app_manifest/foo.manifest', - ], - 'process_outputs_as_mac_bundle_resources': 1, - }, - ], - }, - { - 'target_name': 'dependent_on_resource_bundle', - 'type': 'executable', - 'sources': [ 'empty.c' ], - 'dependencies': [ - 'resource_bundle', - ], - }, - ], -} - diff --git a/tools/gyp/test/mac/strip/file.c b/tools/gyp/test/mac/strip/file.c deleted file mode 100644 index 421f0405f5..0000000000 --- a/tools/gyp/test/mac/strip/file.c +++ /dev/null @@ -1,9 +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. - -static void the_static_function() {} - -void the_function() { - the_static_function(); -} diff --git a/tools/gyp/test/mac/strip/strip.saves b/tools/gyp/test/mac/strip/strip.saves deleted file mode 100644 index b60ca62857..0000000000 --- a/tools/gyp/test/mac/strip/strip.saves +++ /dev/null @@ -1,5 +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. - -# This file would list symbols that should not be stripped. diff --git a/tools/gyp/test/mac/strip/test.gyp b/tools/gyp/test/mac/strip/test.gyp deleted file mode 100644 index 08c8c526ab..0000000000 --- a/tools/gyp/test/mac/strip/test.gyp +++ /dev/null @@ -1,115 +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. - -# These xcode_settings affect stripping: -# "Deployment postprocessing involves stripping the binary, and setting -# its file mode, owner, and group." -#'DEPLOYMENT_POSTPROCESSING': 'YES', - -# "Specifies whether to strip symbol information from the binary. -# Prerequisite: $DEPLOYMENT_POSTPROCESSING = YES" "Default Value: 'NO'" -#'STRIP_INSTALLED_PRODUCT': 'YES', - -# "Values: -# * all: Strips the binary completely, removing the symbol table and -# relocation information -# * non-global: Strips nonglobal symbols but saves external symbols. -# * debugging: Strips debugging symbols but saves local and global -# symbols." -# (maps to no flag, -x, -S in that order) -#'STRIP_STYLE': 'non-global', - -# "Additional strip flags" -#'STRIPFLAGS': '-c', - -# "YES: Copied binaries are stripped of debugging symbols. This does -# not cause the binary produced by the linker to be stripped. Use -# 'STRIP_INSTALLED_PRODUCT (Strip Linked Product)' to have the linker -# strip the binary." -#'COPY_PHASE_STRIP': 'NO', -{ - 'targets': [ - { - 'target_name': 'no_postprocess', - 'type': 'shared_library', - 'sources': [ 'file.c', ], - 'xcode_settings': { - 'DEPLOYMENT_POSTPROCESSING': 'NO', - 'STRIP_INSTALLED_PRODUCT': 'YES', - }, - }, - { - 'target_name': 'no_strip', - 'type': 'shared_library', - 'sources': [ 'file.c', ], - 'xcode_settings': { - 'DEPLOYMENT_POSTPROCESSING': 'YES', - 'STRIP_INSTALLED_PRODUCT': 'NO', - }, - }, - { - 'target_name': 'strip_all', - 'type': 'shared_library', - 'sources': [ 'file.c', ], - 'xcode_settings': { - 'DEPLOYMENT_POSTPROCESSING': 'YES', - 'STRIP_INSTALLED_PRODUCT': 'YES', - 'STRIP_STYLE': 'all', - }, - }, - { - 'target_name': 'strip_nonglobal', - 'type': 'shared_library', - 'sources': [ 'file.c', ], - 'xcode_settings': { - 'DEPLOYMENT_POSTPROCESSING': 'YES', - 'STRIP_INSTALLED_PRODUCT': 'YES', - 'STRIP_STYLE': 'non-global', - }, - }, - { - 'target_name': 'strip_debugging', - 'type': 'shared_library', - 'sources': [ 'file.c', ], - 'xcode_settings': { - 'DEPLOYMENT_POSTPROCESSING': 'YES', - 'STRIP_INSTALLED_PRODUCT': 'YES', - 'STRIP_STYLE': 'debugging', - }, - }, - { - 'target_name': 'strip_all_custom_flags', - 'type': 'shared_library', - 'sources': [ 'file.c', ], - 'xcode_settings': { - 'DEPLOYMENT_POSTPROCESSING': 'YES', - 'STRIP_INSTALLED_PRODUCT': 'YES', - 'STRIP_STYLE': 'all', - 'STRIPFLAGS': '-c', - }, - }, - { - 'target_name': 'strip_all_bundle', - 'type': 'shared_library', - 'mac_bundle': '1', - 'sources': [ 'file.c', ], - 'xcode_settings': { - 'DEPLOYMENT_POSTPROCESSING': 'YES', - 'STRIP_INSTALLED_PRODUCT': 'YES', - 'STRIP_STYLE': 'all', - }, - }, - { - 'target_name': 'strip_save', - 'type': 'shared_library', - 'sources': [ 'file.c', ], - 'xcode_settings': { - 'DEPLOYMENT_POSTPROCESSING': 'YES', - 'STRIP_INSTALLED_PRODUCT': 'YES', - 'STRIPFLAGS': '-s $(CHROMIUM_STRIP_SAVE_FILE)', - 'CHROMIUM_STRIP_SAVE_FILE': 'strip.saves', - }, - }, - ], -} diff --git a/tools/gyp/test/mac/type_envvars/file.c b/tools/gyp/test/mac/type_envvars/file.c deleted file mode 100644 index 9cddaf1b0b..0000000000 --- a/tools/gyp/test/mac/type_envvars/file.c +++ /dev/null @@ -1,6 +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. - -void f() {} -int main() {} diff --git a/tools/gyp/test/mac/type_envvars/test.gyp b/tools/gyp/test/mac/type_envvars/test.gyp deleted file mode 100644 index 465670056b..0000000000 --- a/tools/gyp/test/mac/type_envvars/test.gyp +++ /dev/null @@ -1,100 +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. -{ - 'targets': [ - { - 'target_name': 'my_app', - 'product_name': 'My App', - 'type': 'executable', - 'mac_bundle': 1, - 'sources': [ 'file.c', ], - 'postbuilds': [ - { - 'postbuild_name': 'envtest', - 'action': [ './test_bundle_executable.sh', ], - }, - ], - }, - { - 'target_name': 'bundle_loadable_module', - 'type': 'loadable_module', - 'mac_bundle': 1, - 'sources': [ 'file.c', ], - 'postbuilds': [ - { - 'postbuild_name': 'envtest', - 'action': [ './test_bundle_loadable_module.sh', ], - }, - ], - }, - { - 'target_name': 'bundle_shared_library', - 'type': 'shared_library', - 'mac_bundle': 1, - 'sources': [ 'file.c', ], - 'postbuilds': [ - { - 'postbuild_name': 'envtest', - 'action': [ './test_bundle_shared_library.sh', ], - }, - ], - }, - # Types 'static_library' and 'none' can't exist as bundles. - - { - 'target_name': 'nonbundle_executable', - 'type': 'executable', - 'sources': [ 'file.c', ], - 'postbuilds': [ - { - 'postbuild_name': 'envtest', - 'action': [ './test_nonbundle_executable.sh', ], - }, - ], - }, - { - 'target_name': 'nonbundle_loadable_module', - 'type': 'loadable_module', - 'sources': [ 'file.c', ], - 'postbuilds': [ - { - 'postbuild_name': 'envtest', - 'action': [ './test_nonbundle_loadable_module.sh', ], - }, - ], - }, - { - 'target_name': 'nonbundle_shared_library', - 'type': 'shared_library', - 'sources': [ 'file.c', ], - 'postbuilds': [ - { - 'postbuild_name': 'envtest', - 'action': [ './test_nonbundle_shared_library.sh', ], - }, - ], - }, - { - 'target_name': 'nonbundle_static_library', - 'type': 'static_library', - 'sources': [ 'file.c', ], - 'postbuilds': [ - { - 'postbuild_name': 'envtest', - 'action': [ './test_nonbundle_static_library.sh', ], - }, - ], - }, - { - 'target_name': 'nonbundle_none', - 'type': 'none', - 'postbuilds': [ - { - 'postbuild_name': 'envtest', - 'action': [ './test_nonbundle_none.sh', ], - }, - ], - }, - ], -} diff --git a/tools/gyp/test/mac/type_envvars/test_bundle_executable.sh b/tools/gyp/test/mac/type_envvars/test_bundle_executable.sh deleted file mode 100755 index 1cc6e5668f..0000000000 --- a/tools/gyp/test/mac/type_envvars/test_bundle_executable.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -# 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. - -set -e - -test $MACH_O_TYPE = mh_execute -test $PRODUCT_TYPE = com.apple.product-type.application -test "${PRODUCT_NAME}" = "My App" -test "${FULL_PRODUCT_NAME}" = "My App.app" - -test "${EXECUTABLE_NAME}" = "My App" -test "${EXECUTABLE_PATH}" = "My App.app/Contents/MacOS/My App" -test "${WRAPPER_NAME}" = "My App.app" diff --git a/tools/gyp/test/mac/type_envvars/test_bundle_loadable_module.sh b/tools/gyp/test/mac/type_envvars/test_bundle_loadable_module.sh deleted file mode 100755 index 86fc5c99d8..0000000000 --- a/tools/gyp/test/mac/type_envvars/test_bundle_loadable_module.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# 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. - -set -e - -test $MACH_O_TYPE = mh_bundle -test $PRODUCT_TYPE = com.apple.product-type.bundle -test $PRODUCT_NAME = bundle_loadable_module -test $FULL_PRODUCT_NAME = bundle_loadable_module.bundle - -test $EXECUTABLE_NAME = bundle_loadable_module -test $EXECUTABLE_PATH = \ - "bundle_loadable_module.bundle/Contents/MacOS/bundle_loadable_module" -test $WRAPPER_NAME = bundle_loadable_module.bundle diff --git a/tools/gyp/test/mac/type_envvars/test_bundle_shared_library.sh b/tools/gyp/test/mac/type_envvars/test_bundle_shared_library.sh deleted file mode 100755 index 5585af4221..0000000000 --- a/tools/gyp/test/mac/type_envvars/test_bundle_shared_library.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# 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. - -set -e - -test $MACH_O_TYPE = mh_dylib -test $PRODUCT_TYPE = com.apple.product-type.framework -test $PRODUCT_NAME = bundle_shared_library -test $FULL_PRODUCT_NAME = bundle_shared_library.framework - -test $EXECUTABLE_NAME = bundle_shared_library -test $EXECUTABLE_PATH = \ - "bundle_shared_library.framework/Versions/A/bundle_shared_library" -test $WRAPPER_NAME = bundle_shared_library.framework diff --git a/tools/gyp/test/mac/type_envvars/test_nonbundle_executable.sh b/tools/gyp/test/mac/type_envvars/test_nonbundle_executable.sh deleted file mode 100755 index e026a1e261..0000000000 --- a/tools/gyp/test/mac/type_envvars/test_nonbundle_executable.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# 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. - -set -e -# For some reason, Xcode doesn't set MACH_O_TYPE for non-bundle executables. -# Check for "not set", not just "empty": -[[ ! $MACH_O_TYPE && ${MACH_O_TYPE-_} ]] -test $PRODUCT_TYPE = com.apple.product-type.tool -test $PRODUCT_NAME = nonbundle_executable -test $FULL_PRODUCT_NAME = nonbundle_executable - -test $EXECUTABLE_NAME = nonbundle_executable -test $EXECUTABLE_PATH = nonbundle_executable -[[ ! $WRAPPER_NAME && ${WRAPPER_NAME-_} ]] diff --git a/tools/gyp/test/mac/type_envvars/test_nonbundle_loadable_module.sh b/tools/gyp/test/mac/type_envvars/test_nonbundle_loadable_module.sh deleted file mode 100755 index 317881eda1..0000000000 --- a/tools/gyp/test/mac/type_envvars/test_nonbundle_loadable_module.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -# 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. - -set -e - -test $MACH_O_TYPE = mh_bundle -test $PRODUCT_TYPE = com.apple.product-type.library.dynamic -test $PRODUCT_NAME = nonbundle_loadable_module -test $FULL_PRODUCT_NAME = nonbundle_loadable_module.so - -test $EXECUTABLE_NAME = nonbundle_loadable_module.so -test $EXECUTABLE_PATH = nonbundle_loadable_module.so -[[ ! $WRAPPER_NAME && ${WRAPPER_NAME-_} ]] diff --git a/tools/gyp/test/mac/type_envvars/test_nonbundle_none.sh b/tools/gyp/test/mac/type_envvars/test_nonbundle_none.sh deleted file mode 100755 index 11c40bc638..0000000000 --- a/tools/gyp/test/mac/type_envvars/test_nonbundle_none.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# 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. - -set -e - -# Check for "not set", not just "empty": -[[ ! $MACH_O_TYPE && ${MACH_O_TYPE-_} ]] -[[ ! $PRODUCT_TYPE && ${PRODUCT_TYPE-_} ]] -test $PRODUCT_NAME = nonbundle_none -[[ ! $FULL_PRODUCT_NAME && ${FULL_PRODUCT_NAME-_} ]] - -[[ ! $EXECUTABLE_NAME && ${EXECUTABLE_NAME-_} ]] -[[ ! $EXECUTABLE_PATH && ${EXECUTABLE_PATH-_} ]] -[[ ! $WRAPPER_NAME && ${WRAPPER_NAME-_} ]] diff --git a/tools/gyp/test/mac/type_envvars/test_nonbundle_shared_library.sh b/tools/gyp/test/mac/type_envvars/test_nonbundle_shared_library.sh deleted file mode 100755 index 3b9fb72dd3..0000000000 --- a/tools/gyp/test/mac/type_envvars/test_nonbundle_shared_library.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -# 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. - -set -e - -test $MACH_O_TYPE = mh_dylib -test $PRODUCT_TYPE = com.apple.product-type.library.dynamic -test $PRODUCT_NAME = nonbundle_shared_library -test $FULL_PRODUCT_NAME = libnonbundle_shared_library.dylib - -test $EXECUTABLE_NAME = libnonbundle_shared_library.dylib -test $EXECUTABLE_PATH = libnonbundle_shared_library.dylib -[[ ! $WRAPPER_NAME && ${WRAPPER_NAME-_} ]] diff --git a/tools/gyp/test/mac/type_envvars/test_nonbundle_static_library.sh b/tools/gyp/test/mac/type_envvars/test_nonbundle_static_library.sh deleted file mode 100755 index 77cee2c20a..0000000000 --- a/tools/gyp/test/mac/type_envvars/test_nonbundle_static_library.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -# 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. - -set -e - -test $MACH_O_TYPE = staticlib -test $PRODUCT_TYPE = com.apple.product-type.library.static -test $PRODUCT_NAME = nonbundle_static_library -test $FULL_PRODUCT_NAME = libnonbundle_static_library.a - -test $EXECUTABLE_NAME = libnonbundle_static_library.a -test $EXECUTABLE_PATH = libnonbundle_static_library.a -[[ ! $WRAPPER_NAME && ${WRAPPER_NAME-_} ]] diff --git a/tools/gyp/test/mac/xcode-env-order/Info.plist b/tools/gyp/test/mac/xcode-env-order/Info.plist deleted file mode 100644 index e11f21e52d..0000000000 --- a/tools/gyp/test/mac/xcode-env-order/Info.plist +++ /dev/null @@ -1,56 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIconFile - - CFBundleIdentifier - com.google.${PRODUCT_NAME} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSMinimumSystemVersion - ${MACOSX_DEPLOYMENT_TARGET} - NSMainNibFile - MainMenu - NSPrincipalClass - NSApplication - - BraceProcessedKey1 - ${BRACE_DEPENDENT_KEY1} - BraceProcessedKey2 - ${BRACE_DEPENDENT_KEY2} - BraceProcessedKey3 - ${BRACE_DEPENDENT_KEY3} - - ParenProcessedKey1 - ${PAREN_DEPENDENT_KEY1} - ParenProcessedKey2 - ${PAREN_DEPENDENT_KEY2} - ParenProcessedKey3 - ${PAREN_DEPENDENT_KEY3} - - BareProcessedKey1 - ${BARE_DEPENDENT_KEY1} - BareProcessedKey2 - ${BARE_DEPENDENT_KEY2} - BareProcessedKey3 - ${BARE_DEPENDENT_KEY3} - - MixedProcessedKey - ${MIXED_DEPENDENT_KEY} - - diff --git a/tools/gyp/test/mac/xcode-env-order/main.c b/tools/gyp/test/mac/xcode-env-order/main.c deleted file mode 100644 index 1bf4b2a11a..0000000000 --- a/tools/gyp/test/mac/xcode-env-order/main.c +++ /dev/null @@ -1,7 +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. - -int main() { - return 0; -} diff --git a/tools/gyp/test/mac/xcode-env-order/test.gyp b/tools/gyp/test/mac/xcode-env-order/test.gyp deleted file mode 100644 index 8433faea3c..0000000000 --- a/tools/gyp/test/mac/xcode-env-order/test.gyp +++ /dev/null @@ -1,83 +0,0 @@ -# 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. -{ - 'targets': [ - { - 'target_name': 'test_app', - 'product_name': 'Test', - 'type': 'executable', - 'mac_bundle': 1, - 'sources': [ - 'main.c', - ], - # Env vars in copies. - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)/${PRODUCT_NAME}-copy-brace', - 'files': [ 'main.c', ], # ${SOURCE_ROOT} doesn't work with xcode - }, - { - 'destination': '<(PRODUCT_DIR)/$(PRODUCT_NAME)-copy-paren', - 'files': [ '$(SOURCE_ROOT)/main.c', ], - }, - { - 'destination': '<(PRODUCT_DIR)/$PRODUCT_NAME-copy-bare', - 'files': [ 'main.c', ], # $SOURCE_ROOT doesn't work with xcode - }, - ], - # Env vars in actions. - 'actions': [ - { - 'action_name': 'Action copy braces ${PRODUCT_NAME}', - 'description': 'Action copy braces ${PRODUCT_NAME}', - 'inputs': [ '${SOURCE_ROOT}/main.c' ], - # Referencing ${PRODUCT_NAME} in action outputs doesn't work with - # the Xcode generator (PRODUCT_NAME expands to "Test Support"). - 'outputs': [ '<(PRODUCT_DIR)/action-copy-brace.txt' ], - 'action': [ 'cp', '${SOURCE_ROOT}/main.c', - '<(PRODUCT_DIR)/action-copy-brace.txt' ], - }, - { - 'action_name': 'Action copy parens ${PRODUCT_NAME}', - 'description': 'Action copy parens ${PRODUCT_NAME}', - 'inputs': [ '${SOURCE_ROOT}/main.c' ], - # Referencing ${PRODUCT_NAME} in action outputs doesn't work with - # the Xcode generator (PRODUCT_NAME expands to "Test Support"). - 'outputs': [ '<(PRODUCT_DIR)/action-copy-paren.txt' ], - 'action': [ 'cp', '${SOURCE_ROOT}/main.c', - '<(PRODUCT_DIR)/action-copy-paren.txt' ], - }, - { - 'action_name': 'Action copy bare ${PRODUCT_NAME}', - 'description': 'Action copy bare ${PRODUCT_NAME}', - 'inputs': [ '${SOURCE_ROOT}/main.c' ], - # Referencing ${PRODUCT_NAME} in action outputs doesn't work with - # the Xcode generator (PRODUCT_NAME expands to "Test Support"). - 'outputs': [ '<(PRODUCT_DIR)/action-copy-bare.txt' ], - 'action': [ 'cp', '${SOURCE_ROOT}/main.c', - '<(PRODUCT_DIR)/action-copy-bare.txt' ], - }, - ], - # Env vars in copies. - 'xcode_settings': { - 'INFOPLIST_FILE': 'Info.plist', - 'STRING_KEY': '/Source/Project', - - 'BRACE_DEPENDENT_KEY2': '${STRING_KEY}/${PRODUCT_NAME}', - 'BRACE_DEPENDENT_KEY1': 'D:${BRACE_DEPENDENT_KEY2}', - 'BRACE_DEPENDENT_KEY3': '${PRODUCT_TYPE}:${BRACE_DEPENDENT_KEY1}', - - 'PAREN_DEPENDENT_KEY2': '$(STRING_KEY)/$(PRODUCT_NAME)', - 'PAREN_DEPENDENT_KEY1': 'D:$(PAREN_DEPENDENT_KEY2)', - 'PAREN_DEPENDENT_KEY3': '$(PRODUCT_TYPE):$(PAREN_DEPENDENT_KEY1)', - - 'BARE_DEPENDENT_KEY2': '$STRING_KEY/$PRODUCT_NAME', - 'BARE_DEPENDENT_KEY1': 'D:$BARE_DEPENDENT_KEY2', - 'BARE_DEPENDENT_KEY3': '$PRODUCT_TYPE:$BARE_DEPENDENT_KEY1', - - 'MIXED_DEPENDENT_KEY': '${STRING_KEY}:$(PRODUCT_NAME):$MACH_O_TYPE', - }, - }, - ], -} diff --git a/tools/gyp/test/make/dependencies.gyp b/tools/gyp/test/make/dependencies.gyp deleted file mode 100644 index e2bee24fce..0000000000 --- a/tools/gyp/test/make/dependencies.gyp +++ /dev/null @@ -1,15 +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. - -{ - 'targets': [ - { - 'target_name': 'main', - 'type': 'executable', - 'sources': [ - 'main.cc', - ], - }, - ], -} diff --git a/tools/gyp/test/make/gyptest-dependencies.py b/tools/gyp/test/make/gyptest-dependencies.py deleted file mode 100755 index 76cfd0e819..0000000000 --- a/tools/gyp/test/make/gyptest-dependencies.py +++ /dev/null @@ -1,31 +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. - -""" -Verifies that .d files and all.deps are properly generated. -""" - -import os -import TestGyp - -# .d files are only used by the make build. -test = TestGyp.TestGyp(formats=['make']) - -test.run_gyp('dependencies.gyp') - -test.build('dependencies.gyp', test.ALL) - -deps_file = test.built_file_path(".deps/out/Default/obj.target/main/main.o.d") -test.must_contain(deps_file, "main.h") - -# Build a second time to make sure we generate all.deps. -test.build('dependencies.gyp', test.ALL) - -all_deps_file = test.built_file_path(".deps/all.deps") -test.must_contain(all_deps_file, "main.h") -test.must_contain(all_deps_file, "cmd_") - -test.pass_test() diff --git a/tools/gyp/test/make/gyptest-noload.py b/tools/gyp/test/make/gyptest-noload.py deleted file mode 100755 index 1f5103315c..0000000000 --- a/tools/gyp/test/make/gyptest-noload.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2010 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. - -""" -Tests the use of the NO_LOAD flag which makes loading sub .mk files -optional. -""" - -# Python 2.5 needs this for the with statement. -from __future__ import with_statement - -import os -import TestGyp - -test = TestGyp.TestGyp(formats=['make']) - -test.run_gyp('all.gyp', chdir='noload') - -test.relocate('noload', 'relocate/noload') - -test.build('build/all.gyp', test.ALL, chdir='relocate/noload') -test.run_built_executable('exe', chdir='relocate/noload', - stdout='Hello from shared.c.\n') - -# Just sanity test that NO_LOAD=lib doesn't break anything. -test.build('build/all.gyp', test.ALL, chdir='relocate/noload', - arguments=['NO_LOAD=lib']) -test.run_built_executable('exe', chdir='relocate/noload', - stdout='Hello from shared.c.\n') -test.build('build/all.gyp', test.ALL, chdir='relocate/noload', - arguments=['NO_LOAD=z']) -test.run_built_executable('exe', chdir='relocate/noload', - stdout='Hello from shared.c.\n') - -# Make sure we can rebuild without reloading the sub .mk file. -with open('relocate/noload/main.c', 'a') as src_file: - src_file.write("\n") -test.build('build/all.gyp', test.ALL, chdir='relocate/noload', - arguments=['NO_LOAD=lib']) -test.run_built_executable('exe', chdir='relocate/noload', - stdout='Hello from shared.c.\n') - -# Change shared.c, but verify that it doesn't get rebuild if we don't load it. -with open('relocate/noload/lib/shared.c', 'w') as shared_file: - shared_file.write( - '#include "shared.h"\n' - 'const char kSharedStr[] = "modified";\n' - ) -test.build('build/all.gyp', test.ALL, chdir='relocate/noload', - arguments=['NO_LOAD=lib']) -test.run_built_executable('exe', chdir='relocate/noload', - stdout='Hello from shared.c.\n') - -test.pass_test() diff --git a/tools/gyp/test/make/main.cc b/tools/gyp/test/make/main.cc deleted file mode 100644 index 70ac6e46ae..0000000000 --- a/tools/gyp/test/make/main.cc +++ /dev/null @@ -1,12 +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. */ - -#include - -#include "main.h" - -int main(int argc, char *argv[]) { - printf("hello world\n"); - return 0; -} diff --git a/tools/gyp/test/make/main.h b/tools/gyp/test/make/main.h deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tools/gyp/test/make/noload/all.gyp b/tools/gyp/test/make/noload/all.gyp deleted file mode 100644 index 1617a9e97c..0000000000 --- a/tools/gyp/test/make/noload/all.gyp +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2010 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. - -{ - 'targets': [ - { - 'target_name': 'exe', - 'type': 'executable', - 'sources': [ - 'main.c', - ], - 'dependencies': [ - 'lib/shared.gyp:shared', - ], - }, - ], -} diff --git a/tools/gyp/test/make/noload/lib/shared.c b/tools/gyp/test/make/noload/lib/shared.c deleted file mode 100644 index 51776c5acf..0000000000 --- a/tools/gyp/test/make/noload/lib/shared.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "shared.h" - -const char kSharedStr[] = "shared.c"; diff --git a/tools/gyp/test/make/noload/lib/shared.gyp b/tools/gyp/test/make/noload/lib/shared.gyp deleted file mode 100644 index 8a8841b3a0..0000000000 --- a/tools/gyp/test/make/noload/lib/shared.gyp +++ /dev/null @@ -1,16 +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. - -{ - 'targets': [ - { - 'target_name': 'shared', - 'type': 'shared_library', - 'sources': [ - 'shared.c', - 'shared.h', - ], - }, - ], -} diff --git a/tools/gyp/test/make/noload/lib/shared.h b/tools/gyp/test/make/noload/lib/shared.h deleted file mode 100644 index a21da7538b..0000000000 --- a/tools/gyp/test/make/noload/lib/shared.h +++ /dev/null @@ -1 +0,0 @@ -extern const char kSharedStr[]; diff --git a/tools/gyp/test/make/noload/main.c b/tools/gyp/test/make/noload/main.c deleted file mode 100644 index 46d3c52c2d..0000000000 --- a/tools/gyp/test/make/noload/main.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -#include "lib/shared.h" - -int main(int argc, char *argv[]) -{ - printf("Hello from %s.\n", kSharedStr); - return 0; -} diff --git a/tools/gyp/test/module/gyptest-default.py b/tools/gyp/test/module/gyptest-default.py deleted file mode 100755 index 6b1c9b6a85..0000000000 --- a/tools/gyp/test/module/gyptest-default.py +++ /dev/null @@ -1,28 +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. - -""" -Verifies simple build of a "Hello, world!" program with loadable modules. The -default for all platforms should be to output the loadable modules to the same -path as the executable. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('module.gyp', chdir='src') - -test.build('module.gyp', test.ALL, chdir='src') - -expect = """\ -Hello from program.c -Hello from lib1.c -Hello from lib2.c -""" -test.run_built_executable('program', chdir='src', stdout=expect) - -test.pass_test() diff --git a/tools/gyp/test/module/src/lib1.c b/tools/gyp/test/module/src/lib1.c deleted file mode 100644 index 8de0e94bee..0000000000 --- a/tools/gyp/test/module/src/lib1.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -#ifdef _WIN32 -__declspec(dllexport) -#endif -void module_main(void) -{ - fprintf(stdout, "Hello from lib1.c\n"); - fflush(stdout); -} diff --git a/tools/gyp/test/module/src/lib2.c b/tools/gyp/test/module/src/lib2.c deleted file mode 100644 index 266396dc91..0000000000 --- a/tools/gyp/test/module/src/lib2.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -#ifdef _WIN32 -__declspec(dllexport) -#endif -void module_main(void) -{ - fprintf(stdout, "Hello from lib2.c\n"); - fflush(stdout); -} diff --git a/tools/gyp/test/module/src/module.gyp b/tools/gyp/test/module/src/module.gyp deleted file mode 100644 index cc567ef7b5..0000000000 --- a/tools/gyp/test/module/src/module.gyp +++ /dev/null @@ -1,55 +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. - -{ - 'target_defaults': { - 'conditions': [ - ['OS=="win"', { - 'defines': ['PLATFORM_WIN'], - }], - ['OS=="mac"', { - 'defines': ['PLATFORM_MAC'], - }], - ['OS=="linux"', { - 'defines': ['PLATFORM_LINUX'], - # Support 64-bit shared libs (also works fine for 32-bit). - 'cflags': ['-fPIC'], - 'libraries': ['-ldl'], - }], - ], - }, - 'targets': [ - { - 'target_name': 'program', - 'type': 'executable', - 'dependencies': [ - 'lib1', - 'lib2', - ], - 'sources': [ - 'program.c', - ], - }, - { - 'target_name': 'lib1', - 'type': 'loadable_module', - 'product_name': 'lib1', - 'product_prefix': '', - 'xcode_settings': {'OTHER_LDFLAGS': ['-dynamiclib'], 'MACH_O_TYPE': ''}, - 'sources': [ - 'lib1.c', - ], - }, - { - 'target_name': 'lib2', - 'product_name': 'lib2', - 'product_prefix': '', - 'type': 'loadable_module', - 'xcode_settings': {'OTHER_LDFLAGS': ['-dynamiclib'], 'MACH_O_TYPE': ''}, - 'sources': [ - 'lib2.c', - ], - }, - ], -} diff --git a/tools/gyp/test/module/src/program.c b/tools/gyp/test/module/src/program.c deleted file mode 100644 index b2f3320917..0000000000 --- a/tools/gyp/test/module/src/program.c +++ /dev/null @@ -1,111 +0,0 @@ -#include -#include - -#if defined(PLATFORM_WIN) -#include -#elif defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) -#include -#include -#include -#include -#define MAX_PATH PATH_MAX -#endif - -#if defined(PLATFORM_WIN) -#define MODULE_SUFFIX ".dll" -#elif defined(PLATFORM_MAC) -#define MODULE_SUFFIX ".so" -#elif defined(PLATFORM_LINUX) -#define MODULE_SUFFIX ".so" -#endif - -typedef void (*module_symbol)(void); -char bin_path[MAX_PATH + 1]; - - -void CallModule(const char* module) { - char module_path[MAX_PATH + 1]; - const char* module_function = "module_main"; - module_symbol funcptr; -#if defined(PLATFORM_WIN) - HMODULE dl; - char drive[_MAX_DRIVE]; - char dir[_MAX_DIR]; - - if (_splitpath_s(bin_path, drive, _MAX_DRIVE, dir, _MAX_DIR, - NULL, 0, NULL, 0)) { - fprintf(stderr, "Failed to split executable path.\n"); - return; - } - if (_makepath_s(module_path, MAX_PATH, drive, dir, module, MODULE_SUFFIX)) { - fprintf(stderr, "Failed to calculate module path.\n"); - return; - } - - dl = LoadLibrary(module_path); - if (!dl) { - fprintf(stderr, "Failed to open module: %s\n", module_path); - return; - } - - funcptr = (module_symbol) GetProcAddress(dl, module_function); - if (!funcptr) { - fprintf(stderr, "Failed to find symbol: %s\n", module_function); - return; - } - funcptr(); - - FreeLibrary(dl); -#elif defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) - void* dl; - char* path_copy = strdup(bin_path); - char* bin_dir = dirname(path_copy); - int path_size = snprintf(module_path, MAX_PATH, "%s/%s%s", bin_dir, module, - MODULE_SUFFIX); - free(path_copy); - if (path_size < 0 || path_size > MAX_PATH) { - fprintf(stderr, "Failed to calculate module path.\n"); - return; - } - module_path[path_size] = 0; - - dl = dlopen(module_path, RTLD_LAZY); - if (!dl) { - fprintf(stderr, "Failed to open module: %s\n", module_path); - return; - } - - funcptr = dlsym(dl, module_function); - if (!funcptr) { - fprintf(stderr, "Failed to find symbol: %s\n", module_function); - return; - } - funcptr(); - - dlclose(dl); -#endif -} - -int main(int argc, char *argv[]) -{ - fprintf(stdout, "Hello from program.c\n"); - fflush(stdout); - -#if defined(PLATFORM_WIN) - if (!GetModuleFileName(NULL, bin_path, MAX_PATH)) { - fprintf(stderr, "Failed to determine executable path.\n"); - return; - } -#elif defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) - // Using argv[0] should be OK here since we control how the tests run, and - // can avoid exec and such issues that make it unreliable. - if (!realpath(argv[0], bin_path)) { - fprintf(stderr, "Failed to determine executable path (%s).\n", argv[0]); - return; - } -#endif - - CallModule("lib1"); - CallModule("lib2"); - return 0; -} diff --git a/tools/gyp/test/msvs/express/base/base.gyp b/tools/gyp/test/msvs/express/base/base.gyp deleted file mode 100644 index b7c9fc6d81..0000000000 --- a/tools/gyp/test/msvs/express/base/base.gyp +++ /dev/null @@ -1,22 +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. - -{ - 'targets': [ - { - 'target_name': 'a', - 'type': 'static_library', - 'sources': [ - 'a.c', - ], - }, - { - 'target_name': 'b', - 'type': 'static_library', - 'sources': [ - 'b.c', - ], - }, - ], -} diff --git a/tools/gyp/test/msvs/express/express.gyp b/tools/gyp/test/msvs/express/express.gyp deleted file mode 100644 index 917abe2cc0..0000000000 --- a/tools/gyp/test/msvs/express/express.gyp +++ /dev/null @@ -1,19 +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. - -{ - 'targets': [ - { - 'target_name': 'express', - 'type': 'executable', - 'dependencies': [ - 'base/base.gyp:a', - 'base/base.gyp:b', - ], - 'sources': [ - 'main.c', - ], - }, - ], -} diff --git a/tools/gyp/test/msvs/express/gyptest-express.py b/tools/gyp/test/msvs/express/gyptest-express.py deleted file mode 100755 index 54c06f664a..0000000000 --- a/tools/gyp/test/msvs/express/gyptest-express.py +++ /dev/null @@ -1,29 +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. - -""" -Verifies that flat solutions get generated for Express versions of -Visual Studio. -""" - -import TestGyp - -test = TestGyp.TestGyp(formats=['msvs']) - -test.run_gyp('express.gyp', '-G', 'msvs_version=2005') -test.must_contain('express.sln', '(base)') - -test.run_gyp('express.gyp', '-G', 'msvs_version=2008') -test.must_contain('express.sln', '(base)') - -test.run_gyp('express.gyp', '-G', 'msvs_version=2005e') -test.must_not_contain('express.sln', '(base)') - -test.run_gyp('express.gyp', '-G', 'msvs_version=2008e') -test.must_not_contain('express.sln', '(base)') - - -test.pass_test() diff --git a/tools/gyp/test/msvs/list_excluded/gyptest-all.py b/tools/gyp/test/msvs/list_excluded/gyptest-all.py deleted file mode 100644 index 5a370f6b47..0000000000 --- a/tools/gyp/test/msvs/list_excluded/gyptest-all.py +++ /dev/null @@ -1,51 +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. - -""" -Verifies that msvs_list_excluded_files=0 doesn't list files that would -normally be in _excluded_files, and that if that flag is not set, then they -are still listed. -""" - -import os -import TestGyp - -test = TestGyp.TestGyp(formats=['msvs'], workdir='workarea_all') - - -# with the flag set to 0 -try: - os.environ['GYP_GENERATOR_FLAGS'] = 'msvs_list_excluded_files=0' - test.run_gyp('hello_exclude.gyp') -finally: - del os.environ['GYP_GENERATOR_FLAGS'] -if test.uses_msbuild: - test.must_not_contain('hello.vcxproj', 'hello_mac') -else: - test.must_not_contain('hello.vcproj', 'hello_mac') - - -# with the flag not set -test.run_gyp('hello_exclude.gyp') -if test.uses_msbuild: - test.must_contain('hello.vcxproj', 'hello_mac') -else: - test.must_contain('hello.vcproj', 'hello_mac') - - -# with the flag explicitly set to 1 -try: - os.environ['GYP_GENERATOR_FLAGS'] = 'msvs_list_excluded_files=1' - test.run_gyp('hello_exclude.gyp') -finally: - del os.environ['GYP_GENERATOR_FLAGS'] -if test.uses_msbuild: - test.must_contain('hello.vcxproj', 'hello_mac') -else: - test.must_contain('hello.vcproj', 'hello_mac') - - -test.pass_test() diff --git a/tools/gyp/test/msvs/list_excluded/hello.cpp b/tools/gyp/test/msvs/list_excluded/hello.cpp deleted file mode 100644 index 69acc38bd8..0000000000 --- a/tools/gyp/test/msvs/list_excluded/hello.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// 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. - -#include - -int main(int argc, char *argv[]) { - printf("Hello, world!\n"); - return 0; -} diff --git a/tools/gyp/test/msvs/list_excluded/hello_exclude.gyp b/tools/gyp/test/msvs/list_excluded/hello_exclude.gyp deleted file mode 100644 index aa160f2367..0000000000 --- a/tools/gyp/test/msvs/list_excluded/hello_exclude.gyp +++ /dev/null @@ -1,19 +0,0 @@ -# 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. - -{ - 'targets': [ - { - 'target_name': 'hello', - 'type': 'executable', - 'sources': [ - 'hello.cpp', - 'hello_mac.cpp', - ], - 'conditions': [ - ['OS!="mac"', {'sources!': ['hello_mac.cpp']}], - ] - }, - ], -} diff --git a/tools/gyp/test/msvs/list_excluded/hello_mac.cpp b/tools/gyp/test/msvs/list_excluded/hello_mac.cpp deleted file mode 100644 index b9f6242c4b..0000000000 --- a/tools/gyp/test/msvs/list_excluded/hello_mac.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// 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. - -#include - -int hello2() { - printf("Hello, two!\n"); - return 0; -} diff --git a/tools/gyp/test/msvs/precompiled/gyptest-all.py b/tools/gyp/test/msvs/precompiled/gyptest-all.py deleted file mode 100755 index 327ca6d6e1..0000000000 --- a/tools/gyp/test/msvs/precompiled/gyptest-all.py +++ /dev/null @@ -1,23 +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. - -""" -Verifies that precompiled headers can be specified. -""" - -import TestGyp - -test = TestGyp.TestGyp(formats=['msvs'], workdir='workarea_all') - -test.run_gyp('hello.gyp') - -test.build('hello.gyp', 'hello') - -test.run_built_executable('hello', stdout="Hello, world!\nHello, two!\n") - -test.up_to_date('hello.gyp', test.ALL) - -test.pass_test() diff --git a/tools/gyp/test/msvs/precompiled/hello.c b/tools/gyp/test/msvs/precompiled/hello.c deleted file mode 100644 index d1abbb9e51..0000000000 --- a/tools/gyp/test/msvs/precompiled/hello.c +++ /dev/null @@ -1,14 +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. */ - -// Note the abscence of a stdio.h include. This will be inserted because of the -// precompiled header. - -extern int hello2(); - -int main(int argc, char *argv[]) { - printf("Hello, world!\n"); - hello2(); - return 0; -} diff --git a/tools/gyp/test/msvs/precompiled/hello.gyp b/tools/gyp/test/msvs/precompiled/hello.gyp deleted file mode 100644 index b9533efd85..0000000000 --- a/tools/gyp/test/msvs/precompiled/hello.gyp +++ /dev/null @@ -1,19 +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. - -{ - 'targets': [ - { - 'target_name': 'hello', - 'type': 'executable', - 'sources': [ - 'hello.c', - 'hello2.c', - 'precomp.c', - ], - 'msvs_precompiled_header': 'stdio.h', - 'msvs_precompiled_source': 'precomp.c', - }, - ], -} diff --git a/tools/gyp/test/msvs/precompiled/hello2.c b/tools/gyp/test/msvs/precompiled/hello2.c deleted file mode 100644 index d6d53111fb..0000000000 --- a/tools/gyp/test/msvs/precompiled/hello2.c +++ /dev/null @@ -1,13 +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. */ - -// Unlike hello.c, this file specifies the headers. - -#include -#include - -int hello2() { - printf("Hello, two!\n"); - return 0; -} diff --git a/tools/gyp/test/msvs/precompiled/precomp.c b/tools/gyp/test/msvs/precompiled/precomp.c deleted file mode 100644 index 517c61a36b..0000000000 --- a/tools/gyp/test/msvs/precompiled/precomp.c +++ /dev/null @@ -1,8 +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. */ - -// The precompiled header does not have to be the first one in the file. - -#include -#include diff --git a/tools/gyp/test/msvs/uldi2010/gyptest-all.py b/tools/gyp/test/msvs/uldi2010/gyptest-all.py deleted file mode 100644 index cc248fbd63..0000000000 --- a/tools/gyp/test/msvs/uldi2010/gyptest-all.py +++ /dev/null @@ -1,20 +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. - -""" -Verifies that uldi can be disabled on a per-project-reference basis in vs2010. -""" - -import TestGyp - -test = TestGyp.TestGyp(formats=['msvs'], workdir='workarea_all') - -test.run_gyp('hello.gyp') - -if test.uses_msbuild: - test.must_contain('hello.vcxproj', 'false') - -test.pass_test() diff --git a/tools/gyp/test/msvs/uldi2010/hello.c b/tools/gyp/test/msvs/uldi2010/hello.c deleted file mode 100644 index 2769093694..0000000000 --- a/tools/gyp/test/msvs/uldi2010/hello.c +++ /dev/null @@ -1,13 +0,0 @@ -/* 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. */ - -#include - -extern int hello2(); - -int main(int argc, char *argv[]) { - printf("Hello, world!\n"); - hello2(); - return 0; -} diff --git a/tools/gyp/test/msvs/uldi2010/hello.gyp b/tools/gyp/test/msvs/uldi2010/hello.gyp deleted file mode 100644 index a2bf2badb1..0000000000 --- a/tools/gyp/test/msvs/uldi2010/hello.gyp +++ /dev/null @@ -1,26 +0,0 @@ -# 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. - -{ - 'targets': [ - { - 'target_name': 'hello', - 'type': 'executable', - 'sources': [ - 'hello.c', - ], - 'dependencies': [ - 'hellolib', - ] - }, - { - 'target_name': 'hellolib', - 'type': 'static_library', - 'sources': [ - 'hello2.c', - ], - 'msvs_2010_disable_uldi_when_referenced': 1, - }, - ], -} diff --git a/tools/gyp/test/msvs/uldi2010/hello2.c b/tools/gyp/test/msvs/uldi2010/hello2.c deleted file mode 100644 index e2f23238d1..0000000000 --- a/tools/gyp/test/msvs/uldi2010/hello2.c +++ /dev/null @@ -1,10 +0,0 @@ -/* 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. */ - -#include - -int hello2() { - printf("Hello, two!\n"); - return 0; -} diff --git a/tools/gyp/test/multiple-targets/gyptest-all.py b/tools/gyp/test/multiple-targets/gyptest-all.py deleted file mode 100755 index 9f157c4f82..0000000000 --- a/tools/gyp/test/multiple-targets/gyptest-all.py +++ /dev/null @@ -1,35 +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 TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('multiple.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - -# TODO(sgk): remove stderr=None when the --generator-output= support -# gets rid of the scons warning -test.build('multiple.gyp', test.ALL, chdir='relocate/src', stderr=None) - -expect1 = """\ -hello from prog1.c -hello from common.c -""" - -expect2 = """\ -hello from prog2.c -hello from common.c -""" - -test.run_built_executable('prog1', stdout=expect1, chdir='relocate/src') -test.run_built_executable('prog2', stdout=expect2, chdir='relocate/src') - -test.pass_test() diff --git a/tools/gyp/test/multiple-targets/gyptest-default.py b/tools/gyp/test/multiple-targets/gyptest-default.py deleted file mode 100755 index 8d5072d230..0000000000 --- a/tools/gyp/test/multiple-targets/gyptest-default.py +++ /dev/null @@ -1,35 +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 TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('multiple.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - -# TODO(sgk): remove stderr=None when the --generator-output= support -# gets rid of the scons warning -test.build('multiple.gyp', chdir='relocate/src', stderr=None) - -expect1 = """\ -hello from prog1.c -hello from common.c -""" - -expect2 = """\ -hello from prog2.c -hello from common.c -""" - -test.run_built_executable('prog1', stdout=expect1, chdir='relocate/src') -test.run_built_executable('prog2', stdout=expect2, chdir='relocate/src') - -test.pass_test() diff --git a/tools/gyp/test/multiple-targets/src/common.c b/tools/gyp/test/multiple-targets/src/common.c deleted file mode 100644 index f1df7c1431..0000000000 --- a/tools/gyp/test/multiple-targets/src/common.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -void common(void) -{ - printf("hello from common.c\n"); - return; -} diff --git a/tools/gyp/test/multiple-targets/src/multiple.gyp b/tools/gyp/test/multiple-targets/src/multiple.gyp deleted file mode 100644 index 3db4ea30cd..0000000000 --- a/tools/gyp/test/multiple-targets/src/multiple.gyp +++ /dev/null @@ -1,24 +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. - -{ - 'targets': [ - { - 'target_name': 'prog1', - 'type': 'executable', - 'sources': [ - 'prog1.c', - 'common.c', - ], - }, - { - 'target_name': 'prog2', - 'type': 'executable', - 'sources': [ - 'prog2.c', - 'common.c', - ], - }, - ], -} diff --git a/tools/gyp/test/multiple-targets/src/prog1.c b/tools/gyp/test/multiple-targets/src/prog1.c deleted file mode 100644 index d55f8af1d0..0000000000 --- a/tools/gyp/test/multiple-targets/src/prog1.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -extern void common(void); - -int main(int argc, char *argv[]) -{ - printf("hello from prog1.c\n"); - common(); - return 0; -} diff --git a/tools/gyp/test/multiple-targets/src/prog2.c b/tools/gyp/test/multiple-targets/src/prog2.c deleted file mode 100644 index 760590eb68..0000000000 --- a/tools/gyp/test/multiple-targets/src/prog2.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -extern void common(void); - -int main(int argc, char *argv[]) -{ - printf("hello from prog2.c\n"); - common(); - return 0; -} diff --git a/tools/gyp/test/ninja/action_dependencies/gyptest-action-dependencies.py b/tools/gyp/test/ninja/action_dependencies/gyptest-action-dependencies.py deleted file mode 100755 index f84af24ec5..0000000000 --- a/tools/gyp/test/ninja/action_dependencies/gyptest-action-dependencies.py +++ /dev/null @@ -1,45 +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. - -""" -Verify that building an object file correctly depends on running actions in -dependent targets, but not the targets themselves. -""" - -import TestGyp - -# NOTE(piman): This test will not work with other generators because: -# - it explicitly tests the optimization, which is not implemented (yet?) on -# other generators -# - it relies on the exact path to output object files, which is generator -# dependent, and actually, relies on the ability to build only that object file, -# which I don't think is available on all generators. -# TODO(piman): Extend to other generators when possible. -test = TestGyp.TestGyp(formats=['ninja']) - -test.run_gyp('action_dependencies.gyp', chdir='src') - -chdir = 'relocate/src' -test.relocate('src', chdir) - -test.build('action_dependencies.gyp', 'obj/b.b.o', chdir=chdir) - -# The 'a' actions should be run (letting b.c compile), but the a static library -# should not be built. -test.built_file_must_not_exist('a', type=test.STATIC_LIB, chdir=chdir) -test.built_file_must_not_exist('b', type=test.STATIC_LIB, chdir=chdir) -test.built_file_must_exist('obj/b.b.o', chdir=chdir) - -test.build('action_dependencies.gyp', 'obj/c.c.o', chdir=chdir) - -# 'a' and 'b' should be built, so that the 'c' action succeeds, letting c.c -# compile -test.built_file_must_exist('a', type=test.STATIC_LIB, chdir=chdir) -test.built_file_must_exist('b', type=test.EXECUTABLE, chdir=chdir) -test.built_file_must_exist('obj/c.c.o', chdir=chdir) - - -test.pass_test() diff --git a/tools/gyp/test/ninja/action_dependencies/src/a.c b/tools/gyp/test/ninja/action_dependencies/src/a.c deleted file mode 100644 index 4d7af9b26c..0000000000 --- a/tools/gyp/test/ninja/action_dependencies/src/a.c +++ /dev/null @@ -1,10 +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. - */ - -#include "a.h" - -int funcA() { - return 42; -} diff --git a/tools/gyp/test/ninja/action_dependencies/src/a.h b/tools/gyp/test/ninja/action_dependencies/src/a.h deleted file mode 100644 index 335db56739..0000000000 --- a/tools/gyp/test/ninja/action_dependencies/src/a.h +++ /dev/null @@ -1,13 +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. - */ - -#ifndef A_H_ -#define A_H_ - -#include "a/generated.h" - -int funcA(); - -#endif // A_H_ diff --git a/tools/gyp/test/ninja/action_dependencies/src/action_dependencies.gyp b/tools/gyp/test/ninja/action_dependencies/src/action_dependencies.gyp deleted file mode 100644 index 5baa7a7d47..0000000000 --- a/tools/gyp/test/ninja/action_dependencies/src/action_dependencies.gyp +++ /dev/null @@ -1,88 +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. - -{ - 'targets': [ - { - 'target_name': 'a', - 'type': 'static_library', - 'sources': [ - 'a.c', - 'a.h', - ], - 'actions': [ - { - 'action_name': 'generate_headers', - 'inputs': [ - 'emit.py' - ], - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/a/generated.h' - ], - 'action': [ - 'python', - 'emit.py', - '<(SHARED_INTERMEDIATE_DIR)/a/generated.h', - ], - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - }, - ], - 'include_dirs': [ - '<(SHARED_INTERMEDIATE_DIR)', - ], - 'direct_dependent_settings': { - 'include_dirs': [ - '<(SHARED_INTERMEDIATE_DIR)', - ], - }, - }, - { - 'target_name': 'b', - 'type': 'executable', - 'sources': [ - 'b.c', - 'b.h', - ], - 'dependencies': [ - 'a', - ], - }, - { - 'target_name': 'c', - 'type': 'static_library', - 'sources': [ - 'c.c', - 'c.h', - ], - 'dependencies': [ - 'b', - ], - 'actions': [ - { - 'action_name': 'generate_headers', - 'inputs': [ - ], - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/c/generated.h' - ], - 'action': [ - '<(PRODUCT_DIR)/b', - '<(SHARED_INTERMEDIATE_DIR)/c/generated.h', - ], - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - }, - ], - 'include_dirs': [ - '<(SHARED_INTERMEDIATE_DIR)', - ], - 'direct_dependent_settings': { - 'include_dirs': [ - '<(SHARED_INTERMEDIATE_DIR)', - ], - }, - }, - ], -} diff --git a/tools/gyp/test/ninja/action_dependencies/src/b.c b/tools/gyp/test/ninja/action_dependencies/src/b.c deleted file mode 100644 index 7d70d01ca0..0000000000 --- a/tools/gyp/test/ninja/action_dependencies/src/b.c +++ /dev/null @@ -1,17 +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. - */ - -#include - -#include "b.h" - -int main(int argc, char** argv) { - if (argc < 2) - return 1; - FILE* f = fopen(argv[1], "wt"); - fprintf(f, "#define VALUE %d\n", funcA()); - fclose(f); - return 0; -} diff --git a/tools/gyp/test/ninja/action_dependencies/src/b.h b/tools/gyp/test/ninja/action_dependencies/src/b.h deleted file mode 100644 index 91362cd899..0000000000 --- a/tools/gyp/test/ninja/action_dependencies/src/b.h +++ /dev/null @@ -1,13 +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. - */ - -#ifndef B_H_ -#define B_H_ - -#include "a.h" - -int funcB(); - -#endif // B_H_ diff --git a/tools/gyp/test/ninja/action_dependencies/src/c.c b/tools/gyp/test/ninja/action_dependencies/src/c.c deleted file mode 100644 index b412087ec8..0000000000 --- a/tools/gyp/test/ninja/action_dependencies/src/c.c +++ /dev/null @@ -1,10 +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. - */ - -#include "c.h" - -int funcC() { - return VALUE; -} diff --git a/tools/gyp/test/ninja/action_dependencies/src/c.h b/tools/gyp/test/ninja/action_dependencies/src/c.h deleted file mode 100644 index c81a45bbe7..0000000000 --- a/tools/gyp/test/ninja/action_dependencies/src/c.h +++ /dev/null @@ -1,13 +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. - */ - -#ifndef C_H_ -#define C_H_ - -#include "c/generated.h" - -int funcC(); - -#endif // C_H_ diff --git a/tools/gyp/test/ninja/action_dependencies/src/emit.py b/tools/gyp/test/ninja/action_dependencies/src/emit.py deleted file mode 100755 index 2df74b79a1..0000000000 --- a/tools/gyp/test/ninja/action_dependencies/src/emit.py +++ /dev/null @@ -1,11 +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. - -import sys - -f = open(sys.argv[1], 'wb') -f.write('/* Hello World */\n') -f.close() diff --git a/tools/gyp/test/ninja/chained-dependency/chained-dependency.gyp b/tools/gyp/test/ninja/chained-dependency/chained-dependency.gyp deleted file mode 100644 index a08f893d8c..0000000000 --- a/tools/gyp/test/ninja/chained-dependency/chained-dependency.gyp +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright (c) 2010 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. - -{ - 'targets': [ - # This first target generates a header. - { - 'target_name': 'generate_header', - 'type': 'none', - 'actions': [ - { - 'action_name': 'generate header', - 'inputs': [], - 'outputs': ['<(SHARED_INTERMEDIATE_DIR)/generated/header.h'], - 'action': [ - 'python', '-c', 'open(<(_outputs), "w")' - ] - }, - ], - 'all_dependent_settings': { - 'include_dirs': [ - '<(SHARED_INTERMEDIATE_DIR)', - ], - }, - }, - - # This intermediate target does nothing other than pull in a - # dependency on the above generated target. - { - 'target_name': 'chain', - 'type': 'none', - 'dependencies': [ - 'generate_header', - ], - }, - - # This final target is: - # - a static library (so gyp doesn't transitively pull in dependencies); - # - that relies on the generated file two dependencies away. - { - 'target_name': 'chained', - 'type': 'static_library', - 'dependencies': [ - 'chain', - ], - 'sources': [ - 'chained.c', - ], - }, - ], -} diff --git a/tools/gyp/test/ninja/chained-dependency/chained.c b/tools/gyp/test/ninja/chained-dependency/chained.c deleted file mode 100644 index e4eb5e861f..0000000000 --- a/tools/gyp/test/ninja/chained-dependency/chained.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "generated/header.h" - -int main(int argc, char** argv) { - return 0; -} diff --git a/tools/gyp/test/ninja/chained-dependency/gyptest-chained-dependency.py b/tools/gyp/test/ninja/chained-dependency/gyptest-chained-dependency.py deleted file mode 100755 index 5494c79e09..0000000000 --- a/tools/gyp/test/ninja/chained-dependency/gyptest-chained-dependency.py +++ /dev/null @@ -1,23 +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. - -""" -Verifies that files generated by two-steps-removed actions are built before -dependent compile steps. -""" - -import os -import TestGyp - -# This test is Ninja-specific in that: -# - the bug only showed nondeterministically in parallel builds; -# - it relies on a ninja-specific output file path. - -test = TestGyp.TestGyp(formats=['ninja']) -test.run_gyp('chained-dependency.gyp') -test.build('chained-dependency.gyp', 'obj/chained.chained.o') -# The test passes if the .o file builds successfully. -test.pass_test() diff --git a/tools/gyp/test/no-output/gyptest-no-output.py b/tools/gyp/test/no-output/gyptest-no-output.py deleted file mode 100755 index bf9a0b5aaa..0000000000 --- a/tools/gyp/test/no-output/gyptest-no-output.py +++ /dev/null @@ -1,21 +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. - -""" -Verified things don't explode when there are targets without outputs. -""" - -import TestGyp - -# TODO(evan): in ninja when there are no targets, there is no 'all' -# target either. Disabling this test for now. -test = TestGyp.TestGyp(formats=['!ninja']) - -test.run_gyp('nooutput.gyp', chdir='src') -test.relocate('src', 'relocate/src') -test.build('nooutput.gyp', chdir='relocate/src') - -test.pass_test() diff --git a/tools/gyp/test/no-output/src/nooutput.gyp b/tools/gyp/test/no-output/src/nooutput.gyp deleted file mode 100644 index c40124efc1..0000000000 --- a/tools/gyp/test/no-output/src/nooutput.gyp +++ /dev/null @@ -1,17 +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. - -{ - 'targets': [ - { - 'target_name': 'no_output', - 'type': 'none', - 'direct_dependent_settings': { - 'defines': [ - 'NADA', - ], - }, - }, - ], -} diff --git a/tools/gyp/test/product/gyptest-product.py b/tools/gyp/test/product/gyptest-product.py deleted file mode 100755 index e9790f30da..0000000000 --- a/tools/gyp/test/product/gyptest-product.py +++ /dev/null @@ -1,43 +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. - -""" -Verifies simplest-possible build of a "Hello, world!" program -using the default build target. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('product.gyp') -test.build('product.gyp') - -# executables -test.built_file_must_exist('alt1' + test._exe, test.EXECUTABLE, bare=True) -test.built_file_must_exist('hello2.stuff', test.EXECUTABLE, bare=True) -test.built_file_must_exist('yoalt3.stuff', test.EXECUTABLE, bare=True) - -# shared libraries -test.built_file_must_exist(test.dll_ + 'alt4' + test._dll, - test.SHARED_LIB, bare=True) -test.built_file_must_exist(test.dll_ + 'hello5.stuff', - test.SHARED_LIB, bare=True) -test.built_file_must_exist('yoalt6.stuff', test.SHARED_LIB, bare=True) - -# static libraries -test.built_file_must_exist(test.lib_ + 'alt7' + test._lib, - test.STATIC_LIB, bare=True) -test.built_file_must_exist(test.lib_ + 'hello8.stuff', - test.STATIC_LIB, bare=True) -test.built_file_must_exist('yoalt9.stuff', test.STATIC_LIB, bare=True) - -# alternate product_dir -test.built_file_must_exist('bob/yoalt10.stuff', test.EXECUTABLE, bare=True) -test.built_file_must_exist('bob/yoalt11.stuff', test.EXECUTABLE, bare=True) -test.built_file_must_exist('bob/yoalt12.stuff', test.EXECUTABLE, bare=True) - -test.pass_test() diff --git a/tools/gyp/test/product/hello.c b/tools/gyp/test/product/hello.c deleted file mode 100644 index 94798f3e75..0000000000 --- a/tools/gyp/test/product/hello.c +++ /dev/null @@ -1,15 +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. */ - -#include - -int func1(void) { - return 42; -} - -int main(int argc, char *argv[]) { - printf("Hello, world!\n"); - printf("%d\n", func1()); - return 0; -} diff --git a/tools/gyp/test/product/product.gyp b/tools/gyp/test/product/product.gyp deleted file mode 100644 index c25eaaacb5..0000000000 --- a/tools/gyp/test/product/product.gyp +++ /dev/null @@ -1,128 +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. - -{ - 'targets': [ - { - 'target_name': 'hello1', - 'product_name': 'alt1', - 'type': 'executable', - 'sources': [ - 'hello.c', - ], - }, - { - 'target_name': 'hello2', - 'product_extension': 'stuff', - 'type': 'executable', - 'sources': [ - 'hello.c', - ], - }, - { - 'target_name': 'hello3', - 'product_name': 'alt3', - 'product_extension': 'stuff', - 'product_prefix': 'yo', - 'type': 'executable', - 'sources': [ - 'hello.c', - ], - }, - - { - 'target_name': 'hello4', - 'product_name': 'alt4', - 'type': 'shared_library', - 'sources': [ - 'hello.c', - ], - }, - { - 'target_name': 'hello5', - 'product_extension': 'stuff', - 'type': 'shared_library', - 'sources': [ - 'hello.c', - ], - }, - { - 'target_name': 'hello6', - 'product_name': 'alt6', - 'product_extension': 'stuff', - 'product_prefix': 'yo', - 'type': 'shared_library', - 'sources': [ - 'hello.c', - ], - }, - - { - 'target_name': 'hello7', - 'product_name': 'alt7', - 'type': 'static_library', - 'sources': [ - 'hello.c', - ], - }, - { - 'target_name': 'hello8', - 'product_extension': 'stuff', - 'type': 'static_library', - 'sources': [ - 'hello.c', - ], - }, - { - 'target_name': 'hello9', - 'product_name': 'alt9', - 'product_extension': 'stuff', - 'product_prefix': 'yo', - 'type': 'static_library', - 'sources': [ - 'hello.c', - ], - }, - { - 'target_name': 'hello10', - 'product_name': 'alt10', - 'product_extension': 'stuff', - 'product_prefix': 'yo', - 'product_dir': '<(PRODUCT_DIR)/bob', - 'type': 'executable', - 'sources': [ - 'hello.c', - ], - }, - { - 'target_name': 'hello11', - 'product_name': 'alt11', - 'product_extension': 'stuff', - 'product_prefix': 'yo', - 'product_dir': '<(PRODUCT_DIR)/bob', - 'type': 'shared_library', - 'sources': [ - 'hello.c', - ], - }, - { - 'target_name': 'hello12', - 'product_name': 'alt12', - 'product_extension': 'stuff', - 'product_prefix': 'yo', - 'product_dir': '<(PRODUCT_DIR)/bob', - 'type': 'static_library', - 'sources': [ - 'hello.c', - ], - }, - ], - 'conditions': [ - ['OS=="linux"', { - 'target_defaults': { - 'cflags': ['-fPIC'], - }, - }], - ], -} diff --git a/tools/gyp/test/relative/foo/a/a.cc b/tools/gyp/test/relative/foo/a/a.cc deleted file mode 100644 index 7d1c953448..0000000000 --- a/tools/gyp/test/relative/foo/a/a.cc +++ /dev/null @@ -1,9 +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. - */ - -int main() { - return 0; -} diff --git a/tools/gyp/test/relative/foo/a/a.gyp b/tools/gyp/test/relative/foo/a/a.gyp deleted file mode 100644 index 66316ac681..0000000000 --- a/tools/gyp/test/relative/foo/a/a.gyp +++ /dev/null @@ -1,13 +0,0 @@ -{ - 'targets': [ - { - 'target_name': 'a', - 'type': 'executable', - 'sources': ['a.cc'], - 'dependencies': [ - '../../foo/b/b.gyp:b', - 'c/c.gyp:c', - ], - }, - ], -} diff --git a/tools/gyp/test/relative/foo/a/c/c.cc b/tools/gyp/test/relative/foo/a/c/c.cc deleted file mode 100644 index 9d22471684..0000000000 --- a/tools/gyp/test/relative/foo/a/c/c.cc +++ /dev/null @@ -1,9 +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. - */ - -int func() { - return 0; -} diff --git a/tools/gyp/test/relative/foo/a/c/c.gyp b/tools/gyp/test/relative/foo/a/c/c.gyp deleted file mode 100644 index c1f087db99..0000000000 --- a/tools/gyp/test/relative/foo/a/c/c.gyp +++ /dev/null @@ -1,12 +0,0 @@ -{ - 'targets': [ - { - 'target_name': 'c', - 'type': 'static_library', - 'sources': ['c.cc'], - 'dependencies': [ - '../../b/b.gyp:b', - ], - }, - ], -} diff --git a/tools/gyp/test/relative/foo/b/b.cc b/tools/gyp/test/relative/foo/b/b.cc deleted file mode 100644 index 011d59cebb..0000000000 --- a/tools/gyp/test/relative/foo/b/b.cc +++ /dev/null @@ -1,9 +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. - */ - -int func2() { - return 0; -} diff --git a/tools/gyp/test/relative/foo/b/b.gyp b/tools/gyp/test/relative/foo/b/b.gyp deleted file mode 100644 index 0ebe4533d3..0000000000 --- a/tools/gyp/test/relative/foo/b/b.gyp +++ /dev/null @@ -1,9 +0,0 @@ -{ - 'targets': [ - { - 'target_name': 'b', - 'type': 'static_library', - 'sources': ['b.cc'], - }, - ], -} diff --git a/tools/gyp/test/relative/gyptest-default.py b/tools/gyp/test/relative/gyptest-default.py deleted file mode 100755 index 2d657aa675..0000000000 --- a/tools/gyp/test/relative/gyptest-default.py +++ /dev/null @@ -1,25 +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. - -""" -Verifies simplest-possible build of a "Hello, world!" program -using the default build target. -""" - -import TestGyp - -test = TestGyp.TestGyp(workdir='workarea_default', formats=['msvs']) - -# Run from down in foo. -test.run_gyp('a.gyp', chdir='foo/a') -sln = test.workpath('foo/a/a.sln') -sln_data = open(sln, 'rb').read() -vcproj = sln_data.count('b.vcproj') -vcxproj = sln_data.count('b.vcxproj') -if (vcproj, vcxproj) not in [(1, 0), (0, 1)]: - test.fail_test() - -test.pass_test() diff --git a/tools/gyp/test/restat/gyptest-restat.py b/tools/gyp/test/restat/gyptest-restat.py deleted file mode 100644 index 87379044dd..0000000000 --- a/tools/gyp/test/restat/gyptest-restat.py +++ /dev/null @@ -1,31 +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. - -""" -Verify that dependent rules are executed iff a dependency action modifies its -outputs. -""" - -import TestGyp -import os - -test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) - -test.run_gyp('restat.gyp', chdir='src') - -chdir = 'relocate/src' -test.relocate('src', chdir) - -# Building 'dependent' the first time generates 'side_effect', but building it -# the second time doesn't, because 'create_intermediate' doesn't update its -# output. -test.build('restat.gyp', 'dependent', chdir=chdir) -test.built_file_must_exist('side_effect', chdir=chdir) -os.remove(test.built_file_path('side_effect', chdir=chdir)) -test.build('restat.gyp', 'dependent', chdir=chdir) -test.built_file_must_not_exist('side_effect', chdir=chdir) - -test.pass_test() diff --git a/tools/gyp/test/restat/src/create_intermediate.py b/tools/gyp/test/restat/src/create_intermediate.py deleted file mode 100644 index a4d7450371..0000000000 --- a/tools/gyp/test/restat/src/create_intermediate.py +++ /dev/null @@ -1,17 +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. - -import os -import sys - -""" -Create argv[1] iff it doesn't already exist. -""" - -outfile = sys.argv[1] -if os.path.exists(outfile): - sys.exit() -open(outfile, "wb").close() diff --git a/tools/gyp/test/restat/src/restat.gyp b/tools/gyp/test/restat/src/restat.gyp deleted file mode 100644 index 09b3d71fa8..0000000000 --- a/tools/gyp/test/restat/src/restat.gyp +++ /dev/null @@ -1,48 +0,0 @@ -# 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. - -{ - 'targets': [ - { - 'target_name': 'create_intermediate', - 'type': 'none', - 'actions': [ - { - 'action_name': 'create_intermediate', - 'inputs': [ - 'create_intermediate.py', - ], - 'outputs': [ - '<(PRODUCT_DIR)/intermediate', - 'ALWAYS.run.ALWAYS', - ], - 'action': [ - 'python', 'create_intermediate.py', '<(PRODUCT_DIR)/intermediate', - ], - }, - ], - }, - { - 'target_name': 'dependent', - 'type': 'none', - 'dependencies': [ - 'create_intermediate', - ], - 'actions': [ - { - 'action_name': 'dependent', - 'inputs': [ - '<(PRODUCT_DIR)/intermediate', - ], - 'outputs': [ - '<(PRODUCT_DIR)/dependent' - ], - 'action': [ - 'touch', '<(PRODUCT_DIR)/dependent', '<(PRODUCT_DIR)/side_effect', - ], - }, - ], - }, - ], -} diff --git a/tools/gyp/test/rules-dirname/gyptest-dirname.py b/tools/gyp/test/rules-dirname/gyptest-dirname.py deleted file mode 100755 index 6e684a4c42..0000000000 --- a/tools/gyp/test/rules-dirname/gyptest-dirname.py +++ /dev/null @@ -1,38 +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. - -""" -Verifies simple rules when using an explicit build target of 'all'. -""" - -import TestGyp - -test = TestGyp.TestGyp(formats=['make', 'ninja', 'xcode']) - -test.run_gyp('actions.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - -test.build('actions.gyp', chdir='relocate/src') - -expect = """\ -hi c -hello baz -""" -if test.format == 'xcode': - chdir = 'relocate/src/subdir' -else: - chdir = 'relocate/src' -test.run_built_executable('gencc_int_output', chdir=chdir, stdout=expect) - -if test.format == 'msvs': - test.must_exist('relocate/src/subdir/foo/bar/baz.printed') - test.must_exist('relocate/src/subdir/a/b/c.printed') -else: - test.must_match('relocate/src/subdir/foo/bar/baz.printed', 'foo/bar') - test.must_match('relocate/src/subdir/a/b/c.printed', 'a/b') - -test.pass_test() diff --git a/tools/gyp/test/rules-dirname/src/actions.gyp b/tools/gyp/test/rules-dirname/src/actions.gyp deleted file mode 100644 index c5693c6c9e..0000000000 --- a/tools/gyp/test/rules-dirname/src/actions.gyp +++ /dev/null @@ -1,15 +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. - -{ - 'targets': [ - { - 'target_name': 'pull_in_all_actions', - 'type': 'none', - 'dependencies': [ - 'subdir/input-rule-dirname.gyp:*', - ], - }, - ], -} diff --git a/tools/gyp/test/rules-dirname/src/copy-file.py b/tools/gyp/test/rules-dirname/src/copy-file.py deleted file mode 100755 index 9774ccc960..0000000000 --- a/tools/gyp/test/rules-dirname/src/copy-file.py +++ /dev/null @@ -1,11 +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. -import sys - -contents = open(sys.argv[1], 'r').read() -open(sys.argv[2], 'wb').write(contents) - -sys.exit(0) diff --git a/tools/gyp/test/rules-dirname/src/subdir/a/b/c.gencc b/tools/gyp/test/rules-dirname/src/subdir/a/b/c.gencc deleted file mode 100644 index a4c8eea95f..0000000000 --- a/tools/gyp/test/rules-dirname/src/subdir/a/b/c.gencc +++ /dev/null @@ -1,11 +0,0 @@ -// -*- mode: c++ -*- -#include - -using std::cout; -using std::endl; - -namespace gen { - void c() { - cout << "hi c" << endl; - } -} diff --git a/tools/gyp/test/rules-dirname/src/subdir/a/b/c.printvars b/tools/gyp/test/rules-dirname/src/subdir/a/b/c.printvars deleted file mode 100644 index cc4561dc41..0000000000 --- a/tools/gyp/test/rules-dirname/src/subdir/a/b/c.printvars +++ /dev/null @@ -1 +0,0 @@ -# Empty file for testing build rules diff --git a/tools/gyp/test/rules-dirname/src/subdir/foo/bar/baz.gencc b/tools/gyp/test/rules-dirname/src/subdir/foo/bar/baz.gencc deleted file mode 100644 index ff01c2ee50..0000000000 --- a/tools/gyp/test/rules-dirname/src/subdir/foo/bar/baz.gencc +++ /dev/null @@ -1,11 +0,0 @@ -// -*- mode: c++ -*- -#include - -using std::cout; -using std::endl; - -namespace gen { - void baz() { - cout << "hello baz" << endl; - } -} diff --git a/tools/gyp/test/rules-dirname/src/subdir/foo/bar/baz.printvars b/tools/gyp/test/rules-dirname/src/subdir/foo/bar/baz.printvars deleted file mode 100644 index cc4561dc41..0000000000 --- a/tools/gyp/test/rules-dirname/src/subdir/foo/bar/baz.printvars +++ /dev/null @@ -1 +0,0 @@ -# Empty file for testing build rules diff --git a/tools/gyp/test/rules-dirname/src/subdir/input-rule-dirname.gyp b/tools/gyp/test/rules-dirname/src/subdir/input-rule-dirname.gyp deleted file mode 100644 index 96e32efa7a..0000000000 --- a/tools/gyp/test/rules-dirname/src/subdir/input-rule-dirname.gyp +++ /dev/null @@ -1,92 +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. - -{ - 'targets': [ - { - 'target_name': 'print_rule_input_path', - 'type': 'none', - 'msvs_cygwin_shell': 0, - 'sources': [ - 'foo/bar/baz.printvars', - 'a/b/c.printvars', - ], - 'rules': [ - { - 'rule_name': 'printvars', - 'extension': 'printvars', - 'inputs': [ - 'printvars.py', - ], - 'outputs': [ - '<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).printed', - ], - 'action': [ - 'python', '<@(_inputs)', '<(RULE_INPUT_DIRNAME)', '<@(_outputs)', - ], - }, - ], - }, - { - 'target_name': 'gencc_int_output', - 'type': 'executable', - 'msvs_cygwin_shell': 0, - 'msvs_cygwin_dirs': ['../../../../../../<(DEPTH)/third_party/cygwin'], - 'sources': [ - 'foo/bar/baz.gencc', - 'a/b/c.gencc', - 'main.cc', - ], - 'conditions': [ - ['OS=="win"', { - 'dependencies': [ - 'cygwin', - ], - }], - ], - 'rules': [ - { - 'rule_name': 'gencc', - 'extension': 'gencc', - 'msvs_external_rule': 1, - 'inputs': [ - '<(DEPTH)/copy-file.py', - ], - 'outputs': [ - '<(INTERMEDIATE_DIR)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).cc', - ], - 'action': [ - 'python', '<@(_inputs)', '<(RULE_INPUT_PATH)', '<@(_outputs)', - ], - 'process_outputs_as_sources': 1, - }, - ], - }, - ], - 'conditions': [ - ['OS=="win"', { - 'targets': [ - { - 'target_name': 'cygwin', - 'type': 'none', - 'actions': [ - { - 'action_name': 'setup_mount', - 'msvs_cygwin_shell': 0, - 'inputs': [ - '../../../../../../<(DEPTH)/third_party/cygwin/setup_mount.bat', - ], - # Visual Studio requires an output file, or else the - # custom build step won't run. - 'outputs': [ - '<(INTERMEDIATE_DIR)/_always_run_setup_mount.marker', - ], - 'action': ['', '<@(_inputs)'], - }, - ], - }, - ], - }], - ], -} diff --git a/tools/gyp/test/rules-dirname/src/subdir/main.cc b/tools/gyp/test/rules-dirname/src/subdir/main.cc deleted file mode 100644 index bacc568ad2..0000000000 --- a/tools/gyp/test/rules-dirname/src/subdir/main.cc +++ /dev/null @@ -1,12 +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. -namespace gen { - extern void c(); - extern void baz(); -} - -int main() { - gen::c(); - gen::baz(); -} diff --git a/tools/gyp/test/rules-dirname/src/subdir/printvars.py b/tools/gyp/test/rules-dirname/src/subdir/printvars.py deleted file mode 100755 index ef3d92e8cf..0000000000 --- a/tools/gyp/test/rules-dirname/src/subdir/printvars.py +++ /dev/null @@ -1,14 +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. - -""" -Prints interesting vars -""" - -import sys; - -out = open(sys.argv[2], 'w') -out.write(sys.argv[1]); diff --git a/tools/gyp/test/rules-rebuild/gyptest-all.py b/tools/gyp/test/rules-rebuild/gyptest-all.py deleted file mode 100755 index aaaa2a6e6f..0000000000 --- a/tools/gyp/test/rules-rebuild/gyptest-all.py +++ /dev/null @@ -1,70 +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. - -""" -Verifies that a rule that generates multiple outputs rebuilds -correctly when the inputs change. -""" - -import TestGyp - -test = TestGyp.TestGyp(workdir='workarea_all') - -test.run_gyp('same_target.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - - -test.build('same_target.gyp', test.ALL, chdir='relocate/src') - -expect = """\ -Hello from main.c -Hello from prog1.in! -Hello from prog2.in! -""" - -test.run_built_executable('program', chdir='relocate/src', stdout=expect) - -test.up_to_date('same_target.gyp', 'program', chdir='relocate/src') - - -test.sleep() -contents = test.read(['relocate', 'src', 'prog1.in']) -contents = contents.replace('!', ' AGAIN!') -test.write(['relocate', 'src', 'prog1.in'], contents) - -test.build('same_target.gyp', test.ALL, chdir='relocate/src') - -expect = """\ -Hello from main.c -Hello from prog1.in AGAIN! -Hello from prog2.in! -""" - -test.run_built_executable('program', chdir='relocate/src', stdout=expect) - -test.up_to_date('same_target.gyp', 'program', chdir='relocate/src') - - -test.sleep() -contents = test.read(['relocate', 'src', 'prog2.in']) -contents = contents.replace('!', ' AGAIN!') -test.write(['relocate', 'src', 'prog2.in'], contents) - -test.build('same_target.gyp', test.ALL, chdir='relocate/src') - -expect = """\ -Hello from main.c -Hello from prog1.in AGAIN! -Hello from prog2.in AGAIN! -""" - -test.run_built_executable('program', chdir='relocate/src', stdout=expect) - -test.up_to_date('same_target.gyp', 'program', chdir='relocate/src') - - -test.pass_test() diff --git a/tools/gyp/test/rules-rebuild/gyptest-default.py b/tools/gyp/test/rules-rebuild/gyptest-default.py deleted file mode 100755 index 89694ef08b..0000000000 --- a/tools/gyp/test/rules-rebuild/gyptest-default.py +++ /dev/null @@ -1,70 +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. - -""" -Verifies that a rule that generates multiple outputs rebuilds -correctly when the inputs change. -""" - -import TestGyp - -test = TestGyp.TestGyp(workdir='workarea_default') - -test.run_gyp('same_target.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - - -test.build('same_target.gyp', chdir='relocate/src') - -expect = """\ -Hello from main.c -Hello from prog1.in! -Hello from prog2.in! -""" - -test.run_built_executable('program', chdir='relocate/src', stdout=expect) - -test.up_to_date('same_target.gyp', 'program', chdir='relocate/src') - - -test.sleep() -contents = test.read(['relocate', 'src', 'prog1.in']) -contents = contents.replace('!', ' AGAIN!') -test.write(['relocate', 'src', 'prog1.in'], contents) - -test.build('same_target.gyp', chdir='relocate/src') - -expect = """\ -Hello from main.c -Hello from prog1.in AGAIN! -Hello from prog2.in! -""" - -test.run_built_executable('program', chdir='relocate/src', stdout=expect) - -test.up_to_date('same_target.gyp', 'program', chdir='relocate/src') - - -test.sleep() -contents = test.read(['relocate', 'src', 'prog2.in']) -contents = contents.replace('!', ' AGAIN!') -test.write(['relocate', 'src', 'prog2.in'], contents) - -test.build('same_target.gyp', chdir='relocate/src') - -expect = """\ -Hello from main.c -Hello from prog1.in AGAIN! -Hello from prog2.in AGAIN! -""" - -test.run_built_executable('program', chdir='relocate/src', stdout=expect) - -test.up_to_date('same_target.gyp', 'program', chdir='relocate/src') - - -test.pass_test() diff --git a/tools/gyp/test/rules-rebuild/src/main.c b/tools/gyp/test/rules-rebuild/src/main.c deleted file mode 100644 index bdc5ec875e..0000000000 --- a/tools/gyp/test/rules-rebuild/src/main.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -extern void prog1(void); -extern void prog2(void); - -int main(int argc, char *argv[]) -{ - printf("Hello from main.c\n"); - prog1(); - prog2(); - return 0; -} diff --git a/tools/gyp/test/rules-rebuild/src/make-sources.py b/tools/gyp/test/rules-rebuild/src/make-sources.py deleted file mode 100755 index 7ec022780c..0000000000 --- a/tools/gyp/test/rules-rebuild/src/make-sources.py +++ /dev/null @@ -1,19 +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. - -import sys - -assert len(sys.argv) == 4, sys.argv - -(in_file, c_file, h_file) = sys.argv[1:] - -def write_file(filename, contents): - open(filename, 'wb').write(contents) - -write_file(c_file, open(in_file, 'rb').read()) - -write_file(h_file, '#define NAME "%s"\n' % in_file) - -sys.exit(0) diff --git a/tools/gyp/test/rules-rebuild/src/prog1.in b/tools/gyp/test/rules-rebuild/src/prog1.in deleted file mode 100644 index 191b00ef1e..0000000000 --- a/tools/gyp/test/rules-rebuild/src/prog1.in +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include "prog1.h" - -void prog1(void) -{ - printf("Hello from %s!\n", NAME); -} diff --git a/tools/gyp/test/rules-rebuild/src/prog2.in b/tools/gyp/test/rules-rebuild/src/prog2.in deleted file mode 100644 index 7bfac5104c..0000000000 --- a/tools/gyp/test/rules-rebuild/src/prog2.in +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include "prog2.h" - -void prog2(void) -{ - printf("Hello from %s!\n", NAME); -} diff --git a/tools/gyp/test/rules-rebuild/src/same_target.gyp b/tools/gyp/test/rules-rebuild/src/same_target.gyp deleted file mode 100644 index 22ba56056d..0000000000 --- a/tools/gyp/test/rules-rebuild/src/same_target.gyp +++ /dev/null @@ -1,31 +0,0 @@ -{ - 'targets': [ - { - 'target_name': 'program', - 'type': 'executable', - 'msvs_cygwin_shell': 0, - 'sources': [ - 'main.c', - 'prog1.in', - 'prog2.in', - ], - 'rules': [ - { - 'rule_name': 'make_sources', - 'extension': 'in', - 'inputs': [ - 'make-sources.py', - ], - 'outputs': [ - '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).c', - '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).h', - ], - 'action': [ - 'python', '<(_inputs)', '<(RULE_INPUT_NAME)', '<@(_outputs)', - ], - 'process_outputs_as_sources': 1, - }, - ], - }, - ], -} diff --git a/tools/gyp/test/rules-variables/gyptest-rules-variables.py b/tools/gyp/test/rules-variables/gyptest-rules-variables.py deleted file mode 100755 index 06ee5ca838..0000000000 --- a/tools/gyp/test/rules-variables/gyptest-rules-variables.py +++ /dev/null @@ -1,26 +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. - -""" -Verifies rules related variables are expanded. -""" - -import TestGyp - -test = TestGyp.TestGyp(formats=['ninja']) - -test.relocate('src', 'relocate/src') - -test.run_gyp('variables.gyp', chdir='relocate/src') - -test.build('variables.gyp', chdir='relocate/src') - -test.run_built_executable('all_rule_variables', - chdir='relocate/src', - stdout="input_root\ninput_dirname\ninput_path\n" + - "input_ext\ninput_name\n") - -test.pass_test() diff --git a/tools/gyp/test/rules-variables/src/input_ext.c b/tools/gyp/test/rules-variables/src/input_ext.c deleted file mode 100644 index f41e73ef8a..0000000000 --- a/tools/gyp/test/rules-variables/src/input_ext.c +++ /dev/null @@ -1,9 +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. - -#include - -void input_ext() { - printf("input_ext\n"); -} diff --git a/tools/gyp/test/rules-variables/src/input_name/test.c b/tools/gyp/test/rules-variables/src/input_name/test.c deleted file mode 100644 index e28b74d115..0000000000 --- a/tools/gyp/test/rules-variables/src/input_name/test.c +++ /dev/null @@ -1,9 +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. - -#include - -void input_name() { - printf("input_name\n"); -} diff --git a/tools/gyp/test/rules-variables/src/input_path/subdir/test.c b/tools/gyp/test/rules-variables/src/input_path/subdir/test.c deleted file mode 100644 index 403dbbda4c..0000000000 --- a/tools/gyp/test/rules-variables/src/input_path/subdir/test.c +++ /dev/null @@ -1,9 +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. - -#include - -void input_path() { - printf("input_path\n"); -} diff --git a/tools/gyp/test/rules-variables/src/subdir/input_dirname.c b/tools/gyp/test/rules-variables/src/subdir/input_dirname.c deleted file mode 100644 index 40cecd87d9..0000000000 --- a/tools/gyp/test/rules-variables/src/subdir/input_dirname.c +++ /dev/null @@ -1,9 +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. - -#include - -void input_dirname() { - printf("input_dirname\n"); -} diff --git a/tools/gyp/test/rules-variables/src/subdir/test.c b/tools/gyp/test/rules-variables/src/subdir/test.c deleted file mode 100644 index 6c0280b8ad..0000000000 --- a/tools/gyp/test/rules-variables/src/subdir/test.c +++ /dev/null @@ -1,18 +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. - -extern void input_root(); -extern void input_dirname(); -extern void input_path(); -extern void input_ext(); -extern void input_name(); - -int main() { - input_root(); - input_dirname(); - input_path(); - input_ext(); - input_name(); - return 0; -} diff --git a/tools/gyp/test/rules-variables/src/test.input_root.c b/tools/gyp/test/rules-variables/src/test.input_root.c deleted file mode 100644 index 33a7740a5c..0000000000 --- a/tools/gyp/test/rules-variables/src/test.input_root.c +++ /dev/null @@ -1,9 +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. - -#include - -void input_root() { - printf("input_root\n"); -} diff --git a/tools/gyp/test/rules-variables/src/variables.gyp b/tools/gyp/test/rules-variables/src/variables.gyp deleted file mode 100644 index e40f3a85f5..0000000000 --- a/tools/gyp/test/rules-variables/src/variables.gyp +++ /dev/null @@ -1,30 +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. - -{ - 'targets': [ - { - 'target_name': 'all_rule_variables', - 'type': 'executable', - 'sources': [ - 'subdir/test.c', - ], - 'rules': [ - { - 'rule_name': 'rule_variable', - 'extension': 'c', - 'outputs': [ - '<(RULE_INPUT_ROOT).input_root.c', - '<(RULE_INPUT_DIRNAME)/input_dirname.c', - 'input_path/<(RULE_INPUT_PATH)', - 'input_ext<(RULE_INPUT_EXT)', - 'input_name/<(RULE_INPUT_NAME)', - ], - 'action': [], - 'process_outputs_as_sources': 1, - }, - ], - }, - ], -} diff --git a/tools/gyp/test/rules/gyptest-all.py b/tools/gyp/test/rules/gyptest-all.py deleted file mode 100755 index 63c3a10ba5..0000000000 --- a/tools/gyp/test/rules/gyptest-all.py +++ /dev/null @@ -1,66 +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. - -""" -Verifies simple rules when using an explicit build target of 'all'. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('actions.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - -test.build('actions.gyp', test.ALL, chdir='relocate/src') - -expect = """\ -Hello from program.c -Hello from function1.in -Hello from function2.in -""" - -if test.format == 'xcode': - chdir = 'relocate/src/subdir1' -else: - chdir = 'relocate/src' -test.run_built_executable('program', chdir=chdir, stdout=expect) - -expect = """\ -Hello from program.c -Hello from function3.in -""" - -if test.format == 'xcode': - chdir = 'relocate/src/subdir3' -else: - chdir = 'relocate/src' -test.run_built_executable('program2', chdir=chdir, stdout=expect) - -test.must_match('relocate/src/subdir2/file1.out', 'Hello from file1.in\n') -test.must_match('relocate/src/subdir2/file2.out', 'Hello from file2.in\n') - -test.must_match('relocate/src/subdir2/file1.out2', 'Hello from file1.in\n') -test.must_match('relocate/src/subdir2/file2.out2', 'Hello from file2.in\n') - -test.must_match('relocate/src/external/file1.external_rules.out', - 'Hello from file1.in\n') -test.must_match('relocate/src/external/file2.external_rules.out', - 'Hello from file2.in\n') - -expect = """\ -Hello from program.c -Got 41. -""" - -if test.format == 'xcode': - chdir = 'relocate/src/subdir4' -else: - chdir = 'relocate/src' -test.run_built_executable('program4', chdir=chdir, stdout=expect) - -test.pass_test() diff --git a/tools/gyp/test/rules/gyptest-default.py b/tools/gyp/test/rules/gyptest-default.py deleted file mode 100755 index 117c53db03..0000000000 --- a/tools/gyp/test/rules/gyptest-default.py +++ /dev/null @@ -1,55 +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. - -""" -Verifies simple rules when using an explicit build target of 'all'. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('actions.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - -test.build('actions.gyp', chdir='relocate/src') - -expect = """\ -Hello from program.c -Hello from function1.in -Hello from function2.in -""" - -if test.format == 'xcode': - chdir = 'relocate/src/subdir1' -else: - chdir = 'relocate/src' -test.run_built_executable('program', chdir=chdir, stdout=expect) - -expect = """\ -Hello from program.c -Hello from function3.in -""" - -if test.format == 'xcode': - chdir = 'relocate/src/subdir3' -else: - chdir = 'relocate/src' -test.run_built_executable('program2', chdir=chdir, stdout=expect) - -test.must_match('relocate/src/subdir2/file1.out', 'Hello from file1.in\n') -test.must_match('relocate/src/subdir2/file2.out', 'Hello from file2.in\n') - -test.must_match('relocate/src/subdir2/file1.out2', 'Hello from file1.in\n') -test.must_match('relocate/src/subdir2/file2.out2', 'Hello from file2.in\n') - -test.must_match('relocate/src/external/file1.external_rules.out', - 'Hello from file1.in\n') -test.must_match('relocate/src/external/file2.external_rules.out', - 'Hello from file2.in\n') - -test.pass_test() diff --git a/tools/gyp/test/rules/gyptest-input-root.py b/tools/gyp/test/rules/gyptest-input-root.py deleted file mode 100755 index 92bade6d48..0000000000 --- a/tools/gyp/test/rules/gyptest-input-root.py +++ /dev/null @@ -1,26 +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. - -""" -Verifies that RULE_INPUT_ROOT isn't turned into a path in rule actions -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('input-root.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - -test.build('input-root.gyp', target='test', chdir='relocate/src') - -expect = """\ -Hello somefile -""" - -test.run_built_executable('test', chdir='relocate/src', stdout=expect) -test.pass_test() diff --git a/tools/gyp/test/rules/src/actions.gyp b/tools/gyp/test/rules/src/actions.gyp deleted file mode 100644 index 23e00cec61..0000000000 --- a/tools/gyp/test/rules/src/actions.gyp +++ /dev/null @@ -1,21 +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. - -{ - 'targets': [ - { - 'target_name': 'pull_in_all_actions', - 'type': 'none', - 'dependencies': [ - 'subdir1/executable.gyp:*', - 'subdir2/never_used.gyp:*', - 'subdir2/no_inputs.gyp:*', - 'subdir2/none.gyp:*', - 'subdir3/executable2.gyp:*', - 'subdir4/build-asm.gyp:*', - 'external/external.gyp:*', - ], - }, - ], -} diff --git a/tools/gyp/test/rules/src/copy-file.py b/tools/gyp/test/rules/src/copy-file.py deleted file mode 100755 index 5a5feae1f2..0000000000 --- a/tools/gyp/test/rules/src/copy-file.py +++ /dev/null @@ -1,11 +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 - -contents = open(sys.argv[1], 'r').read() -open(sys.argv[2], 'wb').write(contents) - -sys.exit(0) diff --git a/tools/gyp/test/rules/src/external/external.gyp b/tools/gyp/test/rules/src/external/external.gyp deleted file mode 100644 index 004ec63599..0000000000 --- a/tools/gyp/test/rules/src/external/external.gyp +++ /dev/null @@ -1,66 +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. - -# Test that the case where there are no inputs (other than the -# file the rule applies to). -{ - 'target_defaults': { - 'msvs_cygwin_dirs': ['../../../../../../<(DEPTH)/third_party/cygwin'], - }, - 'targets': [ - { - 'target_name': 'external_rules', - 'type': 'none', - 'sources': [ - 'file1.in', - 'file2.in', - ], - 'conditions': [ - ['OS=="win"', { - 'dependencies': [ - 'cygwin', - ], - }], - ], - 'rules': [ - { - 'rule_name': 'copy_file', - 'extension': 'in', - 'msvs_external_rule': 1, - 'outputs': [ - '<(RULE_INPUT_ROOT).external_rules.out', - ], - 'action': [ - 'python', '../copy-file.py', '<(RULE_INPUT_PATH)', '<@(_outputs)', - ], - }, - ], - }, - ], - 'conditions': [ - ['OS=="win"', { - 'targets': [ - { - 'target_name': 'cygwin', - 'type': 'none', - 'actions': [ - { - 'action_name': 'setup_mount', - 'msvs_cygwin_shell': 0, - 'inputs': [ - '../../../../../../<(DEPTH)/third_party/cygwin/setup_mount.bat', - ], - # Visual Studio requires an output file, or else the - # custom build step won't run. - 'outputs': [ - '<(INTERMEDIATE_DIR)/_always_run_setup_mount.marker', - ], - 'action': ['', '<@(_inputs)'], - }, - ], - }, - ], - }], - ], -} diff --git a/tools/gyp/test/rules/src/external/file1.in b/tools/gyp/test/rules/src/external/file1.in deleted file mode 100644 index 86ac3ad389..0000000000 --- a/tools/gyp/test/rules/src/external/file1.in +++ /dev/null @@ -1 +0,0 @@ -Hello from file1.in diff --git a/tools/gyp/test/rules/src/external/file2.in b/tools/gyp/test/rules/src/external/file2.in deleted file mode 100644 index bf83d8ecec..0000000000 --- a/tools/gyp/test/rules/src/external/file2.in +++ /dev/null @@ -1 +0,0 @@ -Hello from file2.in diff --git a/tools/gyp/test/rules/src/input-root.gyp b/tools/gyp/test/rules/src/input-root.gyp deleted file mode 100644 index b6600e767c..0000000000 --- a/tools/gyp/test/rules/src/input-root.gyp +++ /dev/null @@ -1,24 +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. - -{ - 'targets': [ - { - 'target_name': 'test', - 'type': 'executable', - 'sources': [ 'somefile.ext', ], - 'rules': [{ - 'rule_name': 'rule', - 'extension': 'ext', - 'inputs': [ 'rule.py', ], - 'outputs': [ '<(RULE_INPUT_ROOT).cc', ], - 'action': [ 'python', 'rule.py', '<(RULE_INPUT_ROOT)', ], - 'message': 'Processing <(RULE_INPUT_PATH)', - 'process_outputs_as_sources': 1, - # Allows the test to run without hermetic cygwin on windows. - 'msvs_cygwin_shell': 0, - }], - }, - ], -} diff --git a/tools/gyp/test/rules/src/rule.py b/tools/gyp/test/rules/src/rule.py deleted file mode 100755 index 8a1f36dedb..0000000000 --- a/tools/gyp/test/rules/src/rule.py +++ /dev/null @@ -1,17 +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. - -import sys - -f = open(sys.argv[1] + ".cc", "w") -f.write("""\ -#include - -int main() { - puts("Hello %s"); - return 0; -} -""" % sys.argv[1]) -f.close() diff --git a/tools/gyp/test/rules/src/somefile.ext b/tools/gyp/test/rules/src/somefile.ext deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tools/gyp/test/rules/src/subdir1/executable.gyp b/tools/gyp/test/rules/src/subdir1/executable.gyp deleted file mode 100644 index 302857789d..0000000000 --- a/tools/gyp/test/rules/src/subdir1/executable.gyp +++ /dev/null @@ -1,37 +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. - -{ - 'targets': [ - { - 'target_name': 'program', - 'type': 'executable', - 'msvs_cygwin_shell': 0, - 'sources': [ - 'program.c', - 'function1.in', - 'function2.in', - ], - 'rules': [ - { - 'rule_name': 'copy_file', - 'extension': 'in', - 'inputs': [ - '../copy-file.py', - ], - 'outputs': [ - # TODO: fix SCons and Make to support generated files not - # in a variable-named path like <(INTERMEDIATE_DIR) - #'<(RULE_INPUT_ROOT).c', - '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).c', - ], - 'action': [ - 'python', '<(_inputs)', '<(RULE_INPUT_PATH)', '<@(_outputs)', - ], - 'process_outputs_as_sources': 1, - }, - ], - }, - ], -} diff --git a/tools/gyp/test/rules/src/subdir1/function1.in b/tools/gyp/test/rules/src/subdir1/function1.in deleted file mode 100644 index 60ff28949b..0000000000 --- a/tools/gyp/test/rules/src/subdir1/function1.in +++ /dev/null @@ -1,6 +0,0 @@ -#include - -void function1(void) -{ - printf("Hello from function1.in\n"); -} diff --git a/tools/gyp/test/rules/src/subdir1/function2.in b/tools/gyp/test/rules/src/subdir1/function2.in deleted file mode 100644 index 0fcfc03fdb..0000000000 --- a/tools/gyp/test/rules/src/subdir1/function2.in +++ /dev/null @@ -1,6 +0,0 @@ -#include - -void function2(void) -{ - printf("Hello from function2.in\n"); -} diff --git a/tools/gyp/test/rules/src/subdir1/program.c b/tools/gyp/test/rules/src/subdir1/program.c deleted file mode 100644 index 258d7f99ef..0000000000 --- a/tools/gyp/test/rules/src/subdir1/program.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -extern void function1(void); -extern void function2(void); - -int main(int argc, char *argv[]) -{ - printf("Hello from program.c\n"); - function1(); - function2(); - return 0; -} diff --git a/tools/gyp/test/rules/src/subdir2/file1.in b/tools/gyp/test/rules/src/subdir2/file1.in deleted file mode 100644 index 86ac3ad389..0000000000 --- a/tools/gyp/test/rules/src/subdir2/file1.in +++ /dev/null @@ -1 +0,0 @@ -Hello from file1.in diff --git a/tools/gyp/test/rules/src/subdir2/file2.in b/tools/gyp/test/rules/src/subdir2/file2.in deleted file mode 100644 index bf83d8ecec..0000000000 --- a/tools/gyp/test/rules/src/subdir2/file2.in +++ /dev/null @@ -1 +0,0 @@ -Hello from file2.in diff --git a/tools/gyp/test/rules/src/subdir2/never_used.gyp b/tools/gyp/test/rules/src/subdir2/never_used.gyp deleted file mode 100644 index 17f6f55371..0000000000 --- a/tools/gyp/test/rules/src/subdir2/never_used.gyp +++ /dev/null @@ -1,31 +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. - -# Test that the case where there is a rule that doesn't apply to anything. -{ - 'targets': [ - { - 'target_name': 'files_no_input2', - 'type': 'none', - 'msvs_cygwin_shell': 0, - 'sources': [ - 'file1.in', - 'file2.in', - ], - 'rules': [ - { - 'rule_name': 'copy_file3', - 'extension': 'in2', - 'outputs': [ - '<(RULE_INPUT_ROOT).out3', - ], - 'action': [ - 'python', '../copy-file.py', '<(RULE_INPUT_PATH)', '<@(_outputs)', - ], - 'process_outputs_as_sources': 1, - }, - ], - }, - ], -} diff --git a/tools/gyp/test/rules/src/subdir2/no_inputs.gyp b/tools/gyp/test/rules/src/subdir2/no_inputs.gyp deleted file mode 100644 index e61a1a3ff6..0000000000 --- a/tools/gyp/test/rules/src/subdir2/no_inputs.gyp +++ /dev/null @@ -1,32 +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. - -# Test that the case where there are no inputs (other than the -# file the rule applies to). -{ - 'targets': [ - { - 'target_name': 'files_no_input', - 'type': 'none', - 'msvs_cygwin_shell': 0, - 'sources': [ - 'file1.in', - 'file2.in', - ], - 'rules': [ - { - 'rule_name': 'copy_file2', - 'extension': 'in', - 'outputs': [ - '<(RULE_INPUT_ROOT).out2', - ], - 'action': [ - 'python', '../copy-file.py', '<(RULE_INPUT_PATH)', '<@(_outputs)', - ], - 'process_outputs_as_sources': 1, - }, - ], - }, - ], -} diff --git a/tools/gyp/test/rules/src/subdir2/none.gyp b/tools/gyp/test/rules/src/subdir2/none.gyp deleted file mode 100644 index 38bcdabdf6..0000000000 --- a/tools/gyp/test/rules/src/subdir2/none.gyp +++ /dev/null @@ -1,33 +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. - -{ - 'targets': [ - { - 'target_name': 'files', - 'type': 'none', - 'msvs_cygwin_shell': 0, - 'sources': [ - 'file1.in', - 'file2.in', - ], - 'rules': [ - { - 'rule_name': 'copy_file', - 'extension': 'in', - 'inputs': [ - '../copy-file.py', - ], - 'outputs': [ - '<(RULE_INPUT_ROOT).out', - ], - 'action': [ - 'python', '<(_inputs)', '<(RULE_INPUT_PATH)', '<@(_outputs)', - ], - 'process_outputs_as_sources': 1, - }, - ], - }, - ], -} diff --git a/tools/gyp/test/rules/src/subdir3/executable2.gyp b/tools/gyp/test/rules/src/subdir3/executable2.gyp deleted file mode 100644 index a2a528fc7b..0000000000 --- a/tools/gyp/test/rules/src/subdir3/executable2.gyp +++ /dev/null @@ -1,37 +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. - -# This one tests that rules are properly written if extensions are different -# between the target's sources (program.c) and the generated files -# (function3.cc) - -{ - 'targets': [ - { - 'target_name': 'program2', - 'type': 'executable', - 'msvs_cygwin_shell': 0, - 'sources': [ - 'program.c', - 'function3.in', - ], - 'rules': [ - { - 'rule_name': 'copy_file', - 'extension': 'in', - 'inputs': [ - '../copy-file.py', - ], - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).cc', - ], - 'action': [ - 'python', '<(_inputs)', '<(RULE_INPUT_PATH)', '<@(_outputs)', - ], - 'process_outputs_as_sources': 1, - }, - ], - }, - ], -} diff --git a/tools/gyp/test/rules/src/subdir3/function3.in b/tools/gyp/test/rules/src/subdir3/function3.in deleted file mode 100644 index 99f46ab05e..0000000000 --- a/tools/gyp/test/rules/src/subdir3/function3.in +++ /dev/null @@ -1,6 +0,0 @@ -#include - -extern "C" void function3(void) -{ - printf("Hello from function3.in\n"); -} diff --git a/tools/gyp/test/rules/src/subdir3/program.c b/tools/gyp/test/rules/src/subdir3/program.c deleted file mode 100644 index 94f6c50912..0000000000 --- a/tools/gyp/test/rules/src/subdir3/program.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -extern void function3(void); - -int main(int argc, char *argv[]) -{ - printf("Hello from program.c\n"); - function3(); - return 0; -} diff --git a/tools/gyp/test/rules/src/subdir4/asm-function.asm b/tools/gyp/test/rules/src/subdir4/asm-function.asm deleted file mode 100644 index ed47cade95..0000000000 --- a/tools/gyp/test/rules/src/subdir4/asm-function.asm +++ /dev/null @@ -1,10 +0,0 @@ -#if PLATFORM_WINDOWS || PLATFORM_MAC -# define IDENTIFIER(n) _##n -#else /* Linux */ -# define IDENTIFIER(n) n -#endif - -.globl IDENTIFIER(asm_function) -IDENTIFIER(asm_function): - movl $41, %eax - ret diff --git a/tools/gyp/test/rules/src/subdir4/build-asm.gyp b/tools/gyp/test/rules/src/subdir4/build-asm.gyp deleted file mode 100644 index be4a612d18..0000000000 --- a/tools/gyp/test/rules/src/subdir4/build-asm.gyp +++ /dev/null @@ -1,49 +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. - -# This one tests that assembly files ended as .s and .S are compiled. - -{ - 'target_defaults': { - 'conditions': [ - ['OS=="win"', { - 'defines': ['PLATFORM_WIN'], - }], - ['OS=="mac"', { - 'defines': ['PLATFORM_MAC'], - }], - ['OS=="linux"', { - 'defines': ['PLATFORM_LINUX'], - }], - ], - }, - 'targets': [ - { - 'target_name': 'program4', - 'type': 'executable', - 'sources': [ - 'asm-function.asm', - 'program.c', - ], - 'conditions': [ - ['OS=="linux" or OS=="mac"', { - 'rules': [ - { - 'rule_name': 'convert_asm', - 'extension': 'asm', - 'inputs': [], - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).S', - ], - 'action': [ - 'bash', '-c', 'mv <(RULE_INPUT_PATH) <@(_outputs)', - ], - 'process_outputs_as_sources': 1, - }, - ], - }], - ], - }, - ], -} diff --git a/tools/gyp/test/rules/src/subdir4/program.c b/tools/gyp/test/rules/src/subdir4/program.c deleted file mode 100644 index 4247590624..0000000000 --- a/tools/gyp/test/rules/src/subdir4/program.c +++ /dev/null @@ -1,19 +0,0 @@ -#include - -// Use the assembly function in linux and mac where it is built. -#if PLATFORM_LINUX || PLATFORM_MAC -extern int asm_function(void); -#else -int asm_function() { - return 41; -} -#endif - -int main(int argc, char *argv[]) -{ - fprintf(stdout, "Hello from program.c\n"); - fflush(stdout); - fprintf(stdout, "Got %d.\n", asm_function()); - fflush(stdout); - return 0; -} diff --git a/tools/gyp/test/same-gyp-name/gyptest-all.py b/tools/gyp/test/same-gyp-name/gyptest-all.py deleted file mode 100755 index 98732d52fb..0000000000 --- a/tools/gyp/test/same-gyp-name/gyptest-all.py +++ /dev/null @@ -1,34 +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. - -""" -Build a .gyp that depends on 2 gyp files with the same name. -""" - -import TestGyp - -# This causes a problem on XCode (duplicate ID). -# See http://code.google.com/p/gyp/issues/detail?id=114 -test = TestGyp.TestGyp(formats=['msvs', 'scons', 'make', 'ninja']) - -test.run_gyp('all.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - -test.build('all.gyp', test.ALL, chdir='relocate/src') - -expect1 = """\ -Hello from main1.cc -""" - -expect2 = """\ -Hello from main2.cc -""" - -test.run_built_executable('program1', chdir='relocate/src', stdout=expect1) -test.run_built_executable('program2', chdir='relocate/src', stdout=expect2) - -test.pass_test() diff --git a/tools/gyp/test/same-gyp-name/gyptest-default.py b/tools/gyp/test/same-gyp-name/gyptest-default.py deleted file mode 100755 index b8fb63d15b..0000000000 --- a/tools/gyp/test/same-gyp-name/gyptest-default.py +++ /dev/null @@ -1,34 +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. - -""" -Build a .gyp that depends on 2 gyp files with the same name. -""" - -import TestGyp - -# This causes a problem on XCode (duplicate ID). -# See http://code.google.com/p/gyp/issues/detail?id=114 -test = TestGyp.TestGyp(formats=['msvs', 'scons', 'make', 'ninja']) - -test.run_gyp('all.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - -test.build('all.gyp', chdir='relocate/src') - -expect1 = """\ -Hello from main1.cc -""" - -expect2 = """\ -Hello from main2.cc -""" - -test.run_built_executable('program1', chdir='relocate/src', stdout=expect1) -test.run_built_executable('program2', chdir='relocate/src', stdout=expect2) - -test.pass_test() diff --git a/tools/gyp/test/same-gyp-name/src/all.gyp b/tools/gyp/test/same-gyp-name/src/all.gyp deleted file mode 100644 index 229f02ea84..0000000000 --- a/tools/gyp/test/same-gyp-name/src/all.gyp +++ /dev/null @@ -1,16 +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. - -{ - 'targets': [ - { - 'target_name': 'all_exes', - 'type': 'none', - 'dependencies': [ - 'subdir1/executable.gyp:*', - 'subdir2/executable.gyp:*', - ], - }, - ], -} diff --git a/tools/gyp/test/same-gyp-name/src/subdir1/executable.gyp b/tools/gyp/test/same-gyp-name/src/subdir1/executable.gyp deleted file mode 100644 index 82483b4c69..0000000000 --- a/tools/gyp/test/same-gyp-name/src/subdir1/executable.gyp +++ /dev/null @@ -1,15 +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. - -{ - 'targets': [ - { - 'target_name': 'program1', - 'type': 'executable', - 'sources': [ - 'main1.cc', - ], - }, - ], -} diff --git a/tools/gyp/test/same-gyp-name/src/subdir1/main1.cc b/tools/gyp/test/same-gyp-name/src/subdir1/main1.cc deleted file mode 100644 index 3645558324..0000000000 --- a/tools/gyp/test/same-gyp-name/src/subdir1/main1.cc +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main() { - printf("Hello from main1.cc\n"); - return 0; -} diff --git a/tools/gyp/test/same-gyp-name/src/subdir2/executable.gyp b/tools/gyp/test/same-gyp-name/src/subdir2/executable.gyp deleted file mode 100644 index e3537013eb..0000000000 --- a/tools/gyp/test/same-gyp-name/src/subdir2/executable.gyp +++ /dev/null @@ -1,15 +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. - -{ - 'targets': [ - { - 'target_name': 'program2', - 'type': 'executable', - 'sources': [ - 'main2.cc', - ], - }, - ], -} diff --git a/tools/gyp/test/same-gyp-name/src/subdir2/main2.cc b/tools/gyp/test/same-gyp-name/src/subdir2/main2.cc deleted file mode 100644 index 0c724dee35..0000000000 --- a/tools/gyp/test/same-gyp-name/src/subdir2/main2.cc +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main() { - printf("Hello from main2.cc\n"); - return 0; -} diff --git a/tools/gyp/test/same-name/gyptest-all.py b/tools/gyp/test/same-name/gyptest-all.py deleted file mode 100755 index 4c215027c2..0000000000 --- a/tools/gyp/test/same-name/gyptest-all.py +++ /dev/null @@ -1,34 +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. - -""" -Build a .gyp with two targets that share a common .c source file. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('all.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - -test.build('all.gyp', test.ALL, chdir='relocate/src') - -expect1 = """\ -Hello from prog1.c -Hello prog1 from func.c -""" - -expect2 = """\ -Hello from prog2.c -Hello prog2 from func.c -""" - -test.run_built_executable('prog1', chdir='relocate/src', stdout=expect1) -test.run_built_executable('prog2', chdir='relocate/src', stdout=expect2) - -test.pass_test() diff --git a/tools/gyp/test/same-name/gyptest-default.py b/tools/gyp/test/same-name/gyptest-default.py deleted file mode 100755 index 98757c2697..0000000000 --- a/tools/gyp/test/same-name/gyptest-default.py +++ /dev/null @@ -1,34 +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. - -""" -Build a .gyp with two targets that share a common .c source file. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('all.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - -test.build('all.gyp', chdir='relocate/src') - -expect1 = """\ -Hello from prog1.c -Hello prog1 from func.c -""" - -expect2 = """\ -Hello from prog2.c -Hello prog2 from func.c -""" - -test.run_built_executable('prog1', chdir='relocate/src', stdout=expect1) -test.run_built_executable('prog2', chdir='relocate/src', stdout=expect2) - -test.pass_test() diff --git a/tools/gyp/test/same-name/src/all.gyp b/tools/gyp/test/same-name/src/all.gyp deleted file mode 100644 index 44e1049821..0000000000 --- a/tools/gyp/test/same-name/src/all.gyp +++ /dev/null @@ -1,38 +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. - -{ - 'targets': [ - { - 'target_name': 'prog1', - 'type': 'executable', - 'defines': [ - 'PROG="prog1"', - ], - 'sources': [ - 'prog1.c', - 'func.c', - # Uncomment to test same-named files in different directories, - # which Visual Studio doesn't support. - #'subdir1/func.c', - #'subdir2/func.c', - ], - }, - { - 'target_name': 'prog2', - 'type': 'executable', - 'defines': [ - 'PROG="prog2"', - ], - 'sources': [ - 'prog2.c', - 'func.c', - # Uncomment to test same-named files in different directories, - # which Visual Studio doesn't support. - #'subdir1/func.c', - #'subdir2/func.c', - ], - }, - ], -} diff --git a/tools/gyp/test/same-name/src/func.c b/tools/gyp/test/same-name/src/func.c deleted file mode 100644 index e069c692a6..0000000000 --- a/tools/gyp/test/same-name/src/func.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -void func(void) -{ - printf("Hello %s from func.c\n", PROG); -} diff --git a/tools/gyp/test/same-name/src/prog1.c b/tools/gyp/test/same-name/src/prog1.c deleted file mode 100644 index c8940fedc3..0000000000 --- a/tools/gyp/test/same-name/src/prog1.c +++ /dev/null @@ -1,16 +0,0 @@ -#include - -extern void func(void); - -int main(int argc, char *argv[]) -{ - printf("Hello from prog1.c\n"); - func(); - /* - * Uncomment to test same-named files in different directories, - * which Visual Studio doesn't support. - subdir1_func(); - subdir2_func(); - */ - return 0; -} diff --git a/tools/gyp/test/same-name/src/prog2.c b/tools/gyp/test/same-name/src/prog2.c deleted file mode 100644 index e6605c2bd9..0000000000 --- a/tools/gyp/test/same-name/src/prog2.c +++ /dev/null @@ -1,16 +0,0 @@ -#include - -extern void func(void); - -int main(int argc, char *argv[]) -{ - printf("Hello from prog2.c\n"); - func(); - /* - * Uncomment to test same-named files in different directories, - * which Visual Studio doesn't support. - subdir1_func(); - subdir2_func(); - */ - return 0; -} diff --git a/tools/gyp/test/same-name/src/subdir1/func.c b/tools/gyp/test/same-name/src/subdir1/func.c deleted file mode 100644 index b73450d105..0000000000 --- a/tools/gyp/test/same-name/src/subdir1/func.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -void subdir1_func(void) -{ - printf("Hello %s from subdir1/func.c\n", PROG); -} diff --git a/tools/gyp/test/same-name/src/subdir2/func.c b/tools/gyp/test/same-name/src/subdir2/func.c deleted file mode 100644 index 0248b5720e..0000000000 --- a/tools/gyp/test/same-name/src/subdir2/func.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -void subdir2_func(void) -{ - printf("Hello %s from subdir2/func.c\n", PROG); -} diff --git a/tools/gyp/test/same-target-name/gyptest-same-target-name.py b/tools/gyp/test/same-target-name/gyptest-same-target-name.py deleted file mode 100755 index bfe5540f31..0000000000 --- a/tools/gyp/test/same-target-name/gyptest-same-target-name.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2010 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. - -""" -Check that duplicate targets in a directory gives an error. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -# Require that gyp files with duplicate targets spit out an error. -test.run_gyp('all.gyp', chdir='src', status=1, stderr=None) - -test.pass_test() diff --git a/tools/gyp/test/same-target-name/src/all.gyp b/tools/gyp/test/same-target-name/src/all.gyp deleted file mode 100644 index ac16976da6..0000000000 --- a/tools/gyp/test/same-target-name/src/all.gyp +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (c) 2010 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. - -{ - 'targets': [ - { - 'target_name': 'all_exes', - 'type': 'none', - 'dependencies': [ - 'executable1.gyp:*', - 'executable2.gyp:*', - ], - }, - ], -} diff --git a/tools/gyp/test/same-target-name/src/executable1.gyp b/tools/gyp/test/same-target-name/src/executable1.gyp deleted file mode 100644 index 3c492c1b37..0000000000 --- a/tools/gyp/test/same-target-name/src/executable1.gyp +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2010 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. - -{ - 'targets': [ - { - 'target_name': 'program', - 'type': 'executable', - 'sources': [ - 'main1.cc', - ], - }, - ], -} diff --git a/tools/gyp/test/same-target-name/src/executable2.gyp b/tools/gyp/test/same-target-name/src/executable2.gyp deleted file mode 100644 index 41e84a61c6..0000000000 --- a/tools/gyp/test/same-target-name/src/executable2.gyp +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2010 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. - -{ - 'targets': [ - { - 'target_name': 'program', - 'type': 'executable', - 'sources': [ - 'main2.cc', - ], - }, - ], -} diff --git a/tools/gyp/test/scons_tools/gyptest-tools.py b/tools/gyp/test/scons_tools/gyptest-tools.py deleted file mode 100755 index e97f5e6318..0000000000 --- a/tools/gyp/test/scons_tools/gyptest-tools.py +++ /dev/null @@ -1,26 +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. - -""" -Verifies that a scons build picks up tools modules specified -via 'scons_tools' in the 'scons_settings' dictionary. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('tools.gyp') - -test.build('tools.gyp', test.ALL) - -if test.format == 'scons': - expect = "Hello, world!\n" -else: - expect = "" -test.run_built_executable('tools', stdout=expect) - -test.pass_test() diff --git a/tools/gyp/test/scons_tools/site_scons/site_tools/this_tool.py b/tools/gyp/test/scons_tools/site_scons/site_tools/this_tool.py deleted file mode 100644 index 10c89476d7..0000000000 --- a/tools/gyp/test/scons_tools/site_scons/site_tools/this_tool.py +++ /dev/null @@ -1,10 +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. - -# SCons "tool" module that simply sets a -D value. -def generate(env): - env['CPPDEFINES'] = ['THIS_TOOL'] - -def exists(env): - pass diff --git a/tools/gyp/test/scons_tools/tools.c b/tools/gyp/test/scons_tools/tools.c deleted file mode 100644 index 78dc0e31ef..0000000000 --- a/tools/gyp/test/scons_tools/tools.c +++ /dev/null @@ -1,13 +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. */ - -#include - -int main(int argc, char *argv[]) -{ -#ifdef THIS_TOOL - printf("Hello, world!\n"); -#endif - return 0; -} diff --git a/tools/gyp/test/scons_tools/tools.gyp b/tools/gyp/test/scons_tools/tools.gyp deleted file mode 100644 index 736ba3f224..0000000000 --- a/tools/gyp/test/scons_tools/tools.gyp +++ /dev/null @@ -1,18 +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. - -{ - 'targets': [ - { - 'target_name': 'tools', - 'type': 'executable', - 'sources': [ - 'tools.c', - ], - }, - ], - 'scons_settings': { - 'tools': ['default', 'this_tool'], - }, -} diff --git a/tools/gyp/test/sibling/gyptest-all.py b/tools/gyp/test/sibling/gyptest-all.py deleted file mode 100755 index 7e80cf8236..0000000000 --- a/tools/gyp/test/sibling/gyptest-all.py +++ /dev/null @@ -1,39 +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 TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('build/all.gyp', chdir='src') - -test.build('build/all.gyp', test.ALL, chdir='src') - -chdir = 'src/build' - -# The top-level Makefile is in the directory where gyp was run. -# TODO(mmoss) Should the Makefile go in the directory of the passed in .gyp -# file? What about when passing in multiple .gyp files? Would sub-project -# Makefiles (see http://codereview.chromium.org/340008 comments) solve this? -if test.format in ('make', 'ninja'): - chdir = 'src' - -if test.format == 'xcode': - chdir = 'src/prog1' -test.run_built_executable('prog1', - chdir=chdir, - stdout="Hello from prog1.c\n") - -if test.format == 'xcode': - chdir = 'src/prog2' -test.run_built_executable('prog2', - chdir=chdir, - stdout="Hello from prog2.c\n") - -test.pass_test() diff --git a/tools/gyp/test/sibling/gyptest-relocate.py b/tools/gyp/test/sibling/gyptest-relocate.py deleted file mode 100755 index 7c86548186..0000000000 --- a/tools/gyp/test/sibling/gyptest-relocate.py +++ /dev/null @@ -1,41 +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 TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('build/all.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - -test.build('build/all.gyp', test.ALL, chdir='relocate/src') - -chdir = 'relocate/src/build' - -# The top-level Makefile is in the directory where gyp was run. -# TODO(mmoss) Should the Makefile go in the directory of the passed in .gyp -# file? What about when passing in multiple .gyp files? Would sub-project -# Makefiles (see http://codereview.chromium.org/340008 comments) solve this? -if test.format in ('make', 'ninja'): - chdir = 'relocate/src' - -if test.format == 'xcode': - chdir = 'relocate/src/prog1' -test.run_built_executable('prog1', - chdir=chdir, - stdout="Hello from prog1.c\n") - -if test.format == 'xcode': - chdir = 'relocate/src/prog2' -test.run_built_executable('prog2', - chdir=chdir, - stdout="Hello from prog2.c\n") - -test.pass_test() diff --git a/tools/gyp/test/sibling/src/build/all.gyp b/tools/gyp/test/sibling/src/build/all.gyp deleted file mode 100644 index 6eafdf99b1..0000000000 --- a/tools/gyp/test/sibling/src/build/all.gyp +++ /dev/null @@ -1,17 +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. - -{ - 'targets': [ - { - # TODO(sgk): a target name of 'all' leads to a scons dependency cycle - 'target_name': 'All', - 'type': 'none', - 'dependencies': [ - '../prog1/prog1.gyp:*', - '../prog2/prog2.gyp:*', - ], - }, - ], -} diff --git a/tools/gyp/test/sibling/src/prog1/prog1.c b/tools/gyp/test/sibling/src/prog1/prog1.c deleted file mode 100644 index 161ae8a38e..0000000000 --- a/tools/gyp/test/sibling/src/prog1/prog1.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - printf("Hello from prog1.c\n"); - return 0; -} diff --git a/tools/gyp/test/sibling/src/prog1/prog1.gyp b/tools/gyp/test/sibling/src/prog1/prog1.gyp deleted file mode 100644 index fbe38b97ad..0000000000 --- a/tools/gyp/test/sibling/src/prog1/prog1.gyp +++ /dev/null @@ -1,15 +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. - -{ - 'targets': [ - { - 'target_name': 'prog1', - 'type': 'executable', - 'sources': [ - 'prog1.c', - ], - }, - ], -} diff --git a/tools/gyp/test/sibling/src/prog2/prog2.c b/tools/gyp/test/sibling/src/prog2/prog2.c deleted file mode 100644 index 7635ae8c1c..0000000000 --- a/tools/gyp/test/sibling/src/prog2/prog2.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - printf("Hello from prog2.c\n"); - return 0; -} diff --git a/tools/gyp/test/sibling/src/prog2/prog2.gyp b/tools/gyp/test/sibling/src/prog2/prog2.gyp deleted file mode 100644 index 5934548369..0000000000 --- a/tools/gyp/test/sibling/src/prog2/prog2.gyp +++ /dev/null @@ -1,15 +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. - -{ - 'targets': [ - { - 'target_name': 'prog2', - 'type': 'executable', - 'sources': [ - 'prog2.c', - ], - }, - ], -} diff --git a/tools/gyp/test/small/gyptest-small.py b/tools/gyp/test/small/gyptest-small.py deleted file mode 100755 index 8d22ccafc9..0000000000 --- a/tools/gyp/test/small/gyptest-small.py +++ /dev/null @@ -1,52 +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. - -""" -Runs small tests. -""" - -import imp -import os -import sys -import unittest - -import TestGyp - - -test = TestGyp.TestGyp() - -# Add pylib to the import path (so tests can import their dependencies). -# This is consistant with the path.append done in the top file "gyp". -sys.path.append(os.path.join(test._cwd, 'pylib')) - -# Add new test suites here. -files_to_test = [ - 'pylib/gyp/MSVSSettings_test.py', - 'pylib/gyp/easy_xml_test.py', - 'pylib/gyp/generator/msvs_test.py', - 'pylib/gyp/generator/ninja_test.py', -] - -# Collect all the suites from the above files. -suites = [] -for filename in files_to_test: - # Carve the module name out of the path. - name = os.path.splitext(os.path.split(filename)[1])[0] - # Find the complete module path. - full_filename = os.path.join(test._cwd, filename) - # Load the module. - module = imp.load_source(name, full_filename) - # Add it to the list of test suites. - suites.append(unittest.defaultTestLoader.loadTestsFromModule(module)) -# Create combined suite. -all_tests = unittest.TestSuite(suites) - -# Run all the tests. -result = unittest.TextTestRunner(verbosity=2).run(all_tests) -if result.failures or result.errors: - test.fail_test() - -test.pass_test() diff --git a/tools/gyp/test/subdirectory/gyptest-SYMROOT-all.py b/tools/gyp/test/subdirectory/gyptest-SYMROOT-all.py deleted file mode 100755 index b7509041ae..0000000000 --- a/tools/gyp/test/subdirectory/gyptest-SYMROOT-all.py +++ /dev/null @@ -1,36 +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. - -""" -Verifies building a target and a subsidiary dependent target from a -.gyp file in a subdirectory, without specifying an explicit output build -directory, and using the generated solution or project file at the top -of the tree as the entry point. - -The configuration sets the Xcode SYMROOT variable and uses --depth= -to make Xcode behave like the other build tools--that is, put all -built targets in a single output build directory at the top of the tree. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('prog1.gyp', '-Dset_symroot=1', '--depth=.', chdir='src') - -test.relocate('src', 'relocate/src') - -# Suppress the test infrastructure's setting SYMROOT on the command line. -test.build('prog1.gyp', test.ALL, SYMROOT=None, chdir='relocate/src') - -test.run_built_executable('prog1', - stdout="Hello from prog1.c\n", - chdir='relocate/src') -test.run_built_executable('prog2', - stdout="Hello from prog2.c\n", - chdir='relocate/src') - -test.pass_test() diff --git a/tools/gyp/test/subdirectory/gyptest-SYMROOT-default.py b/tools/gyp/test/subdirectory/gyptest-SYMROOT-default.py deleted file mode 100755 index c64ae7da39..0000000000 --- a/tools/gyp/test/subdirectory/gyptest-SYMROOT-default.py +++ /dev/null @@ -1,37 +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. - -""" -Verifies building a target and a subsidiary dependent target from a -.gyp file in a subdirectory, without specifying an explicit output build -directory, and using the generated solution or project file at the top -of the tree as the entry point. - -The configuration sets the Xcode SYMROOT variable and uses --depth= -to make Xcode behave like the other build tools--that is, put all -built targets in a single output build directory at the top of the tree. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('prog1.gyp', '-Dset_symroot=1', '--depth=.', chdir='src') - -test.relocate('src', 'relocate/src') - -# Suppress the test infrastructure's setting SYMROOT on the command line. -test.build('prog1.gyp', SYMROOT=None, chdir='relocate/src') - -test.run_built_executable('prog1', - stdout="Hello from prog1.c\n", - chdir='relocate/src') - -test.run_built_executable('prog2', - stdout="Hello from prog2.c\n", - chdir='relocate/src') - -test.pass_test() diff --git a/tools/gyp/test/subdirectory/gyptest-subdir-all.py b/tools/gyp/test/subdirectory/gyptest-subdir-all.py deleted file mode 100755 index 93344a075c..0000000000 --- a/tools/gyp/test/subdirectory/gyptest-subdir-all.py +++ /dev/null @@ -1,34 +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. - -""" -Verifies building a subsidiary dependent target from a .gyp file in a -subdirectory, without specifying an explicit output build directory, -and using the subdirectory's solution or project file as the entry point. -""" - -import TestGyp -import errno - -# Ninja doesn't support running from subdirectories. -test = TestGyp.TestGyp(formats=['!ninja']) - -test.run_gyp('prog1.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - -chdir = 'relocate/src/subdir' -target = test.ALL - -test.build('prog2.gyp', target, chdir=chdir) - -test.built_file_must_not_exist('prog1', type=test.EXECUTABLE, chdir=chdir) - -test.run_built_executable('prog2', - chdir=chdir, - stdout="Hello from prog2.c\n") - -test.pass_test() diff --git a/tools/gyp/test/subdirectory/gyptest-subdir-default.py b/tools/gyp/test/subdirectory/gyptest-subdir-default.py deleted file mode 100755 index 92edcd217a..0000000000 --- a/tools/gyp/test/subdirectory/gyptest-subdir-default.py +++ /dev/null @@ -1,33 +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. - -""" -Verifies building a subsidiary dependent target from a .gyp file in a -subdirectory, without specifying an explicit output build directory, -and using the subdirectory's solution or project file as the entry point. -""" - -import TestGyp -import errno - -# Ninja doesn't support running from subdirectories. -test = TestGyp.TestGyp(formats=['!ninja']) - -test.run_gyp('prog1.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - -chdir = 'relocate/src/subdir' - -test.build('prog2.gyp', chdir=chdir) - -test.built_file_must_not_exist('prog1', type=test.EXECUTABLE, chdir=chdir) - -test.run_built_executable('prog2', - chdir=chdir, - stdout="Hello from prog2.c\n") - -test.pass_test() diff --git a/tools/gyp/test/subdirectory/gyptest-subdir2-deep.py b/tools/gyp/test/subdirectory/gyptest-subdir2-deep.py deleted file mode 100755 index 48548982f8..0000000000 --- a/tools/gyp/test/subdirectory/gyptest-subdir2-deep.py +++ /dev/null @@ -1,25 +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. - -""" -Verifies building a project rooted several layers under src_dir works. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('prog3.gyp', chdir='src/subdir/subdir2') - -test.relocate('src', 'relocate/src') - -test.build('prog3.gyp', test.ALL, chdir='relocate/src/subdir/subdir2') - -test.run_built_executable('prog3', - chdir='relocate/src/subdir/subdir2', - stdout="Hello from prog3.c\n") - -test.pass_test() diff --git a/tools/gyp/test/subdirectory/gyptest-top-all.py b/tools/gyp/test/subdirectory/gyptest-top-all.py deleted file mode 100755 index a29a41b4d1..0000000000 --- a/tools/gyp/test/subdirectory/gyptest-top-all.py +++ /dev/null @@ -1,43 +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. - -""" -Verifies building a target and a subsidiary dependent target from a -.gyp file in a subdirectory, without specifying an explicit output build -directory, and using the generated solution or project file at the top -of the tree as the entry point. - -There is a difference here in the default behavior of the underlying -build tools. Specifically, when building the entire "solution", Xcode -puts the output of each project relative to the .xcodeproj directory, -while Visual Studio (and our implementations of SCons and Make) put it -in a build directory relative to the "solution"--that is, the entry-point -from which you built the entire tree. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('prog1.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - -test.build('prog1.gyp', test.ALL, chdir='relocate/src') - -test.run_built_executable('prog1', - stdout="Hello from prog1.c\n", - chdir='relocate/src') - -if test.format == 'xcode': - chdir = 'relocate/src/subdir' -else: - chdir = 'relocate/src' -test.run_built_executable('prog2', - chdir=chdir, - stdout="Hello from prog2.c\n") - -test.pass_test() diff --git a/tools/gyp/test/subdirectory/gyptest-top-default.py b/tools/gyp/test/subdirectory/gyptest-top-default.py deleted file mode 100755 index ac5f60dbcc..0000000000 --- a/tools/gyp/test/subdirectory/gyptest-top-default.py +++ /dev/null @@ -1,43 +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. - -""" -Verifies building a target and a subsidiary dependent target from a -.gyp file in a subdirectory, without specifying an explicit output build -directory, and using the generated solution or project file at the top -of the tree as the entry point. - -There is a difference here in the default behavior of the underlying -build tools. Specifically, when building the entire "solution", Xcode -puts the output of each project relative to the .xcodeproj directory, -while Visual Studio (and our implementations of SCons and Make) put it -in a build directory relative to the "solution"--that is, the entry-point -from which you built the entire tree. -""" - -import TestGyp - -test = TestGyp.TestGyp() - -test.run_gyp('prog1.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - -test.build('prog1.gyp', chdir='relocate/src') - -test.run_built_executable('prog1', - stdout="Hello from prog1.c\n", - chdir='relocate/src') - -if test.format == 'xcode': - chdir = 'relocate/src/subdir' -else: - chdir = 'relocate/src' -test.run_built_executable('prog2', - chdir=chdir, - stdout="Hello from prog2.c\n") - -test.pass_test() diff --git a/tools/gyp/test/subdirectory/src/prog1.c b/tools/gyp/test/subdirectory/src/prog1.c deleted file mode 100644 index 161ae8a38e..0000000000 --- a/tools/gyp/test/subdirectory/src/prog1.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - printf("Hello from prog1.c\n"); - return 0; -} diff --git a/tools/gyp/test/subdirectory/src/prog1.gyp b/tools/gyp/test/subdirectory/src/prog1.gyp deleted file mode 100644 index 2aa66ce7d7..0000000000 --- a/tools/gyp/test/subdirectory/src/prog1.gyp +++ /dev/null @@ -1,21 +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. - -{ - 'includes': [ - 'symroot.gypi', - ], - 'targets': [ - { - 'target_name': 'prog1', - 'type': 'executable', - 'dependencies': [ - 'subdir/prog2.gyp:prog2', - ], - 'sources': [ - 'prog1.c', - ], - }, - ], -} diff --git a/tools/gyp/test/subdirectory/src/subdir/prog2.c b/tools/gyp/test/subdirectory/src/subdir/prog2.c deleted file mode 100644 index 7635ae8c1c..0000000000 --- a/tools/gyp/test/subdirectory/src/subdir/prog2.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - printf("Hello from prog2.c\n"); - return 0; -} diff --git a/tools/gyp/test/subdirectory/src/subdir/prog2.gyp b/tools/gyp/test/subdirectory/src/subdir/prog2.gyp deleted file mode 100644 index c6cd35f7f8..0000000000 --- a/tools/gyp/test/subdirectory/src/subdir/prog2.gyp +++ /dev/null @@ -1,18 +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. - -{ - 'includes': [ - '../symroot.gypi', - ], - 'targets': [ - { - 'target_name': 'prog2', - 'type': 'executable', - 'sources': [ - 'prog2.c', - ], - }, - ], -} diff --git a/tools/gyp/test/subdirectory/src/subdir/subdir2/prog3.c b/tools/gyp/test/subdirectory/src/subdir/subdir2/prog3.c deleted file mode 100644 index 7cfb0fa948..0000000000 --- a/tools/gyp/test/subdirectory/src/subdir/subdir2/prog3.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - printf("Hello from prog3.c\n"); - return 0; -} diff --git a/tools/gyp/test/subdirectory/src/subdir/subdir2/prog3.gyp b/tools/gyp/test/subdirectory/src/subdir/subdir2/prog3.gyp deleted file mode 100644 index b49fb59113..0000000000 --- a/tools/gyp/test/subdirectory/src/subdir/subdir2/prog3.gyp +++ /dev/null @@ -1,18 +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. - -{ - 'includes': [ - '../../symroot.gypi', - ], - 'targets': [ - { - 'target_name': 'prog3', - 'type': 'executable', - 'sources': [ - 'prog3.c', - ], - }, - ], -} diff --git a/tools/gyp/test/subdirectory/src/symroot.gypi b/tools/gyp/test/subdirectory/src/symroot.gypi deleted file mode 100644 index 519916427c..0000000000 --- a/tools/gyp/test/subdirectory/src/symroot.gypi +++ /dev/null @@ -1,16 +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. - -{ - 'variables': { - 'set_symroot%': 0, - }, - 'conditions': [ - ['set_symroot == 1', { - 'xcode_settings': { - 'SYMROOT': '<(DEPTH)/build', - }, - }], - ], -} diff --git a/tools/gyp/test/toolsets/gyptest-toolsets.py b/tools/gyp/test/toolsets/gyptest-toolsets.py deleted file mode 100755 index 19737f83d0..0000000000 --- a/tools/gyp/test/toolsets/gyptest-toolsets.py +++ /dev/null @@ -1,23 +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. - -""" -Verifies that toolsets are correctly applied -""" - -import TestGyp - -# Multiple toolsets are currently only supported by the make generator. -test = TestGyp.TestGyp(formats=['make']) - -test.run_gyp('toolsets.gyp') - -test.build('toolsets.gyp', test.ALL) - -test.run_built_executable('host-main', stdout="Host\n") -test.run_built_executable('target-main', stdout="Target\n") - -test.pass_test() diff --git a/tools/gyp/test/toolsets/main.cc b/tools/gyp/test/toolsets/main.cc deleted file mode 100644 index 0f353ae54f..0000000000 --- a/tools/gyp/test/toolsets/main.cc +++ /dev/null @@ -1,11 +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. */ - -#include - -const char *GetToolset(); - -int main(int argc, char *argv[]) { - printf("%s\n", GetToolset()); -} diff --git a/tools/gyp/test/toolsets/toolsets.cc b/tools/gyp/test/toolsets/toolsets.cc deleted file mode 100644 index a45fa029cb..0000000000 --- a/tools/gyp/test/toolsets/toolsets.cc +++ /dev/null @@ -1,11 +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. */ - -const char *GetToolset() { -#ifdef TARGET - return "Target"; -#else - return "Host"; -#endif -} diff --git a/tools/gyp/test/toolsets/toolsets.gyp b/tools/gyp/test/toolsets/toolsets.gyp deleted file mode 100644 index e41b928de6..0000000000 --- a/tools/gyp/test/toolsets/toolsets.gyp +++ /dev/null @@ -1,38 +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. - -{ - 'target_defaults': { - 'target_conditions': [ - ['_toolset=="target"', {'defines': ['TARGET']}] - ] - }, - 'targets': [ - { - 'target_name': 'toolsets', - 'type': 'static_library', - 'toolsets': ['target', 'host'], - 'sources': [ - 'toolsets.cc', - ], - }, - { - 'target_name': 'host-main', - 'type': 'executable', - 'toolsets': ['host'], - 'dependencies': ['toolsets'], - 'sources': [ - 'main.cc', - ], - }, - { - 'target_name': 'target-main', - 'type': 'executable', - 'dependencies': ['toolsets'], - 'sources': [ - 'main.cc', - ], - }, - ], -} diff --git a/tools/gyp/test/toplevel-dir/gyptest-toplevel-dir.py b/tools/gyp/test/toplevel-dir/gyptest-toplevel-dir.py deleted file mode 100755 index 4daa6b2c11..0000000000 --- a/tools/gyp/test/toplevel-dir/gyptest-toplevel-dir.py +++ /dev/null @@ -1,31 +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. - -""" -Verifies building a subsidiary dependent target from a .gyp file in a -subdirectory, without specifying an explicit output build directory, -and using the subdirectory's solution or project file as the entry point. -""" - -import TestGyp -import errno - -test = TestGyp.TestGyp(formats=['ninja', 'make']) - -# We want our Makefile to be one dir up from main.gyp. -test.run_gyp('main.gyp', '--toplevel-dir=..', chdir='src/sub1') - -toplevel_dir = 'src' - -test.build('all', chdir=toplevel_dir) - -test.built_file_must_exist('prog1', type=test.EXECUTABLE, chdir=toplevel_dir) - -test.run_built_executable('prog1', - chdir=toplevel_dir, - stdout="Hello from prog1.c\n") - -test.pass_test() diff --git a/tools/gyp/test/toplevel-dir/src/sub1/main.gyp b/tools/gyp/test/toplevel-dir/src/sub1/main.gyp deleted file mode 100644 index 33219010e4..0000000000 --- a/tools/gyp/test/toplevel-dir/src/sub1/main.gyp +++ /dev/null @@ -1,18 +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. - -{ - 'targets': [ - { - 'target_name': 'prog1', - 'type': 'executable', - 'dependencies': [ - '<(DEPTH)/../sub2/prog2.gyp:prog2', - ], - 'sources': [ - 'prog1.c', - ], - }, - ], -} diff --git a/tools/gyp/test/toplevel-dir/src/sub1/prog1.c b/tools/gyp/test/toplevel-dir/src/sub1/prog1.c deleted file mode 100644 index 161ae8a38e..0000000000 --- a/tools/gyp/test/toplevel-dir/src/sub1/prog1.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - printf("Hello from prog1.c\n"); - return 0; -} diff --git a/tools/gyp/test/toplevel-dir/src/sub2/prog2.c b/tools/gyp/test/toplevel-dir/src/sub2/prog2.c deleted file mode 100644 index 7635ae8c1c..0000000000 --- a/tools/gyp/test/toplevel-dir/src/sub2/prog2.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - printf("Hello from prog2.c\n"); - return 0; -} diff --git a/tools/gyp/test/toplevel-dir/src/sub2/prog2.gyp b/tools/gyp/test/toplevel-dir/src/sub2/prog2.gyp deleted file mode 100644 index 5934548369..0000000000 --- a/tools/gyp/test/toplevel-dir/src/sub2/prog2.gyp +++ /dev/null @@ -1,15 +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. - -{ - 'targets': [ - { - 'target_name': 'prog2', - 'type': 'executable', - 'sources': [ - 'prog2.c', - ], - }, - ], -} diff --git a/tools/gyp/test/variables/commands/commands-repeated.gyp b/tools/gyp/test/variables/commands/commands-repeated.gyp deleted file mode 100644 index 822ae4f05d..0000000000 --- a/tools/gyp/test/variables/commands/commands-repeated.gyp +++ /dev/null @@ -1,128 +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. - -# This is a simple test file to make sure that variable substitution -# happens correctly. Run "run_tests.py" using python to generate the -# output from this gyp file. - -{ - 'variables': { - 'pi': 'import math; print math.pi', - 'third_letters': "<(other_letters)HIJK", - 'letters_list': 'ABCD', - 'other_letters': '<(letters_list)EFG', - 'check_included': '<(included_variable)', - 'check_lists': [ - '<(included_variable)', - '<(third_letters)', - ], - 'check_int': 5, - 'check_str_int': '6', - 'check_list_int': [ - 7, - '8', - 9, - ], - 'not_int_1': ' 10', - 'not_int_2': '11 ', - 'not_int_3': '012', - 'not_int_4': '13.0', - 'not_int_5': '+14', - 'negative_int': '-15', - 'zero_int': '0', - }, - 'includes': [ - 'commands.gypi', - ], - 'targets': [ - { - 'target_name': 'foo', - 'type': 'none', - 'variables': { - 'var1': ' commands.gyp.stdout -python ../../../gyp --ignore-environment --debug variables --debug general --format gypd --depth . commands.gyp > commands.gyp.ignore-env.stdout -cp -f commands.gypd commands.gypd.golden -python ../../../gyp --debug variables --debug general --format gypd --depth . commands-repeated.gyp > commands-repeated.gyp.stdout -cp -f commands-repeated.gypd commands-repeated.gypd.golden diff --git a/tools/gyp/test/variables/filelist/filelist.gyp.stdout b/tools/gyp/test/variables/filelist/filelist.gyp.stdout deleted file mode 100644 index ee2b0177c0..0000000000 --- a/tools/gyp/test/variables/filelist/filelist.gyp.stdout +++ /dev/null @@ -1,174 +0,0 @@ -GENERAL:__init__.py:357:main running with these options: -GENERAL:__init__.py:364:main check: None -GENERAL:__init__.py:364:main circular_check: True -GENERAL:__init__.py:364:main debug: ['variables', 'general'] -GENERAL:__init__.py:364:main defines: None -GENERAL:__init__.py:362:main depth: '.' -GENERAL:__init__.py:364:main formats: ['gypd'] -GENERAL:__init__.py:364:main generator_flags: [] -GENERAL:__init__.py:364:main generator_output: None -GENERAL:__init__.py:364:main includes: None -GENERAL:__init__.py:364:main msvs_version: None -GENERAL:__init__.py:362:main suffix: '' -GENERAL:__init__.py:364:main toplevel_dir: None -GENERAL:__init__.py:364:main use_environment: True -GENERAL:__init__.py:418:main cmdline_default_variables: {} -GENERAL:__init__.py:444:main generator_flags: {} -VARIABLES:input.py:783:ExpandVariables Expanding 'exclude' to 'exclude' -VARIABLES:input.py:783:ExpandVariables Expanding 'Sch.*' to 'Sch.*' -VARIABLES:input.py:783:ExpandVariables Expanding 'include' to 'include' -VARIABLES:input.py:783:ExpandVariables Expanding '.*dt' to '.*dt' -VARIABLES:input.py:783:ExpandVariables Expanding 'exclude' to 'exclude' -VARIABLES:input.py:783:ExpandVariables Expanding 'Jer.*' to 'Jer.*' -VARIABLES:input.py:783:ExpandVariables Expanding 'John' to 'John' -VARIABLES:input.py:783:ExpandVariables Expanding 'Jacob' to 'Jacob' -VARIABLES:input.py:783:ExpandVariables Expanding 'Astor' to 'Astor' -VARIABLES:input.py:783:ExpandVariables Expanding 'Jingleheimer' to 'Jingleheimer' -VARIABLES:input.py:783:ExpandVariables Expanding 'Jerome' to 'Jerome' -VARIABLES:input.py:783:ExpandVariables Expanding 'Schmidt' to 'Schmidt' -VARIABLES:input.py:783:ExpandVariables Expanding 'Schultz' to 'Schultz' -VARIABLES:input.py:783:ExpandVariables Expanding 'Astor' to 'Astor' -VARIABLES:input.py:783:ExpandVariables Expanding '.' to '.' -VARIABLES:input.py:544:ExpandVariables Matches: {'content': 'names.txt <@(names', 'is_array': '', 'replace': '<|(names.txt <@(names)', 'type': '<|', 'command_string': None} -VARIABLES:input.py:544:ExpandVariables Matches: {'content': 'names', 'is_array': '', 'replace': '<@(names)', 'type': '<@', 'command_string': None} -VARIABLES:input.py:783:ExpandVariables Expanding 'names' to 'names' -VARIABLES:input.py:783:ExpandVariables Expanding 'John' to 'John' -VARIABLES:input.py:783:ExpandVariables Expanding 'Jacob' to 'Jacob' -VARIABLES:input.py:783:ExpandVariables Expanding 'Jingleheimer' to 'Jingleheimer' -VARIABLES:input.py:783:ExpandVariables Expanding 'Schmidt' to 'Schmidt' -VARIABLES:input.py:765:ExpandVariables Found output 'names.txt John Jacob Jingleheimer Schmidt', recursing. -VARIABLES:input.py:783:ExpandVariables Expanding 'names.txt John Jacob Jingleheimer Schmidt' to 'names.txt John Jacob Jingleheimer Schmidt' -VARIABLES:input.py:783:ExpandVariables Expanding 'names.txt <@(names)' to 'names.txt John Jacob Jingleheimer Schmidt' -VARIABLES:input.py:765:ExpandVariables Found output 'names.txt', recursing. -VARIABLES:input.py:783:ExpandVariables Expanding 'names.txt' to 'names.txt' -VARIABLES:input.py:783:ExpandVariables Expanding '<|(names.txt <@(names))' to 'names.txt' -VARIABLES:input.py:783:ExpandVariables Expanding 'foo' to 'foo' -VARIABLES:input.py:783:ExpandVariables Expanding 'target' to 'target' -VARIABLES:input.py:783:ExpandVariables Expanding 'none' to 'none' -VARIABLES:input.py:783:ExpandVariables Expanding 'test_action' to 'test_action' -VARIABLES:input.py:783:ExpandVariables Expanding 'python' to 'python' -VARIABLES:input.py:783:ExpandVariables Expanding 'dummy.py' to 'dummy.py' -VARIABLES:input.py:544:ExpandVariables Matches: {'content': 'names_listfile', 'is_array': '', 'replace': '<(names_listfile)', 'type': '<', 'command_string': None} -VARIABLES:input.py:783:ExpandVariables Expanding 'names_listfile' to 'names_listfile' -VARIABLES:input.py:765:ExpandVariables Found output 'names.txt', recursing. -VARIABLES:input.py:783:ExpandVariables Expanding 'names.txt' to 'names.txt' -VARIABLES:input.py:783:ExpandVariables Expanding '<(names_listfile)' to 'names.txt' -VARIABLES:input.py:544:ExpandVariables Matches: {'content': 'names_listfile', 'is_array': '', 'replace': '<(names_listfile)', 'type': '<', 'command_string': None} -VARIABLES:input.py:783:ExpandVariables Expanding 'names_listfile' to 'names_listfile' -VARIABLES:input.py:765:ExpandVariables Found output 'names.txt', recursing. -VARIABLES:input.py:783:ExpandVariables Expanding 'names.txt' to 'names.txt' -VARIABLES:input.py:783:ExpandVariables Expanding '<(names_listfile)' to 'names.txt' -VARIABLES:input.py:544:ExpandVariables Matches: {'content': 'cat <(names_listfile', 'is_array': '', 'replace': ' filelist.gyp.stdout -cp -f src/filelist.gypd filelist.gypd.golden diff --git a/tools/gyp/test/variants/gyptest-variants.py b/tools/gyp/test/variants/gyptest-variants.py deleted file mode 100755 index ce2455f663..0000000000 --- a/tools/gyp/test/variants/gyptest-variants.py +++ /dev/null @@ -1,45 +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. - -""" -Verify handling of build variants. - -TODO: Right now, only the SCons generator supports this, so the -test case is SCons-specific. In particular, it relise on SCons' -ability to rebuild in response to changes on the command line. It -may be simpler to just drop this feature if the other generators -can't be made to behave the same way. -""" - -import TestGyp - -test = TestGyp.TestGyp(formats=['scons']) - -test.run_gyp('variants.gyp', chdir='src') - -test.relocate('src', 'relocate/src') - -test.build('variants.gyp', chdir='relocate/src') - -test.run_built_executable('variants', - chdir='relocate/src', - stdout="Hello, world!\n") - -test.sleep() -test.build('variants.gyp', 'VARIANT1=1', chdir='relocate/src') - -test.run_built_executable('variants', - chdir='relocate/src', - stdout="Hello from VARIANT1\n") - -test.sleep() -test.build('variants.gyp', 'VARIANT2=1', chdir='relocate/src') - -test.run_built_executable('variants', - chdir='relocate/src', - stdout="Hello from VARIANT2\n") - -test.pass_test() diff --git a/tools/gyp/test/variants/src/variants.c b/tools/gyp/test/variants/src/variants.c deleted file mode 100644 index 3018e40df2..0000000000 --- a/tools/gyp/test/variants/src/variants.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ -#if defined(VARIANT1) - printf("Hello from VARIANT1\n"); -#elif defined(VARIANT2) - printf("Hello from VARIANT2\n"); -#else - printf("Hello, world!\n"); -#endif - return 0; -} diff --git a/tools/gyp/test/variants/src/variants.gyp b/tools/gyp/test/variants/src/variants.gyp deleted file mode 100644 index 0305ca7473..0000000000 --- a/tools/gyp/test/variants/src/variants.gyp +++ /dev/null @@ -1,27 +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. - -{ - 'targets': [ - { - 'target_name': 'variants', - 'type': 'executable', - 'sources': [ - 'variants.c', - ], - 'variants': { - 'variant1' : { - 'defines': [ - 'VARIANT1', - ], - }, - 'variant2' : { - 'defines': [ - 'VARIANT2', - ], - }, - }, - }, - ], -} diff --git a/tools/gyp/tools/pretty_gyp.py b/tools/gyp/tools/pretty_gyp.py index 3749792aac..c51d35872c 100755 --- a/tools/gyp/tools/pretty_gyp.py +++ b/tools/gyp/tools/pretty_gyp.py @@ -1,5 +1,6 @@ #!/usr/bin/env python -# Copyright (c) 2011 The Chromium Authors. All rights reserved. + +# 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. @@ -16,7 +17,7 @@ COMMENT_RE = re.compile(r'\s*#.*') # It takes into account quoted quotes, and makes sure that the quotes match. # NOTE: It does not handle quotes that span more than one line, or # cases where an escaped quote is preceeded by an escaped backslash. -quote_re_str = r'(?P[\'"])(.*?)(?[\'"])(.*?)(?