Skip to content

Commit 7d701d1

Browse files
rickeylevfweikert
authored andcommitted
python: port PyWrapCcInfo to Starlark and enable it
Because providers are based on identity, and there are Java tests that need to reference the provider, it's hard to split up the changes, so it's all in a single change. The Java class is kept to make usage by the Java tests easier; it isn't actually used outside of tests. Work towards bazelbuild#15897 PiperOrigin-RevId: 523748496 Change-Id: I1f5e9316bb3c4aed6c36fbd317914e4deea26f61
1 parent b77cb78 commit 7d701d1

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,7 @@ public void init(ConfiguredRuleClassProvider.Builder builder) {
474474
new PyBootstrap(
475475
PyInfo.PROVIDER,
476476
PyStarlarkTransitions.INSTANCE,
477-
new GoogleLegacyStubs.PyWrapCcHelper(),
478-
new GoogleLegacyStubs.PyWrapCcInfoProvider()));
477+
new GoogleLegacyStubs.PyWrapCcHelper()));
479478

480479
builder.addSymlinkDefinition(PySymlink.PY2);
481480
builder.addSymlinkDefinition(PySymlink.PY3);

src/main/java/com/google/devtools/build/lib/starlarkbuildapi/python/PyBootstrap.java

+3-6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import com.google.devtools.build.lib.starlarkbuildapi.core.Bootstrap;
2222
import com.google.devtools.build.lib.starlarkbuildapi.core.ContextAndFlagGuardedValue;
2323
import com.google.devtools.build.lib.starlarkbuildapi.cpp.PyWrapCcHelperApi;
24-
import com.google.devtools.build.lib.starlarkbuildapi.cpp.PyWrapCcInfoApi;
2524
import com.google.devtools.build.lib.starlarkbuildapi.python.PyInfoApi.PyInfoProviderApi;
2625
import com.google.devtools.build.lib.starlarkbuildapi.stubs.ProviderStub;
2726
import net.starlark.java.eval.FlagGuardedValue;
@@ -38,17 +37,14 @@ public class PyBootstrap implements Bootstrap {
3837
private final PyInfoProviderApi pyInfoProviderApi;
3938
private final PyStarlarkTransitionsApi pyStarlarkTransitionsApi;
4039
private final PyWrapCcHelperApi<?, ?, ?, ?, ?, ?, ?, ?, ?> pyWrapCcHelper;
41-
private final PyWrapCcInfoApi.Provider pyWrapCcInfoProvider;
4240

4341
public PyBootstrap(
4442
PyInfoProviderApi pyInfoProviderApi,
4543
PyStarlarkTransitionsApi pyStarlarkTransitionsApi,
46-
PyWrapCcHelperApi<?, ?, ?, ?, ?, ?, ?, ?, ?> pyWrapCcHelper,
47-
PyWrapCcInfoApi.Provider pyWrapCcInfoProvider) {
44+
PyWrapCcHelperApi<?, ?, ?, ?, ?, ?, ?, ?, ?> pyWrapCcHelper) {
4845
this.pyInfoProviderApi = pyInfoProviderApi;
4946
this.pyStarlarkTransitionsApi = pyStarlarkTransitionsApi;
5047
this.pyWrapCcHelper = pyWrapCcHelper;
51-
this.pyWrapCcInfoProvider = pyWrapCcInfoProvider;
5248
}
5349

5450
@Override
@@ -79,7 +75,8 @@ public void addBindingsToBuilder(ImmutableMap.Builder<String, Object> builder) {
7975
"PyWrapCcInfo",
8076
ContextAndFlagGuardedValue.onlyInAllowedReposOrWhenIncompatibleFlagIsFalse(
8177
BuildLanguageOptions.INCOMPATIBLE_STOP_EXPORTING_LANGUAGE_MODULES,
82-
pyWrapCcInfoProvider,
78+
// Workaround for https://github.com/bazelbuild/bazel/issues/17713
79+
new ProviderStub(),
8380
allowedRepositories));
8481
builder.put(
8582
"PyCcLinkParamsProvider",

0 commit comments

Comments
 (0)