aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2018-08-13 04:00:32 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-08-13 04:02:40 -0700
commit5d46f327041ade0a6314ba0859baef919730c796 (patch)
tree90476b5313a7771d0c686332dba3cefa502d7c49 /src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java
parent08968ed56a0d5ff7f983edc7f5ebbfe85a72b8e0 (diff)
bazel: handle proto_src_root when dealing with proto includes, generated files and C++ headers
This change completes the handling of proto_src_root when it comes to inclusion of protos, generating the proto files in the right place and adding the generated headers to the include paths. WANT_LGTM=elenairina RELNOTES: None. PiperOrigin-RevId: 208457740
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java
index 4266f667f1..319f7d84f0 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java
@@ -175,6 +175,16 @@ public abstract class CcLibrary implements RuleConfiguredTargetFactory {
compilationHelper.addPublicTextualHeaders(
ruleContext.getPrerequisiteArtifacts("textual_hdrs", Mode.TARGET).list());
}
+ if (ruleContext.getRule().isAttrDefined("include_prefix", Type.STRING)
+ && ruleContext.attributes().isAttributeValueExplicitlySpecified("include_prefix")) {
+ compilationHelper.setIncludePrefix(
+ ruleContext.attributes().get("include_prefix", Type.STRING));
+ }
+ if (ruleContext.getRule().isAttrDefined("strip_include_prefix", Type.STRING)
+ && ruleContext.attributes().isAttributeValueExplicitlySpecified("strip_include_prefix")) {
+ compilationHelper.setStripIncludePrefix(
+ ruleContext.attributes().get("strip_include_prefix", Type.STRING));
+ }
if (common.getLinkopts().contains("-static")) {
ruleContext.attributeWarning("linkopts", "Using '-static' here won't work. "