Add the "bsdiff/" prefix to all include paths.

This prevents accidentally including a header file from another project
that happens to have the same name.

Test: `make checkbuild`; emerge-${BOARD} bsdiff
Bug: None

Change-Id: I8af132ed388738c30a8e3d7434de70b1e9d2f924
diff --git a/Android.bp b/Android.bp
index 25a31c2..fb98989 100644
--- a/Android.bp
+++ b/Android.bp
@@ -16,6 +16,9 @@
     name: "bsdiff_defaults",
     host_supported: true,
     static_libs: ["libbz"],
+    // Allow internal includes to be referenced with the "bsdiff/" prefix in the
+    // path.
+    include_dirs: ["external"],
     export_include_dirs: [
         "include",
         // TODO(deymo): Remove include/bsdiff when all callers use the "bsdiff/"
diff --git a/Makefile b/Makefile
index efba574..2372b76 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@
 BINARIES := $(EXECUTABLES-y) $(LIBRARIES-y)
 
 INSTALL = install
-CPPFLAGS += -Iinclude
+CPPFLAGS += -Iinclude -I..
 CXXFLAGS += -std=c++11 -O3 -Wall -Werror -fPIC
 
 DESTDIR ?=
diff --git a/bsdiff.cc b/bsdiff.cc
index 0fbbe5b..0735ea1 100644
--- a/bsdiff.cc
+++ b/bsdiff.cc
@@ -41,7 +41,7 @@
 
 #include <algorithm>
 
-#include "patch_writer.h"
+#include "bsdiff/patch_writer.h"
 
 namespace bsdiff {
 
diff --git a/bsdiff.gyp b/bsdiff.gyp
index f655de4..694e9cc 100644
--- a/bsdiff.gyp
+++ b/bsdiff.gyp
@@ -21,7 +21,12 @@
     'cflags_cc': [
       '-Wnon-virtual-dtor',
     ],
-    'include_dirs': ['include'],
+    'include_dirs': [
+      'include',
+      # We need this include dir because we include all the local code as
+      # "bsdiff/...".
+      '<(platform2_root)/../aosp/external',
+    ],
   },
   'variables': {
     'bspatch_sources': [
diff --git a/bsdiff_unittest.cc b/bsdiff_unittest.cc
index 7b5657d..ad086e8 100644
--- a/bsdiff_unittest.cc
+++ b/bsdiff_unittest.cc
@@ -8,7 +8,7 @@
 #include <string>
 #include <vector>
 
-#include "test_utils.h"
+#include "bsdiff/test_utils.h"
 
 using std::string;
 using std::vector;
diff --git a/bspatch.cc b/bspatch.cc
index c5f670a..50c870f 100644
--- a/bspatch.cc
+++ b/bspatch.cc
@@ -36,22 +36,22 @@
 #include <inttypes.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <unistd.h>
 
 #include <algorithm>
-#include <memory>
 #include <limits>
+#include <memory>
 #include <vector>
 
+#include "bsdiff/buffer_file.h"
+#include "bsdiff/extents.h"
 #include "bsdiff/extents_file.h"
+#include "bsdiff/file.h"
 #include "bsdiff/file_interface.h"
-#include "buffer_file.h"
-#include "extents.h"
-#include "file.h"
-#include "memory_file.h"
-#include "sink_file.h"
+#include "bsdiff/memory_file.h"
+#include "bsdiff/sink_file.h"
 
 namespace {
 
diff --git a/bspatch_unittest.cc b/bspatch_unittest.cc
index 2a4589d..9792d20 100644
--- a/bspatch_unittest.cc
+++ b/bspatch_unittest.cc
@@ -8,7 +8,7 @@
 
 #include <gtest/gtest.h>
 
-#include "test_utils.h"
+#include "bsdiff/test_utils.h"
 
 namespace bsdiff {
 
diff --git a/buffer_file.cc b/buffer_file.cc
index 01dd6d2..5f8a66d 100644
--- a/buffer_file.cc
+++ b/buffer_file.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "buffer_file.h"
+#include "bsdiff/buffer_file.h"
 
 #include "bsdiff/bspatch.h"
 
diff --git a/bz2_compressor.cc b/bz2_compressor.cc
index 69b27e5..5602145 100644
--- a/bz2_compressor.cc
+++ b/bz2_compressor.cc
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "bz2_compressor.h"
+#include "bsdiff/bz2_compressor.h"
 
 #include <string.h>
 
-#include "logging.h"
+#include "bsdiff/logging.h"
 
 using std::endl;
 
diff --git a/extents.cc b/extents.cc
index 52cf404..e01c946 100644
--- a/extents.cc
+++ b/extents.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "extents.h"
+#include "bsdiff/extents.h"
 
 #include <assert.h>
 #include <errno.h>
diff --git a/extents_file_unittest.cc b/extents_file_unittest.cc
index 0bac750..7dc23be 100644
--- a/extents_file_unittest.cc
+++ b/extents_file_unittest.cc
@@ -4,19 +4,18 @@
 
 #include "bsdiff/extents_file.h"
 
-#include <gtest/gtest.h>
 #include <gmock/gmock.h>
+#include <gtest/gtest.h>
 #include <string>
 #include <vector>
 
 #include "bsdiff/file_interface.h"
 
-using std::string;
 using std::vector;
 using testing::AnyNumber;
-using testing::StrictMock;
-using testing::Return;
 using testing::InSequence;
+using testing::Return;
+using testing::StrictMock;
 using testing::_;
 
 namespace bsdiff {
diff --git a/extents_unittest.cc b/extents_unittest.cc
index 84be2e1..792b90d 100644
--- a/extents_unittest.cc
+++ b/extents_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "extents.h"
+#include "bsdiff/extents.h"
 
 #include <gtest/gtest.h>
 #include <vector>
diff --git a/file.cc b/file.cc
index 11b6104..50f8ef1 100644
--- a/file.cc
+++ b/file.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "file.h"
+#include "bsdiff/file.h"
 
 #include <errno.h>
 #include <fcntl.h>
diff --git a/memory_file.cc b/memory_file.cc
index ec179b9..e948759 100644
--- a/memory_file.cc
+++ b/memory_file.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "memory_file.h"
+#include "bsdiff/memory_file.h"
 
 #include <algorithm>
 #include <string.h>
diff --git a/patch_writer.cc b/patch_writer.cc
index 4c3124c..6e9c325 100644
--- a/patch_writer.cc
+++ b/patch_writer.cc
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "patch_writer.h"
+#include "bsdiff/patch_writer.h"
 
 #include <string.h>
 
-#include "logging.h"
+#include "bsdiff/logging.h"
 
 using std::endl;
 
diff --git a/sink_file.cc b/sink_file.cc
index 5cbd3bd..217787a 100644
--- a/sink_file.cc
+++ b/sink_file.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "sink_file.h"
+#include "bsdiff/sink_file.h"
 
 namespace bsdiff {
 
diff --git a/test_utils.cc b/test_utils.cc
index f369f80..b0538d5 100644
--- a/test_utils.cc
+++ b/test_utils.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "test_utils.h"
+#include "bsdiff/test_utils.h"
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/testrunner.cc b/testrunner.cc
index 8b598e2..f1bde7d 100644
--- a/testrunner.cc
+++ b/testrunner.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "test_utils.h"
+#include "bsdiff/test_utils.h"
 
 #include <gtest/gtest.h>