external/gyp.git
4 days agogyp: cache conditional ASTs for 3 CPU seconds (5%) gain. master
thakis@chromium.org [Wed, 16 Apr 2014 15:37:31 +0000 (15:37 +0000)]
gyp: cache conditional ASTs for 3 CPU seconds (5%) gain.

This is in the parallel part so net gain is somewhere between
5/core_count% and 5%. In chromium on my computer I save roughly
1.5 seconds in total runtime.

BUG=chromium:362075
R=mark@chromium.org

Review URL: https://codereview.chromium.org/232773004/
Patch from Daniel Bratell <bratell@opera.com>!

git-svn-id: http://gyp.googlecode.com/svn/trunk@1900 78cadc50-ecff-11dd-a971-7dbc132099af

4 days agogyp: use a set() in DeepDependencies for less O(n^2).
thakis@chromium.org [Wed, 16 Apr 2014 15:35:52 +0000 (15:35 +0000)]
gyp: use a set() in DeepDependencies for less O(n^2).

Another O(n^2) over the number of targets which used about half a second
for a 1000 target system (chromium) on a reasonable computer.

BUG=chromium:362075
R=thakis@chromium.org

Review URL: https://codereview.chromium.org/235193002/
Patch from Daniel Bratell <bratell@opera.com>!

git-svn-id: http://gyp.googlecode.com/svn/trunk@1899 78cadc50-ecff-11dd-a971-7dbc132099af

4 days agogyp: fix O(n^2) in dependency calculations.
thakis@chromium.org [Wed, 16 Apr 2014 15:34:25 +0000 (15:34 +0000)]
gyp: fix O(n^2) in dependency calculations.

With 1000 targets an O(n^2) in the dependency management starts to be
noticed. This patch takes a 0.2s function to 0.02s. The function is not
parallelized so this is a true 1% speedup.

Also commented on another *potential* performance problem with very
specific dependency graphs.

BUG=362075
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/234813003/
Patch from Daniel Bratell <bratell@opera.com>!

git-svn-id: http://gyp.googlecode.com/svn/trunk@1898 78cadc50-ecff-11dd-a971-7dbc132099af

4 days agogyp: 1% faster by optimizing IsPathSections
thakis@chromium.org [Wed, 16 Apr 2014 15:32:59 +0000 (15:32 +0000)]
gyp: 1% faster by optimizing IsPathSections

IsPathSection is 2-3% of the execution time for chromium. Hand optimize
it a bit to make it twice as fast for a total gain of 0.5 CPU seconds.

BUG=chromium:362075
R=scottmg@chromium.org

https://codereview.chromium.org/233483002/
Patch from Daniel Bratell <bratell@opera.com>!

git-svn-id: http://gyp.googlecode.com/svn/trunk@1897 78cadc50-ecff-11dd-a971-7dbc132099af

4 days agogyp: use all processors instead of hard-coded 8.
thakis@chromium.org [Wed, 16 Apr 2014 15:30:14 +0000 (15:30 +0000)]
gyp: use all processors instead of hard-coded 8.

Makes no difference for me but might help others because gyp can easily
keep lots of processors busy.

BUG=362075
R=scottmg@chromium.org
Review URL: https://codereview.chromium.org/232783007/

Patch from Daniel Bratell <bratell@opera.com>!

git-svn-id: http://gyp.googlecode.com/svn/trunk@1896 78cadc50-ecff-11dd-a971-7dbc132099af

6 days agoMake test/cxxflags use a user define instead of __OPTIMIZE__
scottmg@chromium.org [Mon, 14 Apr 2014 16:30:08 +0000 (16:30 +0000)]
Make test/cxxflags use a user define instead of __OPTIMIZE__

__OPTIMIZE__ is a gcc-specific define, so this was broken on Windows
after https://code.google.com/p/gyp/source/detail?r=1893.

R=thakis@chromium.org

Review URL: https://codereview.chromium.org/235033003

git-svn-id: http://gyp.googlecode.com/svn/trunk@1895 78cadc50-ecff-11dd-a971-7dbc132099af

10 days agoAdd MASM settings support to msvs_settings.
scottmg@chromium.org [Thu, 10 Apr 2014 23:36:28 +0000 (23:36 +0000)]
Add MASM settings support to msvs_settings.

The 'UseSafeExceptionHandlers' setting, if set to 'true', passes the
/safeseh option to ml.exe.

Without it, linking fails with error messages like this:

[182/259] LINK_EMBED(DLL) crnss.dll
FAILED: C:\python_27_amd64\files\python.exe gyp-win-tool link-with-manifests env
ironment.x86 True crnss.dll "C:\python_27_amd64\files\python.exe gyp-win-tool li
nk-wrapper environment.x86 False link.exe /nologo /IMPLIB:crnss.dll.lib /DLL /OU
T:crnss.dll @crnss.dll.rsp" 2 mt.exe rc.exe "obj\third_party\nss\nss.crnss.dll.i
ntermediate.manifest" obj\third_party\nss\nss.crnss.dll.generated.manifest
nss_static.lib(nss_static.intel-aes-x86-masm_asm.obj) : error LNK2026: module un
safe for SAFESEH image.
nss_static.lib(nss_static.intel-gcm-x86-masm_asm.obj) : error LNK2026: module un
safe for SAFESEH image.
crnss.dll : fatal error LNK1281: Unable to generate SAFESEH image.

Add the ImageHasSafeExceptionHandlers setting support for VCLinkerTool. If set
to 'true', it is mapped to the /SAFESEH linker option.

R=scottmg@chromium.org
BUG=none

Review URL: https://codereview.chromium.org/217813007

git-svn-id: http://gyp.googlecode.com/svn/trunk@1894 78cadc50-ecff-11dd-a971-7dbc132099af

10 days agoUse context manager to manage OS environment in tests
thakis@chromium.org [Thu, 10 Apr 2014 21:47:22 +0000 (21:47 +0000)]
Use context manager to manage OS environment in tests

Currently tests use manual context management (try: ... finally: ...)
This is cleaner and more robust with a context manager:
https://docs.python.org/2/library/contextlib.html

Also fixes some bugs and typos.

Tests are:
test/cflags/gyptest-cflags.py (make + ninja)
test/cxxflags/gyptest-cxxflags.py (ninja)

R=thakis
TEST=PYTHONPATH=$CHROMIUM_DIR/tools/gyp/test/lib TESTGYP_FORMAT=make test/cflags/gyptest-cflags.py
TEST=PYTHONPATH=$CHROMIUM_DIR/tools/gyp/test/lib TESTGYP_FORMAT=ninja test/cflags/gyptest-cflags.py
TEST=PYTHONPATH=$CHROMIUM_DIR/tools/gyp/test/lib TESTGYP_FORMAT=ninja test/cxxflags/gyptest-cxxflags.py

Review URL: https://codereview.chromium.org/228323002/
Patch from Nils Barth <nbarth@chromium.org>!

git-svn-id: http://gyp.googlecode.com/svn/trunk@1893 78cadc50-ecff-11dd-a971-7dbc132099af

11 days agoRevert "Fix None target type with Ninja build."
torne@chromium.org [Wed, 9 Apr 2014 11:30:31 +0000 (11:30 +0000)]
Revert "Fix None target type with Ninja build."

This reverts r1883, which seems to be causing gyp-win32 bot failures on
test\ninja\solibs_avoid_relinking\gyptest-solibs-avoid-relinking.py and
test\win\gyptest-link-restat-importlib.py.

BUG=
TBR=etienneb@chromium.org,scottmg@chromium.org

Review URL: https://codereview.chromium.org/230633002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1892 78cadc50-ecff-11dd-a971-7dbc132099af

12 days agoAvoid duplicating non-configuration settings when merging configurations
jochen@chromium.org [Tue, 8 Apr 2014 20:36:41 +0000 (20:36 +0000)]
Avoid duplicating non-configuration settings when merging configurations

When one configuration inherits from another, we should merge the
configurations before merging the default settings into the configuration.
Otherwise, the more concrete configuration will end up with all default
settings twice

BUG=none
R=mark@chromium.org, thakis@chromium.org

Review URL: https://codereview.chromium.org/227693002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1891 78cadc50-ecff-11dd-a971-7dbc132099af

12 days agoAdds xcode-ninja flavor for Xcode wrapper projects.
justincohen@chromium.org [Tue, 8 Apr 2014 13:42:35 +0000 (13:42 +0000)]
Adds xcode-ninja flavor for Xcode wrapper projects.

Xcode has great development and debugging tools, but runs slowly with very
large projects.  Ninja does processes build files very quickly.  This -ninja
flavor bridges the gap by building each executable target with ninja, while
loading all the sources and bundle resources into an Xcode project.

