Skip to content

Commit

Permalink
Advertise "java" provider on j_p_l rules
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 221694570
  • Loading branch information
cushon authored and Copybara-Service committed Nov 15, 2018
1 parent b2a86c5 commit e636d30
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ public final class JavaSkylarkApiProvider extends SkylarkApiProvider
/** The name of the field in Skylark used to access this class. */
public static final String NAME = "java";
/** The name of the field in Skylark proto aspects used to access this class. */
public static final SkylarkProviderIdentifier SKYLARK_NAME =
SkylarkProviderIdentifier.forLegacy(NAME);

// This is legacy from when we had a "java" provider on the base proto_library,
// forcing us to use a different name ("proto_java") for the aspect's provider.
// For backwards compatibility we retain proto_java as well.
public static final SkylarkProviderIdentifier PROTO_NAME =
SkylarkProviderIdentifier.forLegacy("proto_java");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,13 @@ public AspectDefinition getDefinition(AspectParameters aspectParameters) {
.requiresConfigurationFragments(JavaConfiguration.class, ProtoConfiguration.class)
.requireProviders(ProtoSourcesProvider.class)
.advertiseProvider(JavaProtoLibraryAspectProvider.class)
.advertiseProvider(ImmutableList.of(JavaSkylarkApiProvider.PROTO_NAME))
.advertiseProvider(
ImmutableList.of(
JavaSkylarkApiProvider.SKYLARK_NAME,
// This is legacy from when we had a "java" provider on the base proto_library,
// forcing us to use a different name ("proto_java") for the aspect's provider.
// For backwards compatibility we retain proto_java as well.
JavaSkylarkApiProvider.PROTO_NAME))
.add(
attr(JavaProtoAspectCommon.LITE_PROTO_TOOLCHAIN_ATTR, LABEL)
.mandatoryNativeProviders(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,13 @@ public AspectDefinition getDefinition(AspectParameters aspectParameters) {
.requiresConfigurationFragments(JavaConfiguration.class, ProtoConfiguration.class)
.requireProviders(ProtoSourcesProvider.class)
.advertiseProvider(JavaProtoLibraryAspectProvider.class)
.advertiseProvider(ImmutableList.of(JavaSkylarkApiProvider.PROTO_NAME))
.advertiseProvider(
ImmutableList.of(
JavaSkylarkApiProvider.SKYLARK_NAME,
// This is legacy from when we had a "java" provider on the base proto_library,
// forcing us to use a different name ("proto_java") for the aspect's provider.
// For backwards compatibility we retain proto_java as well.
JavaSkylarkApiProvider.PROTO_NAME))
.add(
attr(JavaProtoAspectCommon.SPEED_PROTO_TOOLCHAIN_ATTR, LABEL)
// TODO(carmi): reinstate mandatoryNativeProviders(ProtoLangToolchainProvider)
Expand Down

0 comments on commit e636d30

Please sign in to comment.