Fix make and ninja backends to sensibly handle duplicate target names in different directories 

Currently, if two multiple targets in different directories use the same name, 
gyp's behaviour depends on the particular backend and is confusing at best. See 
bug for details. 

This change fixes the make and ninja backends to ... 
- always build all targets when duplicate targets exist 
- use the correct action/rule/copy when such duplicate targets define 
actions/rules/copies with the same name 

It also adds a test for this. 

BUG=gyp:270
TEST=test/same-target-name-different-directory/ 
Review URL: https://chromiumcodereview.appspot.com/10447063

git-svn-id: http://gyp.googlecode.com/svn/trunk@1415 78cadc50-ecff-11dd-a971-7dbc132099af
Don't make the description for external rules contain the rules' commands.

The description for external rules (where msvs_external_rule != 0) had been set to the full command.  As it happens, MSBuild will generate command shell scripts that echo the description (look, ma, I found a command shell injection vulnerability in MSBuild!).  Let's say you have an external rule that does something like:

  foo && bar && baz && bletch

MSBuild takes that and shoves it into a script file that looks not too unlike:

  echo foo && bar && baz && bletch

  foo && bar && baz && bletch

MSBuild then fires up a cmd.exe at that file.  What's the first line gonna do?  Well, it'll send "foo" to stdout and then run bar && baz && bletch.  Is this harmful?  Well, if "foo" happens to actually be something like "call .....\setup_env.bat", then the env isn't set up.  If you're lucky, bar, baz, and bletch don't happen to be in your path, so you never even know this happened.  If you're unlucky, some subset of them are in your path so you get odd behavior (especially if the ones in your path aren't compatible with the expected ones) like modal error dialogs.  If you're another kind of unlucky, bar, baz, and bletch will succeed (chewing up time, disk, memory, and other things) and then be run a second time.  So now your build succeeds but all external rules take twice as long as they should.  Feh.

Anywhoo, this trivial change makes the description something more neutral which shows up in MSBuild log files as "Running external rules for FOOBAR (TaskId:nnn)".

BUG=none
TEST=python gyptest.py -f msvs test\rules\gyptest-all.py
Review URL: https://chromiumcodereview.appspot.com/10556040

git-svn-id: http://gyp.googlecode.com/svn/trunk@1416 78cadc50-ecff-11dd-a971-7dbc132099af
Print full path in diagnostic messages building with ninja on windows.

This allows to click on messages in visual studio to open file with error or warning.
By default all path is relative to src/out/Debug but visual studio search file relative to location project.

Putting project into deeper directory to match default relative path is an option, but in this case you can't use 'Show All Files' in solution explorer to browse source tree.

BUG=none
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10537170

git-svn-id: http://gyp.googlecode.com/svn/trunk@1417 78cadc50-ecff-11dd-a971-7dbc132099af
ninja windows: Use $in_newline instead of $in in response files

Previously, local version of ninja had modified $in to be \n separated when in response files. Upstream ninja now has $in_newline instead so use that where necessary.

R=thakis@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10614004

git-svn-id: http://gyp.googlecode.com/svn/trunk@1418 78cadc50-ecff-11dd-a971-7dbc132099af
ninja windows: extract environment during generation and set it per subprocess

Instead of having one wrapper that happens pre-ninja to set up the compiler
environment, extract the required environment at generation time and save it
to a file in the build dir. Then, wrap toolchain invocations to use the saved
environment rather than the parent environment. This has two benefits: 1)
isolation from the parent environment which may not be correctly set up, or
required complicated futzing in wrapper scripts to get set up; 2) gets closer
to allowing support of msvs_target_platform which has a sub-x64 build even
when doing an x86 build (that isn't done here though).

Note: This needs to be rolled at the same time as https://chromiumcodereview.appspot.com/10399040
(as set_environment.bat that ninja.bat looks for is no longer generated).

R=thakis@chromium.org
BUG=127459

Review URL: https://chromiumcodereview.appspot.com/10382158

git-svn-id: http://gyp.googlecode.com/svn/trunk@1419 78cadc50-ecff-11dd-a971-7dbc132099af
ninja windows: Use sys.executable rather than unqualified 'python'

Isolate from the running environment, and make sure we're directly using the correct python binary. Also removes one cmd/c wrapper that's unnecessary since we're launching the binary directly.

R=thakis@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10656004

git-svn-id: http://gyp.googlecode.com/svn/trunk@1420 78cadc50-ecff-11dd-a971-7dbc132099af
ninja windows: workaround for too long names

Hash rule_name/unique_name for now to make the path shorter and get builds working again. We should come up with a better way of doing this in general.

(Jay was running into this problem, and found this to be a reasonable/working workaround)

BUG=276
TEST=

Review URL: https://chromiumcodereview.appspot.com/10665008

git-svn-id: http://gyp.googlecode.com/svn/trunk@1421 78cadc50-ecff-11dd-a971-7dbc132099af
Get ninja working for nacl.

- Add support for .asm files for win32
- Add support for msvs_target_platform
- Update x64 test to actually do something meaningful relative to how we
  use configurations.

BUG=None
TEST=None
R=scottmg@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10698023

git-svn-id: http://gyp.googlecode.com/svn/trunk@1422 78cadc50-ecff-11dd-a971-7dbc132099af
ninja windows: check for some required environment variables

If these variables aren't available, some tools error out (unable to create temp files, etc.)

R=thakis@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10733002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1423 78cadc50-ecff-11dd-a971-7dbc132099af
Remove the comment for CONFIGURATION_NAME

It's used for chrome build on Android. Ant needs
to know the build type from this variable:
http://codereview.chromium.org/10669030/

Patch from yongsheng.zhu@intel.com!
Review URL: http://codereview.chromium.org/10661052/

git-svn-id: http://gyp.googlecode.com/svn/trunk@1424 78cadc50-ecff-11dd-a971-7dbc132099af
Preserve the mtime of solibs whose API hasn't changed, and enable ninja restat.

This makes it so that changing component-internal implementation details only
causes the component lib to be rebuilt, not downstream dependencies.

For example touching a content/ .cc file and rebuilding "chrome" causes the .cc
file to be recompiled and the new .o to be relinked into lib/libcontent.so, but
the rebuild ends there, since the chrome binary itself doesn't need to be
relinked.

TEST=The second ninja command in this pipeline doesn't relink chrome: ../ninja chrome && touch content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc && ../ninja chrome

Patch from Ami Fischman <fischman@chromium.org>!
Review URL: http://codereview.chromium.org/10578031/

git-svn-id: http://gyp.googlecode.com/svn/trunk@1425 78cadc50-ecff-11dd-a971-7dbc132099af
ninja mac: Smarter dylib linking.

This ports http://code.google.com/p/gyp/source/detail?r=1425 to mac.

Without this change, incremental (release) builds of chrome after
touching a file in:
base: 10.4s
content: 7.7s
chrome: 12.1s

With this change:
base: 1.7s
content: 5.1s
chrome: 12.1s
Review URL: https://chromiumcodereview.appspot.com/10704054

git-svn-id: http://gyp.googlecode.com/svn/trunk@1426 78cadc50-ecff-11dd-a971-7dbc132099af
Switch the default Visual Studio version to 2010.

You can still select 2008 or 2005 by setting GYP_MSVS_VERSION.

When running tests, try 2010 first (python dictionaries are
not sorted).
Review URL: https://chromiumcodereview.appspot.com/10704065

git-svn-id: http://gyp.googlecode.com/svn/trunk@1427 78cadc50-ecff-11dd-a971-7dbc132099af
Add android makefile generator backend to gyp.

Add a new backend to gyp, "android", which creates Android.mk style 
makefiles. This can be used to build gyp projects as part of the full 
Android system build, to incorporate them into the ROM image. 

Android's existing compilation rules are used where possible, and gyp 
targets are mapped 1:1 onto Android modules (via a name mangling scheme 
to ensure uniqueness). Dependencies are preserved to the best of the 
Android build system's ability (some order-only deps have become full 
deps). 

