diff options
author | 2015-08-14 01:28:17 +0000 | |
---|---|---|
committer | 2015-08-14 20:10:55 +0000 | |
commit | 4fd53608d31db8c807ce59190d6617f7535b941a (patch) | |
tree | e84ec8022b419d5c1cf9c7ed53e8c356dfe8572a /src | |
parent | f7d3eb798f8223a884c99350b82a708242d524bf (diff) |
Add an attribute 'per_proto_includes' which can be set on an objc_proto_library overriding the global setting. This is needed as third_party libraries often do not use depot-relative include paths.
RELNOTES: Add objc_proto_library.per_proto_includes attribute.
--
MOS_MIGRATED_REVID=100637689
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibrary.java | 8 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryRule.java | 7 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibrary.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibrary.java index 9bf41d350c..2510fcb80b 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibrary.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibrary.java @@ -158,11 +158,15 @@ public class ObjcProtoLibrary implements RuleConfiguredTargetFactory { ImmutableSet.Builder<PathFragment> searchPathEntriesBuilder = new ImmutableSet.Builder<PathFragment>() .add(workspaceRelativeOutputDir); - if (ruleContext.getConfiguration().getFragment(ObjcConfiguration.class).perProtoIncludes()) { + boolean libPerProtoIncludes = + ruleContext.attributes().get( + ObjcProtoLibraryRule.PER_PROTO_INCLUDES, Type.BOOLEAN); + if (ruleContext.getConfiguration().getFragment(ObjcConfiguration.class).perProtoIncludes() + || libPerProtoIncludes) { searchPathEntriesBuilder .add(generatedProtoDir) .addAll(Iterables.transform(protoGeneratedHeaders, PARENT_PATHFRAGMENT)); - } + } ImmutableSet<PathFragment> searchPathEntries = searchPathEntriesBuilder.build(); ObjcCommon common = new ObjcCommon.Builder(ruleContext) diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryRule.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryRule.java index 273a65baba..ff4903b082 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryRule.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryRule.java @@ -41,6 +41,7 @@ public class ObjcProtoLibraryRule implements RuleDefinition { static final String OPTIONS_FILE_ATTR = "options_file"; static final String OUTPUT_CPP_ATTR = "output_cpp"; static final String USE_OBJC_HEADER_NAMES_ATTR = "use_objc_header_names"; + static final String PER_PROTO_INCLUDES = "per_proto_includes"; static final String LIBPROTOBUF_ATTR = "$lib_protobuf"; @Override @@ -69,6 +70,12 @@ public class ObjcProtoLibraryRule implements RuleDefinition { If true, output headers with .pbobjc.h, rather than .pb.h. ${SYNOPSIS} <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/ + .add(attr(PER_PROTO_INCLUDES, BOOLEAN).value(false)) + /* <!-- #BLAZE_RULE(objc_proto_library).ATTRIBUTE(per_proto_includes) --> + If true, always add all directories to objc_library includes, + overriding --noobjc_per_proto_includes. + ${SYNOPSIS} + <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/ .add(attr(COMPILE_PROTOS_ATTR, LABEL) .allowedFileTypes(FileType.of(".py")) .cfg(HOST) |