Adds three new generator_flags:
 - xcode_ninja_main_gyp: Path to main wrapper workspace.  Otherwise the main
    gyp path will be used with .ninja prepended to the extension.
 - xcode_ninja_target_filter: Regex filter to remove some targets.  Removing
    rarely used seems to make Xcode much faster.
 - xcode_ninja_jobs: Number of jobs to pass to ninja, defaults to 0.

BUG=
TEST=
R=mark@chromium.org, sdefresne@chromium.org

Review URL: https://codereview.chromium.org/199323008

git-svn-id: http://gyp.googlecode.com/svn/trunk@1889 78cadc50-ecff-11dd-a971-7dbc132099af

12 days agoandroid: Add support for multiarch builds.
torne@chromium.org [Tue, 8 Apr 2014 11:07:03 +0000 (11:07 +0000)]
android: Add support for multiarch builds.

The android build system supports 32/64 bit multiarch builds; add
support for this in the android gyp backend. This requires that you run
gyp twice to generate one complete set of makefiles for each
architecture, and then include both into your toplevel Android.mk with
code like:

GYP_VAR_PREFIX :=
include GypAndroid.$(TARGET_ARCH).mk
GYP_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
include GypAndroid.$(TARGET_2ND_ARCH).mk

Changes made in this CL:

1) Set GYP_VAR_PREFIX to the empty string by default (which indicates
building for the primary architecture), to maintain compatibility with
non-multiarch builds.

2) Set LOCAL_MODULE_TARGET_ARCH to indicate that we should only build
the current module for whichever architecture is indicated by
GYP_VAR_PREFIX. This will take effect for target static and dynamic
libraries, and for executables.

3) Set LOCAL_2ND_ARCH_VAR_PREFIX when including base_rules.mk directly
for "none" type targets, since the processing logic for
LOCAL_MODULE_TARGET_ARCH isn't applied by the build system in this case.

3) Pass GYP_VAR_PREFIX when calling local-intermediates-dir or
intermediates-dir-for, and use it when referring to
TARGET_OUT_INTERMEDIATE_LIBARIES, so that we get the correct
intermediate directories.

4) Rename all host targets to include the current target architecture,
so that they will be built separately once per target. Not all host
targets actually need to be built twice, but we can't easily tell which
do. There aren't many in total, so this shouldn't be too expensive.

BUG=chromium:358141
R=thakis@chromium.org

Review URL: https://codereview.chromium.org/216773007

git-svn-id: http://gyp.googlecode.com/svn/trunk@1887 78cadc50-ecff-11dd-a971-7dbc132099af

2 weeks agoandroid: Allow disabling the generation of alias targets.
torne@chromium.org [Wed, 2 Apr 2014 17:56:04 +0000 (17:56 +0000)]
android: Allow disabling the generation of alias targets.

The android backend mangles the names of targets in its output in order
to ensure they don't clash with each other or with existing Android
build system targets, since they are required to be unique. It also
generates aliases referring to their original names as given in the gyp
input, for usability and test purposes, but this can cause namespace
issues. Add a generator option allowing the generation of these aliases
to be disabled, which will also disable generation of the
"gyp_all_modules".

BUG=gyp:341
R=thakis@chromium.org

Review URL: https://codereview.chromium.org/222243004

git-svn-id: http://gyp.googlecode.com/svn/trunk@1886 78cadc50-ecff-11dd-a971-7dbc132099af

2 weeks agoandroid: Remove rule_trigger targets.
torne@chromium.org [Wed, 2 Apr 2014 17:36:53 +0000 (17:36 +0000)]
android: Remove rule_trigger targets.

The rule_trigger target doesn't serve any useful purpose since all the
output files from the rule are added to extra_outputs, which is already
depended on by the final target. It causes problems when trying to do a
multiarch build since the same rule trigger target name is calculated
for both architectures, so remove it.

BUG=chromium:358141
R=thakis@chromium.org

Review URL: https://codereview.chromium.org/222043002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1885 78cadc50-ecff-11dd-a971-7dbc132099af

3 weeks agoImplements ARCHS filtering for all generator on OS X
sdefresne@chromium.org [Wed, 26 Mar 2014 14:36:43 +0000 (14:36 +0000)]
Implements ARCHS filtering for all generator on OS X

Implements ARCHS filtering by VALID_ARCHS and variable expansion, like
$(ARCHS_STANDARD), in XcodeSettings.GetActiveArchs so it is available
for all generators and all SDKROOT (macosx, iphoneos, iphonesimulator)
instead of being restricted to iOS projects.

BUG=None
R=mark@chromium.org

Review URL: https://codereview.chromium.org/211023003

git-svn-id: http://gyp.googlecode.com/svn/trunk@1884 78cadc50-ecff-11dd-a971-7dbc132099af

3 weeks agoFix None target type with Ninja build.
scottmg@chromium.org [Tue, 25 Mar 2014 01:00:04 +0000 (01:00 +0000)]
Fix None target type with Ninja build.

GYP doesn't produce a valid Ninja rule for 'none' target type.
These targets are used to make fake dependencies.

Here is a minimal GYP file to show the issue:

{
  'targets': [
    {
      'target_name': 'dummy',
      'type': 'none',
      'sources': [
        'test.h',
      ],
    },
  ],
}

There is a dummy.ninja file, but there is no rules named 'dummy'.
When using the 'msvs-ninja' build, MSVS complains about a missing target
and fails to compile the project.

Patch from etienneb@chromium.org.

BUG=
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/203303011

git-svn-id: http://gyp.googlecode.com/svn/trunk@1883 78cadc50-ecff-11dd-a971-7dbc132099af

3 weeks agoEnable 64-bit architectures by default for Xcode 5.1 and higher
sdefresne@chromium.org [Mon, 24 Mar 2014 13:37:20 +0000 (13:37 +0000)]
Enable 64-bit architectures by default for Xcode 5.1 and higher

According to Xcode 5.1 release notes, the "Standard Architectures" build
settings now also include 64-bit architecture, while the build settings
"Standard Architectures Including 64-Bit" is no deprecated.

BUG=gyp:412
R=mark@chromium.org

Review URL: https://codereview.chromium.org/194713003

git-svn-id: http://gyp.googlecode.com/svn/trunk@1882 78cadc50-ecff-11dd-a971-7dbc132099af

4 weeks agoFix ARCHS selection when building for iOS
sdefresne@chromium.org [Fri, 21 Mar 2014 14:52:18 +0000 (14:52 +0000)]
Fix ARCHS selection when building for iOS

When building for iOS, consider any architecture set in the gyp files
as valid (to allow building for x86_64 when using Xcode 4.0 or higher).

BUG=webrtc:3073
R=thakis@chromium.org

Review URL: https://codereview.chromium.org/203763002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1881 78cadc50-ecff-11dd-a971-7dbc132099af

4 weeks agoninja: Reduce size of individual_generated_bindings by another 45kB / 15%.
thakis@chromium.org [Thu, 20 Mar 2014 19:21:54 +0000 (19:21 +0000)]
ninja: Reduce size of individual_generated_bindings by another 45kB / 15%.

1. Only write unique_name for rules on Windows, it's unused elsewhere.
Makes individual_generated_bindings.ninja another 30kB / 10% smaller.

2. Don't include the hash in the rule name: It's not needed since the stamp
file has a qualified path. Saves another 14kB.

BUG=350317
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/206153004

git-svn-id: http://gyp.googlecode.com/svn/trunk@1880 78cadc50-ecff-11dd-a971-7dbc132099af

4 weeks agoninja: Collapse rule inputs into a single node when it makes sense.
thakis@chromium.org [Thu, 20 Mar 2014 09:57:01 +0000 (09:57 +0000)]
ninja: Collapse rule inputs into a single node when it makes sense.

Before this CL, if a rule matched N source files and had M inputs, the inputs
where repeated for every build edge, hence showing up N * M times in the
generated ninja file.

After this, gyp instead writes a single stamp node depending on all the inputs
and makes every source rule edge depend on this stamp file, reducing the number
of times they show up in the generated ninja file to N + M. (Also bake
order-only deps into this new node.)

No behavior change. Reduces the size of individual_generated_bindings.ninja
from 4.5MB to 401kB, and the size of all generated ninja files in chromium
from 15.1MB to 10.9MB. This in turn speeds up empty builds by 60ms on my
SSD laptop and by probably over 0.1s on my HDD desktop (didn't try that due
to lack of travel desktop though).

BUG=chromium:350317
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/203193003

git-svn-id: http://gyp.googlecode.com/svn/trunk@1879 78cadc50-ecff-11dd-a971-7dbc132099af

4 weeks agoSupport building selected C/C++ files in msvs-ninja
sbaig1@bloomberg.net [Wed, 19 Mar 2014 14:52:56 +0000 (14:52 +0000)]
Support building selected C/C++ files in msvs-ninja

This commits adds a new 'msvs_external_builder_clcompile_cmd' property, which
will be used when the user tries building selected C/C++ files.

