Fake a JavaStrictCompilationArgsProvider if there's none.
There were convoluted cases with multiple JavaInfo created from Skylark that
didn't have the JavaStrictCompilationArgsProvider. If these were to be merged
and later forwarded with exports we would miss them as dependencies.
RELNOTES: None
@@ -553,6 +553,16 @@ public final class JavaInfo extends NativeInfo implements JavaInfoApi<Artifact>
}
public JavaInfo build() {
+ // TODO(twerth): Clean up after we remove java_proto_library.strict_deps.
+ // Instead of teaching every (potential Skylark) caller to also create the provider for strict
+ // deps we wrap the non strict provider instead.
+ if (!providerMap.contains(JavaStrictCompilationArgsProvider.class)
+ && providerMap.contains(JavaCompilationArgsProvider.class)) {
+ JavaStrictCompilationArgsProvider javaStrictCompilationArgsProvider =
+ new JavaStrictCompilationArgsProvider(
+ providerMap.getProvider(JavaCompilationArgsProvider.class));
+ addProvider(JavaStrictCompilationArgsProvider.class, javaStrictCompilationArgsProvider);
+ }
return new JavaInfo(providerMap.build(), runtimeJars, neverlink, javaConstraints, location);
}
}
