Build update_engine from the new directory path.

The update_engine ebuild recreates the old directory structure placing
update_engine as a subdirectory of platform2 in the build environment.
This structure doesn't match the current location of the code and
breaks incremental builds creating symlinks to update_engine in
platform2/ and even in the new update_engine directory.

This patch modifies the .gyp file to reference platform2 sources via
the platform2_root gyp variable and builds update_engine from the new
path. This fixes incremental builds.

For this change to take effect in Chrome OS, the ebuild file is updated
in a separated CL.

BUG=None
TEST=emerge-link update_engine; cros_workon_make update_engine

Change-Id: Icedd344df5c36b0d6ce07bb5c7714eed4e87e590
diff --git a/update_engine.gyp b/update_engine.gyp
index e038939..c771153 100644
--- a/update_engine.gyp
+++ b/update_engine.gyp
@@ -47,6 +47,11 @@
       'USE_MTD=<(USE_mtd)',
       'USE_POWER_MANAGEMENT=<(USE_power_management)',
     ],
+    'include_dirs': [
+      # We need this include dir because we include all the local code as
+      # "update_engine/...".
+      '<(platform2_root)/../aosp/system',
+    ],
   },
   'targets': [
     # Protobufs.
@@ -71,7 +76,7 @@
       'sources': [
         'update_metadata.proto'
       ],
-      'includes': ['../common-mk/protoc.gypi'],
+      'includes': ['../../../platform2/common-mk/protoc.gypi'],
     },
     # Chrome D-Bus bindings.
     {
@@ -83,7 +88,7 @@
       'sources': [
         'dbus_bindings/org.chromium.UpdateEngineInterface.xml',
       ],
-      'includes': ['../common-mk/generate-dbus-adaptors.gypi'],
+      'includes': ['../../../platform2/common-mk/generate-dbus-adaptors.gypi'],
     },
     {
       'target_name': 'update_engine-other-dbus-proxies',
@@ -99,7 +104,7 @@
             '<(platform2_root)/shill/dbus_bindings/org.chromium.flimflam.Manager.xml',
             '<(platform2_root)/shill/dbus_bindings/org.chromium.flimflam.Service.xml',
           ],
-          'includes': ['../common-mk/generate-dbus-proxies.gypi'],
+          'includes': ['../../../platform2/common-mk/generate-dbus-proxies.gypi'],
         },
         {
           'action_name': 'update_engine-dbus-debugd-client',
@@ -110,7 +115,7 @@
           'sources': [
             '<(platform2_root)/debugd/share/org.chromium.debugd.xml',
           ],
-          'includes': ['../common-mk/generate-dbus-proxies.gypi'],
+          'includes': ['../../../platform2/common-mk/generate-dbus-proxies.gypi'],
         },
         {
           'action_name': 'update_engine-dbus-login_manager-client',
@@ -121,7 +126,7 @@
           'sources': [
             '<(platform2_root)/login_manager/org.chromium.SessionManagerInterface.xml',
           ],
-          'includes': ['../common-mk/generate-dbus-proxies.gypi'],
+          'includes': ['../../../platform2/common-mk/generate-dbus-proxies.gypi'],
         },
         {
           'action_name': 'update_engine-dbus-power_manager-client',
@@ -132,7 +137,7 @@
           'sources': [
             '<(platform2_root)/power_manager/dbus_bindings/org.chromium.PowerManager.xml',
           ],
-          'includes': ['../common-mk/generate-dbus-proxies.gypi'],
+          'includes': ['../../../platform2/common-mk/generate-dbus-proxies.gypi'],
         },
         {
           'action_name': 'update_engine-dbus-libcros-client',
@@ -143,7 +148,7 @@
           'sources': [
             'dbus_bindings/org.chromium.LibCrosService.xml',
           ],
-          'includes': ['../common-mk/generate-dbus-proxies.gypi'],
+          'includes': ['../../../platform2/common-mk/generate-dbus-proxies.gypi'],
         },
       ],
     },
@@ -314,7 +319,7 @@
           'sources': [
             'dbus_bindings/org.chromium.UpdateEngineInterface.xml',
           ],
-          'includes': ['../common-mk/generate-dbus-proxies.gypi'],
+          'includes': ['../../../platform2/common-mk/generate-dbus-proxies.gypi'],
         },
       ]
     },
@@ -406,7 +411,7 @@
             'unittest_key.pem',
             'unittest_key2.pem',
           ],
-          'includes': ['../common-mk/openssl_pem.gypi'],
+          'includes': ['../../../platform2/common-mk/openssl_pem.gypi'],
         },
         # Unpacks sample images used for testing.
         {
@@ -433,7 +438,7 @@
         {
           'target_name': 'update_engine_unittests',
           'type': 'executable',
-          'includes': ['../common-mk/common_test.gypi'],
+          'includes': ['../../../platform2/common-mk/common_test.gypi'],
           'variables': {
             'deps': [
               'libchromeos-test-<(libbase_ver)',
@@ -444,7 +449,7 @@
             'libupdate_engine',
             'libpayload_generator',
           ],
-          'includes': ['../common-mk/common_test.gypi'],
+          'includes': ['../../../platform2/common-mk/common_test.gypi'],
           'sources': [
             'action_pipe_unittest.cc',
             'action_processor_unittest.cc',