For msvs-ninja, the 'msvs_external_builder_clcompile_cmd' will be mapped to a
new 'ExecClCompile' command in gyp-win-tool, which will expand the list of
selected files into a list of ninja targets and then invoke ninja.

BUG=352876
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/203383003

git-svn-id: http://gyp.googlecode.com/svn/trunk@1878 78cadc50-ecff-11dd-a971-7dbc132099af

4 weeks agoninja: Don't support RULE_INPUT_* variables in rule inputs.
thakis@chromium.org [Tue, 18 Mar 2014 16:08:58 +0000 (16:08 +0000)]
ninja: Don't support RULE_INPUT_* variables in rule inputs.

https://code.google.com/p/gyp/wiki/GypLanguageSpecification#Rules doesn't say
that it's available in inputs, and as of r257511 it's not used in inputs
in chromium.

(RULE_INPUT_PATH is always implicitly an input for a rule. Some windows test
files explicitly added it too; fix them.)

BUG=chromium:350317
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/202873002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1877 78cadc50-ecff-11dd-a971-7dbc132099af

4 weeks agomsvs_emulation: Remove unused method.
thakis@chromium.org [Mon, 17 Mar 2014 18:02:11 +0000 (18:02 +0000)]
msvs_emulation: Remove unused method.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/202203002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1876 78cadc50-ecff-11dd-a971-7dbc132099af

5 weeks agoOn some source control systems (perforce), checked out files are by default readonly...
dimator@google.com [Sun, 16 Mar 2014 21:42:05 +0000 (21:42 +0000)]
On some source control systems (perforce), checked out files are by default readonly (unlike git, subversion, etc.)

Using win-tool to do a recursive copy is failing on such systems, because for example, if I had a 'copies' clause in my gyp that put stuff from my source tree into my output directory, it would copy them fine the first time, but it would leave them with the initial file modes: read only.

This means that subsequent attempts at copying the files would result in permission errors. Python's os.unlink() (and shtuil.rmtree) are pretty passive when it comes to read-only files, they raise an exception right away.

Note that under CMD, the command "COPY from to" would prompt to force copy these files to be copied. "COPY /Y from to" would force the copy. Under cygwin, "cp -af from to" would of course work as expected.

The comment in ExecRecursiveMirror says that it should emulate "rm -rf out and cp -af in out", which, as it stands currently, is not exactly true. This change helps to make this routine closer to what it's supposed to be.

BUG=
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/192213002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1875 78cadc50-ecff-11dd-a971-7dbc132099af

5 weeks agoninja/mac: Fix multiarch link regression caused by 1871.
thakis@chromium.org [Sat, 15 Mar 2014 00:05:21 +0000 (00:05 +0000)]
ninja/mac: Fix multiarch link regression caused by 1871.

The bug was caused by i386 and x86_64 binary using the same rsp file.
Add arch to rsp filename in multi-arch builds.

(ld64 prints a warning about .o files not having the right arch when linking
the 64bit version using the rsp file written for the 32bit link and the other
way round and silently skips the .o file, but it exits with 0. To test for this,
get symbols from the final fat binary in each arch and check that they are all
there -- this fails fairly reliably without the patch, even though it depends
on process invocation order.)

