title: The hdrs of cc_library seems not working of Bazel
body: <p>I'm working on a project, which depends on a third party project, let's say project <code>E</code>, which is a <strong>precompiled</strong> libraries. I've set a new <code>repository_rule</code> and invoked it in the <code>workspace.bzl</code>, and in the <code>BUILD</code> of the project <code>E</code>, the corresponding library rule has been set like following:</p>
  
  <pre><code>cc_library(
      name = "e_lib",
      srcs = [
          "@e//:e_lib1",
          "@e//:e_lib2",
      ],
      hdrs = ["@e//:e_headers"],
      visibility = ["//visibility:public"],
  )
  </code></pre>
  
  <p>And the target <code>e_lib1</code>, <code>e_lib2</code> and <code>e_headers</code> are defined in the file <code>e.BUILD</code>, and it is correctly symblo linked to the downloaded contents folder in the last part of implementation function of <code>repository_rule</code>.</p>
  
  <p>The <code>e.BUILD</code> is something like:</p>
  
  <pre><code>filegroup(
      name = "e_headers",
      srcs = glob(["include/*"]),
      visibility = ["//visibility:public"],
  )
  
  filegroup(
      name = "e_lib1",
      srcs = if_darwin(["lib/lib1.dylib"])
           + if_linux_x86_64(["lib/lib1.so"]),
      visibility = ["//visibility:public"],
  )
  
  filegroup(
      name = "e_lib2",
      srcs = if_darwin(["lib/lib2.dylib"])
           + if_linux_x86_64(["lib/lib2.so"]),
      visibility = ["//visibility:public"],
  )
  </code></pre>
  
  <p>Let's say there is a header <code>baz.h</code> in the directory <code>include</code> of the project <code>E</code>.But during the building phase, an error, <code>baz.h</code> file not found, occurred when bazel tried to compile a file <code>core.cc</code>. The pseudocodes are something like:</p>
  
  <pre><code>// core.cc
  #include "core.h"
  ...
  
  // core.h
  #include "im.h"
  ...
  
  // im.h
  #include "baz.h"
  // This file doesn't have the corresponding
  // .cc file since all the implementations
  // are put in this header.
  </code></pre>
  
  <p>The dependency of these files is <code>core.cc -&gt; core.h -&gt; im.h -&gt; baz.h</code>, and the building rule of <code>core.cc</code> is:</p>
  
  <pre><code>cc_library(
      name = "core",
      srcs = [
          "core.cc",
      ],
      hdrs = "core.h",
      deps = [
          "//third_party/E:e_lib"],
      alwayslink = 1,
  )
  </code></pre>
  
  <p>So is there something wrong with my <code>BUILD</code> file? I guess that maybe the <code>core.cc</code> doesn't directly depend on the <code>e_lib</code>, so the <code>deps</code> of it is actually useless. Should I build a <code>cc_library</code> for the <code>im.h</code>?</p>