diff options
author | Carmi Grushko <carmi@google.com> | 2016-11-29 23:52:40 +0000 |
---|---|---|
committer | Irina Iancu <elenairina@google.com> | 2016-11-30 08:07:25 +0000 |
commit | 7866f9af6a0b9ab899b538e6fb098ed69871d0e6 (patch) | |
tree | ee5255f3808853c0f6596e40f92b23b940c2b54e /src/main/java/com/google/devtools/build/lib/rules/proto/BazelProtoLibrary.java | |
parent | 27b95ea1ca23bc2616dcf2596d94e1b1d244f74e (diff) |
Default behavior of proto_library's strict-proto-deps is now determined by the value of a flag.
Used to be hardcoded to "yes, check for strict proto deps" because the value of the "strict_proto_deps" attributes was "true".
--
MOS_MIGRATED_REVID=140538461
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/proto/BazelProtoLibrary.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/proto/BazelProtoLibrary.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/proto/BazelProtoLibrary.java b/src/main/java/com/google/devtools/build/lib/rules/proto/BazelProtoLibrary.java index b81e6e0a70..3557c5f95c 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/proto/BazelProtoLibrary.java +++ b/src/main/java/com/google/devtools/build/lib/rules/proto/BazelProtoLibrary.java @@ -16,7 +16,7 @@ package com.google.devtools.build.lib.rules.proto; import static com.google.devtools.build.lib.analysis.RuleConfiguredTarget.Mode.TARGET; import static com.google.devtools.build.lib.collect.nestedset.Order.STABLE_ORDER; -import static com.google.devtools.build.lib.syntax.Type.BOOLEAN; +import static com.google.devtools.build.lib.rules.proto.ProtoCommon.areDepsStrict; import com.google.common.base.Predicates; import com.google.common.collect.ImmutableList; @@ -52,9 +52,7 @@ public class BazelProtoLibrary implements RuleConfiguredTargetFactory { transitiveImports, transitiveImports, protoSources, checkDepsProtoSources); NestedSet<Artifact> protosInDirectDeps = - ruleContext.attributes().get("strict_proto_deps", BOOLEAN) - ? ProtoCommon.computeProtosInDirectDeps(ruleContext) - : null; + areDepsStrict(ruleContext) ? ProtoCommon.computeProtosInDirectDeps(ruleContext) : null; final SupportData supportData = SupportData.create( @@ -69,7 +67,7 @@ public class BazelProtoLibrary implements RuleConfiguredTargetFactory { RuleConfiguredTargetBuilder result = new RuleConfiguredTargetBuilder(ruleContext); - if (checkDepsProtoSources.isEmpty()) { + if (checkDepsProtoSources.isEmpty() || !outputDescriptorSetFlagEnabled(ruleContext)) { result.setFilesToBuild(NestedSetBuilder.<Artifact>create(STABLE_ORDER)); } else { Artifact descriptorSetOutput = @@ -97,4 +95,11 @@ public class BazelProtoLibrary implements RuleConfiguredTargetFactory { .addSkylarkTransitiveInfo(ProtoSourcesProvider.SKYLARK_NAME, sourcesProvider) .build(); } + + private boolean outputDescriptorSetFlagEnabled(RuleContext ruleContext) { + return ruleContext + .getConfiguration() + .getFragment(ProtoConfiguration.class) + .outputDescriptorSet(); + } } |