BUG=chromium:352816
TBR=scottmg@chromium.org (lg'd at https://codereview.chromium.org/200943003/)

Review URL: https://codereview.chromium.org/196283023

git-svn-id: http://gyp.googlecode.com/svn/trunk@1874 78cadc50-ecff-11dd-a971-7dbc132099af

5 weeks agowin: make msvs_shard work properly for static_library references
scottmg@chromium.org [Fri, 14 Mar 2014 17:38:01 +0000 (17:38 +0000)]
win: make msvs_shard work properly for static_library references

Before this, dependencies inside a static_library weren't updated to
reference the _N targets, necessitating workarounds like
https://src.chromium.org/viewvc/chrome?revision=254345&view=revision .

The 'refs_to_shard_external_lib' target fails before this change.

R=thakis@chromium.org
BUG=chromium:352495

Review URL: https://codereview.chromium.org/199413010

git-svn-id: http://gyp.googlecode.com/svn/trunk@1873 78cadc50-ecff-11dd-a971-7dbc132099af

5 weeks agoninja: Revert accidental windows changes in r1871.
thakis@chromium.org [Thu, 13 Mar 2014 03:52:48 +0000 (03:52 +0000)]
ninja: Revert accidental windows changes in r1871.

TBR=scottmg@chromium.org

Review URL: https://codereview.chromium.org/198283004

git-svn-id: http://gyp.googlecode.com/svn/trunk@1872 78cadc50-ecff-11dd-a971-7dbc132099af

5 weeks agoninja: Use rsp files for SOLINK and SOLINK(module) on linux and mac.
thakis@chromium.org [Thu, 13 Mar 2014 03:47:47 +0000 (03:47 +0000)]
ninja: Use rsp files for SOLINK and SOLINK(module) on linux and mac.

To support link lines longer than 128 kiB == 131072 bytes, like it's
needed for chromium's content library.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/197823008

git-svn-id: http://gyp.googlecode.com/svn/trunk@1871 78cadc50-ecff-11dd-a971-7dbc132099af

5 weeks agoFix missing variable MSVS expansion of copies arguments with Ninja.
scottmg@chromium.org [Wed, 12 Mar 2014 21:58:41 +0000 (21:58 +0000)]
Fix missing variable MSVS expansion of copies arguments with Ninja.

The Visual Studio emulation does not expand the special
variables like 'VSInstallDir' into the 'copies' actions.

Here is a small broken example:

{
  'targets': [
    {
      'target_name': 'Copy_Target',
      'type': 'none',
      'copies': [
        {
          'destination': '<(PRODUCT_DIR)',
          'files': [
            '$(VSInstallDir)\\bin\\cl.exe',
          ],
        },
      ],
    },
  ],
}

Patch from etienneb@chromium.org.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/194883010

git-svn-id: http://gyp.googlecode.com/svn/trunk@1870 78cadc50-ecff-11dd-a971-7dbc132099af

5 weeks agoFix test/mac/gyptest-strip.py with Xcode 5.0 or higher
sdefresne@chromium.org [Wed, 12 Mar 2014 13:47:25 +0000 (13:47 +0000)]
Fix test/mac/gyptest-strip.py with Xcode 5.0 or higher

The version of clang that ships with Xcode 5.0 and higher add an extra
symbol if the command-line use a relative path with more than one
component to reference the source file (like ./file.c). This extra
symbol is not present if using an absolute path to the file, and cause
a difference of behaviour between xcodebuild and ninja.

Account for the extra symbol in the un-stripped binaries when building
with ninja and using Xcode 5.0 or higher. A possible alternative would
be to always use absolute path with ninja, but it would make the build
environment non-relocatable.

BUG=gyp:381
R=mark@chromium.org

Review URL: https://codereview.chromium.org/197073002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1869 78cadc50-ecff-11dd-a971-7dbc132099af

5 weeks agoDisable test/mac/gyptest-objc-gc.py when using Xcode 5.1
sdefresne@chromium.org [Wed, 12 Mar 2014 13:40:21 +0000 (13:40 +0000)]
Disable test/mac/gyptest-objc-gc.py when using Xcode 5.1

Xcode 5.1 removed support for garbage collection, and no longer recognize
the GCC_ENABLE_OBJC_GC settings, so disable the corresponding test.

BUG=gyp:414
R=mark@chromium.org

Review URL: https://codereview.chromium.org/196973002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1868 78cadc50-ecff-11dd-a971-7dbc132099af

5 weeks agoIntroduce a helper module TestMac
sdefresne@chromium.org [Wed, 12 Mar 2014 08:48:14 +0000 (08:48 +0000)]
Introduce a helper module TestMac

Many tests have to check the version of Xcode (as new versions introduce
incompatibilities) so introduce a module TestMac with a singleton object
to help get information about Xcode via xcodebuild.

Move binary architecture introspection into the TestMac module as this
is shared between Mac OS X and iOS unit tests.

BUG=gyp:414
R=mark@chromium.org

Review URL: https://codereview.chromium.org/195023004

git-svn-id: http://gyp.googlecode.com/svn/trunk@1867 78cadc50-ecff-11dd-a971-7dbc132099af

5 weeks agoDisable gyptest-link-dependency.py for cmake, make it pass with ninja/win
thakis@chromium.org [Tue, 11 Mar 2014 18:45:17 +0000 (18:45 +0000)]
Disable gyptest-link-dependency.py for cmake, make it pass with ninja/win

See https://codereview.chromium.org/177043010/#msg15 for the cmake bit, and
the following comments for ninja/win.

R=scottmg@chromium.org
TBR=scottmg@chromium.org

Review URL: https://codereview.chromium.org/194983003

git-svn-id: http://gyp.googlecode.com/svn/trunk@1866 78cadc50-ecff-11dd-a971-7dbc132099af

5 weeks agoAdd support for VCCLCompilerTool EnableEnhancedInstructionSet setting.
grt@chromium.org [Tue, 11 Mar 2014 18:27:07 +0000 (18:27 +0000)]
Add support for VCCLCompilerTool EnableEnhancedInstructionSet setting.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/195283002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1865 78cadc50-ecff-11dd-a971-7dbc132099af

5 weeks agoRemove explicit usage of sh to launch test_check_sdkroot.sh
sdefresne@chromium.org [Mon, 10 Mar 2014 14:02:16 +0000 (14:02 +0000)]
Remove explicit usage of sh to launch test_check_sdkroot.sh

The property svn:executable has been set on the test_check_sdkroot.sh script
so remove the workaround that was introduced to have tests pass when the
property was not set.

BUG=None
R=mark@chromium.org

Review URL: https://codereview.chromium.org/190953006

git-svn-id: http://gyp.googlecode.com/svn/trunk@1864 78cadc50-ecff-11dd-a971-7dbc132099af

6 weeks agoFix gyptest-type-envvars.py for Xcode 5.0.0
sdefresne@chromium.org [Sun, 9 Mar 2014 17:29:56 +0000 (17:29 +0000)]
Fix gyptest-type-envvars.py for Xcode 5.0.0

With Xcode 5.0.0, the SDKROOT environment variable is always set
when building, even if not set in the Xcode project.

BUG=381
R=mark@chromium.org

Review URL: https://codereview.chromium.org/82763006

git-svn-id: http://gyp.googlecode.com/svn/trunk@1863 78cadc50-ecff-11dd-a971-7dbc132099af

6 weeks agoRemove unused parameter. No functionality change.
thakis@chromium.org [Fri, 7 Mar 2014 22:28:44 +0000 (22:28 +0000)]
Remove unused parameter. No functionality change.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/191443005

git-svn-id: http://gyp.googlecode.com/svn/trunk@1862 78cadc50-ecff-11dd-a971-7dbc132099af

6 weeks agoAllow support target name suffix to be customized
mark@chromium.org [Tue, 4 Mar 2014 22:55:23 +0000 (22:55 +0000)]
Allow support target name suffix to be customized

This will allow targets to be generated where spaces aren't desirable in target names.

Patch by Daniel Wagner-Hall <danielwh@google.com>

Review URL: https://codereview.chromium.org/181433011/

git-svn-id: http://gyp.googlecode.com/svn/trunk@1861 78cadc50-ecff-11dd-a971-7dbc132099af

6 weeks agoIntroduce the 'link_dependency' attribute that removes the targets having this
mark@chromium.org [Tue, 4 Mar 2014 15:25:00 +0000 (15:25 +0000)]
Introduce the 'link_dependency' attribute that removes the targets having this
attribute from the 'none' targets' dependencies.

The intention behind this change is to let the users have static_library or
shared_library targets on which _every_ other executable/shared_library target
must depend, without introducing excessive dependencies on the former ones from
the 'none' metatargets (such excessive dependencies may trigger generator bugs
like https://code.google.com/p/gyp/issues/detail?id=409).

Patch by Alexander Potapenko <glider@chromium.org>

Review URL: https://codereview.chromium.org/177043010/

git-svn-id: http://gyp.googlecode.com/svn/trunk@1860 78cadc50-ecff-11dd-a971-7dbc132099af

7 weeks agoClean up the filters in the MSVS generator, for VS >= 2010
scottmg@chromium.org [Thu, 27 Feb 2014 21:55:20 +0000 (21:55 +0000)]
Clean up the filters in the MSVS generator, for VS >= 2010

Addendum to r1804. The fix in that revision only works
for VS 2008; for 2010 and later we generate one filter
per source file, so in order to clean these up, we must
prune sibling filters as long as they all have the same
name.

Patch by stk.haller@googlemail.com.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/171713013

git-svn-id: http://gyp.googlecode.com/svn/trunk@1859 78cadc50-ecff-11dd-a971-7dbc132099af

7 weeks agoGlobally ignore '*_excluded' keys for MSVS Settings
scottmg@chromium.org [Thu, 27 Feb 2014 19:38:40 +0000 (19:38 +0000)]
Globally ignore '*_excluded' keys for MSVS Settings

This extends validation of MSVS settings to ignore any key found that is suffixed with '_excluded', but still verifies that the root key name is a valid setting.

Patch from Eric N. Vander Weele <ericvw@gmail.com>

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/175873002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1858 78cadc50-ecff-11dd-a971-7dbc132099af

8 weeks agoandroid: set ASFLAGS as well as CFLAGS.
torne@chromium.org [Fri, 21 Feb 2014 18:13:16 +0000 (18:13 +0000)]
android: set ASFLAGS as well as CFLAGS.

The Android build system doesn't use CFLAGS for assembly source files,
but gyp expects this. Set LOCAL_ASFLAGS in gyp-generated targets to the
same as LOCAL_CFLAGS.

BUG=
R=thakis@chromium.org

Review URL: https://codereview.chromium.org/163433002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1857 78cadc50-ecff-11dd-a971-7dbc132099af

8 weeks agoVS 2013 emits a warning when two source files have the same
scottmg@chromium.org [Thu, 20 Feb 2014 19:25:41 +0000 (19:25 +0000)]
VS 2013 emits a warning when two source files have the same
name; but it also does this when one of the files is excluded
from the build, which I think is a bug.

Adding the IgnoreWarnCompileDuplicatedFilename key will
suppress this warning; it does so also for files that are
not excluded, but this shouldn't be a problem because gyp
itself already warns in this case.

See this page for more information:

  <http://connect.microsoft.com/VisualStudio/feedback/details/797460/incorrect-warning-msb8027-reported-for-files-excluded-from-build>

Patch from stk.haller@googlemail.com.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/173843004

git-svn-id: http://gyp.googlecode.com/svn/trunk@1856 78cadc50-ecff-11dd-a971-7dbc132099af

2 months agoFix a local rule reference
sdefresne@chromium.org [Tue, 18 Feb 2014 17:44:32 +0000 (17:44 +0000)]
Fix a local rule reference

BUG=None
R=thakis@chromium.org

Review URL: https://codereview.chromium.org/170853002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1855 78cadc50-ecff-11dd-a971-7dbc132099af

2 months agoCache Xcode version at the module level
sdefresne@chromium.org [Tue, 18 Feb 2014 17:29:24 +0000 (17:29 +0000)]
Cache Xcode version at the module level

XcodeVersion may end up being called many times when building large
projects, so cache the version for performance reason. The xcodebuild
command has also been observed to return incorrect values when called
by multiple processes in parallel, so reducing the number of calls
here reduce the risk of encountering this issue.

BUG=408
R=justincohen@chromium.org, thakis@chromium.org

Review URL: https://codereview.chromium.org/170773002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1854 78cadc50-ecff-11dd-a971-7dbc132099af

2 months agoninja: Let TOC code use $lib instead of ${lib}.
thakis@chromium.org [Mon, 17 Feb 2014 23:02:11 +0000 (23:02 +0000)]
ninja: Let TOC code use $lib instead of ${lib}.

No functionality change, but more consistent with -MF $out.d, and the
generated files shrink by a few bytes too.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/169633003

git-svn-id: http://gyp.googlecode.com/svn/trunk@1853 78cadc50-ecff-11dd-a971-7dbc132099af

2 months agoFix generation for ninja of multiarch executable targets
sdefresne@chromium.org [Wed, 12 Feb 2014 15:56:51 +0000 (15:56 +0000)]
Fix generation for ninja of multiarch executable targets

Chromium includes some targets that should only be compiled on
specific platform and end up with an empty 'sources' list. This
works when generating for a single architecture, but fails with
the following callstack when building for multiarch:

Traceback (most recent call last):
  File "./gyp/gyp_main.py", line 18, in <module>
    sys.exit(gyp.script_main())
  File "./gyp/pylib/gyp/__init__.py", line 534, in script_main
    return main(sys.argv[1:])
  File "./gyp/pylib/gyp/__init__.py", line 527, in main
    return gyp_main(args)
  File "./gyp/pylib/gyp/__init__.py", line 512, in gyp_main
    generator.GenerateOutput(flat_list, targets, data, params)
  File "./gyp/pylib/gyp/generator/ninja.py", line 2160, in GenerateOutput
    config_name)
  File "./gyp/pylib/gyp/generator/ninja.py", line 2078, in GenerateOutputForConfig
    target = writer.WriteSpec(spec, config_name, generator_flags)
  File "./gyp/pylib/gyp/generator/ninja.py", line 488, in WriteSpec
    self.target.actions_stamp or actions_depends)
  File "./gyp/pylib/gyp/generator/ninja.py", line 1180, in WriteTarget
    self.target.binary = self.WriteLink(spec, config_name, config, link_deps)
  File "./gyp/pylib/gyp/generator/ninja.py", line 972, in WriteLink
    for arch in self.archs]
