ninja: Don't rerun actions/rules based on where gyp was invoked

Right now, ninja generates unique names for actions/rules by combining the
action/rule name with a hash on the qualified_target.  However, the path of the
qualified_target is relative to where gyp was invoked from.  So, the following
gyp command:

  gyp --depth=. foo/bar.gyp

will generate a different hash than:

  cd foo
  gyp --depth=../ bar.gyp

Since the hash is different, this causes actions/rules to get rerun based on
where gyp happened to be invoked from.

This commit fixes this issue by using a qualified_target relative to the
toplevel_dir, rather than the current working directory.  Also, the
self.qualified_target in NinjaWriter is only used for the hash, so we can
remove it and replace it with a precomputed hash for all actions/rules.

BUG=
R=scottmg@chromium.org

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

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