Check reused source files in hasSrcExt

hasSrcExt is used to determine extra flags and dependencies when
generated files are used.  If the generated files are being handled
in a static library whose objects are reused in a shared library,
the flags and dependencies still need to apply.  Instead of clearing
the source files in the shared library, move them to an OriginalSrcs
property, and check that in hasSrcExt along with the Srcs property.

Also pass extra exported include directories from the static
library to the shared library.

Bug: 37555583
Test: use protos in a cc_library
Change-Id: I709779ec03b66b220b7bd58a1f6f0b9b5067d955
diff --git a/cc/cc.go b/cc/cc.go
index bbdcf6f..f368a13 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -950,7 +950,9 @@
 
 		if tag == reuseObjTag {
 			if l, ok := cc.compiler.(libraryInterface); ok {
-				depPaths.Objs = depPaths.Objs.Append(l.reuseObjs())
+				objs, flags := l.reuseObjs()
+				depPaths.Objs = depPaths.Objs.Append(objs)
+				depPaths.ReexportedFlags = append(depPaths.ReexportedFlags, flags...)
 				return
 			}
 		}