TypeError: list indices must be integers, not str

This is because |link_deps| must be a dictionary keying |arch| to
a list of link dependencies when building for multiarch, but if
'sources' is empty, |link_deps| keep its default value (empty list).

BUG=314720
R=justincohen@chromium.org, mark@chromium.org, justincohen, mark

Review URL: https://codereview.chromium.org/157583011

git-svn-id: http://gyp.googlecode.com/svn/trunk@1852 78cadc50-ecff-11dd-a971-7dbc132099af

2 months agoUse "formats" parameter to TestGyp to filter the format
sdefresne@chromium.org [Wed, 12 Feb 2014 15:54:51 +0000 (15:54 +0000)]
Use "formats" parameter to TestGyp to filter the format

BUG=None
R=mark@chromium.org

Review URL: https://codereview.chromium.org/159303003

git-svn-id: http://gyp.googlecode.com/svn/trunk@1851 78cadc50-ecff-11dd-a971-7dbc132099af

2 months agoImprove ninja's Xcode emulation
sdefresne@chromium.org [Wed, 12 Feb 2014 08:15:10 +0000 (08:15 +0000)]
Improve ninja's Xcode emulation

When cloning the target dictionaries for "iphoneos", correctly filter
the ARCHS value to only include value that apply to the SDK (iphoneos
or iphonesimulator).

Take into consideration the VALID_ARCHS filter if defined and support
the $(ARCHS_STANDARD) and $(ARCHS_STANDARD_INCLUDING_64_BIT) defaults
from Xcode 5.0.

If ARCHS is not set (which is the default for most of the projects)
then result will be identical, but it can now be set to the macro
$(ARCHS_STANDARD_INCLUDING_64_BIT) to build correctly for arm64 and
armv7 with both ninja and Xcode (including xcodebuild).

Update test/ios/gyptest-archs.py to test build for both simulator
and device, with different configuration (no ARCHS and filter that
only keep 32-bit platforms, explicit ARCHS with filters for 32-bit
or 64-bit platforms, and explicit ARCHS with no filter). This breaks
the test with the "make" generator as its support for Xcode emulation
is inexistant.

BUG=http://crbug.com/339477
R=justincohen@chromium.org, mark@chromium.org, thakist@chromium.org

Review URL: https://codereview.chromium.org/138533006

git-svn-id: http://gyp.googlecode.com/svn/trunk@1850 78cadc50-ecff-11dd-a971-7dbc132099af

2 months agoExtract XcodeVersion to be a standalone module function
sdefresne@chromium.org [Tue, 11 Feb 2014 16:15:11 +0000 (16:15 +0000)]
Extract XcodeVersion to be a standalone module function

