Skip to content

Commit

Permalink
Change Starlark builtin helper methods
Browse files Browse the repository at this point in the history
Done to facilitate rewrite of other native rules.

RELNOTES:none
PiperOrigin-RevId: 483619584
Change-Id: Id36af65150d81723785e8f6a877fbd7a6f612697
  • Loading branch information
oquenchil authored and coeuvre committed Oct 26, 2022
1 parent a4d0446 commit 4552fc9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/main/starlark/builtins_bzl/common/cc/cc_helper.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,9 @@ def _expand_make_variables_for_copts(ctx, tokenization, unexpanded_tokens, addit
def _get_copts(ctx, common, feature_configuration, additional_make_variable_substitutions):
if not hasattr(ctx.attr, "copts"):
fail("could not find rule attribute named: 'copts'")
package_copts = common.unexpanded_package_copts
package_copts = []
if common:
package_copts = common.unexpanded_package_copts
attribute_copts = ctx.attr.copts
tokenization = not (cc_common.is_enabled(feature_configuration = feature_configuration, feature_name = "no_copts_tokenization") or "no_copts_tokenization" in ctx.features)
expanded_package_copts = _expand_make_variables_for_copts(ctx, tokenization, package_copts, additional_make_variable_substitutions)
Expand Down
8 changes: 4 additions & 4 deletions src/main/starlark/builtins_bzl/common/java/java_common.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ def basic_java_library(
ctx.outputs.sourcejar,
source_files,
source_jars,
_collect_deps(deps + [coverage_config.runner]) if coverage_config and coverage_config.runner else _collect_deps(deps),
_collect_deps(runtime_deps),
collect_deps(deps + [coverage_config.runner]) if coverage_config and coverage_config.runner else collect_deps(deps),
collect_deps(runtime_deps),
plugins_javaplugininfo,
_collect_deps(exports),
collect_deps(exports),
_collect_plugins(exported_plugins),
resources,
resource_jars,
Expand Down Expand Up @@ -208,7 +208,7 @@ def _collect_plugins(plugins):
"""
return _filter_provider(JavaPluginInfo, plugins)

def _collect_deps(deps):
def collect_deps(deps):
"""Collects dependencies from an attribute.
Use this call to collect plugins from `deps`, `runtime_deps`, or `exports` attribute.
Expand Down

0 comments on commit 4552fc9

Please sign in to comment.