Skip to content

Commit

Permalink
Add documentation for add{Skylark,Native}DeclaredProvider.
Browse files Browse the repository at this point in the history
--
PiperOrigin-RevId: 140904064
MOS_MIGRATED_REVID=140904064
  • Loading branch information
dslomov authored and damienmg committed Dec 5, 2016
1 parent 8d90a6d commit 16d8fec
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,13 @@ public RuleConfiguredTargetBuilder addSkylarkTransitiveInfo(
return this;
}

/**
* Adds a "declared provider" defined in Skylark to the rule.
* Use this method for declared providers defined in Skyark.
*
* Use {@link #addNativeDeclaredProvider(SkylarkClassObject)} in definitions of
* native rules.
*/
public RuleConfiguredTargetBuilder addSkylarkDeclaredProvider(
SkylarkClassObject provider, Location loc) throws EvalException {
SkylarkClassObjectConstructor constructor = provider.getConstructor();
Expand All @@ -298,6 +305,13 @@ public RuleConfiguredTargetBuilder addSkylarkDeclaredProvider(
return this;
}

/**
* Adds a "declared provider" defined in native code to the rule.
* Use this method for declared providers in definitions of native rules.
*
* Use {@link #addSkylarkDeclaredProvider(SkylarkClassObject, Location)}
* for Skylark rule implementations.
*/
public RuleConfiguredTargetBuilder addNativeDeclaredProvider(SkylarkClassObject provider) {
SkylarkClassObjectConstructor constructor = provider.getConstructor();
Preconditions.checkState(constructor.isExported());
Expand Down

0 comments on commit 16d8fec

Please sign in to comment.