Skip to content

Commit

Permalink
Return ProviderStub for ProtoInfo before override
Browse files Browse the repository at this point in the history
Returning None fails type-check, when a rule with ProtoInfo is loaded from WORKSPACE context (builtins are not applied).

Worksaround: #17713
PiperOrigin-RevId: 523387385
Change-Id: I08408a6209de9c266bf10f4584f76f0341029fd5
  • Loading branch information
comius authored and copybara-github committed Apr 11, 2023
1 parent dd99cb1 commit e2d406c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/packages/semantics",
"//src/main/java/com/google/devtools/build/lib/starlarkbuildapi",
"//src/main/java/com/google/devtools/build/lib/starlarkbuildapi/core",
"//src/main/java/com/google/devtools/build/lib/starlarkbuildapi/stubs",
"//src/main/java/net/starlark/java/annot",
"//src/main/java/net/starlark/java/eval",
"//third_party:guava",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import com.google.devtools.build.lib.starlarkbuildapi.core.Bootstrap;
import com.google.devtools.build.lib.starlarkbuildapi.core.ContextAndFlagGuardedValue;
import com.google.devtools.build.lib.starlarkbuildapi.core.ProviderApi;
import com.google.devtools.build.lib.starlarkbuildapi.stubs.ProviderStub;
import net.starlark.java.eval.FlagGuardedValue;
import net.starlark.java.eval.Starlark;

/** A {@link Bootstrap} for Starlark objects related to protocol buffers. */
public class ProtoBootstrap implements Bootstrap {
Expand Down Expand Up @@ -60,7 +60,7 @@ public void addBindingsToBuilder(ImmutableMap.Builder<String, Object> builder) {
PROTO_INFO_STARLARK_NAME,
ContextAndFlagGuardedValue.onlyInAllowedReposOrWhenIncompatibleFlagIsFalse(
BuildLanguageOptions.INCOMPATIBLE_STOP_EXPORTING_LANGUAGE_MODULES,
Starlark.NONE,
new ProviderStub(),
allowedRepositories));
builder.put(
PROTO_COMMON_NAME,
Expand Down

0 comments on commit e2d406c

Please sign in to comment.