gyp tests have been updated to work with the Android backend and all 
either pass or are skipped for being inappropriate; however, there is 
currently no support in the test harness for actually running any 
generated executables (as this would require an Android device or 
emulator), and thus the test framework just checks that the executable 
exists and if so, claims success. 

BUG=gyp:275

git-svn-id: http://gyp.googlecode.com/svn/trunk@1428 78cadc50-ecff-11dd-a971-7dbc132099af
Fix Make and Android backend to improve printing of lists

- Avoid trailing whitespace when list is empty
- Use new line for every entry, including first entry

No functional change to generated output.
Review URL: https://chromiumcodereview.appspot.com/10700106

git-svn-id: http://gyp.googlecode.com/svn/trunk@1429 78cadc50-ecff-11dd-a971-7dbc132099af
ninja windows: make solib avoid-relinking test work

Fix symbol export and exe extension to work on Windows. Enable incremental
linking which makes the import lib timestamp be maintained when exports are
unchanged.

See also http://codereview.chromium.org/10704054

R=thakis@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10786019

git-svn-id: http://gyp.googlecode.com/svn/trunk@1430 78cadc50-ecff-11dd-a971-7dbc132099af
Fix how quotes are rendered in ninja and msvs under cygwin.

Specifically, action strings would render like:
   'action': ['python', '-c', 'print \'Hello world!\'']  ->
     bash -c "'python' '-c' 'print \'Hello world!\''" ->
       python -c 'print 'Hello world!'' ->
         print Hello world!

   'action': ['python', '-c', 'print "Hello world"] ->
     bash -c "'python' '-c' 'print "Hello world!"'" ->
       python -c 'print Hello world!' ->
         print Hello world!

Now they'll render as:
   'action': ['python', '-c', 'print \'Hello world!\'']  ->
     bash -c "'python' '-c' 'print '\''Hello world!'\'''" ->
       python -c 'print '\''Hello world!'\''' ->
         print 'Hello world'!

   'action': ['python', '-c', 'print "Hello world"] ->
     bash -c "'python' '-c' 'print \"Hello world!\"'" ->
       python -c 'print \"Hello world!\"' ->
         print "Hello world!"

This will preserve the intent of the original command.

Msvs was failing on the double-quotes test case because contained
quotes were not properly escaped when constructing the
cmd-runs-bash-runs-command line.

There's probably a higher-level bug here which is that quoting needs
to be done in a deterministic (and common) way across all the
generators.

BUG=132157

Review URL: https://chromiumcodereview.appspot.com/10782040

git-svn-id: http://gyp.googlecode.com/svn/trunk@1431 78cadc50-ecff-11dd-a971-7dbc132099af
Modify RegenerateAppendFlag() to skip duplicate values in environment values

This is useful in cases where environment variables are updated by scripts and
so may contain duplicate entries. This change prevents those duplicates from
appearing in the makefile regeneration rule.
Review URL: https://chromiumcodereview.appspot.com/10709007

git-svn-id: http://gyp.googlecode.com/svn/trunk@1432 78cadc50-ecff-11dd-a971-7dbc132099af
When linking an executable, add the -F options.

When linking an executable, every directory in mac_framework_dirs must be
added as a -F option.

Patch from Benjamin Lerman <qsr@chromium.org>!
Review URL: https://chromiumcodereview.appspot.com/10792018/

git-svn-id: http://gyp.googlecode.com/svn/trunk@1433 78cadc50-ecff-11dd-a971-7dbc132099af
Add support for CONFIGURATION_NAME to ninja.

Patch from Benjamin Lerman <qsr@chromium.org>!
Review URL: https://chromiumcodereview.appspot.com/10778037/

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