Add passive_metrics USE flag to platform2

We want to be able to control the inclusion of the metrics_daemon,
which passively gathers power stats and the like and sends them
through the UMA pipeline iff the user has opted-in to metrics
collection.

CQ-DEPEND=CL:177244, CL:177291
BUG=None
TEST=emerge platform2 with USE='-passive_metrics' on and off, with and without FEATURES=test

Change-Id: Id6af84d3de585a156d8ebbcc23117df000de080d
Reviewed-on: https://chromium-review.googlesource.com/177217
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
Commit-Queue: Chris Masone <cmasone@chromium.org>
diff --git a/metrics/metrics.gyp b/metrics/metrics.gyp
index b2644ba..67e7c37 100644
--- a/metrics/metrics.gyp
+++ b/metrics/metrics.gyp
@@ -53,11 +53,6 @@
       ]
     },
     {
-      'target_name': 'metrics_daemon',
-      'type': 'executable',
-      'dependencies': ['libmetrics_daemon'],
-    },
-    {
       'target_name': 'metrics_client',
       'type': 'executable',
       'dependencies': ['libmetrics'],
@@ -67,6 +62,15 @@
     },
   ],
   'conditions': [
+    ['USE_passive_metrics == 1', {
+      'targets': [
+        {
+          'target_name': 'metrics_daemon',
+          'type': 'executable',
+          'dependencies': ['libmetrics_daemon'],
+        },
+      ],
+    }],
     ['USE_test == 1', {
       'targets': [
         {
@@ -79,17 +83,6 @@
           ]
         },
         {
-          'target_name': 'metrics_daemon_test',
-          'type': 'executable',
-          'dependencies': [
-            'libmetrics_daemon',
-          ],
-          'includes': ['../common-mk/common_test.gypi'],
-          'sources': [
-            'metrics_daemon_test.cc',
-          ]
-        },
-        {
           'target_name': 'counter_test',
           'type': 'executable',
           'includes': ['../common-mk/common_test.gypi'],
@@ -109,5 +102,20 @@
         },
       ],
     }],
+    ['USE_passive_metrics == 1 and USE_test == 1', {
+      'targets': [
+        {
+          'target_name': 'metrics_daemon_test',
+          'type': 'executable',
+          'dependencies': [
+            'libmetrics_daemon',
+          ],
+          'includes': ['../common-mk/common_test.gypi'],
+          'sources': [
+            'metrics_daemon_test.cc',
+          ]
+        },
+      ],
+    }],
   ],
 }