Include the implemented header first in all projects.
The Google C++ style guide dictates that foo.cc and foo_unittest.cc
should include foo.h in the first place, so missing headers in foo.h
are detected with a compile error of the module implementing them and
not when another module uses them.
This CL sweeps across all the .cc file in platform2 enforcing this.
BUG=None
TEST=cbuildbot amd64-generic
Change-Id: I41835835caba13f54c3c844ecf552eb0e47efa9d
Reviewed-on: https://chromium-review.googlesource.com/228894
Tested-by: Alex Deymo <[email protected]>
Reviewed-by: Alex Deymo <[email protected]>
Commit-Queue: Alex Vakulenko <[email protected]>
diff --git a/update_manager/boxed_value.cc b/update_manager/boxed_value.cc
index 2307f8d..0acc8cd 100644
--- a/update_manager/boxed_value.cc
+++ b/update_manager/boxed_value.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "update_engine/update_manager/boxed_value.h"
+
#include <stdint.h>
#include <set>
@@ -10,7 +12,6 @@
#include <base/strings/string_number_conversions.h>
#include <base/time/time.h>
-#include "update_engine/update_manager/boxed_value.h"
#include "update_engine/update_manager/shill_provider.h"
#include "update_engine/update_manager/updater_provider.h"
#include "update_engine/utils.h"
diff --git a/update_manager/boxed_value_unittest.cc b/update_manager/boxed_value_unittest.cc
index 77b44c2..62f4bfe 100644
--- a/update_manager/boxed_value_unittest.cc
+++ b/update_manager/boxed_value_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "update_engine/update_manager/boxed_value.h"
+
#include <gtest/gtest.h>
#include <list>
#include <map>
@@ -11,7 +13,6 @@
#include <base/strings/stringprintf.h>
#include <base/time/time.h>
-#include "update_engine/update_manager/boxed_value.h"
#include "update_engine/update_manager/shill_provider.h"
#include "update_engine/update_manager/umtest_utils.h"
#include "update_engine/update_manager/updater_provider.h"
diff --git a/update_manager/evaluation_context_unittest.cc b/update_manager/evaluation_context_unittest.cc
index f38b641..c5cc883 100644
--- a/update_manager/evaluation_context_unittest.cc
+++ b/update_manager/evaluation_context_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "update_engine/update_manager/evaluation_context.h"
+
#include <memory>
#include <string>
@@ -10,7 +12,6 @@
#include "update_engine/fake_clock.h"
#include "update_engine/test_utils.h"
-#include "update_engine/update_manager/evaluation_context.h"
#include "update_engine/update_manager/fake_variable.h"
#include "update_engine/update_manager/generic_variables.h"
#include "update_engine/update_manager/mock_variable.h"
diff --git a/update_manager/real_random_provider.cc b/update_manager/real_random_provider.cc
index ea10de6..47cb31d 100644
--- a/update_manager/real_random_provider.cc
+++ b/update_manager/real_random_provider.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "update_engine/update_manager/real_random_provider.h"
+
#include <stdio.h>
#include <unistd.h>
@@ -11,7 +13,6 @@
#include <base/files/scoped_file.h>
#include <base/strings/stringprintf.h>
-#include "update_engine/update_manager/real_random_provider.h"
#include "update_engine/update_manager/variable.h"
using std::string;
diff --git a/update_manager/real_random_provider_unittest.cc b/update_manager/real_random_provider_unittest.cc
index d7dfeb2..0deba4c 100644
--- a/update_manager/real_random_provider_unittest.cc
+++ b/update_manager/real_random_provider_unittest.cc
@@ -2,11 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "update_engine/update_manager/real_random_provider.h"
+
#include <gtest/gtest.h>
#include <memory>
-#include "update_engine/update_manager/real_random_provider.h"
#include "update_engine/update_manager/umtest_utils.h"
using std::unique_ptr;
diff --git a/update_manager/real_shill_provider_unittest.cc b/update_manager/real_shill_provider_unittest.cc
index b384e67..641a5c3 100644
--- a/update_manager/real_shill_provider_unittest.cc
+++ b/update_manager/real_shill_provider_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "update_engine/update_manager/real_shill_provider.h"
+
#include <memory>
#include <utility>
@@ -13,7 +15,6 @@
#include "update_engine/fake_clock.h"
#include "update_engine/mock_dbus_wrapper.h"
#include "update_engine/test_utils.h"
-#include "update_engine/update_manager/real_shill_provider.h"
#include "update_engine/update_manager/umtest_utils.h"
using base::Time;
diff --git a/update_manager/real_time_provider_unittest.cc b/update_manager/real_time_provider_unittest.cc
index 3532ff3..7e27a4e 100644
--- a/update_manager/real_time_provider_unittest.cc
+++ b/update_manager/real_time_provider_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "update_engine/update_manager/real_time_provider.h"
+
#include <memory>
#include <base/logging.h>
@@ -9,7 +11,6 @@
#include <gtest/gtest.h>
#include "update_engine/fake_clock.h"
-#include "update_engine/update_manager/real_time_provider.h"
#include "update_engine/update_manager/umtest_utils.h"
using base::Time;
diff --git a/update_manager/umtest_utils.cc b/update_manager/umtest_utils.cc
index 41dc0a6..be6a86f 100644
--- a/update_manager/umtest_utils.cc
+++ b/update_manager/umtest_utils.cc
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <base/time/time.h>
-
#include "update_engine/update_manager/umtest_utils.h"
+#include <base/time/time.h>
+
namespace chromeos_update_manager {
const unsigned UmTestUtils::kDefaultTimeoutInSeconds = 1;
diff --git a/update_manager/update_manager_unittest.cc b/update_manager/update_manager_unittest.cc
index c0ce092..1d79c5c 100644
--- a/update_manager/update_manager_unittest.cc
+++ b/update_manager/update_manager_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "update_engine/update_manager/update_manager.h"
+
#include <unistd.h>
#include <algorithm>
@@ -22,7 +24,6 @@
#include "update_engine/update_manager/fake_state.h"
#include "update_engine/update_manager/mock_policy.h"
#include "update_engine/update_manager/umtest_utils.h"
-#include "update_engine/update_manager/update_manager.h"
using base::Bind;
using base::Callback;