The _XcodeVersion from XcodeSettings class does not need to be a member
function as it does not use any of the field of the class. Extract it
to be a standalone function at the module level, and all the functions
it calls (that also don't use fields from XcodeSettings).

Keep the _XcodeVersion wrapper function that keeps a cache of the
values returned from Xcode to not degrade performance for clients of
the old API that may depends on that cache.

BUG=None
R=mark@chromium.org, thakis@chromium.org

Review URL: https://codereview.chromium.org/148783005

git-svn-id: http://gyp.googlecode.com/svn/trunk@1849 78cadc50-ecff-11dd-a971-7dbc132099af

2 months agoFix comparison of Xcode version
sdefresne@chromium.org [Tue, 11 Feb 2014 14:13:54 +0000 (14:13 +0000)]
Fix comparison of Xcode version

The methods _XcodeVersion returns a tuple with two strings (Xcode
version and Xcode build), so we should check the version against
the first value of the tuple.

BUG=None
R=mark@chromium.com

git-svn-id: http://gyp.googlecode.com/svn/trunk@1848 78cadc50-ecff-11dd-a971-7dbc132099af

2 months agoNinja generator: check if meminfo exists before reading it.
scottmg@chromium.org [Wed, 5 Feb 2014 17:41:32 +0000 (17:41 +0000)]
Ninja generator: check if meminfo exists before reading it.

This CL helps cross-compile work well. Linux doesn't have to have /proc/meminfo.
For example, chroot doesn't have it.

Patch from dongseong.hwang@intel.com.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/137623016

git-svn-id: http://gyp.googlecode.com/svn/trunk@1847 78cadc50-ecff-11dd-a971-7dbc132099af

2 months agoNinja generator: support using clang-cl for Windows
thakis@chromium.org [Tue, 28 Jan 2014 21:45:27 +0000 (21:45 +0000)]
Ninja generator: support using clang-cl for Windows

If CC is set to 'clang-cl' in make_global_settings, use that
as the compiler instead of cl.exe from the environment.

BUG=chromium:82385
Review URL: https://codereview.chromium.org/136113016/

Patch from Hans Wennborg <hans@chromium.org>

git-svn-id: http://gyp.googlecode.com/svn/trunk@1846 78cadc50-ecff-11dd-a971-7dbc132099af

2 months agoQuell warnings for exclusion list dictionaries in MSVS generator.
chrisha@chromium.org [Fri, 24 Jan 2014 20:40:09 +0000 (20:40 +0000)]
Quell warnings for exclusion list dictionaries in MSVS generator.

When using ! or / filtering mechanisms on MSVS tool dictionaries, the resulting automatically created exclusion list dictionary causes the generator to complain that the setting name is unknown. This silences these spurious warnings.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/140483003

git-svn-id: http://gyp.googlecode.com/svn/trunk@1845 78cadc50-ecff-11dd-a971-7dbc132099af

2 months agoEclipse generator now uses compiler's default include dirs.
thakis@chromium.org [Wed, 22 Jan 2014 23:55:03 +0000 (23:55 +0000)]
Eclipse generator now uses compiler's default include dirs.

This adds support to the Eclipse gyp generator for detecting the
compiler's default include directories and adding them to the list of
include dirs. This finally fixes a long-standing bug where size_t was
not defined in the Android Eclipse setup.

BUG=336982
Review URL: https://codereview.chromium.org/145363002/

Patch from Newton Allen <newt@chromium.org>!

git-svn-id: http://gyp.googlecode.com/svn/trunk@1844 78cadc50-ecff-11dd-a971-7dbc132099af

2 months agoXcode: Add .xcassets = folder.assetcatalog in extension_map
mark@chromium.org [Wed, 22 Jan 2014 22:38:16 +0000 (22:38 +0000)]
Xcode: Add .xcassets = folder.assetcatalog in extension_map

This allows lastKnownFileType to be set for files named, for instance,
Images.xcassets.

Patch by Matthew DeVore <matvore@google.com>
Review URL: https://codereview.chromium.org/140103003/

git-svn-id: http://gyp.googlecode.com/svn/trunk@1843 78cadc50-ecff-11dd-a971-7dbc132099af

2 months agoDe-hardcode link concurrency for Windows.
sebmarchand@chromium.org [Mon, 20 Jan 2014 20:47:25 +0000 (20:47 +0000)]
De-hardcode link concurrency for Windows.

it's not needed anymore as we're using the GYP_USE_SEPARATE_MSPDBSRV flag on the Windows builders.

BUG=333000, 335607
R=scottmg@chromium.org, robertshield@chromium.org

Review URL: https://codereview.chromium.org/143473002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1842 78cadc50-ecff-11dd-a971-7dbc132099af

3 months agoremove unreferenced gyp_dummy.c
thakis@chromium.org [Sat, 18 Jan 2014 23:35:48 +0000 (23:35 +0000)]
remove unreferenced gyp_dummy.c

The code that utilized this file was removed in r1184.

Review URL: https://codereview.chromium.org/142433002/
Patch from ericvw@gmail.com!

git-svn-id: http://gyp.googlecode.com/svn/trunk@1841 78cadc50-ecff-11dd-a971-7dbc132099af

3 months agoStrip the invalid characters from the string used as mspdbsrv endpoint.
scottmg@chromium.org [Fri, 17 Jan 2014 19:19:14 +0000 (19:19 +0000)]
Strip the invalid characters from the string used as mspdbsrv endpoint.

Patch from sebmarchand@chromium.org.

R=scottmg@chromium.org
BUG=335607

Review URL: https://codereview.chromium.org/141163014

git-svn-id: http://gyp.googlecode.com/svn/trunk@1840 78cadc50-ecff-11dd-a971-7dbc132099af

3 months agoFix VS 2008 generation with nested folders again
scottmg@chromium.org [Fri, 17 Jan 2014 18:22:47 +0000 (18:22 +0000)]
Fix VS 2008 generation with nested folders again

Follow up to r1831, which forgot to adjust one of the call sites of _ConvertSourcesToFilterHierarchy.

Patch from stk.haller@googlemail.com.

R=jochen@chromium.org

Review URL: https://codereview.chromium.org/135903007

git-svn-id: http://gyp.googlecode.com/svn/trunk@1839 78cadc50-ecff-11dd-a971-7dbc132099af

3 months agowin ninja: build fix for msvs_pre/postbuild error test
scottmg@chromium.org [Wed, 15 Jan 2014 18:57:04 +0000 (18:57 +0000)]
win ninja: build fix for msvs_pre/postbuild error test

Follow up to r1837. The previous test used print, which can get lost
when running in parallel. Instead, just error out with an exception
and update the test to expect that.

TBR=bradn@chromium.org

Review URL: https://codereview.chromium.org/139803002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1838 78cadc50-ecff-11dd-a971-7dbc132099af

3 months agoSupport 'msvs_prebuild/msvs_postbuild' in MSBuild (VS 2010 and later)
scottmg@chromium.org [Tue, 14 Jan 2014 21:50:53 +0000 (21:50 +0000)]
Support 'msvs_prebuild/msvs_postbuild' in MSBuild (VS 2010 and later)

Originally by yukawa_g <yukawa@google.com>,
see <https://codereview.chromium.org/8229003>, except that I moved the
test to the test directory and renamed the gyptest file; and added a
warning to the ninja generator that it doesn't support these.

Patch from stk.haller@googlemail.com.

R=bradnelson@google.com

Review URL: https://codereview.chromium.org/137853003

git-svn-id: http://gyp.googlecode.com/svn/trunk@1837 78cadc50-ecff-11dd-a971-7dbc132099af

3 months agoninja win: Allow parent environment variables through when running actions
scottmg@chromium.org [Mon, 13 Jan 2014 03:42:05 +0000 (03:42 +0000)]
ninja win: Allow parent environment variables through when running actions

This is a hack to get variables set here:
https://code.google.com/p/chromium/codesearch#chromium/tools/build/scripts/slave/compile.py&l=416
through to version.py

In preference to https://codereview.chromium.org/136163002/ as it doesn't
involve trying to modify where the variables are set in master build
scripts.

TBR=thakis@chromium.org
BUG=333738

Review URL: https://codereview.chromium.org/133503003

git-svn-id: http://gyp.googlecode.com/svn/trunk@1836 78cadc50-ecff-11dd-a971-7dbc132099af

3 months agoPass the mspdbsrv flag as a command line argument to the link wrapper.
scottmg@chromium.org [Sat, 11 Jan 2014 05:51:43 +0000 (05:51 +0000)]
Pass the mspdbsrv flag as a command line argument to the link wrapper.

This variable causes separate instances of mspdbsrv to be used
for each invocation of the linker.

Patch by sebmarchand@chromium.org.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/134383002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1835 78cadc50-ecff-11dd-a971-7dbc132099af

3 months agoupdate comment to add tracking bug from r1833
scottmg@chromium.org [Thu, 9 Jan 2014 20:30:44 +0000 (20:30 +0000)]
update comment to add tracking bug from r1833

TBR=thakis@chromium.org

Review URL: https://codereview.chromium.org/131063004

git-svn-id: http://gyp.googlecode.com/svn/trunk@1834 78cadc50-ecff-11dd-a971-7dbc132099af

3 months agoSpeculative fix for OOM on win ninja builders
scottmg@chromium.org [Thu, 9 Jan 2014 17:40:36 +0000 (17:40 +0000)]
Speculative fix for OOM on win ninja builders

Bots failing with

FAILED: C:\b\depot_tools\python276_bin\python.exe gyp-win-tool link-with-manifests environment.x86 True sync_performance_tests.exe "C:\b\depot_tools\python276_bin\python.exe gyp-win-tool link-wrapper environment.x86 link.exe /nologo /OUT:sync_performance_tests.exe @sync_performance_tests.exe.rsp" 1 mt.exe rc.exe "obj\chrome\sync_performance_tests.sync_performance_tests.exe.intermediate.manifest" obj\chrome\sync_performance_tests.sync_performance_tests.exe.generated.manifest ..\..\build\win\compatibility.manifest
LINK : fatalerror LNK1102: out of memory

Attempted speculative global fix to see if this helps.

R=robertshield@chromium.org
TBR=robertshield@chromium.org

Review URL: https://codereview.chromium.org/132273002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1833 78cadc50-ecff-11dd-a971-7dbc132099af

3 months agowin ninja: include .pdb in linker outputs
scottmg@chromium.org [Wed, 8 Jan 2014 23:08:01 +0000 (23:08 +0000)]
win ninja: include .pdb in linker outputs

This is "just more correct" (will e.g. make -t clean work a bit
better) and also allows syzygy rules that process .pdbs to work.

BUG=chromium:325815
R=thakis@chromium.org

Review URL: https://codereview.chromium.org/126443004

git-svn-id: http://gyp.googlecode.com/svn/trunk@1832 78cadc50-ecff-11dd-a971-7dbc132099af

3 months agoDon't try to match mixed source/dir gyp order on MSVS prior to 2010
jochen@chromium.org [Wed, 8 Jan 2014 15:46:42 +0000 (15:46 +0000)]
Don't try to match mixed source/dir gyp order on MSVS prior to 2010

MSVS 2008 can't cope with the generator makefiles.

This is a conditional revert of r1820

BUG=326030
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/128263004

git-svn-id: http://gyp.googlecode.com/svn/trunk@1831 78cadc50-ecff-11dd-a971-7dbc132099af

3 months agogenerator output should be relative to depth.
jochen@chromium.org [Wed, 8 Jan 2014 10:10:11 +0000 (10:10 +0000)]
generator output should be relative to depth.

Currently, it's a strange mix between depth, the filename, and generator
output that happens to work if depth is .

BUG=none
TEST=test/generator-output/gyptest-depth.py
R=joi@chromium.org

Review URL: https://codereview.chromium.org/127893002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1830 78cadc50-ecff-11dd-a971-7dbc132099af

3 months agowin msvs: make express editions not use x64-x64 compiler
scottmg@chromium.org [Tue, 7 Jan 2014 04:51:52 +0000 (04:51 +0000)]
win msvs: make express editions not use x64-x64 compiler

VS2012 express and others do not include a 64 bit compiler
that generates 64 bit code. This patch makes it so the
64 bit compiler is only enabled when not using a Visual
Studio express edition.

Patch from david@sankelsoftware.com.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/101223013

git-svn-id: http://gyp.googlecode.com/svn/trunk@1829 78cadc50-ecff-11dd-a971-7dbc132099af

3 months agoSilence a pylint warning.
thakis@chromium.org [Sat, 28 Dec 2013 19:08:35 +0000 (19:08 +0000)]
Silence a pylint warning.

Without this, `gcl commit` doesn't work without --no_presubmit.

Also set `svn:eol-style LF` on this file.
Review URL: https://codereview.chromium.org/121303002/

git-svn-id: http://gyp.googlecode.com/svn/trunk@1828 78cadc50-ecff-11dd-a971-7dbc132099af

3 months agoWrite the make_global_settings to the error message.
brettw@chromium.org [Sat, 28 Dec 2013 05:32:18 +0000 (05:32 +0000)]
Write the make_global_settings to the error message.

I'm trying to land some GN changes and get this error on various platforms with various configurations. Having the actual values that GYP and GN end up with for the make_global_settings will make troubleshooting much faster.

R=maruel@chromium.org

Review URL: https://codereview.chromium.org/104923014

git-svn-id: http://gyp.googlecode.com/svn/trunk@1827 78cadc50-ecff-11dd-a971-7dbc132099af

3 months ago_XcodeVersion: return CLT version as appropriate
thakis@chromium.org [Thu, 26 Dec 2013 18:08:49 +0000 (18:08 +0000)]
_XcodeVersion: return CLT version as appropriate

If Xcode isn't installed passing the CLT version is the next best bet.
This ports the CLT version function from Homebrew, and calls it if
xcodebuild fails to run.

BUG=code.google.com/p/gyp/issues/detail?id=292
Review URL: https://codereview.chromium.org/117553003/

Patch from mistydemeo@gmail.com!

Review URL: https://codereview.chromium.org/106293003

git-svn-id: http://gyp.googlecode.com/svn/trunk@1826 78cadc50-ecff-11dd-a971-7dbc132099af

3 months agoxcode_emulation: fix on CLT-only systems redux
thakis@chromium.org [Tue, 24 Dec 2013 20:27:02 +0000 (20:27 +0000)]
xcode_emulation: fix on CLT-only systems redux

This reimplements r1819 in a way that should avoid breaking Xcode, and
should also allow setting framework paths on CLT-only systems.

BUG=code.google.com/p/gyp/issues/detail?id=292
Review URL: https://codereview.chromium.org/118473009/
Patch from mistydemeo@gmail.com!

Review URL: https://codereview.chromium.org/117013003

git-svn-id: http://gyp.googlecode.com/svn/trunk@1825 78cadc50-ecff-11dd-a971-7dbc132099af

3 months agomake: Let CC_host, CXX_host env vars win over make_global_settings keys.
thakis@chromium.org [Sat, 21 Dec 2013 01:30:35 +0000 (01:30 +0000)]
make: Let CC_host, CXX_host env vars win over make_global_settings keys.

This is what's happening in the ninja generator, and what's happening in the
make generator for CC / CXX too.

BUG=chromium:326411
Review URL: https://codereview.chromium.org/117823012/

git-svn-id: http://gyp.googlecode.com/svn/trunk@1824 78cadc50-ecff-11dd-a971-7dbc132099af

4 months agoRevert r1819 for now, it broke the mac bots.
thakis@chromium.org [Thu, 19 Dec 2013 17:20:08 +0000 (17:20 +0000)]
Revert r1819 for now, it broke the mac bots.

Failing tests are at
http://build.chromium.org/p/tryserver.nacl/builders/gyp-mac/builds/1478

Failed the following 4 tests:
        test/ios/gyptest-app-ios.py
        test/ios/gyptest-archs.py
        test/ios/gyptest-per-config-settings.py
        test/mac/gyptest-framework-dirs.py

git-svn-id: http://gyp.googlecode.com/svn/trunk@1823 78cadc50-ecff-11dd-a971-7dbc132099af

4 months agowin ninja: add support for ForceSymbolReferences
scottmg@chromium.org [Wed, 18 Dec 2013 20:06:03 +0000 (20:06 +0000)]
win ninja: add support for ForceSymbolReferences

R=thakis@chromium.org
BUG=326030

Review URL: https://codereview.chromium.org/118443002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1822 78cadc50-ecff-11dd-a971-7dbc132099af

4 months agoRestrict multiple codesign assert.
justincohen@chromium.org [Wed, 18 Dec 2013 14:34:30 +0000 (14:34 +0000)]
Restrict multiple codesign assert.

A number of developers have found themselves in a state where they have multiple
copies of the same cert. Running `security find-identity -p codesigning`
should confirm this.  Instead, only assert if there identities with different
cert fingerprints.

BUG=None
R=sdefresne@chromium.org, thakis@chromium.org

Review URL: https://codereview.chromium.org/117463003

git-svn-id: http://gyp.googlecode.com/svn/trunk@1821 78cadc50-ecff-11dd-a971-7dbc132099af

4 months agowin msvs: make mixed source/dir match gyp order
scottmg@chromium.org [Tue, 17 Dec 2013 05:14:06 +0000 (05:14 +0000)]
win msvs: make mixed source/dir match gyp order

Make link order in VS match gyp order (redux).

Previous attempt(s) failed on a sources list of:

a.cc
dir\b.cc
c.cc

In this case, previously the link order would be [a.cc,
c.cc, dir\b.cc] because all the contents of each directory
would be processed before it recursed to subfolders.

We instead walk into folders immediately now. It's possible
that this will cause redundant folders in the IDE structure
on VS2008 (I don't have it installed any more), but it's OK
on 2010+ at least.

R=thakis@chromium.org
BUG=326030

Review URL: https://codereview.chromium.org/104873013

git-svn-id: http://gyp.googlecode.com/svn/trunk@1820 78cadc50-ecff-11dd-a971-7dbc132099af

4 months agoxcode_emulation: work in the absence of xcodebuild
thakis@chromium.org [Mon, 16 Dec 2013 19:00:31 +0000 (19:00 +0000)]
xcode_emulation: work in the absence of xcodebuild

OS X systems running only the Command Line Tools for Xcode package,
without the full Xcode, don't have a functioning xcodebuild, but this
isn't mandatory for building many gyp projects (e.g. node.js, v8).
This commit handles xcodebuild failures and avoids populating
Xcode-specific CFLAGS/LDFLAGS when xcodebuild can't be run.

This has been tested on both Xcode and CLT-only systems by successfully
building node.js. The behaviour can be simulated on systems with Xcode
by setting the xcode-select path to something nonsensical, e.g.
xcode-select -switch /usr/bin

BUG=https://code.google.com/p/gyp/issues/detail?id=292
Review URL: https://codereview.chromium.org/102733012/

Patch from mistydemeo@gmail.com!

git-svn-id: http://gyp.googlecode.com/svn/trunk@1819 78cadc50-ecff-11dd-a971-7dbc132099af

4 months agoAdd license header to ordered_dict
scottmg@chromium.org [Sat, 14 Dec 2013 00:33:21 +0000 (00:33 +0000)]
Add license header to ordered_dict

http://code.activestate.com/recipes/576693/ specifies author and MIT
license, but it wasn't included in the code. Add it to make chromium's
check_licenses step happy.

R=thakis@chromium.org
TBR=thakis@chromium.org

Review URL: https://codereview.chromium.org/103813008

git-svn-id: http://gyp.googlecode.com/svn/trunk@1818 78cadc50-ecff-11dd-a971-7dbc132099af

4 months agoFix OrderedDict path import for 2.6
scottmg@chromium.org [Fri, 13 Dec 2013 23:52:02 +0000 (23:52 +0000)]
Fix OrderedDict path import for 2.6

Now actually tested on 2.6. :/

R=thakis@chromium.org

Review URL: https://codereview.chromium.org/103473005

git-svn-id: http://gyp.googlecode.com/svn/trunk@1817 78cadc50-ecff-11dd-a971-7dbc132099af

4 months agoAdd backported OrderedDict
scottmg@chromium.org [Fri, 13 Dec 2013 17:58:44 +0000 (17:58 +0000)]
Add backported OrderedDict

Using collections.OrderedDict caused chromium roll to fail:

Broke Win Builder (dbg) runhooks:

  File
"C:\b\build\slave\cr-win-dbg\build\src\tools\gyp\pylib\gyp\generator\msvs.py",
line 223, in _ConvertSourcesToFilterHierarchy
      folders = collections.OrderedDict()
  AttributeError: 'module' object has no attribute 'OrderedDict'

R=thakis@chromium.org
BUG=241769

Review URL: https://codereview.chromium.org/106233005

git-svn-id: http://gyp.googlecode.com/svn/trunk@1816 78cadc50-ecff-11dd-a971-7dbc132099af

4 months agoUse gyp.common.EnsureDirExists() in more places.
thakis@chromium.org [Thu, 12 Dec 2013 22:20:21 +0000 (22:20 +0000)]
Use gyp.common.EnsureDirExists() in more places.

No intended behavior change.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/113463003

git-svn-id: http://gyp.googlecode.com/svn/trunk@1815 78cadc50-ecff-11dd-a971-7dbc132099af

4 months agowin ninja: default to embedding manifest to match msvs
scottmg@chromium.org [Thu, 12 Dec 2013 21:54:27 +0000 (21:54 +0000)]
win ninja: default to embedding manifest to match msvs

And add a test for this specific variation.

R=thakis@chromium.org
BUG=chromium:326030

Review URL: https://codereview.chromium.org/103963007

git-svn-id: http://gyp.googlecode.com/svn/trunk@1814 78cadc50-ecff-11dd-a971-7dbc132099af

4 months agowin ninja: Refactor manifest generate and embed to be 1-pass
scottmg@chromium.org [Thu, 12 Dec 2013 21:09:32 +0000 (21:09 +0000)]
win ninja: Refactor manifest generate and embed to be 1-pass

The 'normal' way to do manifests is to have link generate a manifest
based on gathering dependencies from the object files, then merge that
manifest with other manifests supplied as sources, convert the merged
manifest to a resource, and then *relink*, including the compiled
version of the manifest resource. This breaks incremental linking, and
is generally overly complicated.

Instead, we merge all the manifests provided (along with one that
includes what would normally be in the linker-generated one, see
msvs_emulation.py), and include that into the first and only link.
We still tell link to generate a manifest, but we only use that to
assert that our simpler process did not miss anything.

R=thakis@chromium.org, yukawa@chromium.org
BUG=chromium:324863

Review URL: https://codereview.chromium.org/111373002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1813 78cadc50-ecff-11dd-a971-7dbc132099af

4 months agowin msvs: Make ordering of sources in subdirs match gyp order
scottmg@chromium.org [Wed, 11 Dec 2013 23:29:27 +0000 (23:29 +0000)]
win msvs: Make ordering of sources in subdirs match gyp order

Sources in a given directory matched before, this makes folder order
match the gyp order also.

(collections.OrderedDict is py2.7; I'm not sure if that's a problem?)

R=mark@chromium.org, thakis@chromium.org
BUG=326030

Review URL: https://codereview.chromium.org/113053003

git-svn-id: http://gyp.googlecode.com/svn/trunk@1812 78cadc50-ecff-11dd-a971-7dbc132099af

4 months agoFix gyptest-xcode-env-order for Xcode 5.0.0
sdefresne@chromium.org [Wed, 11 Dec 2013 09:23:43 +0000 (09:23 +0000)]
Fix gyptest-xcode-env-order for Xcode 5.0.0

The evaluation bug of bare environment variable has been fixed by
Xcode 5.0.0, so do not check for the failure anymore.

BUG=381
R=mark@chromium.org

Review URL: https://codereview.chromium.org/83173004

git-svn-id: http://gyp.googlecode.com/svn/trunk@1811 78cadc50-ecff-11dd-a971-7dbc132099af

4 months agoFix gyptest-sdkroot when oldest SDK is >= 10.8
sdefresne@chromium.org [Wed, 11 Dec 2013 09:09:23 +0000 (09:09 +0000)]
Fix gyptest-sdkroot when oldest SDK is >= 10.8

When using Mac OS X Mavericks with Xcode 5.0.2, the only SDK installed
are 10.8 and 10.9. Fix the test by using the oldest installed and
supported SDK.

BUG=381
R=mark@chromium.org

Review URL: https://codereview.chromium.org/83073002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1810 78cadc50-ecff-11dd-a971-7dbc132099af

4 months agoFix gyptest-xcode-gcc.py when using Xcode 5.0.2
sdefresne@chromium.org [Tue, 10 Dec 2013 17:45:22 +0000 (17:45 +0000)]
Fix gyptest-xcode-gcc.py when using Xcode 5.0.2

With Xcode 5.0.2, gcc is now a special version of clang and it no
longer supports the -Wno-invalid-offsetof. Skip the test then.

BUG=381
R=mark@chromium.org

Review URL: https://codereview.chromium.org/83113002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1809 78cadc50-ecff-11dd-a971-7dbc132099af

4 months agoFix gyptest-app for Xcode 5.0.2
sdefresne@chromium.org [Mon, 9 Dec 2013 13:19:54 +0000 (13:19 +0000)]
Fix gyptest-app for Xcode 5.0.2

With Xcode 5.0.0 or later, the DTSDKName of Info.plist is always
set, even if SDKROOT is not defined in the Xcode project.

BUG=381
R=mark@chromium.org

Review URL: https://codereview.chromium.org/83463003

git-svn-id: http://gyp.googlecode.com/svn/trunk@1808 78cadc50-ecff-11dd-a971-7dbc132099af

4 months agowin msvs: make ordering match .gyp order
scottmg@chromium.org [Fri, 6 Dec 2013 21:04:26 +0000 (21:04 +0000)]
win msvs: make ordering match .gyp order

The order of .obj on the link command line determines the order in the
final binary in the absence of other need to re-order. Make them
consistent across the windows generators by making them match the order
in the .gyp file, and add a test for this behaviour. This was already
ninja's behaviour.

R=thakis@chromium.org
BUG=chromium:326030

Review URL: https://codereview.chromium.org/107293004

git-svn-id: http://gyp.googlecode.com/svn/trunk@1807 78cadc50-ecff-11dd-a971-7dbc132099af

4 months agoIgnore pylint blacklist on Windows too
scottmg@chromium.org [Wed, 4 Dec 2013 17:25:10 +0000 (17:25 +0000)]
Ignore pylint blacklist on Windows too

I'd been cursing pylint on every dcommit for the last year or
so and then doing --bypass-hooks. This seems an improvement.

R=thakis@chromium.org

Review URL: https://codereview.chromium.org/104683005

git-svn-id: http://gyp.googlecode.com/svn/trunk@1806 78cadc50-ecff-11dd-a971-7dbc132099af

4 months agowin: support linker warnings-as-errors
scottmg@chromium.org [Wed, 4 Dec 2013 16:47:43 +0000 (16:47 +0000)]
win: support linker warnings-as-errors

R=thakis@chromium.org
BUG=310938

Review URL: https://codereview.chromium.org/102593004

git-svn-id: http://gyp.googlecode.com/svn/trunk@1805 78cadc50-ecff-11dd-a971-7dbc132099af

4 months agoClean up the filters in the MSVS generator.
scottmg@chromium.org [Tue, 3 Dec 2013 17:55:14 +0000 (17:55 +0000)]
Clean up the filters in the MSVS generator.

Generating projects in subfolders could produce filters with
several nested '..' folders with a single child. For example,

../
-../
--src/
---projects/
----project1/
----project2/

The patch prunes filters with a single child, making the above

project1/
project2/

Patch by jmadill@chromium.org.

BUG=
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/95193003

git-svn-id: http://gyp.googlecode.com/svn/trunk@1804 78cadc50-ecff-11dd-a971-7dbc132099af

4 months agoSupport Visual C++ PGO in Ninja generator
yukawa@chromium.org [Tue, 3 Dec 2013 16:11:56 +0000 (16:11 +0000)]
Support Visual C++ PGO in Ninja generator

This CL teaches msvs_emulation.py about following settings so that ninja ganarate can handle Progile-Guided Optiomization (PGO) settings for Visual C++.
- VCLinkerTool.LinkTimeCodeGeneration
-- 2: /LTCG:PGINSTRUMENT
-- 3: /LTCG:PGOPTIMIZE
-- 4: /LTCG:PGUPDATE
- VCLinkerTool.ProfileGuidedDatabase

Note that LinkTimeCodeGenerationOption.LinkTimeCodeGenerationOptionUse is partially supported for LTCG (Link-Time Code Generator). This CL also adds unittests for LTCG in addition to unittests for PGO.

BUG=gyp:385
TEST=gyptest.py test/win/gyptest-link-ltcg.py test/win/gyptest-link-pgo.py
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/82703007

git-svn-id: http://gyp.googlecode.com/svn/trunk@1803 78cadc50-ecff-11dd-a971-7dbc132099af

4 months agoninja/win: Support VCLinkerTool.GenerateManifest
yukawa@chromium.org [Tue, 3 Dec 2013 14:32:57 +0000 (14:32 +0000)]
ninja/win: Support VCLinkerTool.GenerateManifest

Currently Ninja generator always expects VCLinkerTool.GenerateManifest is true. With this CL, it will be configurable like MSVS generator.

BUG=gyp:389
TEST=python gyptest.py test/win/gyptest-link-generate-manifest.py
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/97873002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1802 78cadc50-ecff-11dd-a971-7dbc132099af

4 months agoAdds an helper class to shard mspdbsrv.
scottmg@chromium.org [Wed, 27 Nov 2013 21:21:55 +0000 (21:21 +0000)]
Adds an helper class to shard mspdbsrv.

Currently there's a single instance of mspdbsrv shared between all the linkers. This can cause some OOMs if too many linkers are accessing it in parallel.

There's an undocumented environment variable which allows to specify the mspdbsrv endpoint to bound to a linker: _MSPDBSRV_ENDPOINT_ , by setting this variable to a unique value per target you ensure that one different instance of mspdbsrv will be used for every target.

Currently I only use this value for the .exe targets, I keep the shared one for the other ones.

This is hidden behind a 'GYP_USE_SEPARATE_MSPDBSRV' environment variable.

Patch by sebmarchand@chromium.org

R=scottmg@chromium.org, siggi@chromium.org

Review URL: https://codereview.chromium.org/83803003

git-svn-id: http://gyp.googlecode.com/svn/trunk@1801 78cadc50-ecff-11dd-a971-7dbc132099af

4 months agowin ninja: Speculative fix for pdb locking errors
scottmg@chromium.org [Wed, 27 Nov 2013 00:58:00 +0000 (00:58 +0000)]
win ninja: Speculative fix for pdb locking errors

There's longstanding occasional errors where the compiler complains that
the pdb is locked. This isn't really a condition that should be exposed
to the build system, and no one has been able to come up with a reliable
repro. Retrying causes the build to succeed.

In chromium, two targets that often fail this way are 'net' and
'libphonenumber_without_metadata'. These targets are distinctive in that
they build early in the build, contain at least one .c file, and use
pch for their .cc files.

The locking error seems to manifest with the compile step for the obj
associated with creating the .pdb, so the hypothesis is that the .c
compilation is colliding with the creation of the pdb that the
precompile does. This race should be handled by mspdbsrv, but for
appears to be buggy for whatever reason. (This bug has been filed on
connect.microsoft.com, but without a repro it's not very likely that
action will be taken.)

In order to avoid this, have the .c and .cc files use separate .pdb
files. This is otherwise unnecessary, but shouldn't cause any material
drawback either.

R=thakis@chromium.org
BUG=chromium:142362

Review URL: https://codereview.chromium.org/88303004

git-svn-id: http://gyp.googlecode.com/svn/trunk@1800 78cadc50-ecff-11dd-a971-7dbc132099af

4 months agoDisable building simulator for "x86_64"
sdefresne@chromium.org [Tue, 26 Nov 2013 23:10:18 +0000 (23:10 +0000)]
Disable building simulator for "x86_64"

The buildbot have an old SDK / Xcode installed that does not
support building a simulator target for "x86_64".

BUG=chromium:322075
R=thakis@chromium.org
CC=justincohen@chromium.org

Review URL: https://codereview.chromium.org/88813002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1799 78cadc50-ecff-11dd-a971-7dbc132099af