Skip to content

Commit

Permalink
Allow rules to consume CcLinkParamsProviders provided by Skylark rules.
Browse files Browse the repository at this point in the history
--
MOS_MIGRATED_REVID=135457049
  • Loading branch information
dslomov authored and damienmg committed Oct 7, 2016
1 parent fd2bdc3 commit cae7a0f
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,18 @@ public final class CcLinkParamsProvider extends SkylarkClassObject
new Function<TransitiveInfoCollection, CcLinkParamsStore>() {
@Override
public CcLinkParamsStore apply(TransitiveInfoCollection input) {
CcLinkParamsProvider provider = input.getProvider(
CcLinkParamsProvider.class);
return provider == null ? null : provider.getCcLinkParamsStore();
// Try native first...
CcLinkParamsProvider provider = input.getProvider(CcLinkParamsProvider.class);
if (provider != null) {
return provider.getCcLinkParamsStore();
}

// ... then try Skylark.
provider = (CcLinkParamsProvider) input.get(CC_LINK_PARAMS.getKey());
if (provider != null) {
return provider.getCcLinkParamsStore();
}
return null;
}
};

Expand Down

0 comments on commit cae7a0f

Please sign in to comment.