Migrate android providers to use BuiltinProvider instead of NativeProvider
RELNOTES: None.
PiperOrigin-RevId: 200096226
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java b/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
index ca706fc..f69a2c8 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
@@ -975,6 +975,19 @@
}
/**
+ * Returns the declared provider (native and Skylark) for the specified constructor under the
+ * specified attribute of this target in the BUILD file. May return null if there is no
+ * TransitiveInfoCollection under the specified attribute.
+ */
+ @Nullable
+ public <T extends Info> T getPrerequisite(
+ String attributeName, Mode mode, final BuiltinProvider<T> skylarkKey) {
+ TransitiveInfoCollection prerequisite = getPrerequisite(attributeName, mode);
+ return prerequisite == null ? null : prerequisite.get(skylarkKey);
+ }
+
+
+ /**
* Returns all the providers of the specified type that are listed under the specified attribute
* of this target in the BUILD file, and that contain the specified provider.
*/