Skip to content

Commit

Permalink
Implement java_common.get_constraints in Starlark and delete corres…
Browse files Browse the repository at this point in the history
…ponding native code

PiperOrigin-RevId: 545721573
Change-Id: I109df5998ee641d2d85854ea0183e4c000df8773
  • Loading branch information
hvadehra authored and copybara-github committed Jul 5, 2023
1 parent 91d884e commit 691b48b
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,6 @@ public ProviderApi getMessageBundleInfo() {
return null;
}

@Override
public Sequence<String> getConstraints(Info info) throws RuleErrorException {
// No implementation in Bazel. This method not callable in Starlark except through
// (discouraged) use of --experimental_google_legacy_api.
return StarlarkList.empty();
}

@Override
public JavaInfo setAnnotationProcessing(
Info info,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,19 +471,6 @@ JavaInfoT mergeJavaProviders(
enableOnlyWithFlag = BuildLanguageOptions.EXPERIMENTAL_GOOGLE_LEGACY_API)
ProviderApi getMessageBundleInfo();

@StarlarkMethod(
name = "get_constraints",
doc = "Returns a set of constraints added.",
parameters = {
@Param(
name = "java_info",
positional = true,
named = false,
doc = "The JavaInfo to get constraints from."),
},
enableOnlyWithFlag = BuildLanguageOptions.EXPERIMENTAL_GOOGLE_LEGACY_API)
Sequence<String> getConstraints(Info javaInfo) throws RuleErrorException;

@StarlarkMethod(
name = "set_annotation_processing",
doc = "Returns a copy of the given JavaInfo with the given annotation_processing info.",
Expand Down
2 changes: 1 addition & 1 deletion src/main/starlark/builtins_bzl/common/java/java_common.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def _get_constraints(java_info):
Returns:
([str]) The constraints set on the supplied JavaInfo
"""
return _java_common_internal.get_constraints(java_info)
return [] if semantics.IS_BAZEL else java_info._constraints

def _set_annotation_processing(
java_info,
Expand Down

0 comments on commit 691b48b

Please sign in to comment.