aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaProtoSkylarkCommon.java
diff options
context:
space:
mode:
authorGravatar Irina Iancu <elenairina@google.com>2017-02-17 15:07:06 +0000
committerGravatar Irina Iancu <elenairina@google.com>2017-02-20 09:40:25 +0000
commitb1d3f5ffb11151de097311cc3e91bdc44eb0df13 (patch)
tree7e0a86324386e5499ca27a284012498e7154a47c /src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaProtoSkylarkCommon.java
parent463a957a381a1473a973cd88217a12423e9dcd09 (diff)
Progress on Skylarkified java_lite_proto_library.
* Exposed transitive_runtime_jars from the former black-box JavaProvider. * Added support for aliases. * Returned the runfiles from the Skylark rule of java_lite_proto_library. -- PiperOrigin-RevId: 147834471 MOS_MIGRATED_REVID=147834471
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaProtoSkylarkCommon.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaProtoSkylarkCommon.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaProtoSkylarkCommon.java b/src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaProtoSkylarkCommon.java
index 6f07c4683c..8cb64b0fec 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaProtoSkylarkCommon.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaProtoSkylarkCommon.java
@@ -84,6 +84,18 @@ public class JavaProtoSkylarkCommon {
}
@SkylarkCallable(
+ name = "has_proto_sources",
+ doc = "Returns whether the given proto_library target contains proto sources. If there are no"
+ + " sources it means that the proto_library is an alias library, which exports its"
+ + " dependencies."
+ )
+ public static boolean hasProtoSources(ConfiguredTarget target) {
+ SupportData supportData =
+ checkNotNull(target.getProvider(ProtoSupportDataProvider.class).getSupportData());
+ return supportData.hasProtoSources();
+ }
+
+ @SkylarkCallable(
name = "toolchain_deps",
// This function is experimental for now.
documented = false,